refactored MapGroup.movementNearTheEdge()