More Realistic Jump
BlitzMax Forums/BlitzMax Beginners Area/More Realistic Jump
| ||
well Hello...fellow programmers, I am in need of assistance concerning the development of a more realistic method of allowing a character in my program to jump, so far I have this sloppy bit of code--If KeyHit(57) ;Jumping jumptimer = MilliSecs() + 1.5 uptimer = MilliSecs() + 1 While jumptimer > MilliSecs() While uptimer > MilliSecs() TranslateEntity user\model,0,0,.001 Wend Wend EndIf As you can see it's not all that impressive, and I could really use a helping hand, Thanks Guys!! |
| ||
Well you need to have a gravity constant. You also need your sprite to have a yspeed field as well as a normal y field. When the jump is initiated you set your yspeed to be a certain value in pixels per frame (need to tweak this value yourself). Then each frame, you need to reduce the yspeed by gravity and also add yspeed onto y. At a certain point, yspeed will go -ve and the sprite will start to drop down. At somepoint your "platform collision code" or whatever should detect that the sprite is now on solid ground and set the yspeed to 0. |
| ||
looks like B3d code btw.. |
| ||
I wondered that too ... "TranslateEntity" |
| ||
mhoa, more like noticing the \ seperator for type-fields :P TranslateEntity could be a function made in Bmax as well.. ^_^ |
| ||
I thought that too, and didn't say anything until I saw your "it's blitz3d code" post. I didn't notice the \ because I've been using plus for 15 months! :-) |
| ||
I figure you mean 'max', not 'plus', since plus has \ seperators. ^__^ |
| ||
No I meant I didn't notice the \ as *abnormal* because I've been using PLUS for 15 months ^___^ |
| ||
o_O O_o O_O oh! Wait, I see.. ^_^ * runs to collide with wall @ 20km/h |
| ||
clarity is such a beautiful thing. Hey "W" never replied to say thanks or stop derailing my thread :-) |