Jumping

Blitz3D Forums/Blitz3D Programming/Jumping

wizzlefish(Posted 2004) [#1]
Could anyone tell me how to create a jump effect? Thanks.....


fredborg(Posted 2004) [#2]
This is typed straight into the codebox, but it might work :)




wizzlefish(Posted 2004) [#3]
thanks :)


Erroneouss(Posted 2004) [#4]
replace

if keyhit(57)
player_speed_y = 1.0
endif

-with-

If player_y#=0
If KeyHit(57)
player_speed_y = 1.0
EndIf
EndIf

it doesnt allow you to jump while your in the air, but it would only be useful if ur level is flat...which i think urs is "no enemies"? for ur cylinder shooter?


wizzlefish(Posted 2004) [#5]
yes....it is flat. But isn't there a command like, FindHeight or something?


Sledge(Posted 2004) [#6]

If player_y#=0



How likely is it that y# will equal exactly zero in a floating point system? To be on the safe side I'd check to see if it is less than a small height rather than equal to zero or, better still, check for an actual collision with the floor before allowing a jump.


wizzlefish(Posted 2004) [#7]
Collisions! Obviously!

If EntityCollided(player,ground)
  If KeyHit(57)
    player_speed_y = 1.0
  EndIf
EndIf