tilemap_get_y

描述

Using this function you can retrieve the y position (within the room) 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 y-axis position.


语法:

tilemap_get_y(tilemap_element_id);


参数:

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


返回:

Real(实数)


例如:

var lay_id = layer_get_id("Tiles_Walls");
var map_id = layer_tilemap_get_id(lay_id);
var _x = tilemap_get_x(map_id);
var _y = tilemap_get_y(map_id);
tilemap_x(map_id, _x + 10); tilemap_y(map_id, _y + 10);

The above code uses the retrieved tilemap ID to get the tile x and y position of the tilemap and then uses those values to move it.