Class cc.TMXTiledMap#ctor
- Defined in: CCTMXTiledMap.js
| Constructor Attributes | Constructor Name and Description |
|---|---|
|
cc.TMXTiledMap#ctor(tmxFile, resourcePath)
Creates a TMX Tiled Map with a TMX file or content string.
|
Class Detail
cc.TMXTiledMap#ctor(tmxFile, resourcePath)
Creates a TMX Tiled Map with a TMX file or content string.
Implementation cc.TMXTiledMap
//example
1.
//create a TMXTiledMap with file name
var tmxTiledMap = new cc.TMXTiledMap("res/orthogonal-test1.tmx");
2.
//create a TMXTiledMap with content string and resource path
var resources = "res/TileMaps";
var filePath = "res/TileMaps/orthogonal-test1.tmx";
var xmlStr = cc.loader.getRes(filePath);
var tmxTiledMap = new cc.TMXTiledMap(xmlStr, resources);
- Parameters:
- {String} tmxFile
- tmxFile fileName or content string
- {String} resourcePath
- If tmxFile is a file name ,it is not required.If tmxFile is content string ,it is must required.