fadingaura
Member
This is my first script... I know its probably been done before but here it is...
Insert this into Game_Player
Directly after this
Next insert this
and this
under Move_Up in Game_Character3
Then Enjoy!
Please report any bugs!
Demo - http://www.megaupload.com/?d=3BTT1VUG
Includes multiple objects to jump...
-Edit-
Here are some screens...
http://img108.imageshack.us/img108/8940/beforekeyrs4.th.png[/IMG]
Before Alt is pressed
http://img99.imageshack.us/img99/2338/midairbt0.th.png[/IMG]
In Midair
http://img99.imageshack.us/img99/7008/landingrp6.th.png[/IMG]
After Landing
Insert this into Game_Player
Code:
if Input.trigger?(Input::ALT)
keyjump
end
Code:
unless moving? or $game_system.map_interpreter.running? or
@move_route_forcing or $game_temp.message_window_showing
# Move player in the direction the directional button is being pressed
case Input.dir4
when 2
move_down
when 4
move_left
when 6
move_right
when 8
move_up
end
Next insert this
Code:
#--------------------------------------------------------------------------
# * Jump
#--------------------------------------------------------------------------
def keyjump
# If passable
case @direction
when 2
if jumpable?(@x, @y, @direction)
@y += 2
jump(0, 0)
end
when 4
if jumpable?(@x, @y, @direction)
@x -= 2
jump(0, 0)
end
when 6
if jumpable?(@x, @y, @direction)
@x += 2
jump(0, 0)
end
when 8
if jumpable?(@x, @y, @direction)
@y -= 2
jump(0, 0)
end
end
end
Code:
#--------------------------------------------------------------------------
# * Determine if Jump Passable
# x : x-coordinate
# y : y-coordinate
# d : direction (0,2,4,6,8)
# * 0 = Determines if all directions are impassable (for jumping)
#--------------------------------------------------------------------------
def jumpable?(x, y, d)
# Get new coordinates
new_x = x + (d == 6 ? 2 : d == 4 ? -2 : 0)
new_y = y + (d == 2 ? 2 : d == 8 ? -2 : 0)
# If coordinates are outside of map
unless $game_map.valid?(new_x, new_y)
# impassable
return false
end
# If through is ON
if @through
# passable
return true
end
# If unable to leave first move tile in designated direction
unless $game_map.passable?(x, y, d, self)
# impassable
return false
end
# If unable to enter move tile in designated direction
unless $game_map.passable?(new_x, new_y, 10 - d)
# impassable
return false
end
# Loop all events
for event in $game_map.events.values
# If event coordinates are consistent with move destination
if event.x == new_x and event.y == new_y
# If through is OFF
unless event.through
# If self is event
if self != $game_player
# impassable
return false
end
# With self as the player and partner graphic as character
if event.character_name != ""
# impassable
return false
end
end
end
end
# If player coordinates are consistent with move destination
if $game_player.x == new_x and $game_player.y == new_y
# If through is OFF
unless $game_player.through
# If your own graphic is the character
if @character_name != ""
# impassable
return false
end
end
end
# passable
return true
end
Then Enjoy!
Please report any bugs!
Demo - http://www.megaupload.com/?d=3BTT1VUG
Includes multiple objects to jump...
-Edit-
Here are some screens...
http://img108.imageshack.us/img108/8940/beforekeyrs4.th.png[/IMG]
Before Alt is pressed
http://img99.imageshack.us/img99/2338/midairbt0.th.png[/IMG]
In Midair
http://img99.imageshack.us/img99/7008/landingrp6.th.png[/IMG]
After Landing