there is my astar algorithm, But I don't know how to get parent and get a quick route from the Destination.
Node script methods
getPos() (Vector2)
Parent (Node)
Node n = ?.Parent;
while(n != null)
{
path.add(n.getPos());
n = n.Parent;
}
there is my astar algorithm, But I don't know how to get parent and get a quick route from the Destination.
Node script methods
getPos() (Vector2)
Parent (Node)
Node n = ?.Parent;
while(n != null)
{
path.add(n.getPos());
n = n.Parent;
}
You have to set "current" as parent to the adjacent nodes. Then if the destination is found, you follow the path of the parent entries, this is the path
EDIT: Also i can´t see a "cost" implementation ...