This function will destroy the given tile map element.
You supply the tile map ID (which you get when you create the tile map using layer_tilemap_create() or when you use the layer ID along with layer_get_tilemap_id()) and this will remove it.
NOTE This does not remove the layer, only the tile map from it. If the tile map is one that has been added in the Room Editor, the next time you leave the room and then return, the tile map will be created again. If the room is persistent, however, the tile map will be removed unless room persistence is switched off again.
layer_tilemap_destroy(tilemap_element_id);
Argument | Type | Description |
---|---|---|
tilemap_element_id | Tile Map Element ID | The unique ID value of the tile map 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 tile map element exists and if it does, then it is destroyed (but not the layer).