tile_get_left

Returns the left coordinate of a given tile from its background.

Syntax:

tile_get_left(index);


Argument Description
index The index of the tile to check.


Returns: Real


Description

This function is used to get the left (x axis) local position within the background image asset of the specified tile. It is important to realise that the value returned is in relation to the background image used to create the tile, where the top left corner is the (0,0) position, and is not the position of the resource within the room.


Example:

var tile, ww, hh, ll, tt;
tile = tile_layer_find(-1000, mouse_x, mouse_y);
ww = tile_get_width(tile);
hh = tile_get_height(tile);
ll = tile_get_left(tile);
tt = tile_get_top(tile);
tile_add(bck_Tileset, ll, tt, ww, hh, posx, posy, -1000);

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 store various attributes in local variables. These attributes are then used to add a new tile into the room.


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