public int getMaximumFreeDistance(Direction dir, int length)
	{
        Rectangle rectangle = getRect();

        for(int distance = 1; distance <= length; distance++)
        {
            switch (dir)
            {
                case NO_MOVE:
                    return 0;
                case TOP:
                    rectangle.translate(0,-1);
                    break;
                case LEFT:
                    rectangle.translate(-1,0);
                    break;
                case RIGHT:
                    rectangle.translate(1,0);
                    break;
                case BOTTOM:
                    rectangle.translate(0,1);
                    break;
            }
            if(getWorld().getObjectsInRect(rectangle, Actor.class).size() > 1)
                return distance -1;
        }
        return length;


	}