I have been messing around with a script of mine but i can't find how to make this loop works correctly...
What I want is:
-The character just keeps moving up, until @spring power is 0
-if i press right he moves upright
-if i press left he moves upper left
Thanx for reading!
Code:
def spring_jump
if @eventx == nil or @eventy == nil
return
end
loop do
$spring_jump = true
$h_speed = 5
unless $game_player.moving?
if Input.press?(Input::RIGHT) and $game_player.passable?($game_player.x,$game_player.y-1,$game_player.direction)
$game_player.move_upper_right
elsif Input.press?(Input::LEFT) and $game_player.passable?($game_player.x,$game_player.y-1,$game_player.direction)
$game_player.move_upper_left
else
if $game_player.passable?($game_player.x,$game_player.y-1,8)
$game_player.move_up
else
$spring_jump= false
end
end
end
if @spring_power <= 0
$spring_jump= false
break
else
@spring_power -= 1
end
end
end
What I want is:
-The character just keeps moving up, until @spring power is 0
-if i press right he moves upright
-if i press left he moves upper left
Thanx for reading!