help with jumps

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

deathsangel
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 30
Joined: Sat Apr 18, 2009 8:17 pm

Re: help with jumps

Post by deathsangel »

No I want it so that cant jump is set to false either

1)when you get to the target height
2)when you let go of space.

Number 1 works, number 2 doesnt
Thanks to gyro vorbis for inspiring me to learn how to make a 2d graphics engine :)
User avatar
MarauderIIC
Respected Programmer
Respected Programmer
Posts: 3406
Joined: Sat Jul 10, 2004 3:05 pm
Location: Maryland, USA

Re: help with jumps

Post by MarauderIIC »

Oh, I misread. When you're checking for SDL events, add a case for SDL_KEYUP.
I realized the moment I fell into the fissure that the book would not be destroyed as I had planned.
deathsangel
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 30
Joined: Sat Apr 18, 2009 8:17 pm

Re: help with jumps

Post by deathsangel »

ok thanks
Thanks to gyro vorbis for inspiring me to learn how to make a 2d graphics engine :)
aerosmithfan4ever
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 16
Joined: Mon Nov 17, 2008 9:56 am

Re: help with jumps

Post by aerosmithfan4ever »

Spikey wrote: To jump, add a Y+ velocity, say +20.
Then every tick, apply gravity, say -9
DId you forgot that SDL's coordinate system is awkard...? :)
User avatar
Spikey
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 98
Joined: Sat Dec 13, 2008 6:39 am
Programming Language of Choice: C++
Location: Ottawa, Canada
Contact:

Re: help with jumps

Post by Spikey »

aerosmithfan4ever wrote:
Spikey wrote: To jump, add a Y+ velocity, say +20.
Then every tick, apply gravity, say -9
DId you forgot that SDL's coordinate system is awkard...? :)
whoops... Thanks for pointing that out.
User avatar
MarauderIIC
Respected Programmer
Respected Programmer
Posts: 3406
Joined: Sat Jul 10, 2004 3:05 pm
Location: Maryland, USA

Re: help with jumps

Post by MarauderIIC »

I think that's the generally accepted way to put coordinates together. Negative is "up." For instance, take a game of Quake 2 or 3. "set gravity 100" pushes you down. "set gravity -100" flings you into the ceiling.
I realized the moment I fell into the fissure that the book would not be destroyed as I had planned.
Post Reply