Search code examples
pythontiledtmx

I want to get the tile labels from a Tiled (TMX) file using pytmx, i cannot find the syntax


I can get the image path, and also the ID of the tile

however i cannot seem to get the "Type" or the tile or any other properties other than:

The tile ID, Width, Height and Image

My code example:

tmxdata = pytmx.TiledMap('new_map.tmx')
print(tmxdata.get_tile_properties(0, 0, 0))

which gives:

{1: {'height': '16', 'source': 'images/block.png', 'trans': None, 'frames': [], 'width': '16'}}

when you have a map with a tile in that position

please help, thanks, i guess at least PyTMX is better than the other TMX module


Solution

  • The tile "type" attribute was only recently added with Tiled 1.0, so it would not be surprising that it can't be found yet in the library you're using.

    Your best option is probably to contact the author of the library about this by opening an issue on the GitHub project at https://github.com/bitcraft/PyTMX.