layer_get_visible


描述

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.


语法:

layer_get_visible(layer_id)


参数:

参数 描述
layer_id The unique ID value of the layer to target (or the layer name as a string)


返回:

Boolean(布尔值)


例如:

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.


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