Sets a tile's alpha (transparency).


tile_set_alpha(index, alpha);

Argument Description
index The index of the tile to set.
alpha The transparency of the tile.

Returns: N/A


With this function you can set the alpha value (transparency) of individual tiles. This can be anywhere between 0 and 1, where 0 is completely transparent and 1 is completely opaque. This is not permanent and if the player leaves the room and returns to it again, the tile will have it s original alpha value (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);
if tile_get_alpha(tile) < 1
   tile_set_alpha(tile, 1);

The above code will first get the index of a tile at the mouse position with a depth of -1000 and then use that value to check whether the tile alpha is less than 1 or not, and if it is it sets the tile alpha to 1.

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