Skip to content

Instantly share code, notes, and snippets.

@digitalhobbit
Created August 14, 2009 20:52
Show Gist options
  • Save digitalhobbit/168098 to your computer and use it in GitHub Desktop.
Save digitalhobbit/168098 to your computer and use it in GitHub Desktop.
@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