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 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 ...

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