Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Gravity, Jump

Author
Message
Matt Bart
13
Years of Service
User Offline
Joined: 28th Nov 2010
Location:
Posted: 28th Nov 2010 15:29
Hi guys, i know there is lot of it, but i dont know where is the problem in my program.I think, that \\\"sprite\\\" just didn\\\'t jump. I will be glad, if you can help me.




Mireben
15
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 28th Nov 2010 18:15 Edited at: 28th Nov 2010 18:20


Equality check is DOUBLE equation sign. ==
With only one = you make ySpeed equal to zero so the jump stops immediately.

Also, for jumping up you should decrement yPos instead of incrementing it, since Y coordinates increase from the top of screen towards the bottom. And ySpeed should be decremented always, not only when it's equal to MaxJump, since in that case it will be decremented only once and it will never reach zero. Last, you should include a dbSprite instruction before dbSync, to display your sprite at the new coordinates, otherwise the sprite will never move.

Here is a modified code, summarizing all the above, does that work better?

Matt Bart
13
Years of Service
User Offline
Joined: 28th Nov 2010
Location:
Posted: 28th Nov 2010 18:41
Just thanks.

Login to post a reply

Server time is: 2024-06-30 10:53:47
Your offset time is: 2024-06-30 10:53:47