layer_background_destroy


描述

This function will destroy the given background element. You supply the background ID (which you get when you create the background using layer_background_create() or when you use the layer ID along with layer_get_background_id()) and this will remove it. Note that this does not remove the layer, only the background from it, and if the background is one that has been added in the room editor, then the next time you leave the room and then return, the background will be recreated again. However if the room is persistent, the background will be removed unless room persistence is switched off again.


语法:

layer_background_destroy(background_element_id)


参数:

参数 描述
background_element_id The unique ID value of the background to be destroyed


返回:

N/A(无返回值)


例如:

var lay_id = layer_get_id("Background_trees");
var bck_id = layer_background_get_id("Forrest");
if layer_background_exists(lay_id, bck_id)
   {
   layer_background_destroy(bck_id);
   }

The above code checks the layer "Background_trees" to see if the given background element exists and if it does, then it is destroyed (but not the layer).


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