tile_set_background

Sets the background for a tile to be drawn from.

Syntax:

tile_set_background(index, background);


Argument Description
index The index of the tile to set.
background The index of the background to take the tile from.


Returns: N/A


Description

With this function you can change the background image asset that the tile is taken from (maintaining the tile in the room, at the same position but with a different graphic). This is not permanent and if the player leaves the room and returns to it again, the tile will use the original background again (if it was placed in the room editor and the room is not persistent).


Example:

if mouse_check_button_pressed(mb_left)
   {
   var tile;
   tile = tile_layer_find(-1000, mouse_x, mouse_y);
   if tile_exists(tile) tile_set_background(tile, bck_Forest);
   }

The above code will check for a press of the left mouse button, and then check the mouse position for a tile. If there is one found, that tile has its background asset changed.


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