Created
August 14, 2009 20:52
-
-
Save digitalhobbit/168098 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@implementation BackgroundLayer | |
@synthesize map; // the TMXTiledMap | |
@synthesize layer; // convenience property for layer, since we need to access this a lot | |
- (void)clearMap { | |
for (int x = 0; x < 30; x++) { | |
for (int y = 0; y < 20; y++) { | |
[self.layer setTileGID:1 at:ccp(x, y)]; | |
} | |
} | |
} | |
- (id) init { | |
self = [super init]; | |
if (self != nil) { | |
self.map = [TMXTiledMap tiledMapWithTMXFile:TMX_NAME]; | |
self.layer = [map layerNamed:LAYER_NAME]; | |
// TMXTiledMap position workaround | |
self.map.position = ccp(0.0, -16.0); | |
[self clearMap]; | |
[self addChild:self.map z:0]; | |
} | |
return self; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment