赞 | 2 |
VIP | 12 |
好人卡 | 2 |
积分 | 1 |
经验 | 4259 |
最后登录 | 2022-12-28 |
在线时间 | 192 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 116
- 在线时间
- 192 小时
- 注册时间
- 2008-5-11
- 帖子
- 547
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
直接插入到MAIN前面,然后用方向键按方向(比如上键+右键)就可以了
已知冲突:横版战斗(sideview)所有版本
- #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
- #_/ ◆ ダッシュ&8方向移動 - RPG_EDirMove ◆ VX ◆
- #_/ ◇ Last update : 2008/02/17 ◇
- #_/----------------------------------------------------------------------------
- #_/ ダッシュ速度の調整や、8方向移動機能を追加します。
- #_/============================================================================
- #_/
- #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
- #==============================================================================
- # ★ カスタマイズ項目 - Customize ★
- #==============================================================================
- module RPG
- module EDirMove
- # ◆ 8-Way Directional Movement
- # true = Enables the character to move in diagonal directions.
- # false = Disable diagonal movement, restricting the player to the default
- # movement system of up, down, left, and right.
- ENABLE_8DIR = true
- # ◆ ?
- ENABLE_8DIR_ANIMATION = true
- # ◆ Walk Speed
- # Allows you to change the default rate of speed the character walks.
- # A DEFAULT_WALK_SPEED of 4 is the default RMVX walk speed.
- DEFAULT_WALK_SPEED = 4
- # ◆ Dash Speed
- #
- DASH_SPEED_RATE = 2
- end
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- $imported = {} if $imported == nil
- $imported["EDirMove"] = true
- module RPG::EDirMove
- # 斜め画像の接尾辞
- SLANT_SUFFIX = "#"
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #==============================================================================
- # □ RPG::Commands
- #==============================================================================
- module RPG::Commands
- module_function
- #--------------------------------------------------------------------------
- # ○ 歩行速度のリセット
- #--------------------------------------------------------------------------
- def reset_walk_speed
- $game_player.reset_move_speed
- end
- end
- class Game_Interpreter
- include RPG::Commands
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #==============================================================================
- # ■ Game_Party
- #==============================================================================
- class Game_Party < Game_Unit
- #--------------------------------------------------------------------------
- # ○ 歩数減少
- #--------------------------------------------------------------------------
- def decrease_steps
- @steps -= 1
- end
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #==============================================================================
- # ■ Game_Character
- #==============================================================================
- class Game_Character
- #--------------------------------------------------------------------------
- # ○ 向き (8方向用)
- #--------------------------------------------------------------------------
- def direction_8dir
- return @direction
- end
- #--------------------------------------------------------------------------
- # ● 指定方向に向き変更
- # direction : 向き
- #--------------------------------------------------------------------------
- alias set_direction_RPG_EDirMove set_direction
- def set_direction(direction)
- last_dir = @direction
- set_direction_RPG_EDirMove(direction)
- if !@direction_fix && direction != 0
- @direction_8dir = direction
- end
- end
- #--------------------------------------------------------------------------
- # ● 左下に移動
- #--------------------------------------------------------------------------
- alias move_lower_left_RPG_EDirMove move_lower_left
- def move_lower_left
- move_lower_left_RPG_EDirMove
- @direction_8dir = 1 unless @direction_fix
- end
- #--------------------------------------------------------------------------
- # ● 右下に移動
- #--------------------------------------------------------------------------
- alias move_lower_right_RPG_EDirMove move_lower_right
- def move_lower_right
- move_lower_right_RPG_EDirMove
- @direction_8dir = 3 unless @direction_fix
- end
- #--------------------------------------------------------------------------
- # ● 左上に移動
- #--------------------------------------------------------------------------
- alias move_upper_left_RPG_EDirMove move_upper_left
- def move_upper_left
- move_upper_left_RPG_EDirMove
- @direction_8dir = 7 unless @direction_fix
- end
- #--------------------------------------------------------------------------
- # ● 右上に移動
- #--------------------------------------------------------------------------
- alias move_upper_right_RPG_EDirMove move_upper_right
- def move_upper_right
- move_upper_right_RPG_EDirMove
- @direction_8dir = 9 unless @direction_fix
- end
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #==============================================================================
- # ■ Game_Player
- #==============================================================================
- class Game_Player < Game_Character
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- alias initialize_RPG_EDirMove initialize
- def initialize
- initialize_RPG_EDirMove
- reset_move_speed
- end
- #--------------------------------------------------------------------------
- # ○ 向き (8方向用)
- #--------------------------------------------------------------------------
- def direction_8dir
- @direction_8dir = @direction if @direction_8dir == nil
- return @direction_8dir
- end
- #--------------------------------------------------------------------------
- # ○ 移動速度のリセット
- #--------------------------------------------------------------------------
- def reset_move_speed
- @move_speed = RPG::EDirMove::DEFAULT_WALK_SPEED
- end
- if RPG::EDirMove::ENABLE_8DIR
- #--------------------------------------------------------------------------
- # ● 方向ボタン入力による移動処理
- #--------------------------------------------------------------------------
- def move_by_input
- return unless movable?
- return if $game_map.interpreter.running?
- last_steps = $game_party.steps
- case Input.dir8
- when 1; move_down; move_left; @direction = 2
- when 2; move_down
- when 3; move_down; move_right; @direction = 6
- when 4; move_left
- when 6; move_right
- when 7; move_up; move_left; @direction = 4
- when 8; move_up
- when 9; move_up; move_right; @direction = 8
- else; return
- end
- @direction_8dir = Input.dir8
- # 2歩進んでいたら1歩戻す
- if $game_party.steps - last_steps == 2
- $game_party.decrease_steps
- end
- end
- end # ENABLE_8DIR
- #--------------------------------------------------------------------------
- # ● 移動時の更新
- #--------------------------------------------------------------------------
- def update_move
- distance = 2 ** @move_speed # 移動速度から移動距離に変換
- if dash? # ダッシュ状態なら速度変更
- distance *= RPG::EDirMove::DASH_SPEED_RATE
- end
- distance = Integer(distance)
- @real_x = [@real_x - distance, @x * 256].max if @x * 256 < @real_x
- @real_x = [@real_x + distance, @x * 256].min if @x * 256 > @real_x
- @real_y = [@real_y - distance, @y * 256].max if @y * 256 < @real_y
- @real_y = [@real_y + distance, @y * 256].min if @y * 256 > @real_y
- update_bush_depth unless moving?
- if @walk_anime
- @anime_count += 1.5
- elsif @step_anime
- @anime_count += 1
- end
- end
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #==============================================================================
- # ■ Sprite_Character
- #==============================================================================
- if RPG::EDirMove::ENABLE_8DIR_ANIMATION
- class Sprite_Character < Sprite_Base
- #--------------------------------------------------------------------------
- # ○ 定数
- #--------------------------------------------------------------------------
- SLANT_ANIME_TABLE = { 1=>2, 3=>6, 7=>4, 9=>8 }
- #--------------------------------------------------------------------------
- # ● 転送元ビットマップの更新
- #--------------------------------------------------------------------------
- alias update_bitmap_RPG_EDirMove update_bitmap
- def update_bitmap
- name_changed = (@character_name != @character.character_name)
- update_bitmap_RPG_EDirMove
- if @tile_id > 0 # タイル画像使用
- @enable_slant = false
- return
- end
- return unless name_changed # 画像名変化なし
- # 斜め移動アニメ有効判定
- @enable_slant = true
- begin
- @character_name_slant = @character_name + RPG::EDirMove::SLANT_SUFFIX
- Cache.character(@character_name_slant)
- rescue
- @enable_slant = false
- end
- end
- #--------------------------------------------------------------------------
- # ● 転送元矩形の更新
- #--------------------------------------------------------------------------
- alias update_src_rect_RPG_EDirMove update_src_rect
- def update_src_rect
- return if @tile_id > 0 # タイル画像
- if @enable_slant
- update_src_rect_for_slant
- else
- update_src_rect_RPG_EDirMove
- end
- end
- #--------------------------------------------------------------------------
- # ○ 斜め移動用転送元矩形の更新
- #--------------------------------------------------------------------------
- def update_src_rect_for_slant
- index = @character.character_index
- pattern = @character.pattern < 3 ? @character.pattern : 1
- sx = (index % 4 * 3 + pattern) * @cw
- dir = @character.direction_8dir
- case dir % 2
- when 0 # 上下左右
- if @last_slant
- self.bitmap = Cache.character(@character_name)
- @last_slant = false
- end
- else # 斜め
- unless @last_slant
- self.bitmap = Cache.character(@character_name_slant)
- @last_slant = true
- end
- # Convert 1, 3, 7, 9 を 2, 6, 4, 8
- dir = SLANT_ANIME_TABLE[dir]
- end
- sy = (index / 4 * 4 + (dir - 2) / 2) * @ch
- self.src_rect.set(sx, sy, @cw, @ch)
- end
- end
- end # ENABLE_8DIR_ANIMATION
- #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_
- #_/ The original untranslated version of this script can be found here:
- #
- #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_
复制代码 |
|