If A* destination is entity - disable stepping on it
Player shouldn't step on berry or rabbit, etc...
This commit is contained in:
parent
f1e0c3c593
commit
1edaa1f74e
@ -72,6 +72,11 @@ class AutomaticMovement:
|
||||
|
||||
if self.goalTest(elem.state):
|
||||
movesList = []
|
||||
|
||||
coordsWithUiOffset = [elem.state[0] + self.leftUiWidth, elem.state[0]]
|
||||
if self.map.getEntityOnCoord(coordsWithUiOffset) is not None: # If goal was some entity - omit one forward movement, because player shouldn't step on entity.
|
||||
elem = elem.parent
|
||||
|
||||
while elem.action is not None:
|
||||
movesList.append(elem.action)
|
||||
elem = elem.parent
|
||||
|
Loading…
Reference in New Issue
Block a user