Using this function you can retrieve the width (in pixels) of each tile cell of the tilemap element. 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 tile set cell width.
tilemap_get_tile_width(tilemap_element_id);
参数 描述 tilemap_element_id The unique ID value of the tilemap element to get the tile cell width of
Real(实数)
var lay_id = layer_get_id("Tiles_Walls");
var map_id = layer_tilemap_get_id(lay_id);
global.snap_x = tilemap_get_tile_width(map_id);
global.snap_y = tilemap_get_tile_height(map_id);
The above code uses the retrieved tilemap ID to get the tile cell width and height and use them to set two global variables.