layer_tilemap_destroy

描述

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


语法:

layer_tilemap_destroy(tilemap_element_id)


参数:

参数 描述
tilemap_element_id The unique ID value of the tilemap to be destroyed


返回:

N/A(无返回值)


例如:

var lay_id = layer_get_id("Tiles_trees");
var tile_id = layer_tilemap_get_id(lay_id);
if layer_tilemap_exists(lay_id, tile_id)
   {
   layer_tilemap_destroy(tile_id);
   }

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