I followed the Slick 2D tutorials and am making a game. I made the animations but if I type false like Bucky did the animation is only one frame, but if i type nothing or true then the animation continues even when I'm not moving. What should I do? Here is my code:


public class Play extends BasicGameState{
    
    private SpriteSheet guySheetRight, guySheetLeft, guySheetUp, guySheetDown;
    private Animation guy, movingRight, movingLeft, movingUp, movingDown;
    
    private Sound click;
    
    boolean quit = false;
    float playerPositionX = -1538;
    float playerPositionY = -1700;
    float posX = 640;
    float posY = 360;
    int sheetpx = 64;
    
    String mouse = "No input";
    
    Image map1;
    Image data;
    
    public Play(int state){
    }
    
    public void init(GameContainer gc, StateBasedGame sbg) throws SlickException{
        map1 = new Image("res/worldmap1.png");
        
        guySheetRight = new SpriteSheet("res/canadian/right.png", sheetpx, sheetpx);
        guySheetLeft = new SpriteSheet("res/canadian/left.png", sheetpx, sheetpx);
        guySheetUp = new SpriteSheet("res/canadian/up.png", sheetpx, sheetpx);
        guySheetDown = new SpriteSheet("res/canadian/down.png", sheetpx, sheetpx);
        
        movingRight = new Animation(guySheetRight, 200);
        movingLeft = new Animation(guySheetLeft, 200);
        movingUp = new Animation(guySheetUp, 200);
        movingDown = new Animation(guySheetDown, 200);
        guy = movingDown;
        
        data = new Image("res/thing.png");
        
        click = new Sound("res/click_one.wav");
    }
    
    public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException{
        map1.draw(playerPositionX, playerPositionY);
        guy.draw(posX, posY);
        data.draw(0, 0);
        g.drawString(mouse, 10, 30);
        g.drawString("Player X:" + playerPositionX + "\nPlayer Y:" + playerPositionY, 10, 50);
        if(quit == true){
            g.drawString("Resume[R]", 640, 340);
            g.drawString("Menu[M]", 640, 360);
            g.drawString("Quit[Q]", 640, 380);
            if(quit == false){
                g.clear();
            }
        }
    }
    
    public void update(GameContainer gc, StateBasedGame sbg, int delta) throws SlickException{
        Input input = gc.getInput();
        
        movingUp.update(delta);
        movingDown.update(delta);
        movingLeft.update(delta);
        movingRight.update(delta);
        
        if(input.isKeyDown(Input.KEY_W)){guy = movingUp; playerPositionY += delta * .1f; if(playerPositionY>-15){playerPositionY -= delta * .1f;}}
        if(input.isKeyDown(Input.KEY_S)){guy = movingDown; playerPositionY -= delta * .1f; if(playerPositionY<-3672){playerPositionY += delta * .1f;}}
        if(input.isKeyDown(Input.KEY_A)){guy = movingLeft; playerPositionX += delta * .1f; if(playerPositionX>278){playerPositionX -= delta * .1f;}}
        if(input.isKeyDown(Input.KEY_D)){guy = movingRight; playerPositionX -= delta * .1f; if(playerPositionX<-3407){playerPositionX += delta * .1f;}}
        //sprint
        if(input.isKeyDown(Input.KEY_LSHIFT)){if(input.isKeyDown(Input.KEY_W)){guy = movingUp; playerPositionY += delta * .2f; if(playerPositionY>-15){playerPositionY -= delta * .2f;}}}
        if(input.isKeyDown(Input.KEY_LSHIFT)){if(input.isKeyDown(Input.KEY_S)){guy = movingDown; playerPositionY -= delta * .2f; if(playerPositionY<-3672){playerPositionY += delta * .2f;}}}
        if(input.isKeyDown(Input.KEY_LSHIFT)){if(input.isKeyDown(Input.KEY_A)){guy = movingLeft; playerPositionX += delta * .2f; if(playerPositionX>278){playerPositionX -= delta * .2f;}}}
        if(input.isKeyDown(Input.KEY_LSHIFT)){if(input.isKeyDown(Input.KEY_D)){guy = movingRight; playerPositionX -= delta * .2f; if(playerPositionX<-3407){playerPositionX += delta * .2f;}}}
        //menu
        if(input.isKeyDown(Input.KEY_ESCAPE)){
            quit = true;
        }
        
        if(quit == true){
            if(input.isKeyDown(Input.KEY_R)){quit = false;}
            if(input.isKeyDown(Input.KEY_M)){sbg.enterState(0);}
            if(input.isKeyDown(Input.KEY_Q)){System.exit(0);}
        }
        
        int mousePosX = Mouse.getX();
        int mousePosY = Mouse.getY();
        
        mouse = "X: " + mousePosX + " Y: " + mousePosY;
        
        if(gc.getInput().isMousePressed(Input.MOUSE_LEFT_BUTTON)){
            click.play();
        }
    }
    
    public int getID(){
        return 1;
    }

}