public void update() {
        if (!stopped) {
            frameCount++;
            if (frameCount > frameDelay) {
                frameCount = 0;
                currentFrame += 1;
                if (currentFrame >= totalFrames) {
                    currentFrame = 0;
                }
            }
        }

    }