class page1 {
  
  String[] godNames = { "godzilla1.png" , "godzilla5.png", "godzilla2.png" , "godzilla3.png" , "godzilla4.png" };
  PImage[] animeGod= new PImage[godNames.length];
  String[] fondNames = { "godFond.png" , "godFondTexte1.png", "godFond.png", "godFondTexte2.png" };
  PImage[] animeFond= new PImage[fondNames.length];
  PImage decorGod;
  int frame, frameF;
  int countF, countL;
  float start, end, startF;
  float tempo = 100;
  float tempoo = 70;
  float tempoF = 500;
  float startIntro;
  float tempoIntro = 60000;
  boolean langueOn, titreOn, resetOn;
  
  Parrot perro;
  Pap papi;
  
  page1() {
    
    perro = new Parrot( 900, 0, 1 );
    papi = new Pap ( 720, 240 );
    perro.vitesse = 200;
    
    for ( int i = 0; i < fondNames.length; i ++ ) {
      String fondName = fondNames[i];
      animeFond[i] = loadImage(fondName);
    }
      
    for ( int i = 0; i < godNames.length; i ++ ) {
      String godName = godNames[i];
      animeGod[i] = loadImage(godName);
    }
    
    
  }
  
  
  
  
  void display() {
    if ( !resetOn ) {
      startIntro = time;
      resetOn = true;
    }
    if ( time > startIntro + tempoIntro ) {
      introOn = true;
      resetOn = false;
      page = 0;
      sonForet.stop();
      sonAmbiance.stop();
    }
    push();
    image( animeFond[frameF], 0, 0 , 960, 720);
    image ( animeGod[frame], - 48 , height - 403 );
    textAlign(CENTER, CENTER);
    textFont(fontL);
    textSize(90);
    fill(255);
    pop();
    papi.display();
    perro.display();
  }
  
  
  void update() {
    perro.update(niveau1);
    papi.update(niveau1);
    perro.mange( papi.pos , papi.hitBox, papi );
    
    if ( time > startF + tempoF ) {
      frameF++;
      startF = time;
    }
    if ( frameF > 3 ) {
      frameF = 0;
    }
    
    
    
    
    
    
    
    
    
    if ( !langueOn ) {
      if ( time > start + tempo ) {
        countF++;
        start = time;
      }
      if ( countF == 1 ) {
        frame = 1;
      }
      if ( countF >= 8 ) {
        frame = 0;
        countL++;
        countF = 0;
      }
      if ( countL == 3 ) {
        langueOn = true;
        countL = 0;
        countF = 1;
    }
    }
    if ( langueOn ) {
      if ( time > start + tempoo ) {
        countF++;
        start = time;
      }
      if ( countF == 1 ) {
        frame = 1;
      }
      if ( countF == 2 ) {
        frame = 0;
      }
      if ( countF == 3 ) {
        frame = 2;
      }
      if ( countF == 4 ) {
        frame = 3;
      }
      if ( countF == 5 ) {
        frame = 4;
      }
      if ( countF == 6 ) {
        frame = 2;
      }
      if ( countF == 7 ) {
        frame = 1;
      }
      if ( countF == 8 ) {
        frame = 1;
        langueOn = false;
        countF = 0;
      }
    }

    
  }
}
  
  
  
  
  
 
