tilemap_get_mask

描述

This function can be used to retrieve the bit mask value for the 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 the function will return the current mask value or -1 if there is an error or 0 if no mask is specified. For further information on tilemap bit masks, see the function tilemap_set_mask.


语法:

tilemap_get_mask(tilemap_element_id);


参数:

参数 描述
tilemap_element_id The unique ID value of the tilemap element to get the mask of


返回:

Real (0 for no mask, -1 for 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 tilemap 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.