CocosSharp.CCTMXTiledMap Class
knows how to parse and render a TMX map.

See Also: CCTMXTiledMap Members

Syntax

public class CCTMXTiledMap : CCNode

Remarks

It adds support for the TMX tiled map format used by http://www.mapeditor.org It supports isometric, hexagonal and orthogonal tiles. It also supports object groups, objects, and properties.

http://www.mapeditor.org

Features:

Limitations:

Technical description: Each layer is created using an CocosSharp.CCTMXLayer (subclass of CocosSharp.CCSpriteBatchNode). If you have 5 layers, then 5 CocosSharp.CCTMXLayer will be created, unless the layer visibility is off. In that case, the layer won't be created at all. You can obtain the layers (CocosSharp.CCTMXLayer objects) at runtime by:

CocosSharp.CCTMXLayer CocosSharp.CCSpriteBatchNode CocosSharp.CCTMXLayer CocosSharp.CCTMXLayer

Each object group is created using a CocosSharp.CCTMXObjectGroup which is a subclass of MutableArray. You can obtain the object groups at runtime by:

CocosSharp.CCTMXObjectGroup

Each object is a TMXObject.

Each property is stored as a key-value pair in an MutableDictionary. You can obtain the properties at runtime by:

map->propertyNamed(name_of_the_property); layer->propertyNamed(name_of_the_property); objectGroup->propertyNamed(name_of_the_property); object->propertyNamed(name_of_the_property);

v0.8.1

v0.8.1

Each tile will be treated as an Sprite Each tile will be treated as an Sprite The sprites are created on demand. They will be created only when you call "layer->tileAt(position)" The sprites are created on demand. They will be created only when you call "layer->tileAt(position)" Each tile can be rotated / moved / scaled / tinted / "opaqued", since each tile is a Sprite Each tile can be rotated / moved / scaled / tinted / "opaqued", since each tile is a Sprite Tiles can be added/removed in runtime Tiles can be added/removed in runtime The z-order of the tiles can be modified in runtime The z-order of the tiles can be modified in runtime Each tile has an anchorPoint of (0,0) Each tile has an anchorPoint of (0,0) The anchorPoint of the TMXTileMap is (0,0) The anchorPoint of the TMXTileMap is (0,0) The TMX layers will be added as a child The TMX layers will be added as a child The TMX layers will be aliased by default The TMX layers will be aliased by default The tileset image will be loaded using the TextureCache The tileset image will be loaded using the TextureCache Each tile will have a unique tag Each tile will have a unique tag Each tile will have a unique z value. top-left: z=1, bottom-right: z=max z Each tile will have a unique z value. top-left: z=1, bottom-right: z=max z Each object group will be treated as an MutableArray Each object group will be treated as an MutableArray Object class which will contain all the properties in a dictionary Object class which will contain all the properties in a dictionary Properties can be assigned to the Map, Layer, Object Group, and Object Properties can be assigned to the Map, Layer, Object Group, and Object It only supports one tileset per layer. It only supports one tileset per layer. Embedded images are not supported Embedded images are not supported It only supports the XML format (the JSON format is not supported) It only supports the XML format (the JSON format is not supported) map->getChildByTag(tag_number); // 0=1st layer, 1=2nd layer, 2=3rd layer, etc... map->getChildByTag(tag_number); // 0=1st layer, 1=2nd layer, 2=3rd layer, etc... map->layerNamed(name_of_the_layer); map->layerNamed(name_of_the_layer); map->objectGroupNamed(name_of_the_object_group); map->objectGroupNamed(name_of_the_object_group);

Requirements

Namespace: CocosSharp
Assembly: CocosSharp (in CocosSharp.dll)