Javascript A* path finding
- by Veyha
I am trying to learn A* path finding. I am using this library - https://github.com/qiao/PathFinding.js
But there is one thing I don't understand how to do.
To find a path from player.x/player.y (player.x and player.y are both 0) to 10/10 I use this code
var path = finder.findPath(player.x, player.y, 10, 10, grid);
This gives an array of where I need to move, but how do I apply this array to my player.x and player.y?
The path structure looks like this
path = [[0, 0], [1, 0], [1, 1], ..., [10, 10]]