This function returns the bit mask value for the given tile map.
You give the tile map element ID (which you get when you create a tile map element using layer_tilemap_create or when you use the function layer_tilemap_get_id), and the function will return the current mask value or -1 if there is an error.
For further information on tile map bit masks, see the function tilemap_set_mask.
tilemap_get_mask(tilemap_element_id)
Argument | Type | Description |
---|---|---|
tilemap_element_id | Tile Map Element ID | The unique ID value of the tile map element to get the mask of |
Real (the mask value for the tile map or -1 in case of an error)
var _lay_id = layer_get_id("Tiles_sky");
var _map_id = layer_tilemap_get_id(_lay_id);
var _mask = tilemap_get_mask(_map_id);
var _new_mask = tile_mirror | tile_flip | tile_rotate | 255;
if (_mask != _new_mask)
{
tilemap_set_mask(_map_id, _new_mask);
}
The above code gets the tile map ID from the given layer and then checks the mask value associated with it. If it is not the same as the value defined in the variable _new_mask, then it is set to that value.