layer_tilemap_get_id

描述

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.


语法:

layer_tilemap_get_id(layer_id)


参数:

参数 描述
layer_id The unique ID value of the layer to target (or the layer name as a string)


返回:

tilemap element ID value (Real)


例如:

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.