The previous section describes how to use Tiled to create a tile map. The following section describes how to import a map to the game. Step 1: import the generated file into the resource, which is map and image set. Step 2: modify the code in HelloWorldLayer. h. It is better to understand the basics. [Objc] # import <GameKit/GameKit. h> // When you import this file, you import all the cocos2d classes # import "cocos2d. h "// HelloWorldLayer @ interface HelloWorldLayer: CCLayer <GKAchievementViewControllerDelegate, GKLeaderboardViewControllerDelegate> {CCTMXTiledMap * tileMap; // map file CCTMXLayer * background; // map file layer} @ property (nonatomic, retain) CCTMXTiledMap * tileMap; // declare tileMap @ property (nonatomic, Retain) CCTMXLayer * background; // declare background // returns a CCScene that contains the HelloWorldLayer as the only child + (CCScene *) scene; @ end (note: background is the layer of the map file. Several cctmxlayers must be declared for each layer.) Step 3: Modify HelloWorldLayer. m file 1) Add [objc] @ synthesize tileMap; @ synthesize background after implentation; 2) Add in dealloc (it should be garbage processing because object-c does not have this mechanism, to be manually processed) [objc]-(void) dealloc {self. tileMap = nil; self. background = nil; // in Case you have something to dealloc, do it in this method // in this particle example nothing needs to be released. // cocos2d will automatically release all the children (Label) // don't forget to call "super dealloc" [super dealloc];} 3) replace init [objc]-(id) init {// always call "super" init // Apple recommends to re-assign "self" with the "super's" return value if (self = [super init])) {self. TileMap = [CCTMXTiledMap tiledMapWithTMXFile: @ "desert. tmx "]; // desert. tmx is the imported Resource Name self. background = [tileMap layerNamed: @ "Ground"]; // Ground is the final program generated by the layer name [self addChild: tileMap z:-1];} return self.