Tilemap => how to display stuff over my tiles?

Hi!

I’ve recently started to use Tiled, toyed with it, and tried to build a pathfinding grid by “reading” the lua files.

image
=> seems to work as intended, but a “visual debugging” would be nice… which leads me to my questions below.

Now I’d like to make the “link” between the tilemap visual and the pathfinding grid (at least for debugging purposes + understand how to “identify” the tiles, manipulate them and display stuff over them), but… I don’t know what to do :-/

So… Let’s say I want to draw debug squares over the tiles (ex: green squares for the walkable tiles, red squares for the non-walkable tiles)… How should I proceed?

1/ How to get the “world coordinates” of my tiles? So I could draw my squares over them.

2/ Nothing to do with the tilemap but… how to draw squares? (debugdraw’s squares seems to be displayed in world coordinates, but not 100% sure)

Thanks!

You can get the world position of the game object that contains your tilemap component using go.get_world_position(). You should be able to add tile width and height to that position to get the positions of the individual tiles.

1 Like

Makes sense :slight_smile: Thank you!