5
\$\begingroup\$

How can I calculate the position of an object after "firing" it from a fixed point?

I am to create a small game - most likely with canvas (pure HTML, JS based) or Adobe Flash - in which the player fires objects at other obstacles in order to clear them.

\$\endgroup\$

2 Answers 2

2
\$\begingroup\$

You may want to look at this question and this one.

Assuming you are not using a physics engine/library that will handle the motion for you (and simply call back in to your code when a collision event occurs), you probably want to simulate projectile motion (also here, here, and in general here).

\$\endgroup\$
2
\$\begingroup\$

Good old physics will help you here. Specifically the equations of motion: http://en.wikipedia.org/wiki/Equations_of_motion

If you want to simulate projectile motion (as in an arc) there's plenty of information for that too:

http://www.ajdesigner.com/phpprojectilemotion/vertical_velocity_equation.php

http://hyperphysics.phy-astr.gsu.edu/hbase/traj.html

http://library.thinkquest.org/28388/Mechanics/Motions/Projectile.htm

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .