Switch a tile from invisible to visible? (SOLVED)

Hi there,

I would like to know if it’s possible to show and hide tiles programmatically please ? I have a layer which is invisible but I would like to put a tile visible when the player is on it, something like that. :slight_smile:

Thanks in advance.

Sure. You can read and set the content of a tile with http://www.defold.com/ref/tilemap/#tilemap.get_tile and http://www.defold.com/ref/tilemap/#tilemap.set_tile

I already read it but it doesn’t work for me :frowning: When I do tilemap.get_tile() it returns me “nil” with “Could not get the tile since the supplied tile was out of range.”

Oh :open_mouth: yeahh I made it work :slight_smile:

tilemap.set_tile(“tilemap”, “ground”, go.get_position().x / tile_size, go.get_position().y / tile_size, 0)