#### Archived

This topic is now archived and is closed to further replies.

# Getting started in Game Programming -- a simple algorithm

This topic is 6327 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi all, I am new into game programming and wondering where can I find some simple standard algorithm on the web? specifically I am looking for a simple algorithm which can calculate the path of a moving jumping object -- like an inverse "U" shape movement. Any help is much appreciated! Thanks!

##### Share on other sites
Have it set the character''s vertical velocity to -10 (go up 10 pixels at a time), make a gravity value like 5 or something and add that to the velocity every frame. That way, when you jump, you go up really fast, then the gravity pulls you back down so your velocity will be like -10, -5, 0, 5, 10, 15, etc. until you hit the ground. The 5 and 10 are just random numbers for the demonstration, so you''ll have to experiment around until you get the speed right.
Oh, and you should use floats (or fixed point cause it''s faster) so you can have sub-pixel movement (else you''ll only be able to move in 8 directions).

-Deku-chan

DK Art (my site, which has little programming-related stuff on it, but you should go anyway^_^)

##### Share on other sites
you''re talking about a parabola. The formula is: ax^2 + bx + c since you want an upsidedown one you want a to be negative. Get a hold of a math book, algebra II I think and it will tell you some more important stuff. So you''ll want a formula that you can plug time and velocity into, and from time and velocity calculate x, and from there calculate y, and then you have the x,y

##### Share on other sites
btw, deku''s method will make a parabola.

1. 1
2. 2
3. 3
4. 4
frob
15
5. 5

• 16
• 12
• 20
• 12
• 14
• ### Forum Statistics

• Total Topics
632155
• Total Posts
3004477

×