12-07-2008, 06:49 PM
Script by XRXS, posted by PK8.
Here's the code. Put it above main. It turns your game into a platformer. Think of Super Mario.
What's pretty cool about the script is that it allows you, the maker to decide which maps you want to have the platformer script enabled and disabled.
Press UP to jump. If you do not want UP to be the jump button then you can change UP to any button you want. (A, B, C, X, Y, Z, UP, LEFT, DOWN, RIGHT)
This is the script.
Here's the code. Put it above main. It turns your game into a platformer. Think of Super Mario.
What's pretty cool about the script is that it allows you, the maker to decide which maps you want to have the platformer script enabled and disabled.
Press UP to jump. If you do not want UP to be the jump button then you can change UP to any button you want. (A, B, C, X, Y, Z, UP, LEFT, DOWN, RIGHT)
Code:
if Input.trigger?(Input::UP) and
This is the script.
Code:
# ?ÃÂ¥?ã?ÃÂ¥ XRXS50. Action-Maps XC. ?ÃÂ¥?ã?ÃÂ¥ built 033010
# by ?÷â°Ã« ?ÃÂây
#==============================================================================
# ? ÆJÆXÆ^Æ}ÆCÆYÆ|ÆCÆâÆg
#==============================================================================
class XRXS50
#
# Action-Maps âðâ°ÃââîâóâùâéÆ}ÆbÆvIDâÃÅâzâñ
#
ENABLE_FULL_ACTY_MAPS = [3, 100]
#
# ?uŽÃŽâß?~â°Ãº?v
#
ENABLE_SLIDE_DESCENT = true
#
# ÅüâëÆWÆÆÆâÆv(true : ÅüâââÃââââéâ¢Ã»ÅüâÃâÆWÆÆÆâÆv?B
# false : ÆL?[âêâ°Å¸âóâêâÃââââéâ¢Ã»ÅüâÃâÆWÆÆÆâÆv?B)
#
JUMP_AS_KEY = false
end
#==============================================================================
# ?á Game_Player
#==============================================================================
class Game_Player < Game_Character
#--------------------------------------------------------------------------
# ?⺠ÅöŠJÆCÆâÆXÆ^ÆâÆXâ¢ÃÂ?â
#--------------------------------------------------------------------------
# Šùâö
attr_writer :direction_fix
attr_accessor :walk_anime
# ?Vâ¹K
attr_accessor :now_jumps
attr_writer :xrxs50_direction_sidefix
#--------------------------------------------------------------------------
# ?⺠?Ãâ¦âÃÂ¥ÆWÆÆÆâÆvâ°Ã±?â
#--------------------------------------------------------------------------
def max_jumps
return 2
end
#--------------------------------------------------------------------------
# ?Å ?öâðÅüâ*
#--------------------------------------------------------------------------
alias xrxs50_turn_left turn_left
def turn_left
if @xrxs50_direction_sidefix
@direction = 4
else
xrxs50_turn_left
end
end
#--------------------------------------------------------------------------
# ?Å â°EâðÅüâ*
#--------------------------------------------------------------------------
alias xrxs50_turn_right turn_right
def turn_right
if @xrxs50_direction_sidefix
@direction = 6
else
xrxs50_turn_right
end
end
end
#==============================================================================
# ?á Scene_Map
#==============================================================================
class Scene_Map
#--------------------------------------------------------------------------
# ?Å Æ?ÆCÆâ?Ëâ?
#--------------------------------------------------------------------------
alias xrxs50_main main
def main
# Æ`ÆFÆbÆN
xrxs50_enable_check
# ÅÃââÃââßâ÷
xrxs50_main
end
#--------------------------------------------------------------------------
# ?Å ÆtÆÅ?[Æâ¬?X?V
#--------------------------------------------------------------------------
alias xrxs50_update update
def update
# ÅÃââÃââßâ÷
xrxs50_update
# ÆtÆÅ?[Æâ¬?X?V (?Ãâ¬â¢WÅn?X?V)
if @xrxs50_enable
update_coordinates
end
end
#--------------------------------------------------------------------------
# ?⺠ÆtÆÅ?[Æâ¬?X?V (?Ãâ¬â¢WÅn?X?V)
#--------------------------------------------------------------------------
def update_coordinates
if $game_player.passable?($game_player.x,$game_player.y,2)
unless $game_player.moving?
if XRXS50::ENABLE_SLIDE_DESCENT and
Input.press?(Input::RIGHT) and
$game_player.passable?($game_player.x,$game_player.y+1,6)
$game_player.move_lower_right
elsif XRXS50::ENABLE_SLIDE_DESCENT and
Input.press?(Input::LEFT) and
$game_player.passable?($game_player.x,$game_player.y+1,4)
$game_player.move_lower_left
else
$game_player.move_down
end
end
else
$game_player.move_down
$game_player.walk_anime = true unless $game_player.walk_anime
$game_player.now_jumps = 0
if Input.trigger?(Input::UP) and
$game_player.now_jumps < $game_player.max_jumps
if XRXS50::JUMP_AS_KEY
direction = $game_player.direction == 4 ? -1 : 1
else
if Input.press?(Input::RIGHT)
direction = 1
elsif Input.press?(Input::LEFT)
direction = -1
else
direction = 0
end
end
$game_player.jump(direction, -2)
$game_player.now_jumps += 1
$game_player.walk_anime = false
end
end
end
#--------------------------------------------------------------------------
# ?Å ÆvÆÅÆCÆâ?[âÃÅ?ê?Å ËÃÅ¡âî
#--------------------------------------------------------------------------
alias xrxs50_transfer_player transfer_player
def transfer_player
# ÅÃââÃââßâ÷
xrxs50_transfer_player
# Æ`ÆFÆbÆN
xrxs50_enable_check
end
#--------------------------------------------------------------------------
# ?⺠XRXS50 âêâ°Ãââîâ÷âéâéâûâè
#--------------------------------------------------------------------------
def xrxs50_enable_check
if XRXS50::ENABLE_FULL_ACTY_MAPS.include?($game_map.map_id)
$game_player.now_jumps = 0 if $game_player.now_jumps.nil?
@xrxs50_enable = true
$game_player.direction_fix = true
$game_player.xrxs50_direction_sidefix = true
else
@xrxs50_enable = false
$game_player.direction_fix = false
$game_player.xrxs50_direction_sidefix = false
end
end
end