For exemple :
Here we have an distance approximate distance of 68 and a tile distance of 6.
And here we have an distance approximate distance of 80 and a tile distance of 5.
Develop games in your browser. Powerful, performant & highly capable.
If the tile size is 32x32 you can do it with the following. Basically the horizontal distance plus the vertical one. It’s called Manhattan distance after the city.
int(abs(Player.x-goal.x)/32)+int(abs(player.y-goal.y)/32)
Thanks a lot !