Smooth Jump

Blitz3D Forums/Blitz3D Beginners Area/Smooth Jump

Here's a quick code sample off the top of my head:

Const GRAVITY# = 0.005

Local PlayerYVel# = 0 ;Players vertical velocity
Local PlayerYPos# = 0 ;Players vertical position

Repeat ;Begin looping

;Deduct gravity from the players vertical velocity.
PlayerYVel# = PlayerYVel# - GRAVITY#

;If the player is touching the ground, set vertical velocity
;to 0 (since upward force from the ground would equal
;downward force from gravity).
If (PlayerIsOnGround) then PlayerYVel# = 0.0

;If the player jumps, set the vertical velocity to a positive value.
If (PlayerJumps) then PlayerYVel# = 5.0

;Adjust the player vertical position based on the vertical velocity.
PlayerYPos# = PlayerYPos# + PlayerYVel#

Until KeyHit( 1 );End loop


That should give you a basic idea :)