If you've skipped ahead to Chapter 8, Tips, Tools, and Ports, you'll see a recipe showing how to use the Tiled application with the TMX tilemap toolset. In this recipe, we create a 2.5D adventure game. To see our grid based pathfinding technique in action, we overload the Chapter 8, Tips, Tools, and Ports recipe entitled Creating levels using Tiled.
Execute the following code:
@interface Ch7_TileMapPathfinding : Ch8_TMXTilemap { NSMutableArray *grid; float actorRadius; } @end @implementation Ch7_TileMapPathfinding -(CCLayer*) runRecipe { //Shorter variable names float mw = tileMap.mapSize.width; float mh = tileMap.mapSize.height; float tw = tileMap.tileSize.width; float th = tileMap.tileSize.height; /* CODE OMITTED */ //Create active and inactive nodes determined by the "Collidable" TMX layer CCTMXLayer *collidableLayer = [tileMap...