Book Image

Cocos2d-X Game Development Blueprints

By : Karan Sequeira
Book Image

Cocos2d-X Game Development Blueprints

By: Karan Sequeira

Overview of this book

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

Chapter 5. Let's Get Physical!

For our fifth game, we will get down to the physics of things. Cocos2d-x comes bundled with two wonderful physics engines: Box2D and Chipmunk. In this chapter, we will make use of the versatile and robust Box2D physics engine to add some realism to our game.

In this chapter, you'll learn about the following:

  • Box2D basics

  • Setting up Box2D world and debug draw

  • Creating Box2D bodies, fixtures, and shapes

  • Manipulating simple physics at runtime

  • Maintaining a state machine

  • Listening for collisions

  • Creating pools for reusable objects