diff --git a/src/Engine.py b/src/Engine.py index d57a9be..5230cb0 100644 --- a/src/Engine.py +++ b/src/Engine.py @@ -71,13 +71,17 @@ class Engine: if self.paused: return + self.predict() + if not self.state.path: if self.goals: if not self.state.graphsearch(self) and self.goals: self.objects.remove(self.goals.pop().parent) - self.predict() - else: + if not self.state.path[0].compare_pos(self.goals[-1].position): + self.state.reset() + return + # went path state = self.user.obj.changeState(self.state.path.pop()) self.clock_increment(state.cost)