tile_set_empty

This function can be used to set a given set of tile-data to be an empty tile.

You give the tile-data, which can be retrieved using the function tilemap_get(). The function will return a modified tile-data set which can then be applied using the tilemap_set() function.

 

Syntax:

tile_set_empty(tiledata)

ArgumentTypeDescription
tiledataTile Datathe tile-data to set

 

Returns:

Tile Data

 

Example:

var lay_id = layer_get_id("Tiles_sky");
var map_id = layer_tilemap_get_id(lay_id);
for (var i = 0; i < tilemap_get_width(map_id); i++;)
{
    for (var j = 0; j < tilemap_get_height(map_id); j++;)
    {
        var data = tilemap_get(map_id, i, j);
        if (!tile_get_empty(data))
        {
            data = tile_set_empty(data)
            tilemap_set(map_id, data, i, j);
        }
    }
}

The above code gets the tile map ID from the given layer and then proceeds to check every tile cell on the map to see if it has data or not. If it does, the tile is set to empty.