summaryrefslogtreecommitdiff
path: root/pathfinding.py
diff options
context:
space:
mode:
Diffstat (limited to 'pathfinding.py')
-rw-r--r--pathfinding.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/pathfinding.py b/pathfinding.py
index e2b631a..8529b93 100644
--- a/pathfinding.py
+++ b/pathfinding.py
@@ -112,4 +112,12 @@ class PathfindingTesterStrategy:
for (node1,node2) in zip(path,path[1:]):
gui.draw_line(node1.point, node2.point, (0,0,0))
+
+ if path:
+ relx, rely = path[0].point[0]-self.c.player.center.x, path[0].point[1]-self.c.player.center.y
+ if relx*relx + rely*rely < 10**2:
+ path=path[1:]
+
+ if path:
+ return path[0].point
return marker[0]