Box2D setup and debug drawing

In our first physics recipe, we will explore the basics of creating a Box2D project and setting up a Box2D world. The example creates a scene that allows the user to create realistic 2D blocks.

Box2D setup and debug drawing

Getting ready

Please refer to the project RecipeCollection02 for full working code of this recipe.

How to do it...

The first thing we need to do is create a Box2D project using the built-in Box2D project template:

  1. Go to File | New Project.
  2. Under User Templates click on Cocos2d.
  3. Now, right click on Cocos2d Box2d Application.
    How to do it...
  4. Click Choose ...

Get Cocos2d for iPhone 1 Game Development Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.