dynamic path change
This commit is contained in:
parent
f0cf99cabe
commit
d9611b6cd8
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user