Hi
we are making a tiled map in our game but the tmx files are on the server…
we load these tmx files but we are getting a string version of these files…
we try
cc.load.('url.tmx',cc.TiledMap,function(err,tiledMap){
cc.log(tiledMap)// logs string file of this tmx file
});
First, please put your tmx assets into assets/resources folder.
Then, you can load the map by code like this:
// get the TiledMap component
var theMap = this.node.getComponent(cc.TiledMap);
// load the tmx file by loadRes interface (iso-test means: load the file 'assets/resources/iso-test.tmx ' )
cc.loader.loadRes('iso-test', function(err, map) {
// the tmx asset is loaded, update the property 'tmxAsset' of map.
theMap.tmxAsset = map;
});