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 / Need help with getting sprite to jump (2D dark GDK)

Author
Message
iceloop
15
Years of Service
User Offline
Joined: 11th Oct 2008
Location:
Posted: 25th Nov 2008 01:22
I need some help figuring out how to get my sprite to jump. I've looked around the forum and have found some sample code to make your sprite jump but most of the code is for DB, DBPro or FPS, and i haven't been able to find one for dark GDK. I did read one about looping and increasing frame until it reaches a predetermined height and then just do the reverse to get it to come down but I'm still not clear on how to do that.

here is what i was trying to do but it doesn't really work

when it reaches max height it freezes and i'm not sure how to make it come back down.
CheatCat
17
Years of Service
User Offline
Joined: 7th Mar 2007
Location: Sweden
Posted: 25th Nov 2008 09:06 Edited at: 25th Nov 2008 09:08
You should make a global variable and the set the variable to some value when it reaches the max height. Then you check if the variable have that value and if so, make the player fall down. Like this:
iceloop
15
Years of Service
User Offline
Joined: 11th Oct 2008
Location:
Posted: 26th Nov 2008 02:39
Ok cool. Thanks for your help.
iceloop
15
Years of Service
User Offline
Joined: 11th Oct 2008
Location:
Posted: 26th Nov 2008 09:10
also, what if i want the sprite to jump forward or backwards, could i just offset the sprite by some angle variable (180 - 360 for left to right & the reverse for right to left):



something to that affect. any suggestions?
Cole Xemi
16
Years of Service
User Offline
Joined: 20th Aug 2008
Location:
Posted: 2nd Dec 2008 01:35 Edited at: 2nd Dec 2008 02:28
To make the game more realistic use real gravity equations. A constant rise and fall seems dull.

Gravity class:



Jumping:



Falling:

Login to post a reply

Server time is: 2024-09-30 11:27:09
Your offset time is: 2024-09-30 11:27:09