Saturday, 7 September 2013

Astar implemntation using Vector2

Astar implemntation using Vector2

So I'm trying to implement Pathfinding for my game written using libgdx.
The problem is I dont know how to do it for a grid where I all the
information is stored as coordinates(x,y).
The examples I have looked at just have grid numbering that go to the end
of the row and then continue on the next
This is what I have started to do but I'm not sure how to continue on from
this.
public class AStarPAthFinding {
public static void calcPAth(Vector2 from, Vector2 to,
Cell[][] mapCells) {
Vector2 start = from;
Vector2 end = to;
Cell[][] cells = mapCells;
List<Vector2> openList = new ArrayList<Vector2>();
List<Vector2> closedList = new ArrayList<Vector2>();
closedList.add(start);// add start to closed list,
// dont need to check;
// check if the parent is in a list
// if (openList.contains(new Vector2())) {
//
// } else if (openList.contains(new Vector2())) {
//
// } else {
//
// }
}
}

No comments:

Post a Comment