From 59fbdf0f97dcf02048507dfca2c1dc8868aef84e Mon Sep 17 00:00:00 2001 From: Florian Jung Date: Tue, 18 Aug 2015 03:24:39 +0200 Subject: follows path \o/ --- pathfinding.py | 8 ++++++++ 1 file changed, 8 insertions(+) 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] -- cgit v1.2.3