// Get number index of a tile name
// Note: this is 0 based, useful for mathematical operations
-// Note: Since the tile notation starts from the bottom left,
+// Note: Since the tile notation starts from the bottom left,
// you may want to do number_of_rows - what_this_function_returns or something
int minigame_tile_number(string id)
{
// Get relative position of the center of a given tile
vector minigame_tile_pos(string id, int rows, int columns)
{
- return eX*(minigame_tile_letter(id)+0.5)/columns +
+ return eX*(minigame_tile_letter(id)+0.5)/columns +
eY - eY*(minigame_tile_number(id)+0.5)/rows;
}
{
if ( pos_x < 0 || pos_x > 1 || pos_y < 0 || pos_y > 1 )
return ""; // no tile
-
+
int letter = floor(pos_x * columns);
int number = floor((1-pos_y) * rows);
return minigame_tile_buildname(letter, number);