VX Jump Restriction ScriptWhen I used Jump command in VX, I found out that
it can jump on the place where it's not passable (which make player cannot move) and
it can jump out of the screen! (I means out of the map)These problems are not happen in XP, so I use same commands from RGSS1 to edit jump command in RGSS2.
Place it above Main (or replace it on
def jump in
Game_Character),
CODE
#==============================================================================
# ■ Game_Character - Jump Check
#------------------------------------------------------------------------------
# キャラクターを扱うクラスです。このクラスは Game_Player クラスと Game_Event
# クラスのスーパークラスとして使用されます。
#==============================================================================
class Game_Character
def jump(x_plus, y_plus)
if x_plus.abs > y_plus.abs # 横の距離のほうが長い
x_plus < 0 ? turn_left : turn_right
elsif x_plus.abs > y_plus.abs # 縦の距離のほうが長い
y_plus < 0 ? turn_up : turn_down
end
new_x = @x + x_plus
new_y = @y + y_plus
if (x_plus == 0 and y_plus == 0) or passable?(new_x, new_y)
@x += x_plus
@y += y_plus
distance = Math.sqrt(x_plus * x_plus + y_plus * y_plus).round
@jump_peak = 10 + distance - @move_speed
@jump_count = @jump_peak * 2
@stop_count = 0
straighten
end
end
end
=========================
Feel free to ask the questions if you found any error.