import processing.core.*; 
import processing.data.*; 
import processing.event.*; 
import processing.opengl.*; 

import ddf.minim.*; 
import ddf.minim.analysis.*; 
import ddf.minim.effects.*; 
import ddf.minim.signals.*; 
import ddf.minim.spi.*; 
import ddf.minim.ugens.*; 

import java.util.HashMap; 
import java.util.ArrayList; 
import java.io.File; 
import java.io.BufferedReader; 
import java.io.PrintWriter; 
import java.io.InputStream; 
import java.io.OutputStream; 
import java.io.IOException; 

public class shoot2forain extends PApplet {







// Libraries minim

Minim minim;
AudioPlayer background_sound;
// Variables PImage
PImage panel_prin;
PImage background;
PImage background_di;
PImage stand;
PImage perso;
PImage logo;
PImage buttonquit;
PImage buttonplay;
PImage background_level;
PImage zero_etoile;
PImage une_etoile;
PImage deux_etoile;
PImage trois_etoile;
PImage quatre_etoile;
PImage cible;
PImage plomb_img;
PImage plomb_nope;
PImage robot;
PImage minimap;
PImage fleche_hud;
PImage win_panel;
PImage bar;
PImage inventory;
PImage retry;
PImage menu_panel_shop;
PImage shopshop;
PImage panelstart;
PImage choix_boost;
PImage battlepass;
PImage shop;
PImage minage;
PImage echange;
PImage buy;
PImage buy_button;
PImage end_part;
PFont font;
AudioSnippet music;
//Variables int globales
int boite_plombs = 0;
int gemmex4 = 0;
int boostx2 = 0;
int boostx4 = 0;
int boostx6 = 0;
int x_cible_a = 1750;
int x_cible_b = 200;
int x_cible_c = 600;
int x_cible_d = 1500;
int y = 450;
int x_hud = 200;
int msg_box;
int compteur = 0;
int score = 0;
int plomb;
int ecran;
int vitesse_x =5;
int vitesse_x_b =5;
int vitesse_x_c =-5;
int vitesse_x_d =-5;
int disparition =-100;
int ticket = 0;
int gemme = 0;
int ciblett = 0;
int fcoins = 0;
int nb_click = 0;
//Variables Boolean globales
boolean fin_temps;
boolean dispo_boite_plombs = false;
boolean dispo_gemmex4 = false;
boolean dispo_boostx2 = false;
boolean dispo_boostx4 = false;
boolean dispo_boostx6 = false;
boolean peut_utiliser_gemmex4 = true;
boolean peut_utiliser_boite_plombs = true;
boolean peut_utiliser_boostx2 = true;
boolean peut_utiliser_boostx4 = true;
boolean peut_utiliser_boostx6 = true;
boolean active_gemmex4 = false;
boolean active_boite_plombs = false;
boolean active_boostx2 = false;
boolean active_boostx4 = false;
boolean active_boostx6 = false;
boolean possede_pass = false;
boolean visibile = false;  // FALSE !
boolean visibile_b = false; // FALSE !
boolean visibile_c = false; // FALSE !
boolean visibile_d = false; // FALSE !
boolean start = false;
boolean mission_01 = false;
boolean mission_02 = false;
boolean mission_03 = false;
boolean mission_04 = false;
boolean mission_05 = false;
boolean mission_06 = false;
boolean mission_07 = false;
boolean mission_08 = false;
boolean dominage = false;
boolean show_etoiles = false;
boolean serie_00 = true;
boolean serie_01 = false;
boolean serie_02 = false;
boolean serie_03 = false;
boolean serie_04 = false;

// Void setup
public void setup() {
  
  ecran = 0;
  fullScreen();
  msg_box = 0;
  minim = new Minim(this);
  // Associations des images aux variables PImage
  background_sound = minim.loadFile("background_sound.wav");
  background_sound.play();
  panelstart = loadImage("panel_start.png");
  choix_boost = loadImage("choixboost.png");
  buy = loadImage("shop_shop.png");
  buy_button = loadImage("buybutton.png");
  echange = loadImage("shop_coin.png");
  minage = loadImage("shop_minage.png");
  inventory = loadImage("inventory.png");
  retry = loadImage("retry.png");
  menu_panel_shop = loadImage("menu_panel_shop.png");
  end_part = loadImage("endpart.png");
  zero_etoile = loadImage("zero_etoiles.png");
  une_etoile = loadImage("une_etoiles.png");
  deux_etoile = loadImage("deux_etoiles.png");
  trois_etoile = loadImage("trois_etoiles.png");
  quatre_etoile = loadImage("quatre_etoiles.png");
  shopshop = loadImage("shopshop.png");
  bar = loadImage("bar.png");
  cible = loadImage("cible.png");
  win_panel = loadImage("win_panel.png");
  battlepass = loadImage("battlepass.png");
  plomb_img = loadImage("plomb.png");
  plomb_nope = loadImage("plomb_nope.png");
  robot = loadImage("robot.png");
  minimap = loadImage("minimap.png");
  fleche_hud = loadImage("fleche.png");
  font = createFont("bebasneue.ttf", 128);
  textFont(font, 128);



// Condition du BattlePass

  if (possede_pass) {
    if (ciblett <= 10) {
      boostx2 = boostx2 + 3;
    } else if ((ciblett >= 10) && (ciblett <= 20)) {
      boostx2 = boostx2 + 1;
      gemmex4 = gemmex4 + 1;
      boite_plombs = boite_plombs + 1;
    } else if ((ciblett >= 20) && (ciblett <= 30)) {
      boostx4 = boostx4 + 1;
      gemmex4 = gemmex4 + 1;
    } else if ((ciblett >= 30) && (ciblett <= 40)) {
      gemmex4 = gemmex4 + 1;
      boite_plombs = boite_plombs + 1;
    } else if ((ciblett >= 40) && (ciblett <= 50)) {
      boostx2 = boostx2 + 1;
      boite_plombs = boite_plombs + 1;
    } else if ((ciblett >= 50) && (ciblett <= 60)) {
      gemmex4 = gemmex4 + 1;
      boite_plombs = boite_plombs + 1;
    } else if ((ciblett >= 60) && (ciblett <= 70)) {
      boostx6 = boostx6 + 1;
      gemmex4 = gemmex4 + 1;
      boite_plombs = boite_plombs + 1;
    }
  }
}
// Void Draw
public void draw() {
// Conditions des menus du jeu

  if (ecran == 0) {
    MenuStart();
  } else if (ecran == 2) {
    MenuJeu();
  } else if (ecran == 1) {
    MenuLevel();
  } else if (ecran == 3) {
    Level_didacticiel();
  } else if (ecran == 4) {
    Level_01();
  } else if (ecran == 5) {
    Shop_Minage();
  } else if (ecran == 6) {
    Shop_Buy();
  } else if (ecran == 7) {
    Shop_Echange();
  } else if (ecran == 8) {
    MenuBribrac();
  } else if (ecran == 9) {
    Shop_Item();
  } else if (ecran == 10) {
    BattlePass();
  } else if (ecran == 11) {
    MenuClassement();
  } else if (ecran == 12) {
    MenuCredit();
  } else if (ecran == 13) {
    Inventaire_Item();
  } else if (ecran == 14) {
    MenuRetry();
  } else if (ecran == 15) {
    Level_02();
  } else if (ecran == 16) {
    Level_03();
  } else if (ecran == 17) {
    Level_04();
  } else if (ecran == 18) {
    Level_05();
  } else if (ecran == 19) {
    Level_06();
  } else if (ecran == 20) {
    Level_07();
  } else if (ecran == 21) {
    MenuGoShop();
  } else if (ecran == 22) {
    MenuBoost();
  } else if (ecran == 23) {
    MenuEnd();
  }

// Conditions des msg_box du didacticiel
  if (msg_box == 0) {
    msg_box_01();
  } else if (msg_box == 1) {
    msg_box_02();
  } else if (msg_box == 2) {
    msg_box_03();
  } else if (msg_box == 3) {
    msg_box_04();
  } else if (msg_box == 4) {
    msg_box_05();
  } else if (msg_box == 5) {
    msg_box_06();
  } else if (msg_box == 6) {
    msg_box_07();
  } else if (msg_box == 7) {
    msg_box_08();
  } else if (msg_box == 8) {
    msg_box_09();
  } else if (msg_box == 9) {
    msg_box_10();
  } else if (msg_box == 10) {
    msg_box_11();
  }
// Vitesse des cibles
  x_cible_a = x_cible_a + vitesse_x;
  x_cible_b = x_cible_b + vitesse_x_b;
  x_cible_c = x_cible_c + vitesse_x_c;
  x_cible_d = x_cible_d + vitesse_x_d;

// Condition du mouvement des cibles pour les missions et le didacticiel
  if ((serie_00) || (serie_01) || (serie_02) || (serie_03)) {

    // CIBLE A
    if (x_cible_a > 1750)

    {
      vitesse_x = -5;
    }

    if (x_cible_a < 460)

    {
      vitesse_x = 5;
    }
    // CIBLE B

    if (x_cible_b > 1750)

    {
      vitesse_x_b = -5;
    }

    if (x_cible_b < 460)

    {
      vitesse_x_b = 5;
    }

    // CIBLE D

    if (x_cible_c > 1750)

    {
      vitesse_x_c = -5;
    }

    if (x_cible_c < 460)

    {
      vitesse_x_c = 5;
    }

    // CIBLE D

    if (x_cible_d > 1750)

    {
      vitesse_x_d = -5;
    }

    if (x_cible_d < 460)

    {
      vitesse_x_d = 5;
    }
  }

  if (serie_04) {

    // CIBLE A
    if (x_cible_a > 1750)

    {
      vitesse_x = -15;
    }

    if (x_cible_a < 460)

    {
      vitesse_x = 15;
    }
    // CIBLE B

    if (x_cible_b > 1750)

    {
      vitesse_x_b = -15;
    }

    if (x_cible_b < 460)

    {
      vitesse_x_b = 15;
    }

    // CIBLE D

    if (x_cible_c > 1750)

    {
      vitesse_x_c = -15;
    }

    if (x_cible_c < 460)

    {
      vitesse_x_c = 15;
    }
  }





  // DEV MOD
//  textSize(20);
//  fill(255, 255, 255);
//  text(mouseX, 10, 20);
//  text(mouseY, 50, 20);

//  // Choix du message à afficher selon la position
//  if ((mouseX < width/2) && (mouseY < height/2))
//  {
//    text("en haut à gauche", 10, 40);
//  }
//  if ((mouseX > width/2) && (mouseY < height/2))
//  {
//    text("en haut à droite", 10, 40);
//  }
//  if ((mouseX < width/2) && (mouseY > height/2))
//  {
//    text("en bas à gauche", 10, 40);
//  }
//  if ((mouseX > width/2) && (mouseY > height/2))
//  {
//    text("en bas à droite", 10, 40);
//  }
}

public void BattlePass() {

// Panel battlepass

  background = loadImage("background.png");
  image(background, 0, 0);
  image(battlepass, 0, 0);
  textSize(50);
  text(ticket, 163, 75);
  text(gemme, 645, 75);
  text(ciblett, 1028, 75);
  text(fcoins, 1418, 75);

// Boolean pour savoir si il a le battlepass
  if (!possede_pass) {
    image(buy_button, 0, 0);
  }

}
public void keyPressed()

// Pressez "R" pour recommencer pendant les levels

{
  if (mission_01) {
    if ( key == 'r' ) {
      mission_01 = false;
      visibile = false;
      visibile_b = false;
      visibile_c = false;
      visibile_d = false;
      serie_02 = false;
      serie_03 = false;
      serie_04 = false;
      serie_01 = false;
      msg_box = 0 ;
      plomb = 10;
      score = 0;
      compteur = 0;
    }
  }

  if (mission_02) {
    if ( key == 'r' ) {
      mission_02 = false;
      visibile = true;
      visibile_b = false;
      visibile_c = false;
      visibile_d = false;
      plomb = 10;
      score = 0;
      compteur = 0;
    }
  }

  if (mission_03) {
    if ( key == 'r' ) {
      mission_03 = false;
      visibile = true;
      visibile_b = false;
      visibile_c = false;
      visibile_d = false;
      plomb = 10;
      score = 0;
      compteur = 0;
    }
  }

  if (mission_04) {
    if ( key == 'r' ) {
      mission_04 = false;
      visibile = true;
      visibile_b = false;
      visibile_c = false;
      visibile_d = false;
      plomb = 10;
      score = 0;
      compteur = 0;
    }
  }

  if (mission_05) {
    if ( key == 'r' ) {
      mission_05 = false;
      visibile = true;
      visibile_b = false;
      visibile_c = false;
      visibile_d = false;
      plomb = 10;
      score = 0;
      compteur = 0;
    }
  }

  if (mission_06) {
    if ( key == 'r' ) {
      mission_06 = false;
      visibile = true;
      visibile_b = false;
      visibile_c = false;
      visibile_d = false;
      plomb = 10;
      score = 0;
      compteur = 0;
    }
  }

  if (mission_07) {
    if ( key == 'r' ) {
      mission_03 = false;
      visibile = true;
      visibile_b = false;
      visibile_c = false;
      visibile_d = false;
      plomb = 10;
      score = 0;
      compteur = 0;
    }
  }

  if (mission_08) {
    if ( key == 'r' ) {
      mission_03 = false;
      visibile = true;
      visibile_b = false;
      visibile_c = false;
      visibile_d = false;
      plomb = 10;
      score = 0;
      compteur = 0;
    }
  }
}

// Tous les levels sauf le didacticiel
public void Level_01() {
  stand = loadImage("stand3.png");
  image(stand, 0, 0);
  mission_02 = true;



  stroke(0, 0, 0);
  image(cible, x_hud, 950, 60, 60);
  font = createFont("bebasneue.ttf", 128);
  textFont(font, 128);
  image(minimap, 1655, 1000, 60, 60);
  textSize(50);
  fill(0, 0, 0);
  text ("Cible:"+compteur+"/14", 20, 1000);
  text ("Score:"+score, 20, 1050);
  text ("level1", 1720, 1050);


// Gestion des munitions
  if (plomb >= 1) {
    textSize(50);
    text ("Plombs:"+plomb, 20, 950);
    image(plomb_img, 200, 900, 60, 50);
  } else {
    textSize(50);
    fill(255, 255, 255);
    text("Plus de plombs", 20, 950);
    image(plomb_nope, 275, 900, 60, 50);
    ecran = 14;
  }

  if (compteur > 9) {
    x_hud = 220;
  }



  if (mission_02) {

    if (compteur == 1) {
      visibile = false;
      visibile_b = true;
      visibile_c = true;
    } else if (compteur == 3) {
      visibile = true;
      visibile_b = false;
      visibile_c = false;
      visibile_d = true;
    } else if (compteur == 5) {
      visibile = false;
      visibile_b = true;
      visibile_c = true;
      visibile_d = false;
    } else if (compteur == 7) {
      visibile = true;
      visibile_b = true;
      visibile_c = true;
      visibile_d = false;
      vitesse_x =15;
      vitesse_x_b =15;
      vitesse_x_c =-15;
      vitesse_x_d =-15;
    } else if (compteur == 10) {
      visibile = true;
      visibile_b = true;
      visibile_c = true;
      visibile_d = true;
    } else if (compteur == 14) {
      if (active_boostx2) {
        score = score*2;
      }

      if (active_boostx4) {
        score = score*4;
      }

      if (active_boostx4) {
        score = score*4;
      }

      ecran = 23;
    }
  }







  if (mission_02) {
    if (visibile) {
      image(cible, x_cible_a, y, 100, 100);
      if (mousePressed == true) {

        if (mouseButton == LEFT) {
          //  tir.trigger();
          // Bouton bleu
          if (dist(x_cible_a+50, y+50, mouseX, mouseY) < 50)
          {
            visibile = false;
            compteur = compteur +1;
            score = score + 600;
          }
        }
      }
    }



    if (visibile_b) {
      image(cible, x_cible_b, y, 100, 100);

      if (mousePressed == true) {
        if (mouseButton == LEFT) {
          //  tir.trigger();
          // Bouton bleu
          if (dist(x_cible_b+50, y+50, mouseX, mouseY) < 50)
          {
            visibile_b = false;
            compteur = compteur +1;
            score = score + 600;
          }
        }
      }
    }

    if (visibile_c) {
      image(cible, x_cible_c, y, 100, 100);

      if (mousePressed == true) {
        if (mouseButton == LEFT) {
          //  tir.trigger();
          // Bouton bleu
          if (dist(x_cible_c+50, y+50, mouseX, mouseY) < 50)
          {
            visibile_c = false;
            compteur = compteur +1;
            score = score + 600;
          }
        }
      }
    }

    if (visibile_d) {
      image(cible, x_cible_d, y, 100, 100);

      if (mousePressed == true) {
        if (mouseButton == LEFT) {
          //  tir.trigger();
          // Bouton bleu
          if (dist(x_cible_d+50, y+50, mouseX, mouseY) < 50)
          {
            visibile_d = false;
            compteur = compteur +1;
            score = score + 1000;
          }
        }
      }
    }
  }
}

public void Level_02() {
  stand = loadImage("stand3.png");
  image(stand, 0, 0);
  mission_03 = true;



  stroke(0, 0, 0);
  image(cible, x_hud, 950, 60, 60);
  font = createFont("bebasneue.ttf", 128);
  textFont(font, 128);
  image(minimap, 1655, 1000, 60, 60);
  textSize(50);
  fill(0, 0, 0);
  text ("Cible:"+compteur+"/14", 20, 1000);
  text ("Score:"+score, 20, 1050);
  text ("level2", 1720, 1050);

  if (plomb >= 1) {
    textSize(50);
    text ("Plombs:"+plomb, 20, 950);
    image(plomb_img, 200, 900, 60, 50);
  } else {
    textSize(50);
    fill(255, 255, 255);
    text("Plus de plombs", 20, 950);
    image(plomb_nope, 275, 900, 60, 50);
    ecran = 14;
  }

  if (compteur > 9) {
    x_hud = 220;
  }





  if (mission_03) {

    if (compteur == 1) {
      visibile = false;
      visibile_b = true;
      visibile_c = true;
    } else if (compteur == 3) {
      visibile = true;
      visibile_b = false;
      visibile_c = false;
      visibile_d = true;
    } else if (compteur == 5) {
      visibile = false;
      visibile_b = true;
      visibile_c = true;
      visibile_d = false;
    } else if (compteur == 7) {
      visibile = true;
      visibile_b = true;
      visibile_c = true;
      visibile_d = false;
      vitesse_x =15;
      vitesse_x_b =15;
      vitesse_x_c =-15;
      vitesse_x_d =-15;
    } else if (compteur == 10) {
      visibile = true;
      visibile_b = true;
      visibile_c = true;
      visibile_d = true;
    } else if (compteur == 14) {
      ecran = 23;
    }
  }






  if (mission_03) {
    if (visibile) {
      image(cible, x_cible_a, y, 100, 100);
      if (mousePressed == true) {

        if (mouseButton == LEFT) {
          //  tir.trigger();
          // Bouton bleu
          if (dist(x_cible_a+50, y+50, mouseX, mouseY) < 50)
          {
            visibile = false;
            compteur = compteur +1;
            score = score + 600;
          }
        }
      }
    }



    if (visibile_b) {
      image(cible, x_cible_b, y, 100, 100);

      if (mousePressed == true) {
        if (mouseButton == LEFT) {
          //  tir.trigger();
          // Bouton bleu
          if (dist(x_cible_b+50, y+50, mouseX, mouseY) < 50)
          {
            visibile_b = false;
            compteur = compteur +1;
            score = score + 600;
          }
        }
      }
    }

    if (visibile_c) {
      image(cible, x_cible_c, y, 100, 100);

      if (mousePressed == true) {
        if (mouseButton == LEFT) {
          //  tir.trigger();
          // Bouton bleu
          if (dist(x_cible_c+50, y+50, mouseX, mouseY) < 50)
          {
            visibile_c = false;
            compteur = compteur +1;
            score = score + 600;
          }
        }
      }
    }

    if (visibile_d) {
      image(cible, x_cible_d, y, 100, 100);

      if (mousePressed == true) {
        if (mouseButton == LEFT) {
          //  tir.trigger();
          // Bouton bleu
          if (dist(x_cible_d+50, y+50, mouseX, mouseY) < 50)
          {
            visibile_d = false;
            compteur = compteur +1;
            score = score + 1000;
          }
        }
      }
    }
  }
}

public void Level_03() {
  stand = loadImage("stand3.png");
  image(stand, 0, 0);
  mission_04 = true;



  stroke(0, 0, 0);
  image(cible, x_hud, 950, 60, 60);
  font = createFont("bebasneue.ttf", 128);
  textFont(font, 128);
  image(minimap, 1655, 1000, 60, 60);
  textSize(50);
  fill(0, 0, 0);
  text ("Cible:"+compteur+"/14", 20, 1000);
  text ("Score:"+score, 20, 1050);
  text ("level3", 1720, 1050);

  if (plomb >= 1) {
    textSize(50);
    text ("Plombs:"+plomb, 20, 950);
    image(plomb_img, 200, 900, 60, 50);
  } else {
    textSize(50);
    fill(255, 255, 255);
    text("Plus de plombs", 20, 950);
    image(plomb_nope, 275, 900, 60, 50);
    ecran = 14;
  }

  if (compteur > 9) {
    x_hud = 220;
  }





  if (mission_04) {

    if (compteur == 1) {
      visibile = false;
      visibile_b = true;
      visibile_c = true;
    } else if (compteur == 3) {
      visibile = true;
      visibile_b = false;
      visibile_c = false;
      visibile_d = true;
    } else if (compteur == 5) {
      visibile = false;
      visibile_b = true;
      visibile_c = true;
      visibile_d = false;
    } else if (compteur == 7) {
      visibile = true;
      visibile_b = true;
      visibile_c = true;
      visibile_d = false;
      vitesse_x =15;
      vitesse_x_b =15;
      vitesse_x_c =-15;
      vitesse_x_d =-15;
    } else if (compteur == 10) {
      visibile = true;
      visibile_b = true;
      visibile_c = true;
      visibile_d = true;
    } else if (compteur == 14) {
      ecran = 23;
    }
  }






  if (mission_04) {
    if (visibile) {
      image(cible, x_cible_a, y, 100, 100);
      if (mousePressed == true) {

        if (mouseButton == LEFT) {
          //  tir.trigger();
          // Bouton bleu
          if (dist(x_cible_a+50, y+50, mouseX, mouseY) < 50)
          {
            visibile = false;
            compteur = compteur +1;
            score = score + 600;
          }
        }
      }
    }



    if (visibile_b) {
      image(cible, x_cible_b, y, 100, 100);

      if (mousePressed == true) {
        if (mouseButton == LEFT) {
          //  tir.trigger();
          // Bouton bleu
          if (dist(x_cible_b+50, y+50, mouseX, mouseY) < 50)
          {
            visibile_b = false;
            compteur = compteur +1;
            score = score + 600;
          }
        }
      }
    }

    if (visibile_c) {
      image(cible, x_cible_c, y, 100, 100);

      if (mousePressed == true) {
        if (mouseButton == LEFT) {
          //  tir.trigger();
          // Bouton bleu
          if (dist(x_cible_c+50, y+50, mouseX, mouseY) < 50)
          {
            visibile_c = false;
            compteur = compteur +1;
            score = score + 600;
          }
        }
      }
    }

    if (visibile_d) {
      image(cible, x_cible_d, y, 100, 100);

      if (mousePressed == true) {
        if (mouseButton == LEFT) {
          //  tir.trigger();
          // Bouton bleu
          if (dist(x_cible_d+50, y+50, mouseX, mouseY) < 50)
          {
            visibile_d = false;
            compteur = compteur +1;
            score = score + 1000;
          }
        }
      }
    }
  }
}

public void Level_04() {
  stand = loadImage("stand3.png");
  image(stand, 0, 0);
  mission_05 = true;



  stroke(0, 0, 0);
  image(cible, x_hud, 950, 60, 60);
  font = createFont("bebasneue.ttf", 128);
  textFont(font, 128);
  image(minimap, 1655, 1000, 60, 60);
  textSize(50);
  fill(0, 0, 0);
  text ("Cible:"+compteur+"/14", 20, 1000);
  text ("Score:"+score, 20, 1050);
  text ("level4", 1720, 1050);

  if (plomb >= 1) {
    textSize(50);
    text ("Plombs:"+plomb, 20, 950);
    image(plomb_img, 200, 900, 60, 50);
  } else {
    textSize(50);
    fill(255, 255, 255);
    text("Plus de plombs", 20, 950);
    image(plomb_nope, 275, 900, 60, 50);
    ecran = 14;
  }

  if (compteur > 9) {
    x_hud = 220;
  }





  if (mission_05) {

    if (compteur == 1) {
      visibile = false;
      visibile_b = true;
      visibile_c = true;
    } else if (compteur == 3) {
      visibile = true;
      visibile_b = false;
      visibile_c = false;
      visibile_d = true;
    } else if (compteur == 5) {
      visibile = false;
      visibile_b = true;
      visibile_c = true;
      visibile_d = false;
    } else if (compteur == 7) {
      visibile = true;
      visibile_b = true;
      visibile_c = true;
      visibile_d = false;
      vitesse_x =15;
      vitesse_x_b =15;
      vitesse_x_c =-15;
      vitesse_x_d =-15;
    } else if (compteur == 10) {
      visibile = true;
      visibile_b = true;
      visibile_c = true;
      visibile_d = true;
    } else if (compteur == 14) {
      ecran = 23;
    }
  }






  if (mission_05) {
    if (visibile) {
      image(cible, x_cible_a, y, 100, 100);
      if (mousePressed == true) {

        if (mouseButton == LEFT) {
          //  tir.trigger();
          // Bouton bleu
          if (dist(x_cible_a+50, y+50, mouseX, mouseY) < 50)
          {
            visibile = false;
            compteur = compteur +1;
            score = score + 600;
          }
        }
      }
    }



    if (visibile_b) {
      image(cible, x_cible_b, y, 100, 100);

      if (mousePressed == true) {
        if (mouseButton == LEFT) {
          //  tir.trigger();
          // Bouton bleu
          if (dist(x_cible_b+50, y+50, mouseX, mouseY) < 50)
          {
            visibile_b = false;
            compteur = compteur +1;
            score = score + 600;
          }
        }
      }
    }

    if (visibile_c) {
      image(cible, x_cible_c, y, 100, 100);

      if (mousePressed == true) {
        if (mouseButton == LEFT) {
          //  tir.trigger();
          // Bouton bleu
          if (dist(x_cible_c+50, y+50, mouseX, mouseY) < 50)
          {
            visibile_c = false;
            compteur = compteur +1;
            score = score + 600;
          }
        }
      }
    }

    if (visibile_d) {
      image(cible, x_cible_d, y, 100, 100);

      if (mousePressed == true) {
        if (mouseButton == LEFT) {
          //  tir.trigger();
          // Bouton bleu
          if (dist(x_cible_d+50, y+50, mouseX, mouseY) < 50)
          {
            visibile_d = false;
            compteur = compteur +1;
            score = score + 1000;
          }
        }
      }
    }
  }
}

public void Level_05() {
  stand = loadImage("stand3.png");
  image(stand, 0, 0);
  mission_06 = true;



  stroke(0, 0, 0);
  image(cible, x_hud, 950, 60, 60);
  font = createFont("bebasneue.ttf", 128);
  textFont(font, 128);
  image(minimap, 1655, 1000, 60, 60);
  textSize(50);
  fill(0, 0, 0);
  text ("Cible:"+compteur+"/14", 20, 1000);
  text ("Score:"+score, 20, 1050);
  text ("level5", 1720, 1050);

  if (plomb >= 1) {
    textSize(50);
    text ("Plombs:"+plomb, 20, 950);
    image(plomb_img, 200, 900, 60, 50);
  } else {
    textSize(50);
    fill(255, 255, 255);
    text("Plus de plombs", 20, 950);
    image(plomb_nope, 275, 900, 60, 50);
    ecran = 14;
  }

  if (compteur > 9) {
    x_hud = 220;
  }





  if (mission_06) {

    if (compteur == 1) {
      visibile = false;
      visibile_b = true;
      visibile_c = true;
    } else if (compteur == 3) {
      visibile = true;
      visibile_b = false;
      visibile_c = false;
      visibile_d = true;
    } else if (compteur == 5) {
      visibile = false;
      visibile_b = true;
      visibile_c = true;
      visibile_d = false;
    } else if (compteur == 7) {
      visibile = true;
      visibile_b = true;
      visibile_c = true;
      visibile_d = false;
      vitesse_x =15;
      vitesse_x_b =15;
      vitesse_x_c =-15;
      vitesse_x_d =-15;
    } else if (compteur == 10) {
      visibile = true;
      visibile_b = true;
      visibile_c = true;
      visibile_d = true;
    } else if (compteur == 14) {
      ecran = 23;
    }
  }






  if (mission_06) {
    if (visibile) {
      image(cible, x_cible_a, y, 100, 100);
      if (mousePressed == true) {

        if (mouseButton == LEFT) {
          //  tir.trigger();
          // Bouton bleu
          if (dist(x_cible_a+50, y+50, mouseX, mouseY) < 50)
          {
            visibile = false;
            compteur = compteur +1;
            score = score + 600;
          }
        }
      }
    }



    if (visibile_b) {
      image(cible, x_cible_b, y, 100, 100);

      if (mousePressed == true) {
        if (mouseButton == LEFT) {
          //  tir.trigger();
          // Bouton bleu
          if (dist(x_cible_b+50, y+50, mouseX, mouseY) < 50)
          {
            visibile_b = false;
            compteur = compteur +1;
            score = score + 600;
          }
        }
      }
    }

    if (visibile_c) {
      image(cible, x_cible_c, y, 100, 100);

      if (mousePressed == true) {
        if (mouseButton == LEFT) {
          //  tir.trigger();
          // Bouton bleu
          if (dist(x_cible_c+50, y+50, mouseX, mouseY) < 50)
          {
            visibile_c = false;
            compteur = compteur +1;
            score = score + 600;
          }
        }
      }
    }

    if (visibile_d) {
      image(cible, x_cible_d, y, 100, 100);

      if (mousePressed == true) {
        if (mouseButton == LEFT) {
          //  tir.trigger();
          // Bouton bleu
          if (dist(x_cible_d+50, y+50, mouseX, mouseY) < 50)
          {
            visibile_d = false;
            compteur = compteur +1;
            score = score + 1000;
          }
        }
      }
    }
  }
}

public void Level_06() {
  stand = loadImage("stand3.png");
  image(stand, 0, 0);
  mission_07 = true;



  stroke(0, 0, 0);
  image(cible, x_hud, 950, 60, 60);
  font = createFont("bebasneue.ttf", 128);
  textFont(font, 128);
  image(minimap, 1655, 1000, 60, 60);
  textSize(50);
  fill(0, 0, 0);
  text ("Cible:"+compteur+"/14", 20, 1000);
  text ("Score:"+score, 20, 1050);
  text ("level6", 1720, 1050);

  if (plomb >= 1) {
    textSize(50);
    text ("Plombs:"+plomb, 20, 950);
    image(plomb_img, 200, 900, 60, 50);
  } else {
    textSize(50);
    fill(255, 255, 255);
    text("Plus de plombs", 20, 950);
    image(plomb_nope, 275, 900, 60, 50);
    ecran = 14;
  }

  if (compteur > 9) {
    x_hud = 220;
  }





  if (mission_07) {

    if (compteur == 1) {
      visibile = false;
      visibile_b = true;
      visibile_c = true;
    } else if (compteur == 3) {
      visibile = true;
      visibile_b = false;
      visibile_c = false;
      visibile_d = true;
    } else if (compteur == 5) {
      visibile = false;
      visibile_b = true;
      visibile_c = true;
      visibile_d = false;
    } else if (compteur == 7) {
      visibile = true;
      visibile_b = true;
      visibile_c = true;
      visibile_d = false;
      vitesse_x =15;
      vitesse_x_b =15;
      vitesse_x_c =-15;
      vitesse_x_d =-15;
    } else if (compteur == 10) {
      visibile = true;
      visibile_b = true;
      visibile_c = true;
      visibile_d = true;
    } else if (compteur == 14) {
      ecran = 23;
    }
  }






  if (mission_07) {
    if (visibile) {
      image(cible, x_cible_a, y, 100, 100);
      if (mousePressed == true) {

        if (mouseButton == LEFT) {
          //  tir.trigger();
          // Bouton bleu
          if (dist(x_cible_a+50, y+50, mouseX, mouseY) < 50)
          {
            visibile = false;
            compteur = compteur +1;
            score = score + 600;
          }
        }
      }
    }



    if (visibile_b) {
      image(cible, x_cible_b, y, 100, 100);

      if (mousePressed == true) {
        if (mouseButton == LEFT) {
          //  tir.trigger();
          // Bouton bleu
          if (dist(x_cible_b+50, y+50, mouseX, mouseY) < 50)
          {
            visibile_b = false;
            compteur = compteur +1;
            score = score + 600;
          }
        }
      }
    }

    if (visibile_c) {
      image(cible, x_cible_c, y, 100, 100);

      if (mousePressed == true) {
        if (mouseButton == LEFT) {
          //  tir.trigger();
          // Bouton bleu
          if (dist(x_cible_c+50, y+50, mouseX, mouseY) < 50)
          {
            visibile_c = false;
            compteur = compteur +1;
            score = score + 600;
          }
        }
      }
    }

    if (visibile_d) {
      image(cible, x_cible_d, y, 100, 100);

      if (mousePressed == true) {
        if (mouseButton == LEFT) {
          //  tir.trigger();
          // Bouton bleu
          if (dist(x_cible_d+50, y+50, mouseX, mouseY) < 50)
          {
            visibile_d = false;
            compteur = compteur +1;
            score = score + 1000;
          }
        }
      }
    }
  }
}

public void Level_07() {
  stand = loadImage("stand3.png");
  image(stand, 0, 0);
  mission_08 = true;



  stroke(0, 0, 0);
  image(cible, x_hud, 950, 60, 60);
  font = createFont("bebasneue.ttf", 128);
  textFont(font, 128);
  image(minimap, 1655, 1000, 60, 60);
  textSize(50);
  fill(0, 0, 0);
  text ("Cible:"+compteur+"/14", 20, 1000);
  text ("Score:"+score, 20, 1050);
  text ("level7", 1720, 1050);

  if (plomb >= 1) {
    textSize(50);
    text ("Plombs:"+plomb, 20, 950);
    image(plomb_img, 200, 900, 60, 50);
  } else {
    textSize(50);
    fill(255, 255, 255);
    text("Plus de plombs", 20, 950);
    image(plomb_nope, 275, 900, 60, 50);
    ecran = 14;
  }

  if (compteur > 9) {
    x_hud = 220;
  }





  if (mission_08) {

    if (compteur == 1) {
      visibile = false;
      visibile_b = true;
      visibile_c = true;
    } else if (compteur == 3) {
      visibile = true;
      visibile_b = false;
      visibile_c = false;
      visibile_d = true;
    } else if (compteur == 5) {
      visibile = false;
      visibile_b = true;
      visibile_c = true;
      visibile_d = false;
    } else if (compteur == 7) {
      visibile = true;
      visibile_b = true;
      visibile_c = true;
      visibile_d = false;
      vitesse_x =15;
      vitesse_x_b =15;
      vitesse_x_c =-15;
      vitesse_x_d =-15;
    } else if (compteur == 10) {
      visibile = true;
      visibile_b = true;
      visibile_c = true;
      visibile_d = true;
    } else if (compteur == 14) {
      ecran = 23;
    }
  }






  if (mission_08) {
    if (visibile) {
      image(cible, x_cible_a, y, 100, 100);
      if (mousePressed == true) {

        if (mouseButton == LEFT) {
          //  tir.trigger();
          // Bouton bleu
          if (dist(x_cible_a+50, y+50, mouseX, mouseY) < 50)
          {
            visibile = false;
            compteur = compteur +1;
            score = score + 600;
          }
        }
      }
    }



    if (visibile_b) {
      image(cible, x_cible_b, y, 100, 100);

      if (mousePressed == true) {
        if (mouseButton == LEFT) {
          //  tir.trigger();
          // Bouton bleu
          if (dist(x_cible_b+50, y+50, mouseX, mouseY) < 50)
          {
            visibile_b = false;
            compteur = compteur +1;
            score = score + 600;
          }
        }
      }
    }

    if (visibile_c) {
      image(cible, x_cible_c, y, 100, 100);

      if (mousePressed == true) {
        if (mouseButton == LEFT) {
          //  tir.trigger();
          // Bouton bleu
          if (dist(x_cible_c+50, y+50, mouseX, mouseY) < 50)
          {
            visibile_c = false;
            compteur = compteur +1;
            score = score + 600;
          }
        }
      }
    }

    if (visibile_d) {
      image(cible, x_cible_d, y, 100, 100);

      if (mousePressed == true) {
        if (mouseButton == LEFT) {
          //  tir.trigger();
          // Bouton bleu
          if (dist(x_cible_d+50, y+50, mouseX, mouseY) < 50)
          {
            visibile_d = false;
            compteur = compteur +1;
            score = score + 1000;
          }
        }
      }
    }
  }
}

public void Level_didacticiel() {
  background_di = loadImage("background_di.png");

  image(background_di, 0, 0);
  mission_01 = true;
  stroke(0, 0, 0);
  image(cible, x_hud, 950, 60, 60);
  font = createFont("bebasneue.ttf", 128);
  textFont(font, 128);
  image(minimap, 1655, 1000, 60, 60);
  textSize(50);
  fill(255, 255, 255);
  text ("Cible:"+compteur+"/10", 20, 1000);
  text ("Score:"+score, 20, 1050);
  text ("Didacticiel", 1720, 1050);

  if (plomb >= 1) {
    textSize(50);
    text ("Plombs:"+plomb, 20, 950);
    image(plomb_img, 200, 900, 60, 50);
  } else {
    textSize(50);
    fill(255, 255, 255);
    text("Plus de plombs", 20, 950);
    image(plomb_nope, 275, 900, 60, 50);
    ecran = 14;
  }

  if (compteur > 9) {
    x_hud = 220;
  }






  if (mission_01) {

    if (serie_01) {
      if (mousePressed == true) {
        if (mouseButton == LEFT) {
          if (dist(x_cible_a+50, y+50, mouseX, mouseY) < 50)
          {
            msg_box = 3;
          }
        }
      }
    }

    if (serie_02) {
      if (mousePressed == true) {
        if (mouseButton == LEFT) {
          if (dist(x_cible_a+50, y+50, mouseX, mouseY) < 50)

          {
            msg_box = 5;
          }
        }
      }
    }

    if (serie_03) {
      if (mousePressed == true) {
        if (mouseButton == LEFT) {
          if (dist(x_cible_a+50, y+50, mouseX, mouseY) < 50)
            //     if (dist(x_cible_b, y, mouseX, mouseY) < 75)
          {
            msg_box = 7;
          }
        }
      }
    }

    if (serie_04) {
      if (mousePressed == true) {
        if (mouseButton == LEFT) {
          if (dist(x_cible_a+50, y+50, mouseX, mouseY) < 50)
            //     if (dist(x_cible_b, y, mouseX, mouseY) < 75)
          {
            msg_box = 9;
          }
        }
      }
    }
  }

  if (mission_01) {
    if (visibile) {
      image(cible, x_cible_a, y, 100, 100);
      if (mousePressed == true) {

        if (mouseButton == LEFT) {
          //  tir.trigger();
          // Bouton bleu
          if (dist(x_cible_a+50, y+50, mouseX, mouseY) < 50)
          {
            visibile = false;
            start = true;
            compteur = compteur +1;
            score = score + 600;
          }
        }
      }
    }



    if (visibile_b) {
      image(cible, x_cible_b, y, 100, 100);

      if (mousePressed == true) {
        if (mouseButton == LEFT) {
          //  tir.trigger();
          // Bouton bleu
          if (dist(x_cible_b+50, y+50, mouseX, mouseY) < 50)
          {
            visibile_b = false;
            compteur = compteur +1;
            score = score + 1000;
          }
        }
      }
    }

    if (visibile_c) {
      image(cible, x_cible_c, y, 100, 100);

      if (mousePressed == true) {
        if (mouseButton == LEFT) {
          //  tir.trigger();
          // Bouton bleu
          if (dist(x_cible_c+50, y+50, mouseX, mouseY) < 50)
          {
            visibile_c = false;
            compteur = compteur +1;
            score = score + 1000;
          }
        }
      }
    }

    if (visibile_d) {
      image(cible, x_cible_d, y, 100, 100);

      if (mousePressed == true) {
        if (mouseButton == LEFT) {
          //  tir.trigger();
          // Bouton bleu
          if (dist(x_cible_d+50, y+50, mouseX, mouseY) < 50)
          {
            visibile_d = false;
            compteur = compteur +1;
            score = score + 1000;
          }
        }
      }
    }
  }
}

// Tous les menus de navigation du jeu

public void MenuEnd() {
  if (mission_01) {
    image(end_part, 0, 0);
    textSize(50);
    fill(255, 255, 255);
    text ("Cible:"+compteur+"/10", 567, 390);
    text ("+2", 575, 550);
    peut_utiliser_gemmex4 = true;
    if (active_boostx2) {
      text ("Score:"+score*2, 880, 670);
    }

    if (active_boostx4) {
      text ("Score:"+score*4, 880, 670);
    }

    if (active_boostx6) {
      text ("Score:"+score*6, 880, 670);
    }
  }

  if (mission_02) {
    image(end_part, 0, 0);
    textSize(50);
    fill(255, 255, 255);
    text ("Cible:"+compteur+"/14", 567, 390);
    text ("+2", 575, 550);
    text ("Score:"+score, 880, 670);
    peut_utiliser_gemmex4 = true;
  }

  if (mission_03) {
    image(end_part, 0, 0);
    textSize(50);
    fill(255, 255, 255);
    text ("Cible:"+compteur+"/14", 567, 390);
    text ("+2", 575, 550);
    text ("Score:"+score, 880, 670);
    peut_utiliser_gemmex4 = true;
  }

  if (mission_04) {
    image(end_part, 0, 0);
    textSize(50);
    fill(255, 255, 255);
    text ("Cible:"+compteur+"/14", 567, 390);
    text ("+2", 575, 550);
    text ("Score:"+score, 880, 670);
    peut_utiliser_gemmex4 = true;
  }

  if (mission_05) {
    image(end_part, 0, 0);
    textSize(50);
    fill(255, 255, 255);
    text ("Cible:"+compteur+"/14", 567, 390);
    text ("+2", 575, 550);
    text ("Score:"+score, 880, 670);
    peut_utiliser_gemmex4 = true;
  }

  if (mission_06) {
    image(end_part, 0, 0);
    textSize(50);
    fill(255, 255, 255);
    text ("Cible:"+compteur+"/14", 567, 390);
    text ("+2", 575, 550);
    text ("Score:"+score, 880, 670);
    peut_utiliser_gemmex4 = true;
  }

  if (mission_07) {
    image(end_part, 0, 0);
    textSize(50);
    fill(255, 255, 255);
    text ("Cible:"+compteur+"/14", 567, 390);
    text ("+2", 575, 550);
    text ("Score:"+score, 880, 670);
    peut_utiliser_gemmex4 = true;
  }

  if (mission_08) {
    image(end_part, 0, 0);
    textSize(50);
    fill(255, 255, 255);
    text ("Cible:"+compteur+"/14", 567, 390);
    text ("+2", 575, 550);
    text ("Score:"+score, 880, 670);
    peut_utiliser_gemmex4 = true;
  }
}

public void MenuBoost() {

  background = loadImage("background.png");
  background(0, 0, 0, 0);
  image(choix_boost, 0, 0);

  textSize(50);
  text(boostx2, 878, 685); // 1300, 685
  text(+boostx4, 1090, 685);
  text(+boostx6, 1300, 685); // 878, 685
  text(boite_plombs, 670, 685);
  text(gemmex4, 460, 685);


  if (boostx2 == 0) {
    dispo_boostx2 = false;
    fill(255, 00, 00, 130);
    //  rect(447,500,190,190);
    //  rect(655,500,190,190);
    //  rect(865,500,190,190);
    //  rect(1074,500,190,190);
    rect(865, 500, 190, 190); //
  } else if (boostx2 >= 1) {
    dispo_boostx2 = true;
    fill(00, 00, 00, 00);
    //  rect(447,500,190,190);
    //  rect(655,500,190,190);
    //  rect(865,500,190,190);
    //  rect(1074,500,190,190);
    rect(865, 500, 190, 190);
  }

  if (boostx4 == 0) {
    dispo_boostx4 = false;
    fill(255, 00, 00, 130);
    rect(1074, 500, 190, 190);
  } else if (boostx4 >= 1) {
    dispo_boostx4 = true;
    fill(00, 00, 00, 00);
    rect(1074, 500, 190, 190);
  }

  if (boostx6 == 0) {
    dispo_boostx6 = false;
    fill(255, 00, 00, 130);
    rect(1283, 500, 190, 190); //
  } else if (boostx6 >= 1) {
    dispo_boostx6 = true;
    fill(00, 00, 00, 00);
    rect(1283, 500, 190, 190);
  }

  if (gemmex4 == 0) {
    dispo_gemmex4 = false;
    fill(255, 00, 00, 130);
    rect(447, 500, 190, 190);
  } else if (gemmex4 >= 1) {
    dispo_gemmex4 = true;
    fill(00, 00, 00, 00);
    rect(447, 500, 190, 190);
  }



  if (boite_plombs == 0) {
    dispo_boite_plombs = false;
    fill(255, 00, 00, 130);
    rect(655, 500, 190, 190);
  } else if (boite_plombs >= 1) {
    dispo_boite_plombs = true;
    fill(00, 00, 00, 00);
    rect(655, 500, 190, 190);
  }
}

public void MenuBribrac() {

  background = loadImage("background.png");
  image(background, 0, 0);
  image(menu_panel_shop, 0, 0);
}

public void MenuClassement() {

  background = loadImage("background.png");
  image(background, 0, 0);
  textSize(50);
  text(score, 163, 75);
}

int monte = 1250;
int vitesse_monte = -1;
public void MenuCredit() {
  background(0, 0, 0, 0);
  monte = monte + vitesse_monte;

  //  image(credit, 0, 0);
  textSize(50);
  text("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", 300, monte);
  text("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", 300, monte+60);
  text("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", 300, monte+120);
  text("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", 300, monte+180);
  text("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", 300, monte+240);
  text("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", 300, monte+300);
  text("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", 300, monte+360);
  text("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", 300, monte+420);
  text("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", 300, monte+180);
  text("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", 300, monte+180);
  text("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", 300, monte+180);
  text("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", 300, monte+180);
}

public void MenuGoShop() {
  background = loadImage("background.png");
  image(background, 0, 0);
  image(panelstart, 0, 0);
  textSize(70);
  if (mission_02) {
    text(ticket+"/2 tickets", 1150, 470);
    text(ciblett+"/10 cibles", 600, 470);
  }

  if (mission_03) {
    text(ticket+"/5 tickets", 1150, 470);
    text(ciblett+"/20 cibles", 600, 470);
  }

  if (mission_04) {
    text(ticket+"/5 tickets", 1150, 470);
    text(ciblett+"/20 cibles", 600, 470);
  }

  if (mission_05) {
    text(ticket+"/5 tickets", 1150, 470);
    text(ciblett+"/20 cibles", 600, 470);
  }

  if (mission_06) {
    text(ticket+"/5 tickets", 1150, 470);
    text(ciblett+"/20 cibles", 600, 470);
  }

  if (mission_07) {
    text(ticket+"/5 tickets", 1150, 470);
    text(ciblett+"/20 cibles", 600, 470);
  }

  if (mission_08) {
    text(ticket+"/5 tickets", 1150, 470);
    text(ciblett+"/20 cibles", 600, 470);
  }
}

public void Inventaire_Item() {

  background = loadImage("background.png");
  image(background, 0, 0);
  image(inventory, 0, 0);
  textSize(50);
  text(ticket, 163, 75);
  text(gemme, 645, 75);
  text(ciblett, 1028, 75);



  text(boite_plombs, 1075, 300);
  text(boostx2, 465, 300);
  text(+boostx4, 615, 300);
  text(+boostx6, 765, 300);
  text(gemmex4, 920, 300);
}

public void MenuJeu() {
  panel_prin = loadImage("panel_menu_prin.png");
  image(panel_prin, 0, 0);
  image(bar, 0, 0);
  textSize(50);
  text(ticket, 163, 75);
  text(gemme, 645, 75);
  text(ciblett, 1028, 75);
}

public void MenuLevel() {
  background = loadImage("background.png");
  image(background, 0, 0);
  background_level = loadImage("panel_menu.png");
  image(background_level, 0, 0);
}

public void MenuRetry() {

  if (mission_01) {
    image(retry, 0, 0, 1920, 1080);
    mission_01 = false;
    visibile = false;
    visibile_b = false;
    visibile_c = false;
    visibile_d = false;
    serie_02 = false;
    serie_03 = false;
    serie_04 = false;
    serie_01 = false;
    msg_box = 0 ;
    plomb = 10;
    score = 0;
    compteur = 0;
    peut_utiliser_gemmex4 = true;
  }

  if (mission_02) {
    image(retry, 0, 0, 1920, 1080);
    mission_02 = false;
    visibile = true;
    visibile_b = false;
    visibile_c = false;
    visibile_d = false;
    plomb = 10;
    score = 0;
    compteur = 0;
    peut_utiliser_gemmex4 = true;
  }

  if (mission_03) {
    image(retry, 0, 0, 1920, 1080);
    mission_03 = false;
    visibile = true;
    visibile_b = false;
    visibile_c = false;
    visibile_d = false;
    plomb = 10;
    score = 0;
    compteur = 0;
    peut_utiliser_gemmex4 = true;
  }

  if (mission_04) {
    image(retry, 0, 0, 1920, 1080);
    mission_04 = false;
    visibile = true;
    visibile_b = false;
    visibile_c = false;
    visibile_d = false;
    plomb = 10;
    score = 0;
    compteur = 0;
    peut_utiliser_gemmex4 = true;
  }

  if (mission_05) {
    image(retry, 0, 0, 1920, 1080);
    mission_05 = false;
    visibile = true;
    visibile_b = false;
    visibile_c = false;
    visibile_d = false;
    plomb = 10;
    score = 0;
    compteur = 0;
    peut_utiliser_gemmex4 = true;
  }

  if (mission_06) {
    image(retry, 0, 0, 1920, 1080);
    mission_06 = false;
    visibile = true;
    visibile_b = false;
    visibile_c = false;
    visibile_d = false;
    plomb = 10;
    score = 0;
    compteur = 0;
    peut_utiliser_gemmex4 = true;
  }

  if (mission_07) {
    image(retry, 0, 0, 1920, 1080);
    mission_07 = false;
    visibile = true;
    visibile_b = false;
    visibile_c = false;
    visibile_d = false;
    plomb = 10;
    score = 0;
    compteur = 0;
    peut_utiliser_gemmex4 = true;
  }

  if (mission_08) {
    image(retry, 0, 0, 1920, 1080);
    mission_08 = false;
    visibile = true;
    visibile_b = false;
    visibile_c = false;
    visibile_d = false;
    plomb = 10;
    score = 0;
    compteur = 0;
    peut_utiliser_gemmex4 = true;
  }
}

public void MenuStart() {
  fill(255, 255, 255);
  rect(25, 25, 50, 50);
  background = loadImage("background.png");
  image(background, 0, 0);
  buttonplay = loadImage("commencer_btn.png");
  image(buttonplay, 660, 400);
  buttonquit = loadImage("quitter_btn.png");
  image(buttonquit, 660, 550);
  logo = loadImage("logo.png");
  image(logo, 380, -60);
  perso = loadImage("perso.png");
  image(perso, 60, 100);
}
public void mouseClicked() {

// Tous les boutons d'action et de navigation du jeu  
  
  
  if ((mouseX > 0) && (mouseX < 1920) && (mouseY > 0) && (mouseY < 895) ) {
    plomb = plomb - 1;
    println("-1");
  }

  if ((mouseX > 0) && (mouseX < 1350) && (mouseY > 120) && (mouseY < 1080) && (ecran == 5) ) {
    fcoins = fcoins +1;
    nb_click = nb_click +1;
  }

  if ((mouseX > 200) && (mouseX < 400) && (mouseY > 100) && (mouseY < 300) && (ecran == 8) ) {
    ecran = 5;
  }

  if ((mouseX > 600) && (mouseX < 800) && (mouseY > 100) && (mouseY < 300) && (ecran == 8) ) {
    ecran = 9;
  }

  if ((mouseX > 1000) && (mouseX < 1200) && (mouseY > 100) && (mouseY < 300) && (ecran == 8) ) {
    ecran = 10;
  }
  if ((mouseX > 1400) && (mouseX < 1600) && (mouseY > 100) && (mouseY < 300) && (ecran == 8) ) {
    ecran = 13;
  }

  if ((mouseX > 93) && (mouseX < 423) && (mouseY > 503) && (mouseY < 553) && (ecran == 9) ) {
    if (gemme >= 4) {
      gemme = gemme -4  ;
      gemmex4 = gemmex4 +1;
    }
  }

  if ((mouseX > 445) && (mouseX < 775) && (mouseY > 503) && (mouseY < 553) && (ecran == 9) ) {
    if (gemme >= 4) {
      gemme = gemme -4  ;
      boite_plombs = boite_plombs +1;
    }
  }

  if ((mouseX > 795) && (mouseX < 1124) && (mouseY > 503) && (mouseY < 553) && (ecran == 9) ) {
    if (gemme >= 4) {
      gemme = gemme -4  ;
      boostx2 = boostx2 +1;
    }
  }

  if ((mouseX > 93) && (mouseX < 423) && (mouseY > 934) && (mouseY < 982) && (ecran == 9) ) {
    if (gemme >= 4) {
      gemme = gemme -4  ;
      boostx4 = boostx4 +1;
    }
  }

  if ((mouseX > 445) && (mouseX < 775) && (mouseY > 934) && (mouseY < 982) && (ecran == 9) ) {
    if (gemme >= 4) {
      gemme = gemme -4  ;
      boostx6 = boostx6 +1;
    }
  }

  if ((mouseX > 450) && (mouseX < 635) && (mouseY > 500) && (mouseY < 690) && (ecran == 22) ) {
    if (peut_utiliser_gemmex4) {
      if (dispo_gemmex4) {
        gemmex4 = gemmex4 - 1;
        peut_utiliser_gemmex4 = false;
        active_gemmex4 = true;
      }
    }
  }

  if ((mouseX > 655) && (mouseX < 845) && (mouseY > 500) && (mouseY < 690) && (ecran == 22) ) {
    if (peut_utiliser_boite_plombs) {
      if (dispo_boite_plombs) {
        boite_plombs = boite_plombs - 1;
        peut_utiliser_boite_plombs = false;
        active_boite_plombs = true;
      }
    }
  }

  if ((mouseX > 865) && (mouseX < 1055) && (mouseY > 500) && (mouseY < 690) && (ecran == 22) ) {
    if (peut_utiliser_boostx2) {
      if (dispo_boostx2) {
        boostx2 = boostx2 - 1;
        peut_utiliser_boostx2 = false;
        active_boostx2 = true;
      }
    }
  }

  if ((mouseX > 1075) && (mouseX < 1253) && (mouseY > 500) && (mouseY < 690) && (ecran == 22) ) {
    if (peut_utiliser_boostx4) {
      if (dispo_boostx4) {
        boostx4 = boostx4 - 1;
        peut_utiliser_boostx4 = false;
        active_boostx4 = true;
      }
    }
  }

  if ((mouseX > 1285) && (mouseX < 1470) && (mouseY > 500) && (mouseY < 690) && (ecran == 22) ) {
    if (peut_utiliser_boostx6) {
      if (dispo_boostx6) {
        boostx6 = boostx6 - 1;
        peut_utiliser_boostx6 = false;
        active_boostx6 = true;
      }
    }
  }

  if ((mouseX > 922) && (mouseX < 1175) && (mouseY > 340) && (mouseY < 415) && (ecran == 6) ) {
    if (gemme >= 10) {
      gemme = gemme -20;
      ticket = ticket +5;
    }
  }

  if ((mouseX > 922) && (mouseX < 1175) && (mouseY > 460) && (mouseY < 530) && (ecran == 6) ) {
    if (gemme >= 20) {
      gemme = gemme -20;
      ticket = ticket +15;
    }
  }

  if ((mouseX > 922) && (mouseX < 1175) && (mouseY > 580) && (mouseY < 645) && (ecran == 6) ) {
    if (gemme >= 30) {
      gemme = gemme -30;
      ticket = ticket +25;
    }
  }

  if ((mouseX > 922) && (mouseX < 1175) && (mouseY > 710) && (mouseY < 775) && (ecran == 6) ) {
    if (gemme >= 40) {
      gemme = gemme -40;
      ticket = ticket +35;
    }
  }

  if ((mouseX > 922) && (mouseX < 1175) && (mouseY > 842) && (mouseY < 908) && (ecran == 6) ) {
    if (gemme >= 50) {
      gemme = gemme -50;
      ticket = ticket +45;
    }
  }

  if ((mouseX > 922) && (mouseX < 1175) && (mouseY > 340) && (mouseY < 415) && (ecran == 7) ) {
    if (fcoins >= 10) {
      fcoins = fcoins -100;
      ticket = ticket +5;
    }
  }

  if ((mouseX > 922) && (mouseX < 1175) && (mouseY > 455) && (mouseY < 533) && (ecran == 7) ) {
    if (fcoins >= 20) {
      fcoins = fcoins -200;
      ticket = ticket +15;
    }
  }

  if ((mouseX > 922) && (mouseX < 1175) && (mouseY > 575) && (mouseY < 655) && (ecran == 7) ) {
    if (fcoins >= 30) {
      fcoins = fcoins -300;
      ticket = ticket +25;
    }
  }

  if ((mouseX > 922) && (mouseX < 1175) && (mouseY > 705) && (mouseY < 780) && (ecran == 7) ) {
    if (fcoins >= 40) {
      fcoins = fcoins -400;
      ticket = ticket +35;
    }
  }

  if ((mouseX > 9) && (mouseX < 1175) && (mouseY > 837) && (mouseY < 915) && (ecran == 7) ) {
    if (fcoins >= 50) {
      fcoins = fcoins -500;
      ticket = ticket +45;
    }
  }

  if (!possede_pass) {
    if ((mouseX > 0) && (mouseX < 560) && (mouseY > 976) && (mouseY < 1080) && (ecran == 10) ) {
      if (fcoins >= 500) {
        fcoins = fcoins -500;
        possede_pass = true;
      }
    }
  }
  if ((mouseX > 660) && (mouseX < 1260) && (mouseY > 400) && (mouseY < 520) && (ecran == 0) ) {
    ecran = 2;
  } else if ((mouseX > 660) && (mouseX < 1260) && (mouseY > 550) && (mouseY < 670) && (ecran == 0) ) {
    exit();
  }
  //levels
  else if ((mouseX > 65) && (mouseX < 440) && (mouseY > 580) && (mouseY < 940) && (ecran == 1) ) {
    ecran = 3;
    mission_01 = false;
    ticket = ticket+2;
    mission_01 = false;
    visibile = false;
    visibile_b = false;
    visibile_c = false;
    visibile_d = false;
    serie_02 = false;
    serie_03 = false;
    serie_04 = false;
    serie_01 = false;
    msg_box = 0 ;
    plomb = 10;
    score = 0;
    compteur = 0;
  } else if ((mouseX > 65) && (mouseX < 430) && (mouseY > 100) && (mouseY < 490) && (ecran == 1) ) {
    mission_02 = true;
    ecran = 21;
  } else if ((mouseX > 65) && (mouseX < 430) && (mouseY > 100) && (mouseY < 490) && (ecran == 22) ) {
    ecran = 22;
  } else if ((mouseX > 895) && (mouseX < 1500) && (mouseY > 745) && (mouseY < 870) && (ecran == 22) ) {
    if (mission_02) {
      ticket = ticket - 2;
      ecran = 4;
      visibile = true;
      visibile_b = false;
      visibile_c = false;
      visibile_d = false;
      if (active_boite_plombs) {
        plomb = 20;
      } else if (!active_boite_plombs) {
        plomb = 10;
      }
      score = 0;
      compteur = 0;
    } else if (mission_03) {
      ticket = ticket - 5;
      ecran = 15;
      visibile = true;
      visibile_b = false;
      visibile_c = false;
      visibile_d = false;
      plomb = 10;
      score = 0;
      compteur = 0;
    } else if (mission_04) {
      ticket = ticket - 5;
      ecran = 16;
      visibile = true;
      visibile_b = false;
      visibile_c = false;
      visibile_d = false;
      plomb = 10;
      score = 0;
      compteur = 0;
    } else if (mission_05) {
      ticket = ticket - 5;
      ecran = 17;
      visibile = true;
      visibile_b = false;
      visibile_c = false;
      visibile_d = false;
      plomb = 10;
      score = 0;
      compteur = 0;
    } else if (mission_06) {
      ticket = ticket - 5;
      ecran = 18;
      visibile = true;
      visibile_b = false;
      visibile_c = false;
      visibile_d = false;
      plomb = 10;
      score = 0;
      compteur = 0;
    } else if (mission_07) {
      ticket = ticket - 5;
      ecran = 19;
      visibile = true;
      visibile_b = false;
      visibile_c = false;
      visibile_d = false;
      plomb = 10;
      score = 0;
      compteur = 0;
    } else if (mission_08) {
      ticket = ticket - 5;
      ecran = 20;
      visibile = true;
      visibile_b = false;
      visibile_c = false;
      visibile_d = false;
      plomb = 10;
      score = 0;
      compteur = 0;
    }
  } else if ((mouseX > 660) && (mouseX < 1260) && (mouseY > 600) && (mouseY < 720) && (ecran == 21) ) {
    if (ticket >=2) {

      ecran = 22;
    } else if
      (ticket <2) {
      ecran = 5;
    }
  } else if ((mouseX > 660) && (mouseX < 1260) && (mouseY > 740) && (mouseY < 858) && (ecran == 21) ) {
    ecran = 1;
  } else if ((mouseX > 0) && (mouseX < 1920) && (mouseY > 0) && (mouseY < 1080) && (ecran == 14) ) {

    ecran = 2;
  } else if ((mouseX > 560) && (mouseX < 940) && (mouseY > 100) && (mouseY < 490) && (ecran == 1) ) {
    mission_03 = true;
    ecran = 21;
  } else if ((mouseX > 560) && (mouseX < 940) && (mouseY > 580) && (mouseY < 975) && (ecran == 1) ) {
    mission_04 = true;
    ecran = 21;
  } else if ((mouseX > 1040) && (mouseX < 1415) && (mouseY > 580) && (mouseY < 975) && (ecran == 1) ) {
    ecran = 21;
    mission_05 = true;
  } else if ((mouseX > 1040) && (mouseX < 1415) && (mouseY > 100) && (mouseY < 490) && (ecran == 1) ) {
    ecran = 21;
    mission_06 = true;
  } else if ((mouseX > 1480) && (mouseX < 1855) && (mouseY > 100) && (mouseY < 490) && (ecran == 1) ) {
    ecran = 21;
    mission_07 = true;
  } else if ((mouseX > 1480) && (mouseX < 1855) && (mouseY > 580) && (mouseY < 975) && (ecran == 1) ) {
    ecran = 21;
    mission_08 = true;
  }
  // MENU PRIN
  else if ((mouseX > 1140) && (mouseX < 1445) && (mouseY > 552) && (mouseY < 863) && (ecran == 2) ) {
    exit();
  } else if ((mouseX > 475) && (mouseX < 780) && (mouseY > 215) && (mouseY < 862) && (ecran == 2) ) {
    ecran = 1;
  } else if ((mouseX > 0) && (mouseX < 200) && (mouseY > 0) && (mouseY < 60) && (ecran == 1) ) {
    ecran = 2;
  } else if ((mouseX > 1140) && (mouseX < 1445) && (mouseY > 215) && (mouseY < 527) && (ecran == 2)) {
    ecran = 12;
  } else if ((mouseX > 418) && (mouseX < 478) && (mouseY > 28) && (mouseY < 90) && (ecran == 2) ) {
    ecran = 6;
  } else if ((mouseX > 805) && (mouseX < 1115) && (mouseY > 550) && (mouseY < 867) && (ecran == 2) ) {
    ecran = 8;
  } else if ((mouseX > 1365) && (mouseX < 1919) && (mouseY > 300) && (mouseY < 400) && (ecran == 5) ) {
    ecran = 6;
  } else if ((mouseX > 355) && (mouseX < 730) && (mouseY > 95) && (mouseY < 495) && (ecran == 8) ) {
    ecran = 5;
  } else if ((mouseX > 1154) && (mouseX < 1533) && (mouseY > 95) && (mouseY < 495) && (ecran == 8) ) {
    ecran = 9;
  } else if ((mouseX > 355) && (mouseX < 730) && (mouseY > 95) && (mouseY < 495) && (ecran == 8) ) {
    ecran = 5;
  } else if ((mouseX > 355) && (mouseX < 730) && (mouseY > 540) && (mouseY < 940) && (ecran == 8) ) {
    ecran = 13;
  } else if ((mouseX > 1365) && (mouseX < 1919) && (mouseY > 185) && (mouseY < 280) && (ecran == 6) ) {
    ecran = 5;
  } else if ((mouseX > 1365) && (mouseX < 1919) && (mouseY > 420) && (mouseY < 520) && (ecran == 6) ) {
    ecran = 7;
  } else if ((mouseX > 1154) && (mouseX < 1533) && (mouseY > 550) && (mouseY < 950) && (ecran == 8) ) {
    ecran = 10;
  } else if ((mouseX > 1365) && (mouseX < 1919) && (mouseY > 185) && (mouseY < 280) && (ecran == 7) ) {
    ecran = 5;
  } else if ((mouseX > 1365) && (mouseX < 1919) && (mouseY > 300) && (mouseY < 400) && (ecran == 7) ) {
    ecran = 6;
  } else if ((mouseX > 1365) && (mouseX < 1919) && (mouseY > 982) && (mouseY < 1080) && ((ecran == 5) || (ecran == 6) || (ecran == 7) || (ecran == 13) || (ecran == 10) )) {
    ecran = 8;
  } else if ((mouseX > 1365) && (mouseX < 1919) && (mouseY > 982) && (mouseY < 1080) && (ecran == 8)) {
    ecran = 2;
  } else if ((mouseX > 1365) && (mouseX < 1919) && (mouseY > 11) && (mouseY < 109) && (ecran == 9)) {
    ecran = 8;
  }
  if ((mouseX > 600) && (mouseX < 1360) && (mouseY > 950) && (mouseY < 1050) && (msg_box == 0) ) {
    msg_box = 1 ;
  } else if ((mouseX > 600) && (mouseX < 1360) && (mouseY > 950) && (mouseY < 1050) && (msg_box == 1) ) {
    msg_box = 2 ;
    visibile = true;
    serie_01 = true;
  } else if ((mouseX > 600) && (mouseX < 1360) && (mouseY > 950) && (mouseY < 1050) && (msg_box == 3) ) {
    msg_box = 4 ;
    serie_01 = false;
    serie_02 = true;
    visibile = true;
    visibile_b = true;
  } else if ((mouseX > 600) && (mouseX < 1360) && (mouseY > 950) && (mouseY < 1050) && (msg_box == 5) ) {
    msg_box = 6 ;
    serie_02 = false;
    serie_03 = true;
    visibile = true;
    visibile_b = true;
    visibile_c = true;
    visibile_d = true;
  } else if ((mouseX > 600) && (mouseX < 1360) && (mouseY > 950) && (mouseY < 1050) && (msg_box == 7) ) {
    msg_box = 8 ;
    serie_03 = false;
    serie_04 = true;
    visibile = true;
    visibile_b = true;
    visibile_c = true;
    vitesse_x =15;
    vitesse_x_b =15;
    vitesse_x_c =15;
  } else if ((mouseX > 600) && (mouseX < 1360) && (mouseY > 950) && (mouseY < 1050) && (msg_box == 9) ) {
    msg_box = 10 ;
  } else if ((mouseX > 600) && (mouseX < 1360) && (mouseY > 950) && (mouseY < 1050) && (msg_box == 10) ) {
    msg_box = 11 ;
  } else if ((mouseX > 873) && (mouseX < 1472) && (mouseY > 690) && (mouseY < 811) && (msg_box == 23) || (ecran==23) ) {

    if (active_gemmex4) {
      gemme = gemme +4;
    }
    if (!active_gemmex4) {
      gemme = gemme +1;
    }

    active_gemmex4 = false;
    active_boite_plombs = false;
    active_boostx2 = false;
    active_boostx4 = false;
    active_boostx6 = false;

    if (mission_01) {
      ecran = 2 ;
      ticket = ticket+2;
      mission_01 = false;
      visibile = false;
      visibile_b = false;
      visibile_c = false;
      visibile_d = false;
      serie_02 = false;
      serie_03 = false;
      serie_04 = false;
      serie_01 = false;
      ciblett = ciblett + compteur;
      msg_box = 0 ;
      plomb = 10;
      score = 0;
      compteur = 0;
      vitesse_x =5;
      vitesse_x_b =5;
      vitesse_x_c =-5;
      vitesse_x_d =-5;
    } else if (mission_02) {
      ecran = 2 ;
      mission_02 = false;
      visibile = false;
      visibile_b = false;
      visibile_c = false;
      visibile_d = false;
      vitesse_x =5;
      vitesse_x_b =5;
      vitesse_x_c =-5;
      vitesse_x_d =-5;
      ciblett = ciblett + compteur;
      msg_box = 0 ;
      plomb = 10;
      score = 0;
      compteur = 0;
    } else if (mission_03) {
      ecran = 2 ;
      mission_02 = false;
      visibile = false;
      visibile_b = false;
      visibile_c = false;
      visibile_d = false;
      vitesse_x =5;
      vitesse_x_b =5;
      vitesse_x_c =-5;
      vitesse_x_d =-5;
      ciblett = ciblett + compteur;
      msg_box = 0 ;
      plomb = 10;
      score = 0;
      compteur = 0;
    } else if (mission_04) {
      ecran = 2 ;
      mission_04 = false;
      visibile = false;
      visibile_b = false;
      visibile_c = false;
      visibile_d = false;
      vitesse_x =5;
      vitesse_x_b =5;
      vitesse_x_c =-5;
      vitesse_x_d =-5;
      ciblett = ciblett + compteur;
      msg_box = 0 ;
      plomb = 10;
      score = 0;
      compteur = 0;
    } else if (mission_05) {
      ecran = 2 ;
      mission_05 = false;
      visibile = false;
      visibile_b = false;
      visibile_c = false;
      visibile_d = false;
      vitesse_x =5;
      vitesse_x_b =5;
      vitesse_x_c =-5;
      vitesse_x_d =-5;
      ciblett = ciblett + compteur;
      msg_box = 0 ;
      plomb = 10;
      score = 0;
      compteur = 0;
    } else if (mission_06) {
      ecran = 2 ;
      mission_06 = false;
      visibile = false;
      visibile_b = false;
      visibile_c = false;
      visibile_d = false;
      vitesse_x =5;
      vitesse_x_b =5;
      vitesse_x_c =-5;
      vitesse_x_d =-5;
      ciblett = ciblett + compteur;
      msg_box = 0 ;
      plomb = 10;
      score = 0;
      compteur = 0;
    } else if (mission_07) {
      ecran = 2 ;
      mission_07 = false;
      visibile = false;
      visibile_b = false;
      visibile_c = false;
      visibile_d = false;
      vitesse_x =5;
      vitesse_x_b =5;
      vitesse_x_c =-5;
      vitesse_x_d =-5;
      ciblett = ciblett + compteur;
      msg_box = 0 ;
      plomb = 10;
      score = 0;
      compteur = 0;
    } else if (mission_08) {
      ecran = 2 ;
      mission_08 = false;
      visibile = false;
      visibile_b = false;
      visibile_c = false;
      visibile_d = false;
      vitesse_x =5;
      vitesse_x_b =5;
      vitesse_x_c =-5;
      vitesse_x_d =-5;
      ciblett = ciblett + compteur;
      msg_box = 0 ;
      plomb = 10;
      score = 0;
      compteur = 0;
    }
  }
}
// les msg box du didacticiel

public void msg_box_01() {
  if (mission_01) {
    fill(255, 170, 0, 200);
    rect(600, 950, 800, 100);
    image(robot, 1200, 700, 400, 400);
    textSize(30);
    fill(255, 255, 255);
    // Premiere
    text ("Clique sur carré jaune pour continuer !", 600, 940);
    text ("Bienvenue dans le didacticiel de Shoot 2 Forain ! Je vais t'expliquer", 605, 990);
    text ("comment jouer au jeu ! C'est parti !", 605, 1020);
  }
}

public void msg_box_02() {
  if (mission_01) {
    // TCHAT BOX
    textSize(30);
    fill(255, 255, 255);
    // Premiere
    fill(255, 170, 0, 200);
    rect(600, 950, 800, 100);
    image(robot, 1200, 700, 400, 400);
    fill(255, 255, 255);
    text ("Clique sur carré jaune pour continuer !", 600, 940);
    text ("En bas à gauche, voici l'HUD, tu peux y trouver plusieurs informations", 605, 990);
    text ("comme les plombs restants (munitions), les cibles restantes et le score.", 605, 1020);
    image(fleche_hud, 0, 0);
  }
}

public void msg_box_03() {
  if (mission_01) {
    // TCHAT BOX

    textSize(30);
    fill(255, 255, 255);
    fill(255, 170, 0, 200);
    rect(600, 950, 800, 100);
    image(robot, 1200, 700, 400, 400);
    fill(255, 255, 255);
    text ("Tire sur la cible pour continuer!                              (Aide: Utilise la souris)!", 600, 940);
    text ("Voici ta carabine, tire sur la première cible!", 605, 990);
    text ("Attention à ne pas tirer à coté, tu perds des plombs et ton score descend!", 605, 1020);
  }
}

public void msg_box_04() {
  // TCHAT BOX
  if (mission_01) {
    textSize(30);
    fill(255, 255, 255);
    fill(255, 170, 0, 200);
    rect(600, 950, 800, 100);
    image(robot, 1200, 700, 400, 400);
    fill(255, 255, 255);
    text ("Clique sur carré jaune pour continuer !                           ", 600, 940);
    text ("Super ! Tu serais pas un forain pure souche par hasard ?", 605, 990);
    text ("J'ai rarement vu une tel precision! ", 605, 1020);
  }
}

public void msg_box_05() {
  // TCHAT BOX
  if (mission_01) {
    textSize(30);
    fill(255, 255, 255);
    fill(255, 170, 0, 200);
    rect(600, 950, 800, 100);
    image(robot, 1200, 700, 400, 400);
    fill(255, 255, 255);
    text ("Tire sur les cibles pour continuer!                           (Aide: Utilise la souris)!", 600, 940);
    text ("Ducoup...", 605, 990);
    text ("En voici 2 autres! ", 605, 1020);
  }
}

public void msg_box_06() {
  // TCHAT BOX
  if (mission_01) {
    textSize(30);
    fill(255, 255, 255);
    fill(255, 170, 0, 200);
    rect(600, 950, 800, 100);
    image(robot, 1200, 700, 400, 400);
    fill(255, 255, 255);
    text ("Clique sur carré jaune pour continuer !                          ", 600, 940);
    text ("Et la doublette ! Bien joué", 605, 990);
    text ("Tu es pret ?  ", 605, 1020);
  }
}

public void msg_box_07() {
  // TCHAT BOX
  if (mission_01) {
    textSize(30);
    fill(255, 255, 255);
    fill(255, 170, 0, 200);
    rect(600, 950, 800, 100);
    image(robot, 1200, 700, 400, 400);
    fill(255, 255, 255);
    text ("Tire sur les cibles pour continuer!                           (Aide: Utilise la souris)!", 600, 940);
    text ("Ok, on double le nombre. Désormais il y a 4 cibles!", 605, 990);
    text ("C'est parti !  ", 605, 1020);
  }
}

public void msg_box_08() {
  // TCHAT BOX
  if (mission_01) {
    textSize(30);
    fill(255, 255, 255);
    fill(255, 170, 0, 200);
    rect(600, 950, 800, 100);
    image(robot, 1200, 700, 400, 400);
    fill(255, 255, 255);
    text ("Clique sur carré jaune pour continuer !                          ", 600, 940);
    text ("En plein dans le mile", 605, 990);
    text ("Tu as du talent !  ", 605, 1020);
  }
}

public void msg_box_09() {
  // TCHAT BOX
  if (mission_01) {
    textSize(30);
    fill(255, 255, 255);
    fill(255, 170, 0, 200);
    rect(600, 950, 800, 100);
    image(robot, 1200, 700, 400, 400);
    fill(255, 255, 255);
    text ("Tire sur les cibles pour continuer!                           (Aide: Utilise la souris)!", 600, 940);
    text ("J'augmente la vitesse maintenant", 605, 990);
    text ("Feuuuuuu !  ", 605, 1020);
  }
}

public void msg_box_10() {
  // TCHAT BOX
  if (mission_01) {
    textSize(30);
    fill(255, 255, 255);
    fill(255, 170, 0, 200);
    rect(600, 950, 800, 100);
    image(robot, 1200, 700, 400, 400);
    fill(255, 255, 255);
    text ("Clique sur carré jaune pour continuer !                          ", 600, 940);
    text ("Bon on arrete la, tu est tres fort!", 605, 990);
    text ("Récupère ta récompense!  ", 605, 1020);
  }
}

public void msg_box_11() {
  // TCHAT BOX
  if (mission_01) {
    ecran = 23;
  }
}
// Tous les menus du magasin


public void Shop_Buy() {

  background = loadImage("background.png");
  image(background, 0, 0);
  image(buy, 0, 0);
  textSize(50);
  text(ticket, 163, 75);
  text(gemme, 645, 75);
  text(ciblett, 1028, 75);
  text(fcoins, 1418, 75);
  text("Nombre de clicks:"+nb_click, 20, 200);

  text ("10 GEMMES", 950, 395);
  text ("20 GEMMES", 950, 515);
  text ("30 GEMMES", 950, 633);
  text ("40 GEMMES", 950, 760);
  text ("50 GEMMES", 950, 893);
}
public void Shop_Echange() {

  background = loadImage("background.png");
  image(background, 0, 0);
  image(echange, 0, 0);
  textSize(50);
  text(ticket, 163, 75);
  text(gemme, 645, 75);
  text(ciblett, 1028, 75);
  text(fcoins, 1418, 75);
  text("Nombre de clicks:"+nb_click, 20, 200);

  text ("100 FCOINS", 950, 395);
  text ("200 FCOINS", 950, 515);
  text ("300 FCOINS", 950, 633);
  text ("400 FCOINS", 950, 760);
  text ("500 FCOINS", 950, 893);
}

public void Shop_Item() {

  background = loadImage("background.png");
  image(background, 0, 0);
  image(shopshop, 0, 0);
  textSize(50);
  text(ticket, 163, 75);
  text(gemme, 645, 75);
  text(ciblett, 1028, 75);

  text("4 GEMMES", 180, 546);
  text("4 GEMMES", 535, 546);
  text("4 GEMMES", 880, 546);
  text("4 GEMMES", 180, 975);
  text("4 GEMMES", 535, 975);



  // text("Nombre de boites:"+boite_plombs, 20, 200);
  //  text("Boost Score x2 :"+gemmex4, 20, 260);
  //  text("Boost Score x4 :"+boostx2, 20, 320);
  //  text("Boost Score x6 :"+boostx4, 20, 380);
  //  text("Boost gemmes x4 :"+boostx6, 20, 440);
}

public void Shop_Minage() {

  background = loadImage("background.png");
  image(background, 0, 0);
  image(minage, 0, 0);
  textSize(50);
  text(ticket, 163, 75);
  text(gemme, 645, 75);
  text(ciblett, 1028, 75);
  text(fcoins, 1418, 75);
  text("Nombre de clicks:"+nb_click, 20, 200);
}
  public void settings() {  fullScreen(); }
  static public void main(String[] passedArgs) {
    String[] appletArgs = new String[] { "shoot2forain" };
    if (passedArgs != null) {
      PApplet.main(concat(appletArgs, passedArgs));
    } else {
      PApplet.main(appletArgs);
    }
  }
}
