new object, dynamic memory

Hi, I'm trying to edit http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=39
to do something that I know is simple, but I can't figure out on my own. I'm not a complete noob of a programmer, though. I want to make it so when I press the space bar, a new pixel is drawn and falls under gravitational force and then "dies" after a few seconds.

I've tried to figure out how to do this by looking at source code for simple games like asteroids. In asteroids, a ship fires a bullet, the bullet "lives" until it gets to the end of the screen, then is deleted.
gotta bump this... I really want to learn how to do this
What's your question?
An object has a position (p), acceleration (a) and a velocity (v). Each tick, you add a to v and v to p.
A gravitational force is equivalent to a constant acceleration on the y axis.
Last edited on
coder777, I think the simplest way to explain it is in video game terms. I want to spawn something in the environment and then have it deleted after some condition is met. So picture a missile from Battlefield 1942. You click fire, the missile spawns, flies (governed by physics), hits an object, is removed from the world.
Topic archived. No new replies allowed.