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

Creating a vehicle

Combining two or more joints can create some interesting effects. In this example, we will create a car that can be driven around a level.

Creating a vehicle

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_Vehicles -(CCLayer*) runRecipe { [super runRecipe]; [message setString:@"Press and hold to drive car."]; //Initialization pressedLeft = NO; pressedRight = NO; //Create level [self createLevel]; //Add taxi [self addTaxi]; return self; } -(void) createLevel { /* Create ...

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