Get Tile Index At Pixel Icon Get Tile Index At Pixel

This action is used to get a tile index on a given layer. The layer is specified from the layer name given (a string, as used to name the layer in the Room Editor), and then you give an x and y position to find the tile to get the index of. The tile will be the one that the given position falls within in the room, and the index will be returned to the target variable, where 0 is no tile, and a positive integer is the index of the tile. The x and y position can be flagged as being relative to the position of the calling instance, and the target variable can be flagged as a temporary (local) variable that can be used until the end of the event.

 

Action Syntax:

Get Tile Index At Pixel Action

Arguments:

ArgumentDescription
LayerThe layer to set the tile on
xThe x position to check
yThe y position to check
TargetThe target variable to store the tile index

 

Example:

Get Tile Index At Pixel ExampleThe above action block code checks for a mouse left button press and if one is detected it gets the index of the tile cell that the position of the mouse falls within. This tile index is then checked and if it is not 0, it is set to 0.