summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Jung <flo@windfisch.org>2015-08-18 03:24:39 +0200
committerFlorian Jung <flo@windfisch.org>2015-08-18 03:24:39 +0200
commit59fbdf0f97dcf02048507dfca2c1dc8868aef84e (patch)
tree108fb67259944293cdee1cd6d79f2489503ea79b
parentbd7579543c44d0e41a084dc53cbdb763a84186b6 (diff)
follows path \o/
-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]