In https://stackoverflow.com/questions/19193413/pathfinding-in-a-grid-system there is a code by Mehul Nirala to calculate a path using A*.
It works like a charm.
![](https://uploads.gamedev.net/forums/monthly_2022_11/9acd13ddeac2470c86ce9977b4b5bdd2.out.png)
In https://stackoverflow.com/questions/19193413/pathfinding-in-a-grid-system there is a code by Mehul Nirala to calculate a path using A*.
It works like a charm.