S
Steneub
Guest
I would like to know what tile is at a given position.
This is helpful in finding the tile and which Background, but it doesn't give me enough information about the tile itself. I want to know which tile is being indexed here. If I have two tiles next to eachother which use, say, the grass tile, the tile value is unique between them.
When I click two adjacent positions that use the same tile from the same background asset, these values appear in my console:
Which I've discovered these values are what are generated sequentially in the order in which they were placed (starting with 10000000 apparently).
If I could even get the x and y offset into the background asset, that would still be helpful enough to do some simple math to determine which tile is at the position.
Any help would be appreciated.
Code:
if (mouse_check_button_released(mb_left)) {
//d is defined as depth of tiles
var tile = tile_layer_find(d, mouse_x, mouse_y);
if (tile != -1) {
show_debug_message(string( tile_get_background(tile) ));
}
}
When I click two adjacent positions that use the same tile from the same background asset, these values appear in my console:
Code:
10000000
10000001
If I could even get the x and y offset into the background asset, that would still be helpful enough to do some simple math to determine which tile is at the position.
Any help would be appreciated.