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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.