battle-maiden-mizuki/Scripts/8_.rb
2025-06-17 11:57:06 -05:00

44 lines
1.8 KiB
Ruby
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#==============================================================================
# ■ VXAce-RGSS3-26 8方向移動 [Ver.1.0.0] by Claimh
#------------------------------------------------------------------------------
# 8方向の移動が可能となります。
# 斜め移動ができない時に縦or横に移動できる場合は縦or横に移動するようになります。
#==============================================================================
class Game_Player < Game_Character
#--------------------------------------------------------------------------
# ● 方向ボタン入力による移動処理
#--------------------------------------------------------------------------
def move_by_input
return if !movable? || $game_map.interpreter.running?
if [1, 3, 7, 9].include?(Input.dir8)
case Input.dir8
when 1; move_diagonal(4, 2)
when 3; move_diagonal(6, 2)
when 7; move_diagonal(4, 8)
when 9; move_diagonal(6, 8)
end
return if @move_succeed
end
move_straight(Input.dir4) if Input.dir4 > 0
end
end
class Game_CharacterBase
#--------------------------------------------------------------------------
# ● 斜めに移動
# horz : 横方向4 or 6
# vert : 縦方向2 or 8
#--------------------------------------------------------------------------
alias move_diagonal_8dir move_diagonal
def move_diagonal(horz, vert)
if !passable?(@x, @y, horz) and !passable?(@x, @y, vert)
@move_succeed = false
return
end
return move_straight(horz) if passable?(@x, @y, horz) and !passable?(@x, @y, vert)
return move_straight(vert) if !passable?(@x, @y, horz) and passable?(@x, @y, vert)
move_diagonal_8dir(horz, vert)
end
end