I'm working with Kivy and Pytmx, I need to get Grid Tile from Map Coordinates for staggered map.
My tile size is:
TILE_WIDTH = 256
TILE_HEIGHT = 149
When I used the isometric diamond grid, I calculated it like this:
def screen_to_isometric_grid(cartX, cartY):
screenx = mh - cartY / (TILE_HEIGHT * SPRITE_SCALING) + cartX / (TILE_WIDTH * SPRITE_SCALING) - mw / 2 - 1 / 2
screeny = mh - cartY / (TILE_HEIGHT * SPRITE_SCALING) - cartX / (TILE_WIDTH * SPRITE_SCALING) + mw / 2 - 1 / 2
screenx2 = round(screenx)
screeny2 = round(screeny)
return screenx2, screeny2
Now I'm using staggered map and I dont know how to get tile coordinates.
I found algorithm in C++ here enter link description here