Generating a list of all coordinates of tile in layer


(Gguyot) #1

Hi there ! How are you ?
So here’s the thing:
I need to generate a list of all coordinates (x, y) of a specific tileset (like a 48x48 grass texture) on a layer.
ex:
50,50
50,51
49,50
48,51
etc.
How can i obtain that ? I looked at all the export type, but none of them offer that, sadly.
Pardon me in advance if the question already exists on the forum.

(i’ll use these coordinates list to recreate the map in an online mapping library called Leaflet for a web game)
Thank you in advance for any idea/solution you have in mind ! :stuck_out_tongue:


(Jonathan Bayle) #3

Hi,
It’s not really possible as Tiled does not work with lists of coordinates but with matrices of tile IDs.


(Thorbjørn Lindeijer) #4

Well, it is possible to write either a C++ or Python plugin that exports to this format, though currently the plugin would have no way of knowing for which specific tile you want to write out the list of coordinates. It could just write out multiple files though (one for each tile).

For Tiled 1.3 I plan to add scripting, which will make it easier to add such functionality.