Hi!
I made this kind of a tiled map in Tiled:
Why does it look like this in the game:
You see, there is nowhere in the map this kind of tiles.
Code:
_tileMap = new TMXTiledMap();
_tileMap->initWithTMXFile("TileMapTutorial.tmx");
this->addChild(_tileMap);
When there are problems with the drawings probably the issue is that you’re using more than 1 TileSet in the same Layer.
Make sure that each Layer uses 1 TileSet.
If you’ve 1 Tileset then use 1 Layer. If you’ve 2 Tilesets then use 2 Layers. Etc.
That’s how cocos works. And make sure to use the option “Based on tileset image” (if you’re using Tiled), because cocos doesn’t support .tsx files yet.
There is just 1 tileset and two layers. 1 terrain layer and 1 object layer.
And I’m pretty sure that cocos-2d-x 4.0 reads the .tsx file as well, because I ran the game in debugger and it parsed also the XML of the .tsx file.
<?xml version="1.0" encoding="UTF-8"?>
<tileset version="1.2" tiledversion="1.3.2" name="tmw_desert_spacing" tilewidth="32" tileheight="32" spacing="1" margin="1" tilecount="48" columns="8">
<image source="tmw_desert_spacing.png" width="265" height="199"/>
</tileset>
If you’ve just 1 tileset, I would try using only 1 layer.
I’m not sure. I’ve not tested v4 yet. I’m using 3.17, and in this version cocos is checking with the following code (found in CCTMXXMLParser.cpp):
if ( version != "1.0")
{
CCLOG("cocos2d: TMXFormat: Unsupported TMX version: %s", version.c_str());
}
So, it supports until Tiled 1.0. Check in Tiled changelogs when they launched “tsx” files. I don’t remember.
Anyway I didn’t read something related to Tiled Maps in the Features of v4: Cocos2d-x V4.0 released