Sets a tile's depth.


tile_set_depth(index, depth);

Argument Description
index The index of the tile to set.
depth The depth of the tile.

Returns: N/A


With this function you can set the depth of a specific tile. This is not permanent and if the player leaves the room and returns to it again, the tile will have its original depth (if it was placed in the room editor and the room is not persistent).


var tile;
tile = tile_layer_find(-1000, mouse_x, mouse_y);
tile_set_depth(tile, 1000);

The above code will check the mouse position for a tile and store its index in a variable. This is then used to set the depth of the tile.

Back: Background Tiles
Next: tile_set_position
© Copyright YoYo Games Ltd. 2018 All Rights Reserved