Fix not stepping on final entity

This commit is contained in:
Michał Czekański 2020-04-26 16:04:47 +02:00
parent b12c969d14
commit dee9ebb77c

View File

@ -69,12 +69,8 @@ class AutomaticMovement:
if self.goalTest(elem.state): if self.goalTest(elem.state):
movesList = [] movesList = []
coordsWithUiOffset = [elem.state[0] + self.leftUiWidth, elem.state[0]] if isinstance(self.actualTarget, Entity):
if self.map.collision(coordsWithUiOffset[0], coordsWithUiOffset[1]): # If goal was some entity - omit one forward movement, because player shouldn't step on entity.
elem = elem.parent elem = elem.parent
else: # debug
a = 1
a += 1
while elem.action is not None: while elem.action is not None:
movesList.append(elem.action) movesList.append(elem.action)