1. ## character jump

hi all!

know a good way to jump the character
when a key is hit. i'm trying to make a
super-mario clone.
i'm making this in allegro.

2. I've never used allegro, personally, but here's how you'd do it with just about any API -- Use vectors for velocity and acceleration, come up with some constant for gravity (9.8 m/sec is about earth's gravity), then when the player jumps add an arbitrary amount to his velocity vector in his jump direction (usually straight up), then everytime you update your scene, subtract from the y value of the velocity vector (assuming gravity is straight down) the amount of time passed times the gravity constant you created.

3. how would i make the character first go
up then back down?

4. Actually, gravity is 9.8 meters a second per second.

You don't need vectors. The simplist way would be just to have a velocity variable, you could use int float or double to store this. Have a constant value defined on how much gravity effects this variable, and initial velocity. When the player presses the jump button, make the velocity variable equal the initial velocity. Everytime you update the player's movement add the velocity variable to the y value of the player. Make sure initial value is a positive number. Then subtract the gravity from the velocity over and over.

To sum it up: have a variable hold velocity, change character's y value according to the variable, then subtract gravity from velocity.

5. Vectors make it easier -- you don't always have motion in a single direction -- jumping while moving for instance isn't a direct upward jump -- with vectors you can just add to the y component of the vector to get the new vector.

6. THAT WAS EASY as %&¤%/(/)#¤"

you just need to -- its value while the
character isnt touching ground
then just ++ it when hit key!

simple as that!!!?
i cant believe it i didnt figure this out in the first place.
anyway guys thanks alot for your replies
so now i need velocity, btw can u explain how velocity works?? i got no idea
thanks again.

7. dude, it doesn't restrict your x movement. You can still change your character's x value.

8. Actually, gravity is 9.8 meters a second per second.
Yeah, thanks for the correction. I actually was gonna look up the ascii character for a ² to put after the sec when I finished the post, but I forgot to by the time I finished.

dude, it doesn't restrict your x movement. You can still change your character's x value.
Well then you do have an x velocity and a y velocity -- you're just not storing it in one data structure. Velocity with x and y direction makes a vector, that's why most people store it as one.

so now i need velocity, btw can u explain how velocity works?? i got no idea
thanks again.
Velocity is your rate of movement -- similar to speed but can have direction.