Hide tilemap layer programmatically (SOLVED)

Is it possible to hide a tilemap layer programmatically?
I’m using a specific layer of a tilemap to build a puzzle scheme (like in the Colorslide tutorial)
I need to replace all tiles with sprites and hide that specific layer, but hiding it within editor is unlikely, because I’ll lose WYSIWYG ability to design levels.
I can’t find any api in tilemap for hiding a specific layer.
Maybe some msg.post(…) can do it ??

1 Like

There is currently no function for this but I believe it would be fairly easy to add.

As a workaround you could use a separate tilemap and disable it. Or maybe clear the layer when you are done with it.

Ok I can copy initial level status from tilemap to a lua table and clear the layer.
Now I’m creating sprites (really is game object with a sprite) in replacement of tiles, because I need to add some animation.
But now another annoying task: from tilemap I can get the tile index of the tilesource, but no way to translate tile index to animation name it referes
Sprite uses animation name, not tilesource indexes

1 Like

We added tilemap.set_visible() to hide/show layers in 1.2.161

3 Likes

Thx :slight_smile:

1 Like