layer_exists


描述

This function can be used to check if the given layer exists. 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 a boolean value of true if it exists or false if it does not.

注意: This function works within the scope of the current target room - by default the room in which the function is called - which can be set using the function layer_set_target_room().


语法:

layer_exists(layer_name)


参数:

参数 描述
layer_name The name of the layer (a string or ID value)


返回:

Boolean(布尔值)


例如:

if !layer_exists(global.tileLayer)
   {
   global.tileLayer = layer_create(1000);
   }

The above code will check to see if the layer stored in the global variable actually exists, and if it does not then it is created.


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