Book Image

Cocos2d Game Development Blueprints

By : Jorge Jordán
Book Image

Cocos2d Game Development Blueprints

By: Jorge Jordán

Overview of this book

Table of Contents (15 chapters)
Cocos2d Game Development Blueprints
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Physics engines


If you have played games such as Pong, Air Hockey, or Angry Birds, you may have noticed that there are some physical rules applied to the objects in the scene. Thanks to these rules, we can see how balls and pucks rebound against blocks and how birds demolish the pigs' constructions.

You might think that all these rules were implemented one by one, defining the exit angles when rebounding, the gain of velocity when hitting the puck, or the arc traced by launched birds. Pong was implemented by hand as it was first released in 1972 and the first physics engines date from the 80s. There are no complex behaviors in the game, but you can imagine the number of lines of code needed to simulate gravity, collision, and bouncing in a game similar to Angry Birds.

Physics engines were developed to ease tasks when simulating physical systems in games, films, and computer graphics, so we can specify the parameters of our "world" and the engine will do the rest.

In physics, we can talk about...