jumping
Blitz3D Forums/Blitz3D Beginners Area/jumping
| ||
aaaaaaaah i hate to resurrect the most asked question in blitz history. i'm just trying to get something together to test maps. the following code works, but always equals -4.0 when standing still. any ideas to improve this so it'll equal zero?; Jump If KeyHit(57) And jumping = 0 Then yvel# = 15 jumping = 1 CountCollisions (player) If EntityCollided(player,COLLISIONTYPE_BRUSH) If CollisionNY#(player,1)<>0 If yvel#<0 Then jumping=0 yvel#=yvel#*0.8 EndIf EndIf EndIf yvel#=yvel#-0.8 |
| ||
scratch that, didn't realize i had moved yvel#=yvel#-0.8 below keyhit. |
| ||
Watch out for uneven ground remember. If your testing such an exact normal, then even the slightest slope will fool the code into thinking you have not landed yet. Try giving the normal value a little slack. |
| ||
thanks Ross. .5 seems to work well. |