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.



Argument Description
tilemap_element_id The unique ID value of the tilemap to be destroyed




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)

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).