layer_exists


Description

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.

NOTE: 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().


Syntax:

layer_exists(layer_name)


Arguments:

Argument Description
layer_name The name of the layer (a string or ID value)


Returns:

Boolean


Example:

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.


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