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 / 3-D sidescroller jumping

Author
Message
Mew151
16
Years of Service
User Offline
Joined: 1st Jun 2008
Location: Glitch city
Posted: 9th Nov 2008 23:38 Edited at: 9th Nov 2008 23:39
Hey, I'm going making a 3D sidescroller, and I'm sort of stuck on the jumping part.
Here's the code I have so far:
(This only contains the jumping code. All of the other code is not included...)


ow! that hurt!
Mew151
16
Years of Service
User Offline
Joined: 1st Jun 2008
Location: Glitch city
Posted: 9th Nov 2008 23:41
Bump... (Sorry for the bump, I just forgot to click the mailback checkbox...)

ow! that hurt!
SunDawg
19
Years of Service
User Offline
Joined: 21st Dec 2004
Location: Massachusetts
Posted: 10th Nov 2008 00:00
Not how I would have approached it. Do you intend to have quadratic or linear jump paths? That is to say, do you want to have the character accelerate as they fall or fall at a constant rate?


My site, for various stuff that I make.
Mew151
16
Years of Service
User Offline
Joined: 1st Jun 2008
Location: Glitch city
Posted: 10th Nov 2008 00:02
I just want them to fall at a constant rate.

ow! that hurt!
SunDawg
19
Years of Service
User Offline
Joined: 21st Dec 2004
Location: Massachusetts
Posted: 10th Nov 2008 00:13
That's fairly simple, then. It would be best, I think, to use a boolean variable to tell whether the character is on the ground. Like playerIsGrounded or something. When you start your jump, give the player a certain velocity in the y direction, like playeryYVelocity=5.0. Position the player at their current location, plus their current velocity. (playerYPos+playerYVelocity) Then just subtract from the Y velocity until the player is touching the ground again, at which point playerIsGrounded would be made true again.


My site, for various stuff that I make.
Mew151
16
Years of Service
User Offline
Joined: 1st Jun 2008
Location: Glitch city
Posted: 10th Nov 2008 00:36
Like this?


ow! that hurt!
SunDawg
19
Years of Service
User Offline
Joined: 21st Dec 2004
Location: Massachusetts
Posted: 10th Nov 2008 00:51 Edited at: 10th Nov 2008 00:52
I was thinking more along the lines of this:



My site, for various stuff that I make.
Mew151
16
Years of Service
User Offline
Joined: 1st Jun 2008
Location: Glitch city
Posted: 10th Nov 2008 01:00
Hmmm.... the jump is a little bit... fast, but, the falling is quite smooth.

ow! that hurt!
SunDawg
19
Years of Service
User Offline
Joined: 21st Dec 2004
Location: Massachusetts
Posted: 10th Nov 2008 02:36
You can slow it down by decreasing the initial velocity, and the rate of acceleration.


My site, for various stuff that I make.
FIGHTEX
15
Years of Service
User Offline
Joined: 30th Nov 2008
Location:
Posted: 25th Dec 2008 17:40
before loop

in loop


this is a bounce that works for me

Game.Love

Login to post a reply

Server time is: 2024-09-30 13:26:51
Your offset time is: 2024-09-30 13:26:51