CCTiledMapLayer Class Reference
| Inherits from | CCNode : CCResponder : NSObject |
| Conforms to | CCBlendProtocol CCShaderProtocol CCTextureProtocol |
| Declared in | CCTiledMapLayer.h |
Overview
CCTiledMapLayer represents the Tiled Map layer.
If you modify a tile on runtime, then that tile will become a CCSprite otherwise no CCSprite objects are initially created.
Notes
Tiles can have tile flags for additional properties. At the moment only flip horizontal and flip vertical are used. These bit flags are defined in CCTMXXMLParser.h.
Tasks
Accessing the Tile Map Layer Attributes
-
layerNameproperty -
layerSizeproperty -
mapTileSizeproperty -
tilesproperty -
tilesetproperty -
layerOrientationproperty -
propertiesproperty
Creating a CCTiledMapLayer Object
Initializing a CCTiledMapLayer Object
Tile Map Layer Helpers
Properties
layerName
Name of the layer.
@property (nonatomic, readwrite, strong) NSString *layerNameDeclared In
CCTiledMapLayer.hlayerOrientation
Layer orientation method, which is the same as the map orientation method.
@property (nonatomic, readwrite) CCTiledMapOrientation layerOrientationDeclared In
CCTiledMapLayer.hlayerSize
Size of the layer in tiles.
@property (nonatomic, readwrite) CGSize layerSizeDeclared In
CCTiledMapLayer.hmapTileSize
Size of the Map’s tile, could be different from the tile size.
@property (nonatomic, readwrite) CGSize mapTileSizeDeclared In
CCTiledMapLayer.hClass Methods
layerWithTilesetInfo:layerInfo:mapInfo:
Create and return a CCTiledMapLayer using the specified tileset info, layerinfo and mapinfo values.
+ (id)layerWithTilesetInfo:(CCTiledMapTilesetInfo *)tilesetInfo layerInfo:(CCTiledMapLayerInfo *)layerInfo mapInfo:(CCTiledMapInfo *)mapInfoParameters
- tilesetInfo
Tileset Info to use.
- layerInfo
Layer Info to use.
- mapInfo
Map Info to use.
Return Value
The CCTiledMapLayer Object.
Declared In
CCTiledMapLayer.hInstance Methods
addChild:z:tag:
addchild:z:tag: is not supported on CCTMXLayer. Instead use setTileGID:at: and tileAt: methods.
- (void)addChild:(CCNode *)node z:(NSInteger)z tag:(NSInteger)tagParameters
- node
Node to use.
- z
Z value to use.
- tag
Tag to use.
Discussion
Warning: addchild:z:tag: is not supported on CCTMXLayer. Instead use setTileGID:at: and tileAt: methods.
Declared In
CCTiledMapLayer.hinitWithTilesetInfo:layerInfo:mapInfo:
Initializes and returns a CCTiledMapLayer using the specified tileset info, layerinfo and mapinfo values.
- (id)initWithTilesetInfo:(CCTiledMapTilesetInfo *)tilesetInfo layerInfo:(CCTiledMapLayerInfo *)layerInfo mapInfo:(CCTiledMapInfo *)mapInfoParameters
- tilesetInfo
Tileset Info to use.
- layerInfo
Layer Info to use.
- mapInfo
Map Info to use.
Return Value
An initialized CCTiledMapLayer Object.
Declared In
CCTiledMapLayer.hpositionAt:
Return the position in points of the tile specified by the tile coordinates.
- (CGPoint)positionAt:(CGPoint)tileCoordinateParameters
- tileCoordinate
Tile Coordinate to use.
Return Value
Return position of tile.
Declared In
CCTiledMapLayer.hpropertyNamed:
Return the value for the specified property name value.
- (id)propertyNamed:(NSString *)propertyNameParameters
- propertyName
Propery name to lookup.
Return Value
Property name value.
Declared In
CCTiledMapLayer.hremoveTileAt:
Remove tile at specified tile coordinates.
- (void)removeTileAt:(CGPoint)tileCoordinateParameters
- tileCoordinate
Tile Coordinate to use.
Declared In
CCTiledMapLayer.hsetTileGID:at:
Sets the tile GID using the specified tile coordinates and GID value.
- (void)setTileGID:(uint32_t)gid at:(CGPoint)tileCoordinateParameters
- gid
GID value to use.
- tileCoordinate
Tile Coordinate to use.
Declared In
CCTiledMapLayer.hsetTileGID:at:withFlags:
Sets the tile GID using the specified GID value, tile coordinates and flag option values.
- (void)setTileGID:(uint32_t)gid at:(CGPoint)pos withFlags:(ccTMXTileFlags)flagsParameters
- gid
GID value to use.
- pos
Tile Coordinate to use.
- flags
Flag options to use.
Declared In
CCTiledMapLayer.h