C#C
C#2y ago
136 replies
Cam

✅ A* Algorithm Get Node where x and y is 1 less (Neigbour)

Any idea how to get the neighbours? ive tried to grab the neighbour pathnode item by subtracting 1 from x. Either im not doing it correctly or the list needs to be formatted better but all the ways i have tried are not seeming to work so help?.

public class PathNode
{
    private double width;
    private double height;
    public double x;
    public double y;
    //private List<double> neighbours;
    private bool closed = false;
    private bool walkable = true;
    public PathNode(double width, double height, double x, double y)
    {
        this.x = x;
        this.y = y;
        this.width = width;
        this.height = height;
    }
    public bool barrierNode()
    {
        return walkable = false;
    }
    public void updateNeighbours(List<PathNode> panelNodes)
    {
        if (x < width - 1 /* Code Here to get the pathnode with x - 1 and y -1*/ )
        {

        }
    }
}
Was this page helpful?