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.

Properties

layerName

Name of the layer.

@property (nonatomic, readwrite, strong) NSString *layerName

Declared In

CCTiledMapLayer.h

layerOrientation

Layer orientation method, which is the same as the map orientation method.

@property (nonatomic, readwrite) CCTiledMapOrientation layerOrientation

Declared In

CCTiledMapLayer.h

layerSize

Size of the layer in tiles.

@property (nonatomic, readwrite) CGSize layerSize

Declared In

CCTiledMapLayer.h

mapTileSize

Size of the Map’s tile, could be different from the tile size.

@property (nonatomic, readwrite) CGSize mapTileSize

Declared In

CCTiledMapLayer.h

properties

Properties from the layer. They can be added using tiled.

@property (nonatomic, readwrite, strong) NSMutableDictionary *properties

Declared In

CCTiledMapLayer.h

tiles

Tile pointer.

@property (nonatomic, readonly) uint32_t *tiles

Declared In

CCTiledMapLayer.h

tileset

Tileset information for the layer.

@property (nonatomic, readwrite, strong) CCTiledMapTilesetInfo *tileset

Declared In

CCTiledMapLayer.h

Class 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 *)mapInfo

Parameters

tilesetInfo

Tileset Info to use.

layerInfo

Layer Info to use.

mapInfo

Map Info to use.

Return Value

The CCTiledMapLayer Object.

Declared In

CCTiledMapLayer.h

Instance 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)tag

Parameters

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.h

initWithTilesetInfo: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 *)mapInfo

Parameters

tilesetInfo

Tileset Info to use.

layerInfo

Layer Info to use.

mapInfo

Map Info to use.

Return Value

An initialized CCTiledMapLayer Object.

Declared In

CCTiledMapLayer.h

positionAt:

Return the position in points of the tile specified by the tile coordinates.

- (CGPoint)positionAt:(CGPoint)tileCoordinate

Parameters

tileCoordinate

Tile Coordinate to use.

Return Value

Return position of tile.

Declared In

CCTiledMapLayer.h

propertyNamed:

Return the value for the specified property name value.

- (id)propertyNamed:(NSString *)propertyName

Parameters

propertyName

Propery name to lookup.

Return Value

Property name value.

Declared In

CCTiledMapLayer.h

removeTileAt:

Remove tile at specified tile coordinates.

- (void)removeTileAt:(CGPoint)tileCoordinate

Parameters

tileCoordinate

Tile Coordinate to use.

Declared In

CCTiledMapLayer.h

setTileGID:at:

Sets the tile GID using the specified tile coordinates and GID value.

- (void)setTileGID:(uint32_t)gid at:(CGPoint)tileCoordinate

Parameters

gid

GID value to use.

tileCoordinate

Tile Coordinate to use.

Declared In

CCTiledMapLayer.h

setTileGID: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)flags

Parameters

gid

GID value to use.

pos

Tile Coordinate to use.

flags

Flag options to use.

Declared In

CCTiledMapLayer.h

tileCoordinateAt:

Return the position in tile coordinates of the tile specified by position in points.

- (CGPoint)tileCoordinateAt:(CGPoint)position

Parameters

position

Position in points.

Return Value

Coordinate of the tile at that position.

Declared In

CCTiledMapLayer.h

tileGIDAt:

Returns the tile GID at the specified tile coordinates.

- (uint32_t)tileGIDAt:(CGPoint)tileCoordinate

Parameters

tileCoordinate

Tile Coordinate to use.

Return Value

Tile GID value.

Declared In

CCTiledMapLayer.h