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 levels using JSONWorldBuilder

Creating a game level using tiles is a technique that works well for many games. In this recipe, however, we will create a level in a more non-linear fashion using the JSONWorldBuilder level editor.

Creating levels using JSONWorldBuilder

Getting ready

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

How to do it...

Execute the following code:

#import "ActualPath.h" #import "CJSONDeserializer.h" //Interface @interface Ch8_JSONWorldBuilder : GameArea2D { NSDictionary *mapData; CGPoint canvasSize; NSMutableArray *lineVerticesA; NSMutableArray *lineVerticesB; NSMutableArray *points; } @end //Implementation @implementation ...

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