tilemap_get_height

Using this function you can retrieve the height (in cells) of the tile map element.

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 height (number of cells wide).

 

Syntax:

tilemap_get_height(tilemap_element_id)

ArgumentTypeDescription
tilemap_element_idTile Map Element IDThe unique ID value of the tile map element to get the height of

 

Returns:

Real

 

Example:

var lay_id = layer_get_id("espadrilles");
var map_id = layer_tilemap_get_id(lay_id);
var _w = tilemap_get_width(map_id);
var _h = tilemap_get_height(map_id);
total_tiles = (_w * _h);

The above code uses the retrieved tile map ID to get the tile width and height of the tile map and then uses those values to set an instance variable.