tilemap_clear

Description

Using this function you can clear/set all the tiles on a given tilemap. You give the tilemap element ID (which you get when you create a tilemap element using layer_tilemap_create() or when you use the function layer_tilemap_get_id()), and then supply the tile data that you wish to clear the layer with. A default value of 0 will clear all the tiles from the layer (essentially making all tiles "empty"), while you can use the dedicated tile functions to create your own tile data to clear the tilemap with.


Syntax:

tilemap_clear(tilemap_element_id, tiledata)


Arguments:

Argument Description
tilemap_element_id The unique ID value of the tilemap element to change
tiledata The tile data to use to clear the layer


Returns:

N/A


Example:

var layer_id = layer_get_id("Forest");
var tile_id = layer_tilemap_get_id(layer_id);
tilemap_clear(tile_id, 0);

The above code gets the ID value of a tilemap created in the room editor, and then clears it using "empty" tiles.