Hello, I made a small game awhile back, and I had an A-Star algorithm used for making the NPC’s follow a particular path. This algorithm worked fine until recently, I’m not exactly sure what i’ve touched. But it never seems to work anymore. I have tried to set up logging so that I can debug it, but I can’t seem to figure out what the problem is. This is the output of the log
With 0 = Unwalkable 1 = Walkable
My code is as follows:
Pathfinder.java http://pastebin.com/KL43FbuD
NodeList.java http://pastebin.com/dqhuTDye
Node.java http://pastebin.com/BZqJgY9j
Movement.java http://pastebin.com/q5jUHJZ3
AStarMap.java http://pastebin.com/UF5h9Ux4
The method gets called like this:
Node startNode = new Node(npc.getX(), npc.getY());
Node endNode = new Node(8, 1);
AStarMap loader = new AStarMap(map);
PathFinder pathMaker = new PathFinder(loader.getMap());
pathMaker.findPath(startNode, endNode);
pathMaker.displayPath();
No matter what start and end position it is, it always returns that same path.
There are no exceptions being thrown, there is just a problem with my code. I would be so greatful for any assistance.