public float moveX(float amount) {
        float newX = worldX + amount;

        if (newX > maxOffsetX) {
            float moved = maxOffsetX - worldX;
            worldX = maxOffsetX;
            return moved;
        } else if (newX < minOffsetX) {
            float moved = minOffsetX - worldX;
            worldX = minOffsetX;
            return moved;
        }

        worldX = newX;
        return amount;
    }