I'm writing a game, and I need to simulate a the path of a cannon ball. I imagine I would have the initial velocity vector, and a vector for gravity. Is there a good tutorial on how to do this? (maybe I need to read some high school text books?)
migrated from stackoverflow.com Nov 24 '11 at 21:15
This question came from our site for professional and enthusiast programmers.
What I would do is learn how to use Cocos2d. You can use a function thats kind of like a timer, it is called 60 times a second by default but you can change this.
What you would do with this is update the x/y position of your sprite (the cannonball image) by a minuscule amount inside this time function, called ccTime.
If your actually looking for the math for the trajectory, here is an amazing tutorial on that
Here is a question on a forum very similar to yours
You show read the basics of the trajectory from where you can extract any equation you need.