Ghosts can get stuck if there is an impassable adjacent tile in their current direction #1
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
If a ghost's direction is suddenly reversed such that they're facing an impassible adjacent tile (such a case can occur when eating a power pellet), they get stuck. This is due to the path finding code requiring an empty space in front of the ghost in order to search for a valid next direction.
A simple solution would be to make use of the canMove property in MovableEntity. If it's ever false on a ghost, the ghost is trying to move in an invalid direction. In such case, we should force their currentDirection to a new, valid direction.