Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Possible Duplicate:
Tracking Object Position - Firing on a Trajectory

I need help in implementing the projectile motion in my game as was implemented in Angry Birds.

Please help.

share|improve this question

marked as duplicate by Ricket Oct 10 '12 at 23:49

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1  
-1: Not everyone has played every game you have. Many of us have no idea what Angry Birds is, and some may not have known of its existence until you mentioned it. Please explain what exactly you are trying to accomplish, without referencing other games. –  Nicol Bolas Jul 14 '11 at 0:45

5 Answers 5

Projectile motion is just a function of gravity and velocity. At every tick, decrease your vertical velocity by g (the force of gravity), and then add g to your current height. If you're having trouble doing this, come back and ask another question with some of the code that you've tried.

For a more in depth look at the physics required in these sorts of games, Google around for some game development blogs or how-to's, or start with this one here.

share|improve this answer

Physics.

Specifically look at http://en.wikipedia.org/wiki/Hooke's_law, http://en.wikipedia.org/wiki/Equations_of_motion and the application of a constant force of gravity.

Obviously if you're not sure about how to apply these things together, perhaps look at implementing a Physics engine.

share|improve this answer
    
Why would you need Hooke's law for projectile? –  iamcreasy Jul 13 '11 at 22:00
1  
Not for the projectile, but he mentioned angry birds, and that contains a sling shot. –  Daniel Jul 13 '11 at 23:59

Here is some code for doing exactly what your ask for...

http://developer.anscamobile.com/code/how-make-angry-birds-catapult

It's written in Lua and uses the Corona SDK. But I'm sure you could port it over to whatever platform you are working on.

share|improve this answer

You haven't told us what is the problem. Anyway, I guess you are asking how to do it. Here is a link.

Implementing the equations is not hard at all.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.