layer_destroy


描述

This function will destroy the given layer. 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 this will remove it from the current room. If the layer is one that has been designed in the room editor, then the next time you leave the room and then return, the layer will be recreated again with the original contents, however if the room is persistent, the layer will be removed unless room persistence is switched off again. When you destroy a layer in this way, all it's contents will be removed too, so any reference IDs for backgrounds or tilemaps, etc... will no longer be valid and any instances assigned to the layer will be destroyed (performing their Destroy Event at the same time, if they have one, as well as the Clean Up Event).


语法:

layer_destroy(layer_id)


参数:

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


返回:

N/A(无返回值)


例如:

if !instance_exists(obj_Bullet_Parent)
   {
   layer_destroy(global.Bullet_Layer);
   }

The above code will check to see if any instances of the object "obj_Bullet_Parent" exists, and if they don't it will destroy the layer with the ID stored in the global variable.


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