PImage img;
PImage img2;
PImage img3;
PImage img4;
PImage img5;
PImage img6;
//clic1 pour accéder à la première pièce
boolean clic1 = false;
//clic2 pour accéder à la première question
boolean clic2 = false;
//clic3 pour première réponse
boolean clic3 = false;
//clic4 pour deuxieme réponse
boolean clic4 = false;
//clic5 pour troisieme reponse
boolean clic5 = false;
//clic5bis pour quatrieme reponse
boolean clic5bis = false;
//clic6 pour accéder à la deuxieme pièce
boolean clic6 = false;
//clic6bis pour afficher consigne
boolean clic6bis = false;
//clic7 pour accéder à la deuxieme question
boolean clic7 = false;
//clic8 pour premiere reponse
boolean clic8 = false;
//clic9 pour deuxieme reponse
boolean clic9 = false;
//clic10 pour troisieme reponse
boolean clic10 = false;
//clic11 pour afficher troisieme piece
boolean clic11 = false;
//clic12 pour afficher troisieme question
boolean clic12 = false;
//clic13 pour premiere reponse
boolean clic13 = false;
//clic14 pour deuxieme reponse
boolean clic14 = false;
//clic15 pour troisieme reponse
boolean clic15 = false;
//clic16 pour sortir
boolean clic16 = false;
void setup() {
img = loadImage("escapegame.jpg");
size(img.width, img.height);
img2 = loadImage("eg.jpg");
img3 = loadImage("eg3.jpg");
img4 = loadImage("chimie.jpg");
img5 = loadImage("chimie2.jpg");
img6 = loadImage("salle.jpg");
}
void draw() {
if (clic1 == false) {
image(img, 0, 0);
//créer le bouton commencer
fill(#21150B);
ellipse(275, 195, 200, 90);
fill(0);
stroke(0);
fill(#675649);
textSize(24);
text("COMMENCER", 200, 205);
//créer le titre
fill(#120C07);
textSize(60);
text("Escape Game", 100, 100);
//créer histoire
fill(#D1C0B9);
rect(10, 280, 520, 50);
fill(#120C07);
textSize(15);
text("Vous voici enfermez dans le sous-sol de physique de palissy...", 30, 300);
text("Pour y sortir il faudra répondre aux questions tordues de M. Laclaverie", 15, 320);
}
if (clic1) {
//afficher premiere piece et consigne
image(img2, 0, 0);
fill(#FFFFFF);
textSize(40);
text("Trouvez le cadenas", 110, 100);
}
if (clic2) {
//afficher premiere question
image(img2, 0, 0);
fill(255);
textSize(40);
text("La vitesse de la lumière", 50, 60);
textSize(30);
text("est extrèmement faible.", 10, 140);
text("est de 299 792 458 m/s", 10, 200);
text("est de 342 m/s", 10, 260);
text("a été trouvée il y a 342ans", 10, 320);
rect(500, 120, 20, 20);
rect(500, 180, 20, 20);
rect(500, 240, 20, 20);
rect(500, 300, 20, 20);
}
if (clic3) {
//afficher perdu et recommencer
fill(#FF0000);
textSize(30);
text("perdu", 230, 100);
rect(500, 120, 20, 20);
fill(255);
rect(365, 330, 150, 27);
fill(0);
textSize(20);
text("Recommencer", 373, 350);
clic4 = false;
clic5 = false;
clic5bis = false;
if (mousePressed) {
if (mouseX>365) {
if (mouseX<515) {
if (mouseY>330) {
if (mouseY<357) {
initialisation();
}
}
}
}
}
}
if (clic4) {
//afficher gagné et next
rect(420, 320, 65, 30);
fill(0);
textSize(25);
text("Next", 423, 345);
fill(#39CE32);
textSize(30);
text("gagné", 230, 100);
rect(500, 180, 20, 20);
clic3 = false;
clic5 = false;
clic5bis = false;
if (mousePressed) {
if (mouseX>420) {
if (mouseX<485) {
if (mouseY>320) {
if (mouseY<350) {
clic6= true;
clic6bis = true;
}
}
}
}
}
}
if (clic5) {
//afficher perdu
fill(#FF0000);
textSize(30);
text("perdu", 230, 100);
rect(500, 240, 20, 20);
fill(255);
rect(365, 330, 150, 27);
fill(0);
textSize(20);
text("Recommencer", 373, 350);
if (mousePressed) {
if (mouseX>365) {
if (mouseX<515) {
if (mouseY>330) {
if (mouseY<357) {
initialisation();
}
}
}
}
}
clic3 = false;
clic4 = false;
clic5bis = false;
}
if (clic5bis) {
//afficher perdu
fill(#FF0000);
textSize(30);
text("perdu", 230, 100);
rect(500, 300, 20, 20);
fill(255);
rect(365, 330, 150, 27);
fill(0);
textSize(20);
text("Recommencer", 373, 350);
if (mousePressed) {
if (mouseX>365) {
if (mouseX<515) {
if (mouseY>330) {
if (mouseY<357) {
initialisation();
}
}
}
}
}
clic3 = false;
clic4 = false;
clic5 = false;
}
if (clic6) {
//afficher deuxieme piece et consigne
image(img3, 0, 0);
if (clic6bis) {
fill(#FFFFFF);
textSize(40);
text("Trouvez Newton", 120, 100);
}
}
if (clic7) {
//afficher deuxieme question
fill(255);
textSize(25);
text("Quelle est la Seconde loi de Newton :", 50, 70);
textSize(15);
text("Dans un référentiel héliocentrique, la trajectoire d'une", 10, 140);
text("planète est une ellipse dont le soleil occupe l'un des foyers.", 10, 160);
text("Dans un référentiel géocentrique, la somme des forces", 10, 200);
text("extérieures du système est égale à la masse fois le vecteur", 10, 220);
text("d'accélération.", 10, 240);
text("Dans un référentiel terrestre supposé Galiléen, la somme", 10, 280);
text("des forces extérieures du système est égale à la masse fois le ", 10, 300);
text("vecteur d'accélération.", 10, 320);
rect(500, 135, 20, 20);
rect(500, 205, 20, 20);
rect(500, 275, 20, 20);
clic6bis=false;
}
if (clic8) {
//afficher perdu
fill(#FF0000);
textSize(30);
text("perdu", 230, 115);
rect(500, 135, 20, 20);
fill(255);
rect(365, 330, 150, 27);
fill(0);
textSize(20);
text("Recommencer", 373, 350);
if (mousePressed) {
if (mouseX>365) {
if (mouseX<515) {
if (mouseY>330) {
if (mouseY<357) {
initialisation();
}
}
}
}
}
clic9 = false;
clic10 = false;
}
if (clic9) {
//afficher perdu
fill(#FF0000);
textSize(30);
text("perdu", 230, 115);
rect(500, 205, 20, 20);
fill(255);
rect(365, 330, 150, 27);
fill(0);
textSize(20);
text("Recommencer", 373, 350);
if (mousePressed) {
if (mouseX>365) {
if (mouseX<515) {
if (mouseY>330) {
if (mouseY<357) {
initialisation();
}
}
}
}
}
clic8 = false;
clic10 = false;
}
if (clic10) {
//afficher gagné et next
fill(#39CE32);
textSize(30);
text("gagné", 230, 115);
rect(500, 275, 20, 20);
fill(255);
rect(420, 320, 65, 30);
fill(0);
textSize(25);
text("Next", 423, 345);
clic8 = false;
clic9 = false;
if (mousePressed) {
if (mouseX>420) {
if (mouseX<485) {
if (mouseY>320) {
if (mouseY<350) {
clic11= true;
}
}
}
}
}
}
if (clic11){
//afficher troisieme pièce
image(img4, 0, 0);
fill(#FFFFFF);
textSize(30);
text("Trouver le erlenmeyer rouge", 80, 80);
}
if(clic12){
// afficher troisieme question
image(img5, 0, 0);
fill(255);
textSize(20);
text("Quel est le plus précis des instruments", 80,60);
text("de mesure de volume suivant:", 120, 80);
textSize(20);
text("La burette graduée.", 10, 300);
text("L'éprouvette graduée. ", 210, 300);
text("Le bécher.", 430, 300);
rect(100, 305, 20, 20);
rect(300, 305, 20, 20);
rect(470, 305, 20, 20);
}
if(clic13){
//afficher gagné et sortie
fill(#39CE32);
textSize(60);
text("gagné", 200, 220);
rect(100, 305, 20, 20);
fill(255);
rect(445, 330, 80, 27);
fill(0);
textSize(20);
text("sortir", 460, 350);
if (mousePressed) {
if (mouseX>365) {
if (mouseX<515) {
if (mouseY>330) {
if (mouseY<357) {
clic16 = true;
}
}
}
}
}
clic14=false;
clic15=false;
}
if(clic14){
//afficher perdu
fill(#FF0000);
textSize(30);
text("perdu", 230, 115);
rect(300, 305, 20, 20);
fill(255);
rect(365, 330, 150, 27);
fill(0);
textSize(20);
text("Recommencer", 373, 350);
if (mousePressed) {
if (mouseX>365) {
if (mouseX<515) {
if (mouseY>330) {
if (mouseY<357) {
initialisation();
}
}
}
}
}
clic13=false;
clic15=false;
}
if(clic15){
//afficher perdu
fill(#FF0000);
textSize(30);
text("perdu", 230, 115);
rect(470, 305, 20, 20);
fill(255);
rect(365, 330, 150, 27);
fill(0);
textSize(20);
text("Recommencer", 373, 350);
if (mousePressed) {
if (mouseX>365) {
if (mouseX<515) {
if (mouseY>330) {
if (mouseY<357) {
initialisation();
}
}
}
}
}
clic13=false;
clic14=false;
}
if(clic16){
image (img6,0,0);
fill(0);
textSize(60);
text("Bravo",200,150);
textSize(30);
text("Vous avez résolu toutes les énignes !",10,300);
clic13 = false;
}
button();
cadenas();
question1();
question2();
question3();
}
void button() {
if (mousePressed) {
if (mouseX>175) {
if (mouseX<375) {
if (mouseY>150) {
if (mouseY<250) {
clic1 = true;
}
}
}
}
}
}
void cadenas() {
if (mousePressed) {
if (mouseX>430) {
if (mouseX<450) {
if (mouseY>200) {
if (mouseY<220) {
if(clic1){
clic2 = true;
}
}
}
}
}
}
}
void question1() {
if (clic1) {
if (clic2) {
if (mousePressed) {
if (mouseX>500) {
if (mouseX<520) {
if (mouseY>120) {
if (mouseY<140) {
clic3 = true;
}
}
}
}
}
if (mousePressed) {
if (mouseX>500) {
if (mouseX<520) {
if (mouseY>180) {
if (mouseY<200) {
clic4 = true;
}
}
}
}
}
if (mousePressed) {
if (mouseX>500) {
if (mouseX<520) {
if (mouseY>240) {
if (mouseY<280) {
clic5 = true;
}
}
}
}
}
if (mousePressed) {
if (mouseX>500) {
if (mouseX<520) {
if (mouseY>300) {
if (mouseY<320) {
clic5bis = true;
}
}
}
}
}
}
}
}
void question2() {
if (clic1) {
if (clic2) {
if (clic6) {
if (mousePressed) {
if (mouseX>230) {
if (mouseX<300) {
if (mouseY>180) {
if (mouseY<280) {
clic7=true;
}
}
}
}
}
}
if (clic7) {
if (mousePressed) {
if (mouseX>500) {
if (mouseX<520) {
if (mouseY>135) {
if (mouseY<155) {
clic8=true;
}
}
}
}
}
if (mousePressed) {
if (mouseX>500) {
if (mouseX<520) {
if (mouseY>205) {
if (mouseY<225) {
clic9=true;
}
}
}
}
}
if (mousePressed) {
if (mouseX>500) {
if (mouseX<520) {
if (mouseY>275) {
if (mouseY<295) {
clic10=true;
}
}
}
}
}
}
}
}
}
void initialisation(){
//clic1 pour accéder à la première pièce
clic1 = false;
//clic2 pour accéder à la première question
clic2 = false;
//clic3 pour première réponse
clic3 = false;
//clic4 pour deuxieme réponse
clic4 = false;
//clic5 pour troisieme reponse
clic5 = false;
//clic5bis pour quatrieme reponse
clic5bis = false;
//clic6 pour accéder à la deuxieme pièce
clic6 = false;
//clic6bis pour afficher consigne
clic6bis = false;
//clic7 pour accéder à la deuxieme question
clic7 = false;
//clic8 pour premiere reponse
clic8 = false;
//clic9 pour deuxieme reponse
clic9 = false;
//clic10 pour troisieme reponse
clic10 = false;
//clic11 pour afficher troisieme piece
clic11 = false;
//clic12 pour afficher troisieme question
clic12 = false;
}
void question3() {
if (clic1) {
if (clic2) {
if (clic6) {
if (clic11) {
if (mousePressed) {
if (mouseX>490) {
if (mouseX<510) {
if (mouseY>320) {
if (mouseY<356) {
clic12 = true;
}
}
}
}
}
if (clic12) {
if (mousePressed) {
if (mouseX>100) {
if (mouseX<120) {
if (mouseY>320) {
if (mouseY<340) {
clic13=true;
}
}
}
}
}
if (mousePressed) {
if (mouseX>300) {
if (mouseX<320) {
if (mouseY>320) {
if (mouseY<340) {
clic14=true;
}
}
}
}
}
if (mousePressed) {
if (mouseX>470) {
if (mouseX<490) {
if (mouseY>320) {
if (mouseY<340) {
clic15=true;
}
}
}
}
}
}
}
}
}
}
}