How to get the position of a tiledmap cell in libgdx

I have an isometric tiled map and I’d like to get the position (x, y) of a given cell in the screen. Is this possible?

cell = ((TiledMapTileLayer) map.getLayers().get(0)).getCell(0, 0);

How do I get the position of this cell so I can place a sprite on top of it?

Answer

I ended up making a parser that gets the tiled file exported as JSON and imports every tile as an extended scene2D actor which has all the methods and variables I need. I can even parse tile information such as the kind of terrain the tileset is or the altitude of the tile (I’m working with an isometric map that has multiple height levels)

I believe this to be the best solution in my case. I’m not posting any code because it’s very case specific so if anyone wants to use this aproach you’ll have to study the json file you generate in order to parse it correctly. Anyway, If someone needs it for reference just send me an email.

Leave a Reply

Your email address will not be published. Required fields are marked *