Zénith RPG version 1.1

Soaglor, terre de conflits
miniature
de harusame17.

SPZelda: Déclarations
miniature
de Dark8744.

SPZelda: Déclarations
miniature
de Dark8744.

Tutoriaux événements

Sauter avec Z


  • Script de Gaara.
  • Aucune démo n'est disponible pour ce script.


#==============================================================================
=begin
par gaara
Saut
=end
#==============================================================================
# ? WallJump Script
#------------------------------------------------------------------------------
#==============================================================================

#==============================================================================
# ? Customisation
#==============================================================================
JumpID = 1 # The terrain ID of the tiles which can be jumped over
MaxJump = 2 # The longest jump that can be made by the player
#==============================================================================
# ? Game_Player
#==============================================================================

class Game_Player < Game_Character

# forces Game_Character's passable method to be used, so CTRL no longer makes
# the hero able to walk through walls
def passable?(x, y, d)
super(x, y, d)
end

def leap
# finds the increases to x & y for the current direction
xdir = (@direction == 6 ? 4 : @direction == 4 ? -4 : 0)
ydir = (@direction == 2 ? 2 : @direction == 8 ? -2 : 0)

# Ow!
unless $game_map.terrain_tag(@x + xdir, @y + ydir) == JumpID or
$game_map.passable?(@x + xdir, @y + ydir, @direction, self)
# make the player jump
route = RPG::MoveRoute.new
route.list.clear
route.list.push(RPG::MoveCommand.new(37))
route.list.push(RPG::MoveCommand.new(14, [0, 0]))
route.list.push(RPG::MoveCommand.new(38))
route.list.push(RPG::MoveCommand.new(0))
route.repeat = false
$game_player.force_move_route(route)

# shake the screen
$game_screen.start_shake(7, 7, 5)

# display an "Ouch!" message
$game_temp.message_text = "Booum!!"
return
end

# finds the jumpable distance
dist = jumpable_distance

# wall jump
if dist.between?(1, MaxJump - 5) and
!$game_map.passable?(@x + (dist + 1) * xdir, @y + (dist + 1) * ydir, @direction, self) and
!($game_map.terrain_tag(@x + (dist + 1) * xdir, @y + (dist + 1) * ydir) == JumpID)
# finds the reverse direction
bounce_dir = @direction == 2 ? 8 : (@direction == 4 ? 6 : (@direction == 6 ? 4 : 2))

# finds the wall-jump distance
b_dist = jumpable_distance(bounce_dir, MaxJump + 2, @x + dist * xdir, @y + dist * ydir)

# finds the additions to x and y made by the reverse direction
b_xdir = (bounce_dir == 6 ? 2 : bounce_dir == 4 ? -1 : 0)
b_ydir = (bounce_dir == 6 ? 2 : bounce_dir == 4 ? -1 : 0)

# create the move_route
route = RPG::MoveRoute.new
route.list.clear
route.list.push(RPG::MoveCommand.new(37))
# add the normal jump
route.list.push(RPG::MoveCommand.new(14, [xdir * dist, ydir * dist]))
# add the wall jump
route.list.push(RPG::MoveCommand.new(14, [b_xdir * b_dist, b_ydir * b_dist]))
route.list.push(RPG::MoveCommand.new(38))
route.list.push(RPG::MoveCommand.new(0))
route.repeat = true

$game_player.force_move_route(route)

return
end

# creates a route for a normal jump and forces the player to follow it
route = RPG::MoveRoute.new
route.list.clear
route.list.push(RPG::MoveCommand.new(37))
route.list.push(RPG::MoveCommand.new(14, [xdir * dist, ydir * dist]))
route.list.push(RPG::MoveCommand.new(38))
route.list.push(RPG::MoveCommand.new(0))
route.repeat = false

$game_player.force_move_route(route)
end

alias update_primary update
def update
# calls the normal update method
update_primary

# locks the facing if CTRL is pressed, else unlocks it
@direction_fix = Input.press?(Input::CTRL)

# leaps if Input::A is triggered
leap if Input.trigger?(Input::A) && !moving?
end

def jumpable_distance(dir = @direction, max_dist = MaxJump, x = @x, y = @y)
xdir = (dir == 6 ? 1 : dir == 4 ? -1 : 0)
ydir = (dir == 2 ? 1 : dir == 8 ? -1 : 0)

jumpable_tiles = []

for i in 0..max_dist
check_x = x + i * xdir
check_y = y + i * ydir

e = $game_map.events[$game_map.check_event(check_x, check_y)]
if e
if e.list[0].parameters[0] =~ "\Tall"
break
end
if not e.through
next
end
end

if $game_map.passable?(check_x, check_y, dir, self) or
$game_map.terrain_tag(check_x, check_y) == JumpID
jumpable_tiles.push(i)
end
end

jumpable_tiles.reverse.each do |i|
check_x = x + i * xdir
check_y = y + i * ydir

return i if $game_map.passable?(check_x, check_y, dir, self)
end

return 1
end

end

Concours d'ambiance

Début du concours :
20 Septembre 2007
Fin du concours :
N/A

BattleZone Games Creations
Final Destiny
Island Maker
Légende
Manga Power
Oniromancie
Relite
RPG Making
RPG Sky
RPGMaker FR
RPGSky
RTP Power
Saleth Empire
Terra RPGXP
Terre RPG
World of DBZ