Can you explain this a little bit?
Do you have a small code snippet showing how you do this?
It might be the map/layer trying to access a different texture which is not how these tile maps work…
@tdebock i’m loading the map with the class cocos2d::TMXTiledMap and I’m not making nothing strange in the code. The problem is when I edit some tiles in the tool Tiled.
I think the code isn’t the problem because with some tiles it works perfectly, and with others not. The code is the same. I wonder if the tiles images must have some special settings for be loaded by the TMX cocos class
For example, this tile is perfectly drawn by cocos TMX class:
But this tile not:
Why?
I’m testing it with a 32x32 map and 32x32 px tiles.
Check the .tmx file… there will be a file path to the tilesheets (image files). In Tiled, this is generally a relative file path… ie: like ‘/…/…/SomeFolder/sheet.png’.
This will make it hard for the cocos2d-x project to find/use as the paths are different.
I assume this might be the issue. A small recommendation… ALWAYS put the image for tiles in the same folder as the .tmx file you are creating, and everything should work.
edit: In the tmx file… Look for a <image source="SOME_FILE" width="SOME_WIDTH" height="SOME_HEIGHT"/>
Make sure the file is not a relative path, just the filename itself is needed for cocos to read it.
Anyway you can zip a folder with the .tmx file and the image assets? And put it on a public dropbox, hard to do any further assessment without digging in. Another thing you could (should) do, is to breakpoint into the Tilemap class from cocos, and step through the functions, make sure everything seems right in memory etc. Are there any warnings/errors logged to the console when this happens?
My designer made the assets, with a designers program, i don’t know which.
Can you create an empty project and test the map? It takes 5 minutes
For make sure that you’ve the same problem. I don’t know… it sounds like a problem in cocos class. It sounds like cocos has problems for draw some special tiles/sprites…
Got this on my iPhone. I created a new .tmx file (attached below). I got an ‘version unsupported’ error in my console log with your tmx file. I am using v3.13 though, rather old.
Also… please (unless you are doing manual memory management)… allocate the map with cocos2d-x create methods for autorelease.
tilemap = TMXTiledMap::create("file.tmx");
Let me know if that worked. I just created a new tmx file in tiled with base64 (zlib compressed) and put each texture on its own layer, without the .tsx, just added each tileset separately
Add each png/tile without .tsx. I mean, embed each png in the map separatly.
Add 1 layer per each type of png/tile.
Now works.
Thanks you @tdebock you helped me to discover the problem.
The question is when cocos team will update the class TMXTiledMap for support .tsx files. @slackmoehrle
Currently is very tedious design a map. It’s crazy.
I don’t want to add each tile/png separatly and 1 layer per type of tile.
I would like to work with .tsx files and add the amount of layers that I want. I don’t want to be obliged to add one layer per type of tile.
This disappoints me because of the importance of tiled maps. Is very common to make a game with a tiled map. The cocos team should prioritize this update.