diff --git a/src/Frame.java b/src/Frame.java index 4c4a2e6..eb956e4 100644 --- a/src/Frame.java +++ b/src/Frame.java @@ -266,10 +266,12 @@ public void MapCalculations(MouseEvent e) { else if (currentKey == 'e') { int xRollover = e.getX() % size; int yRollover = e.getY() % size; - + int location = pathfinding.searchBorder(mouseBoxX, mouseBoxY); if (endNode == null) { + if(location>-1) pathfinding.removeBorder(location); endNode = new Node(e.getX() - xRollover, e.getY() - yRollover); } else { + if(location>-1) pathfinding.removeBorder(location); endNode.setXY(e.getX() - xRollover, e.getY() - yRollover); } repaint();