O'Reilly logo

Cocos2d for iPhone 1 Game Development Cookbook by Nathan Burba

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using joints

The last major feature of Box2D we have yet to investigate is joints. Joints allow us to link objects to create simple machines like pulleys, levers, and simple motors. In this recipe, we will learn how to create a simple seesaw using a joint.

Using joints

Getting ready

Please refer to the project RecipeCollection02 for full working code of this recipe. Also note that some of the following code has been omitted for brevity.

How to do it...

Execute the following code:

@implementation Ch4_Joints -(CCLayer*) runRecipe { [super runRecipe]; [message setString:@"Drop the weight on the see-saw"]; //Initialization movableObjects = [[[NSMutableArray alloc] init] ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required