layer_get_visible


Description

With this function you can check whether a layer is visible or not. You supply the layer ID (which you get when you create the layer using layer_create()) or the layer name (as a string - this will have a performance impact) and the function will return true if it is visible, and false otherwise.


Syntax:

layer_get_visible(layer_id)


Arguments:

Argument Description
layer_id The unique ID value of the layer to target (or the layer name as a string)


Returns:

Boolean


Example:

var lay_id = layer_get_id("Instances");
if layer_get_visible(lay_id)
   {
   layer_set_visible(lay_id, false);
   }
else
   {
   layer_set_visible(lay_id, true);
   }

The above code gets the ID value for the layer named "Instances" in the room editor, then uses the ID to check if the layer is visible or not, toggling the layer visibility depending on the returned value.


Back: General Layer Functions
next: layer_depth
© Copyright YoYo Games Ltd. 2018 All Rights Reserved