Hi i found this tutorial on sprite sheet that works great.

java - Managing sprite sheets for animation - Game Development Stack Exchange

i am not sure how can i modify it, so that it loop though onces. my though was to add if statment in update method. This way i can stop the animation, but unable to figure it out what to put in if statment. in constructor i can set 'loop' to true of fase.

the problem is that i cant hard code it to true or false. i need a test. when iam not sure of.

if(totalFrames != 4)
this.loop = true;
this.loop = false;

public void update() {
    if (!stopped) {
        if (frameCount > frameDelay) {
            frameCount = 0;
            currentFrame += animationDirection;
            if (currentFrame > totalFrames - 1) {
                currentFrame = 0; 
                   stopped = true;
            else if (currentFrame < 0) {
                currentFrame = totalFrames - 1;