[BUG] TiledMap Parser error while set a tmx file

[BUG] TiledMap Parser error while set a tmx file
0.0 0

#1

Hi,

I try to make a TiledMap whit cocos creator. When I drag my tmx file from asset panel to TiledMap component of the TiledMap node in the properties panel I get this error :

Error: Please load the resource first : C:/Users/Pierre/Documents/CocosProjects/FeudalTimes/assets/map/tile_set/iso-outside.tsx
at parseXMLFile (C:\CocosCreator\resources\engine\cocos2d\tilemap\CCTMXXMLParser.js:566:27)
at parseXMLFile (C:\CocosCreator\resources\engine\cocos2d\tilemap\CCTMXXMLParser.js:646:22)
at parseXMLString (C:\CocosCreator\resources\engine\cocos2d\tilemap\CCTMXXMLParser.js:943:21)
at initWithXML (C:\CocosCreator\resources\engine\cocos2d\tilemap\CCTMXXMLParser.js:554:21)
at ctor (C:\CocosCreator\resources\engine\cocos2d\tilemap\CCTMXXMLParser.js:273:18)
at new TheClass (C:\CocosCreator\resources\engine\cocos2d\core\platform\_CCClass.js:117:34)
at initWithXML (C:\CocosCreator\resources\engine\cocos2d\tilemap\CCSGTMXTiledMap.js:274:23)
at cc_TiledMap._applyFile (C:\CocosCreator\resources\engine\cocos2d\tilemap\CCTiledMap.js:851:30)
at cc_TiledMap.set (C:\CocosCreator\resources\engine\cocos2d\tilemap\CCTiledMap.js:251:26)
at cc_TiledMap.r.set [as tmxAsset] (C:\CocosCreator\resources\app.asar\editor\page\scene-utils\asset-watcher.js:1:697)

However the .tsx files are in the rigth place under C:/Users/Pierre/Documents/CocosProjects/FeudalTimes/assets/map/tile_set/iso-outside.tsx

What is wrong ?

edit: I used Tiled for make the iso map with this settings:

  • isometric
  • width 50
  • height 50
  • tile width 64
  • tile height 32
  • tile Side Lenght (Hex) 0
  • Stagger Axis Y
  • Stagger Inder odd
  • tile layer format base64 (zlib)
  • tile renderer order bottom right
  • background color no set

I use 3 layers and one object layer
All layers have at least one tile. The object layer have several object
I use one tileSet based on Tileset image

here my map (63.5 KB)

Cocos Creator v1.5.2 - windows10


#2

The bug Repair progress:


#3

Hi, im new to Tiled. How can I export the TSX embeded in the TMX?


#4

Hi,

There is two ways to embedded a tileset (.tsx) in the map itself (.tmx) into Tiled:

  • when you create a new tileset (new tileset button in tilesets panel), there is a checkbox “embed in map” to check
  • if the tilset is already created, you just have to click on the button “Embed Tileset” in the tilsets panel to embed it

Then now when you export the map, the tileset datas are embedded into the .tmx and not into a distinct file .tsx :wink:


#5

Hi, thanks for the explanation!
Ive done that, but when I load the tmx in my creator project, only one tile type is shown. The rest are in black. And the only type show is the first one I used in that map. It is so weird… Do you know why this happens?


#6

No sorry, I didn’t try to load a map in cocos creator since the bug with tsx file. I went back on cocos2dx (which works perfectly with tiledMap)


#7

ok. Then I understand… dont try, there are a lot of bugs there…
Creator is not able to load all icons and only loads one (the first one?). Quite disappointed.

Edit: found the bug. Creator is no able to handle a tmx with more than one image. So only works well with all icons in an atlas. I build an atlas with texture packer and rebuilt my tmx and now I can see all the tiles. So yes, its a bug.


#8

Yes if isn’t precised in the spec of Cocos Creator TileMap module it’s a bug. In this case you should be open an issue in github :slight_smile:


#9

Relative to http://www.cocos2d-x.org/wiki/TileMap

Apparently cocos2d-x engine not supports more than one tileset per layer :wink:


#10

Yeah, I learned the hard way. :frowning2:
Thats what lack of documentation and best practices does to us the Creator pioneers.