class Satiete{
  
  String[] imgNames = { "s00.png", "s01.png", "s02.png", "s03.png", "s04.png", "s05.png", "s06.png", "s07.png", "s08.png","s09.png", "s10.png","s11.png" , "s12.png" };
  PImage[] animeImg = new PImage[imgNames.length];
  
  int satiety = 10;
  float start, end;
  boolean over;
  
  
  Satiete(  ) {
    
    for ( int i = 0; i < imgNames.length; i ++ ) {
    String imgName = imgNames[i];
    animeImg[i] = loadImage(imgName);
    }
    start = 0;
    end = start + 1500;
  }
  
   void display() {
     
    if ( time >= end ) {
      satiety-= 1;
      start = time;
      end = start + 1500;
    } 
    if ( satiety < 5 && satiety > 0) {
      sonSatiete.amp(0.1*(6 - satiety));
      //sonForet.amp(0.2);
      //sonAmbiance.amp(0.0);
    }
    if ( satiety >= 5 ) {
      sonSatiete.amp(0);
      //sonForet.amp(0.5);
      //sonAmbiance.amp(0.4);
    }
    if ( satiety == 0 ) {
      if ( !over ) {
      sonSatiete.stop();
      if ( !liz.dead ) {
      sonOver.play();
      }
      //sonForet.amp(0.2);
      //sonAmbiance.amp(0.2);
      liz.dead = true;
      over = true;
      }
    }
    if ( liz.dead ) {
      sonSatiete.stop();
    }
    satiety = constrain( satiety, 0, 12);
    image( animeImg[satiety], 35, height - 30);
    // animeImg[satiety].width*3, animeImg[satiety].height*3 );
   
 }
 
 void update() {
   
 }
  
}
