This is a very good script, and in my case extremely useful since my fangame takes place in the Hoenn region.
The only thing I'd like to note is that when you're jumping with the Acro Bike, your characters turns the direction you're jumping to, while in R/S/E, the character actually keeps facing the direction he was facing before jumping. That's cleary not important and just a graphical detail that isn't even disturbing, but I wanted to report that to you anyway.
module PBTerrain
ACROBIKEUpDown = 18
ACROBIKELeftRight = 19
ACROBIKEHOP = 20
MACHBIKE = 21
def self.isAcroBike?(tag)
return tag==PBTerrain::ACROBIKEUpDown ||
tag==PBTerrain::ACROBIKELeftRight
end
def self.isUDAcroBike?(tag)
return tag==PBTerrain::ACROBIKEUpDown
end
def self.isLRAcroBike?(tag)
return tag==PBTerrain::ACROBIKELeftRight
end
def self.isAcroBikeHop?(tag)
return tag==PBTerrain::ACROBIKEHOP
end
def self.isMachBike?(tag)
return tag==PBTerrain::MACHBIKE
end
end
def jump(x_plus, y_plus)
tag = $game_map.terrain_tag($game_player.x,$game_player.y)
if !PBTerrain.isAcroBike?(tag)
if x_plus != 0 or y_plus != 0
if x_plus.abs > y_plus.abs
(x_plus < 0) ? turn_left : turn_right
else
(y_plus < 0) ? turn_up : turn_down
end
end
end
new_x = @x + x_plus
new_y = @y + y_plus
if (x_plus == 0 and y_plus == 0) || passable?(new_x, new_y, 0)
@x = new_x
@y = new_y
real_distance = Math::sqrt(x_plus * x_plus + y_plus * y_plus)
distance = [1, real_distance].max
@jump_peak = distance * Game_Map::TILE_HEIGHT * 3 / 8 # 3/4 of tile for ledge jumping
@jump_distance = [x_plus.abs * Game_Map::REAL_RES_X, y_plus.abs * Game_Map::REAL_RES_Y].max
@jump_distance_left = 1 # Just needs to be non-zero
if real_distance > 0 # Jumping to somewhere else
@jump_count = 0
else # Jumping on the spot
@jump_count = Game_Map::REAL_RES_X / jump_speed_real # Number of frames to jump one tile
end
@stop_count = 0
if self.is_a?(Game_Player)
$PokemonTemp.dependentEvents.pbMoveDependentEvents
end
triggerLeaveTile
end
end
class Game_Player
alias old_up_command_new update_command_new
def update_command_new
dir = Input.dir4
unless pbMapInterpreterRunning? || $game_temp.message_window_showing ||
$PokemonTemp.miniupdate || $game_temp.in_menu
tag = $game_map.terrain_tag($game_player.x,$game_player.y)
if PBTerrain.isUDAcroBike?(tag)
return if dir == 4 || dir == 6
elsif PBTerrain.isLRAcroBike?(tag)
return if dir == 2 || dir == 8
end
end
old_up_command_new
end
end