layer_tilemap_get_id

Description

This function can be used to retrieve the unique ID value of the tilemap element on a layer. You supply the layer ID (which you get when you create the layer using layer_create()) or the layer name (as a string - this will have a performance impact) and the function will return the ID value associated with the tilemap element on the layer. Note that this function is specifically designed for use with tilemaps that have been added in the IDE, as if you add a tilemap to a layer through code using the function layer_tilemap_create, then it will return the unique ID for the tilemap element added.


Syntax:

layer_tilemap_get_id(layer_id)


Arguments:

Argument Description
layer_id The unique ID value of the layer to target (or the layer name as a string)


Returns:

tilemap element ID value (Real)


Example:

var lay_id = layer_get_id("tilemap_trees");
var tile_id = layer_tilemap_get_id(lay_id);
layer_tilemap_destroy(tile_id);

The above code will get the layer ID for the layer named "tilemap_trees" and then use that to get the ID of the tilemap element on that layer. This ID is then used to remove the tilemap from the layer.