Chapter 4. Physics

In this chapter, we will cover the following points:

  • Box2D setup and debug drawing
  • Creating collision response routines
  • Using different shapes
  • Dragging and collision filtering
  • Manipulating physical properties
  • Applying impulses
  • Applying forces
  • Asynchronous body destruction
  • Using joints
  • Creating a vehicle
  • Character movement
  • Simulating bullets
  • Simulating and rendering a rope
  • Creating a top-down isometric game engine

Introduction

For years, physics engines have been used in video games to add a sense of realism to the action onscreen. In many games, physics plays a crucial role within the gameplay. Cocos2d comes bundled with two popular 2D physics engines: Box2D and Chipmunk . In this chapter, we will explain the most common uses of physics in ...

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.