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.
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 Ch8_JSONWorldBuilder -(CCLayer*) runRecipe { //Load our map file [self loadMap:@"world.json"]; return self; } /* Called after the map has been loaded into a container but before assets have been loaded */ -(void) finishInit { //Superclass initialization and message [super runRecipe]; /* CODE OMITTED */ //Init...