Hi everyone. This is my first post on this forum and I'm not sure about the protocol, so feel free to point out if I'm doing something wrong (I have already searched the forums and couldn't find a similar issue to mine).
I'm currently working on a turn-based board game with tiles. I've been mostly following the "Small Tactics" tutorial by Kyatric, (I can't post the URL apparently). The main difference is that while he manually places the Cell sprite objects and snaps them to the grid, I generate them dynamically like this:
I then proceed to create the Player Sprites (which are the same size as the tiles) and place them on the corners by selecting the respective tiles (Xpos = 0, Ypos = 0; Xpos = grid_size - 1, Ypos = grid_size - 1) and changing their position to Tile.X and Tile.Y. So far so good.
The problem arises when I try to (in another event) select the tile the Player Sprite is currently on by using the condition "Player is overlapping Tile". When I'm referring to the Player on the logic [0, 0] it's ok, but when it's the other Player, the tile selected is not the one at [grid_size - 1, grid_size -1], but the one at [grid_size - 2, grid_size - 2]. How can this be if all tiles are exactly the same size and spaced apart by that same amount, and the player sprites are the same size as the tiles and placed at the center of them?
I have circumvented the issue by simply adding a logical position instance variable to the player sprites, not having to rely on overlapping to figure out where the player is (which is a better practice anyway because I may want to use player sprites which are bigger than the tiles if I decide to use more of a top-side view rather than top-down) but I am still curious for a solution to this particular issue.
I hope the problem was well specified
Cheers