This function can be used to draw a given tilemap anywhere in the room. 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()), then give the x/y position for drawing (in the room). Note that this will simply draw the tilemap at the specified point, using the layer depth of the instance that is calling the function. It does not move the tilemap - nor change it in any way - and does it matter if the tilemap is flagged as visible or not.


draw_tilemap(tilemap_element_id, x, y);


参数 描述
tilemap_element_id The unique ID value of the tilemap element to get the cell y position of
x The x position within the room to draw at
y The y position within the room to draw at




var lay_id = layer_get_id("Tiles_Effects");
var map_id = layer_tilemap_get_id(lay_id);
draw_tilemap(map_id, mouse_x, mouse_y);

The above code gets the layer ID then uses that to get a specific tilemap ID which in turn is used to draw the tilemap at the mouse position.

上一页: Drawing Sprites And Tiles
next: draw_self
© Copyright YoYo Games Ltd. 2018 All Rights Reserved