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.

Newcomers DBPro Corner / Some ideas of how to make a jump code?

Author
Message
Drakportalen
22
Years of Service
User Offline
Joined: 9th Oct 2002
Location: Sweden
Posted: 23rd Dec 2002 01:39
I know that theres many ways of makeing a jump code or function.
I want tips on how I should write a code like the picture is discribing. Note that i dont want any full functional code for this just a guide or some ideas of what I'll need and how it should be done. You can post som snippets but please explain values and variables in the code.
The jumping code I want to write should work like the picture:



NOTE: I just want a little push so I can begin. I would appreciate this really much. Thank you in advance
www.drakportalen.dot.nu
Shadow
22
Years of Service
User Offline
Joined: 17th Oct 2002
Location: In the shadows
Posted: 23rd Dec 2002 17:48
You need treat the horizontal and vertical completely separately.

Vertical:
What you want to use is acceleration (due to gravity). You should have variables for:
the height position of the player object
the vertical velocity of the player object
the acceleration due to gravity

e.g.
y=height pos
v=velocity
g=gravity
h=ground height


Horizontal:
You must use air resistance (this is actually that hard)
when player is not pressing left or right, horizontal velocity is multiplied by 0.95 (or something else less than 1.0 depending on how much resistance you want - The lower the number, the more you'll decelerate).

Login to post a reply

Server time is: 2024-11-23 19:25:46
Your offset time is: 2024-11-23 19:25:46