This function controls the position along the x-axis of the room of the asset tilemap element on the layer. 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 then set the x value to use (based on the room coordinates).
layer_tilemap_x(tilemap_element_id, x);
参数 描述 tilemap_element_id The unique ID value of the tilemap element to change x The x position for the tilemap
N/A(无返回值)
var lay_id = layer_get_id("Asset_sky");
var map_id = layer_tilemap_get_id(lay_id);
tilemap_x(map_id, irandom(room_width));
The above code gets the ID value of the tilemap asset assigned to the layer "Asset_sky" and then sets its x position to a random value between 0 and the width of the room.