diff options
| author | Florian Jung <flo@windfisch.org> | 2015-08-18 03:24:39 +0200 |
|---|---|---|
| committer | Florian Jung <flo@windfisch.org> | 2015-08-18 03:24:39 +0200 |
| commit | 59fbdf0f97dcf02048507dfca2c1dc8868aef84e (patch) | |
| tree | 108fb67259944293cdee1cd6d79f2489503ea79b | |
| parent | bd7579543c44d0e41a084dc53cbdb763a84186b6 (diff) | |
follows path \o/
| -rw-r--r-- | pathfinding.py | 8 |
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] |
