tile_get_empty

描述

This function can be used to check whether a given set of tiledata is for an empty tile or not. 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.


语法:

tile_get_empty(tiledata)


参数:

参数 描述
tiledata the tiledata to check


返回:

Boolean(布尔值)


例如:

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.