Skip to main content
gamedev.net
🔒 Locked

Getting started in Game Programming -- a simple algorithm

Started by javabean Apr 21, 2001 at 4:23 PM 2 replies 300+ views
Original Post
javabean
javabean
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!
DekuTree64
DekuTree64
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^_^)
Thrump
Thrump
btw, deku''s method will make a parabola.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.