How to implement pathfinding in Tiled-based game