diff --git a/scenes/game_objects/ghost.py b/scenes/game_objects/ghost.py index 5b96f7b..fea0e62 100644 --- a/scenes/game_objects/ghost.py +++ b/scenes/game_objects/ghost.py @@ -104,6 +104,9 @@ class Ghost(Entity): graph = SceneManager().scene.entities['level'].graph cur_node = graph[self.y//S][self.x//S] children = cur_node.children + child_ok = list(filter(lambda c: c[0] == final_node, children)) + if child_ok: + return [child_ok[0]] trace = [cur_node] + [x[0] for x in children] paths = [[x] for x in children] while 1: