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

The basics of Box2D


The Box2D manual, found at http://www.box2d.org/manual.html, summarizes Box2D as a 2D rigid-body simulation library for games. Now what exactly do they mean by rigid body? A quick search on Google and you will know that a rigid body is one that does not deform regardless of the external forces exerted on it. Thus, Box2D is built to simulate hard objects such as rocks, walls, and bowling balls rather than soft bodies such as cotton, toothpaste, and mom's pudding!

In this section, you will get a brief overview of the various components of Box2D that we will interact with in the due course of time. However, I must insist you to read the manual provided at the preceding URL for a deeper understanding of what happens under the hood of this amazing physics engine.

The first object of the engine you will create is of type b2World. This is the object that manages the entire physics simulation. It provides factory methods to create bodies and joints, and even manages their memory...