Try having these variables:
vSpeed, vSpeedMax, gravity, jHeight;
if there is no collision below the object, add gravity ( should be positive ) to vSpeed.
if vSpeed > vSpeedMax set vSpeed to vSpeedMax
if you press the jump key set vSpeed = to jHeight ( you want jHeight to be negative )
if you are in the air and there is a collision below the object at the vSpeed distance, set vSpeed to 0 and resolve collision.
Finally, add the vSpeed variable to the objects y coordinate.
CombatCactusMember Since 09 Oct 2012
Offline Last Active Jul 23 2013 06:56 AM