5

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.

user1306322
  • 1,399
  • 1
  • 19
  • 38
jSherz
  • 225
  • 2
  • 5

2 Answers2

2

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

House
  • 73,224
  • 17
  • 184
  • 273
2

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).