![]() |
cocos2d-iphone
2.1
Improved Cocos2D API Reference (iOS version) for www.kobold2d.com developers
|
#import <CCTMXTiledMap.h>
Public Member Functions | |
(id) | - initWithTMXFile: |
(id) | - initWithXML:resourcePath: |
(CCTMXLayer *) | - layerNamed: |
(CCTMXObjectGroup *) | - objectGroupNamed: |
(id) | - propertyNamed: |
(NSDictionary *) | - propertiesForGID: |
Static Public Member Functions | |
(id) | + tiledMapWithTMXFile: |
(id) | + tiledMapWithXML:resourcePath: |
Protected Attributes | |
CGSize | _mapSize |
CGSize | _tileSize |
int | _mapOrientation |
NSMutableArray * | _objectGroups |
NSMutableDictionary * | _properties |
NSMutableDictionary * | _tileProperties |
Properties | |
CGSize | mapSize |
CGSize | tileSize |
int | mapOrientation |
NSMutableArray * | objectGroups |
NSMutableDictionary * | properties |
CCTMXTiledMap knows how to parse and render a TMX map.
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.
Features:
Limitations:
Technical description: Each layer is created using an CCTMXLayer (subclass of CCSpriteBatchNode). If you have 5 layers, then 5 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 (CCTMXLayer objects) at runtime by:
Each object group is created using a CCTMXObjectGroup which is a subclass of NSMutableArray. You can obtain the object groups at runtime by:
Each object is a CCTMXObject.
Each property is stored as a key-value pair in an NSMutableDictionary. 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];
- (id) initWithTMXFile: | (NSString *) | tmxFile |
initializes a TMX Tiled Map with a TMX file
- (id) initWithXML: | (NSString *) | tmxString | |
resourcePath: | (NSString *) | resourcePath | |
initializes a TMX Tiled Map with a TMX formatted XML string and a path to TMX resources
- (CCTMXLayer*) layerNamed: | (NSString *) | layerName |
return the TMXLayer for the specific layer
- (CCTMXObjectGroup*) objectGroupNamed: | (NSString *) | groupName |
return the TMXObjectGroup for the specific group
- (NSDictionary*) propertiesForGID: | (unsigned int) | GID |
return properties dictionary for tile GID
- (id) propertyNamed: | (NSString *) | propertyName |
return the value for the specific property name
+ (id) tiledMapWithTMXFile: | (NSString *) | tmxFile |
creates a TMX Tiled Map with a TMX file.
+ (id) tiledMapWithXML: | (NSString *) | tmxString | |
resourcePath: | (NSString *) | resourcePath | |
initializes a TMX Tiled Map with a TMX formatted XML string and a path to TMX resources
- (int) mapOrientation [read, assign] |
map orientation
- (CGSize) mapSize [read, assign] |
the map's size property measured in tiles
- (NSMutableArray*) objectGroups [read, write, retain] |
object groups
- (NSMutableDictionary*) properties [read, write, retain] |
properties
- (CGSize) tileSize [read, assign] |
the tiles's size property measured in pixels