tile_set_empty

Description

This function can be used to set a given set of tiledata to be an empty tile. You give the tiledata, which can be retrieved using the function tilemap_get, and the function will return true if the tile is empty, or false if there is a tile index. The function will return a modified tiledata set which can then be applied using the tilemap_set function.


Syntax:

tile_set_empty(tiledata)


Arguments:

Argument Description
tiledata the tiledata to set


Returns:

Real (tiledata)


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