Hi all, i’m noob with cocos, i have a strange problem with the method getTileAt. When i use it on a hexagonal map apparentely he delete the Hexagon.
this is the code:
auto layer = _tileMap->getLayer(“Livello tile 1”);
layer->getTileAt(Vec2(1,8));
I tried it, now it works, but the map it’s completely wrong now. The tiles are in wrong places, the draw order it’s different from the old one and from the appearence in Tiled program.
Hi I have exactly the same problem. It is also easily reproducable in the cpp tests. Is this a bug? Maybe I should open an Issue on Github? Any Help appreciated
Please do and tag me in it. I’d be happy to look into this bug. It will help me update our TMX docs at the same time. Include pictures of results with original TMXTiledMap class and after using experimental::TMXTiledMap class. Basically what you have here but with a few more things.
I dunno if this will help you but, can you use this in the meantime?
uint32_t* tiles = tmxLayer->getTiles();
int tileIdx = x + (y * tmxLayer->getLayerSize().width);
// optional: subtract 1 to make it match the value reported inside Tiled editor
int tileId = tiles[tileIdx] - 1;