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




参数 描述
sprite_element_id The unique ID value of the sprite to be destroyed




var lay_id = layer_get_id("Asset_Trees");
if layer_sprite_exists(lay_id, global.Asset_spr_trees)

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

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