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