Creating levels using Tiled

One of the most important weapons in the game developer's arsenal is the level editor . In this recipe we will create a level using the Tiled level editor. We will then create a simple top-down world using this level.

Creating levels using Tiled

Getting ready

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

How to do it...

Execute the following code:

//Interface @interface Ch8_Tiled : GameArea2D { CCTMXTiledMap *tileMap; } @end //Implementation @implementation Ch8_Tiled -(CCLayer*) runRecipe { //Load TMX tilemap file tileMap = [CCTMXTiledMap tiledMapWithTMXFile:@"tilemap.tmx"]; //Set game area size based on tilemap ...

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.