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 / theory of 3d jumping (any ideas, if you don't wanna keep answering me then give me some!)

Author
Message
Rico109
15
Years of Service
User Offline
Joined: 2nd Dec 2008
Location: none-of-your-beeswax!!!!! (lol)
Posted: 2nd Jan 2009 23:26
Ok, whenever I ask what's wrong with my code here is what happens...

1. people fix it
2. I copy it
3. it works
4. I want to apply it somewhere else
5. I don't understand the code so I end up flooding the forum with
tons of newbie questions!

so, I would like a simple explanation of how a 3d sidescrolling jumping works. If you wanna go more in depth, then I'd like to have an explanation about "ghost platforms" (like you jump through a platform, but land on it when you come back down).

Thanks for not wanting to answer any of my newbie jumping questions and giving me a few simple explanations so we can all move along in our lives!
Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 3rd Jan 2009 00:01
Well, I don't know what code you've been given, but this is usually how I have a jumping system:

Movement is based on 'velocity', so instead of always using the Move Object command, I continually use the Position Object, and keep offsetting the current position by a given velocity, which is calculated during the main loop.
To make it jump, all you have to do is check two things: 1) You press the appropriate button, i.e., space bar, and 2) you are currently colliding with the ground. If both these statements are true, then simply add an arbitrary value to the Y velocity (it should only be added during one frame of the loop).
Finally, while there is nothing directly beneath the player, continuously subtract a given gravity value from the Y velocity.

Rico109
15
Years of Service
User Offline
Joined: 2nd Dec 2008
Location: none-of-your-beeswax!!!!! (lol)
Posted: 3rd Jan 2009 17:50


wow...

I feel like a complete idiot now... (gee, thanx...)

I get it! thank you!
Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 3rd Jan 2009 17:55
No probs. Some algorithms end up quite easy when at first they seem complex. It's good for the brain to be able to figure them out, so try not to let yourself feel like an idiot, heheh.

jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 4th Jan 2009 04:48
this link gave me a headache - but... http://forum.thegamecreators.com/?m=forum_view&t=142554&b=7&p=0

It does do gravity - though I'm perplexed about my timer code acting bizarre

Login to post a reply

Server time is: 2024-09-28 00:25:53
Your offset time is: 2024-09-28 00:25:53