Game Development Reference
In-Depth Information
[scene addChild: layer];
return scene;
}
-(id) init
{
self = [super init];
if (self)
{
CCTMXTiledMap* tileMap = [CCTMXTiledMap tiledMapWithTMXFile:@"isometric.tmx"];
[self addChild:tileMap z:-1 tag:TileMapNode];
// offset the tilemap's start position to move it into view
tileMap.position = CGPointMake(−500, -500);
self.isTouchEnabled = YES;
}
return self;
}
@end
If you refer to Figure 10-11 in the previous chapter, you'll recall that the tilemap in-
dices of orthogonal tilemaps have their origin point (0, 0) at the top-left corner. Now,
with isometric tilemaps, there is no top-left corner anymore. The tilemap itself is ro-
tated by 45 degrees, which makes the topmost tile the point of origin. Figure 11-14 il-
lustrates this well. Tiles toward the bottom right have increasing X coordinates, while
Tiles toward the bottom left have increasing Y coordinates. The bottommost tile then
has the coordinates 29, 29 in a map consisting of 30x30 tiles.
 
Search Nedrilad ::




Custom Search