Programme ISN Jeu le Juste prix
Chloe_2112
-
Chloe_2112 -
Chloe_2112 -
Bonjour,
Je m'explique, je suis en terminale S option ISN et mon projet final est un jeu en ligne tiré du jeu télévisé le juste prix! Il consiste a faire afficher des photos et à demander à l'utilisateur d'entrer le juste prix, en fonction de ce qu'il a rentrer le programme dit si le prix et bon ou faux. Je vous met le code. Je travaille sur processing.
Mon problème est le suivant : Je veux que dans l'écran d'accueil l'utilisateur puisse choisir entre jouer aléatoirement ou jouer par thèmes, J'ai réussi sur 2 programmes différents à faire les deux séparément mais lorsque je met les deux combinés ca ne marche pas..
Merci de répondre au plus vite, j'espère avoir été claire, merci d'avance.
Je m'explique, je suis en terminale S option ISN et mon projet final est un jeu en ligne tiré du jeu télévisé le juste prix! Il consiste a faire afficher des photos et à demander à l'utilisateur d'entrer le juste prix, en fonction de ce qu'il a rentrer le programme dit si le prix et bon ou faux. Je vous met le code. Je travaille sur processing.
Mon problème est le suivant : Je veux que dans l'écran d'accueil l'utilisateur puisse choisir entre jouer aléatoirement ou jouer par thèmes, J'ai réussi sur 2 programmes différents à faire les deux séparément mais lorsque je met les deux combinés ca ne marche pas..
Merci de répondre au plus vite, j'espère avoir été claire, merci d'avance.
A voir également:
- Programme ISN Jeu le Juste prix
- 94 jeu - Télécharger - Puzzle & Réflexion
- Programme demarrage windows - Guide
- 94 degrés jeu - Télécharger - Divers Jeux
- Jeu zuma - Télécharger - Jeux vidéo
- Historique prix amazon - Guide
2 réponses
Voici le code pour les thèmes :
import javax.swing.*;
PImage[]images=new PImage[51];
int[]prix= {5, 29, 31, 45, 50, 70, 84, 113, 149, 247, 199, 239, 250, 270, 300, 350, 399, 420, 749, 804, 110, 115, 132, 134, 138, 399, 571, 1082, 1375, 1700, 1, 2, 3, 10, 35, 39, 46, 50, 66, 460, 9000, 16790, 19640, 19950, 23390, 24200, 39600, 46800, 75250, 88310};
int compteur=0;
int i;
int nb_coup=0;
PFont police;
PImage fond;
boolean running=false;
boolean test=false;
boolean test2=false;
int nombre;
PImage tmp;
int retour=0;
//////////////////////////////////////////////////////////////
void setup() {
test2=false;
fond=loadImage("fond.jpg");
police = loadFont("TwCenMT-Italic-48.vlw");
textFont(police, 60);
images[50]=fond;
running=false;
compteur=50;
//
for (int i=0; i<images.length-1; i++) {
images[i]=loadImage("jeu_"+i+".jpg");
}
size(images[compteur].width, images[compteur].height+100);
image(images[50], 0, 0);
}
///////////////////////////////////////////////////////////////////
void draw() {
intro();
if (running==true) {
jeu1();
affichage();
compare();
}
}
/////////////////////////////////////////////////////////////////
void affichage() {
if (running==true) {
image(images[compteur], 0, 0);
test=true;
//mousePressed=false;
} else {
intro();
}
}
////////////////////////////////////////////////////////////////
void prix() {
String s= (String)JOptionPane.showInputDialog( null, "Entrez un prix entier :", "Dialog",
JOptionPane.PLAIN_MESSAGE);
nombre= Integer.parseInt(s);
//println(nombre);
nb_coup=nb_coup+1;
//println(nb_coup);
println(compteur);
}
//////////////////////////////////////////////////////////////
void jeu1() {
if (test==true && mousePressed) {
prix();
}
}
///////////////////////////////////////////////////////////////
void compare() {
if (nombre<prix[compteur]) {
fill(0, 0, 0);
rect(0, images[compteur].height, images[compteur].width, images[compteur].height);
fill(255, 255, 255);
textSize(25);
text(nombre + " € : ", 100, images[compteur].height+50);
text("C'est plus !", 225, images[compteur].height+50);
}
if (nombre>prix[compteur]) {
fill(0, 0, 0);
rect(0, images[compteur].height, images[compteur].width, images[compteur].height);
fill(255, 255, 255);
textSize(25);
text(nombre + " € : ", 100, images[compteur].height+50);
text("C'est moins !", 225, images[compteur].height+50);
}
if (nombre==prix[compteur]) {
fill(0, 0, 0);
rect(0, images[compteur].height, images[compteur].width, images[compteur].height);
fill(random (255), random (255), random (255));
textSize(25);
text(nombre + " € : Bravo vous avez trouvé le juste prix en "+ nb_coup +" coups", images[compteur].width/2, images[compteur].height+50);
test=false;
text("Pressez espace pour rejouer", images[compteur].width/2, images[compteur].height+70);
if (keyPressed) {
if(key==' '){
mousePressed=false;
setup();
nb_coup=0;
}
}
}
}
///////////////////////////////////////////////////////////////
void intro() {
if(retour==0){
image(fond, 0, 0, 600,500);//affichage du fond
fill(0, 0, 0);
textAlign(CENTER);
text("Le Juste Prix", width/2, 75);
textSize(40);
//text("Jouer", width/2, 150);
}
if (mousePressed) {
if (mouseX>width/2-50 && mouseX < width/2+100 && mouseY>100 && mouseY<150) {
retour=1;
}
if (mouseX>width/2-100 && mouseX < width/2+200 && mouseY>170 && mouseY<200) {
retour=2;
}
if (mouseX>0 && mouseX < 500 && mouseY>400 && mouseY<540) {
retour=0;
}
}
if(retour==1){
running=true;
}
// pour afficher les regles du jeu
if (retour==2) {
test=false;
background(255);
text("Règles du jeu", width/2, 30);
line(150, 50, 450, 50);
textSize(20);
ellipse(20, 93, 10, 10);
ellipse(20, 145, 10, 10);
text("Lorsque l'image apparaît, cliquez dessus pour rentrer un prix.", 280, 100);
text("On peut choisir de jouer par thèmes :", 185, 150);
text("- 5 thèmes différents ; 10 photos par thèmes :", 230, 200);
text("1er thème : Beauté", 230, 250);
text("2eme thème : Loisirs", 240, 280);
text("3eme thème : Voitures", 250, 310);
text("4eme thème : Voyages", 260, 340);
text("5eme thème : Objets du quotidien", 310, 370);
textSize(25);
text("retour",500,500);
}
if(retour==0){
textSize(40);
text("Règles du jeu", width/2, 200);
textSize(40);
text("Thème 1", width/6, 300);
if (mousePressed && test2==false) {
if (mouseX>width/6-80 && mouseX < (width/6-80)+150 && mouseY>250 && mouseY<300) {
running=true;
test2=true;
theme1();// pour lancer le jeu
}
if (mouseX>width/6-80 && mouseX < width/(6-80)+200 && mouseY>350 && mouseY<400) {
running = true;
test2=true;
theme2();// pour lancer le jeu
}
if (mouseX>width/6-80 && mouseX < (width/6-80)+200 && mouseY>425 && mouseY<475) {
running = true;
test2=true;
theme3();// pour lancer le jeu
}
if (mouseX>width/1.25-80 && mouseX < (width/1.25-80)+200 && mouseY>275 && mouseY<325) {
running = true;
test2=true;
theme4();// pour lancer le jeu
}
if (mouseX>width/1.25-80 && mouseX < (width/1.25-80)+200 && mouseY>375 && mouseY<425) {
running = true;
test2=true;
theme5();// pour lancer le jeu
}
}
textSize(40);
text("Thème 2", width/6, 375);
//rect(width/6-80,350,200,50);
textSize(40);
text("Thème 3", width/6, 450);
//rect(width/6-80,425,200,50);
textSize(40);
text("Thème 4", width/1.25, 300);
//rect(width/1.25-80,275,200,50);
textSize(40);
text("Thème 5", width/1.25, 400);
//rect(width/1.25-80,375,200,50);
}
}
void theme1() {
compteur=(int)random(0, 9);
for (int i=0; i<10; i++) {
images[i]=loadImage("jeu_"+i+".jpg");
}
}
void theme2() {
compteur=(int)random(10, 19);
for (int i=10; i<20; i++) {
images[i]=loadImage("jeu_"+i+".jpg");
}
}
void theme3() {
compteur=(int)random(20, 29);
for (int i=20; i<30; i++) {
images[i]=loadImage("jeu_"+i+".jpg");
}
}
void theme4() {
compteur=(int)random(30, 39);
for (int i=30; i<40; i++) {
images[i]=loadImage("jeu_"+i+".jpg");
}
}
void theme5() {
compteur=(int)random(40, 49);
for (int i=40; i<50; i++) {
images[i]=loadImage("jeu_"+i+".jpg");
}
}
void mouseReleased(){
mousePressed=false;
}
import javax.swing.*;
PImage[]images=new PImage[51];
int[]prix= {5, 29, 31, 45, 50, 70, 84, 113, 149, 247, 199, 239, 250, 270, 300, 350, 399, 420, 749, 804, 110, 115, 132, 134, 138, 399, 571, 1082, 1375, 1700, 1, 2, 3, 10, 35, 39, 46, 50, 66, 460, 9000, 16790, 19640, 19950, 23390, 24200, 39600, 46800, 75250, 88310};
int compteur=0;
int i;
int nb_coup=0;
PFont police;
PImage fond;
boolean running=false;
boolean test=false;
boolean test2=false;
int nombre;
PImage tmp;
int retour=0;
//////////////////////////////////////////////////////////////
void setup() {
test2=false;
fond=loadImage("fond.jpg");
police = loadFont("TwCenMT-Italic-48.vlw");
textFont(police, 60);
images[50]=fond;
running=false;
compteur=50;
//
for (int i=0; i<images.length-1; i++) {
images[i]=loadImage("jeu_"+i+".jpg");
}
size(images[compteur].width, images[compteur].height+100);
image(images[50], 0, 0);
}
///////////////////////////////////////////////////////////////////
void draw() {
intro();
if (running==true) {
jeu1();
affichage();
compare();
}
}
/////////////////////////////////////////////////////////////////
void affichage() {
if (running==true) {
image(images[compteur], 0, 0);
test=true;
//mousePressed=false;
} else {
intro();
}
}
////////////////////////////////////////////////////////////////
void prix() {
String s= (String)JOptionPane.showInputDialog( null, "Entrez un prix entier :", "Dialog",
JOptionPane.PLAIN_MESSAGE);
nombre= Integer.parseInt(s);
//println(nombre);
nb_coup=nb_coup+1;
//println(nb_coup);
println(compteur);
}
//////////////////////////////////////////////////////////////
void jeu1() {
if (test==true && mousePressed) {
prix();
}
}
///////////////////////////////////////////////////////////////
void compare() {
if (nombre<prix[compteur]) {
fill(0, 0, 0);
rect(0, images[compteur].height, images[compteur].width, images[compteur].height);
fill(255, 255, 255);
textSize(25);
text(nombre + " € : ", 100, images[compteur].height+50);
text("C'est plus !", 225, images[compteur].height+50);
}
if (nombre>prix[compteur]) {
fill(0, 0, 0);
rect(0, images[compteur].height, images[compteur].width, images[compteur].height);
fill(255, 255, 255);
textSize(25);
text(nombre + " € : ", 100, images[compteur].height+50);
text("C'est moins !", 225, images[compteur].height+50);
}
if (nombre==prix[compteur]) {
fill(0, 0, 0);
rect(0, images[compteur].height, images[compteur].width, images[compteur].height);
fill(random (255), random (255), random (255));
textSize(25);
text(nombre + " € : Bravo vous avez trouvé le juste prix en "+ nb_coup +" coups", images[compteur].width/2, images[compteur].height+50);
test=false;
text("Pressez espace pour rejouer", images[compteur].width/2, images[compteur].height+70);
if (keyPressed) {
if(key==' '){
mousePressed=false;
setup();
nb_coup=0;
}
}
}
}
///////////////////////////////////////////////////////////////
void intro() {
if(retour==0){
image(fond, 0, 0, 600,500);//affichage du fond
fill(0, 0, 0);
textAlign(CENTER);
text("Le Juste Prix", width/2, 75);
textSize(40);
//text("Jouer", width/2, 150);
}
if (mousePressed) {
if (mouseX>width/2-50 && mouseX < width/2+100 && mouseY>100 && mouseY<150) {
retour=1;
}
if (mouseX>width/2-100 && mouseX < width/2+200 && mouseY>170 && mouseY<200) {
retour=2;
}
if (mouseX>0 && mouseX < 500 && mouseY>400 && mouseY<540) {
retour=0;
}
}
if(retour==1){
running=true;
}
// pour afficher les regles du jeu
if (retour==2) {
test=false;
background(255);
text("Règles du jeu", width/2, 30);
line(150, 50, 450, 50);
textSize(20);
ellipse(20, 93, 10, 10);
ellipse(20, 145, 10, 10);
text("Lorsque l'image apparaît, cliquez dessus pour rentrer un prix.", 280, 100);
text("On peut choisir de jouer par thèmes :", 185, 150);
text("- 5 thèmes différents ; 10 photos par thèmes :", 230, 200);
text("1er thème : Beauté", 230, 250);
text("2eme thème : Loisirs", 240, 280);
text("3eme thème : Voitures", 250, 310);
text("4eme thème : Voyages", 260, 340);
text("5eme thème : Objets du quotidien", 310, 370);
textSize(25);
text("retour",500,500);
}
if(retour==0){
textSize(40);
text("Règles du jeu", width/2, 200);
textSize(40);
text("Thème 1", width/6, 300);
if (mousePressed && test2==false) {
if (mouseX>width/6-80 && mouseX < (width/6-80)+150 && mouseY>250 && mouseY<300) {
running=true;
test2=true;
theme1();// pour lancer le jeu
}
if (mouseX>width/6-80 && mouseX < width/(6-80)+200 && mouseY>350 && mouseY<400) {
running = true;
test2=true;
theme2();// pour lancer le jeu
}
if (mouseX>width/6-80 && mouseX < (width/6-80)+200 && mouseY>425 && mouseY<475) {
running = true;
test2=true;
theme3();// pour lancer le jeu
}
if (mouseX>width/1.25-80 && mouseX < (width/1.25-80)+200 && mouseY>275 && mouseY<325) {
running = true;
test2=true;
theme4();// pour lancer le jeu
}
if (mouseX>width/1.25-80 && mouseX < (width/1.25-80)+200 && mouseY>375 && mouseY<425) {
running = true;
test2=true;
theme5();// pour lancer le jeu
}
}
textSize(40);
text("Thème 2", width/6, 375);
//rect(width/6-80,350,200,50);
textSize(40);
text("Thème 3", width/6, 450);
//rect(width/6-80,425,200,50);
textSize(40);
text("Thème 4", width/1.25, 300);
//rect(width/1.25-80,275,200,50);
textSize(40);
text("Thème 5", width/1.25, 400);
//rect(width/1.25-80,375,200,50);
}
}
void theme1() {
compteur=(int)random(0, 9);
for (int i=0; i<10; i++) {
images[i]=loadImage("jeu_"+i+".jpg");
}
}
void theme2() {
compteur=(int)random(10, 19);
for (int i=10; i<20; i++) {
images[i]=loadImage("jeu_"+i+".jpg");
}
}
void theme3() {
compteur=(int)random(20, 29);
for (int i=20; i<30; i++) {
images[i]=loadImage("jeu_"+i+".jpg");
}
}
void theme4() {
compteur=(int)random(30, 39);
for (int i=30; i<40; i++) {
images[i]=loadImage("jeu_"+i+".jpg");
}
}
void theme5() {
compteur=(int)random(40, 49);
for (int i=40; i<50; i++) {
images[i]=loadImage("jeu_"+i+".jpg");
}
}
void mouseReleased(){
mousePressed=false;
}
Et le code pour le jeu aléatoire : (il y a les thèmes mais en cliquant sur un thème c'est le jeu aléatoire qui se lance)
import javax.swing.*;
PImage[]images=new PImage[50];
int[]prix= {5, 29, 31, 45, 50, 70, 84, 113, 149, 247, 199, 239, 250, 270, 300, 350, 399, 420, 749, 804, 110, 115, 132, 134, 138, 399, 571, 1082, 1375, 1700, 1, 2, 3, 10, 35, 39, 46, 50, 66, 460, 9000, 16790, 19640, 19950, 23390, 24200, 39600, 46800, 75250, 88310};
int compteur=0;
int i;
int nb_coup=0;
PFont police;
PImage fond;
boolean running=false;
boolean test=false;
int nombre;
PImage tmp;
int retour=0;
//////////////////////////////////////////////////////////////
void setup() {
fond=loadImage("fond.jpg");
police = loadFont("TwCenMT-Italic-48.vlw");
textFont(police, 60);
tmp=fond;
running=false;
compteur=(int)random(0, 50);
for (int i=0; i<images.length; i++) {
images[i]=loadImage("jeu_"+i+".jpg");
}
size(images[compteur].width, images[compteur].height+100);
image(tmp, 0, 0);
}
///////////////////////////////////////////////////////////////////
void draw() {
intro();
if (running==true) {
jeu1();
affichage();
compare();
}
}
/////////////////////////////////////////////////////////////////
void affichage() {
if (running==true) {
image(images[compteur], 0, 0);
test=true;
//mousePressed=false;
} else {
intro();
}
}
////////////////////////////////////////////////////////////////
void prix() {
String s= (String)JOptionPane.showInputDialog( null, "Entrez un prix entier :", "Dialog",
JOptionPane.PLAIN_MESSAGE);
nombre= Integer.parseInt(s);
println(nombre);
nb_coup=nb_coup+1;
println(nb_coup);
}
//////////////////////////////////////////////////////////////
void jeu1() {
if (test==true && mousePressed) {
prix();
}
}
///////////////////////////////////////////////////////////////
void compare() {
if (nombre<prix[compteur]) {
fill(0, 0, 0);
rect(0, images[compteur].height, images[compteur].width, images[compteur].height);
fill(255, 255, 255);
textSize(25);
text(nombre + " € : ", 100, images[compteur].height+50);
text("C'est plus !", 225, images[compteur].height+50);
}
if (nombre>prix[compteur]) {
fill(0, 0, 0);
rect(0, images[compteur].height, images[compteur].width, images[compteur].height);
fill(255, 255, 255);
textSize(25);
text(nombre + " € : ", 100, images[compteur].height+50);
text("C'est moins !", 225, images[compteur].height+50);
}
if (nombre==prix[compteur]) {
fill(0, 0, 0);
rect(0, images[compteur].height, images[compteur].width, images[compteur].height);
fill(random (255), random (255), random (255));
textSize(25);
text(nombre + " € : Bravo vous avez trouvé le juste prix en "+ nb_coup +" coups", images[compteur].width/2, images[compteur].height+50);
test=false;
text("Pressez espace pour rejouer", images[compteur].width/2, images[compteur].height+70);
if (keyPressed) {
setup();
nb_coup=0;
}
}
}
///////////////////////////////////////////////////////////////
void intro() {
if(retour==0){
image(fond, 0, 0, 600,500);//affichage du fond
fill(0, 0, 0);
textAlign(CENTER);
text("Le Juste Prix", width/2, 75);
textSize(40);
text("Jouer", width/2, 150);
}
if (mousePressed) {
if (mouseX>width/2-50 && mouseX < width/2+100 && mouseY>100 && mouseY<150) {
retour=1;
}
}
if(retour==1){
running=true;
}
if (mousePressed) {
if (mouseX>width/2-100 && mouseX < width/2+200 && mouseY>170 && mouseY<200) {
retour=2;
}
// pour afficher les regles du jeu
if (retour==2) {
test=false;
background(255);
text("Règles du jeu", width/2, 30);
line(150, 50, 450, 50);
textSize(20);
ellipse(20, 93, 10, 10);
ellipse(20, 145, 10, 10);
text("Lorsque l'image apparaît, cliquez dessus pour rentrer un prix.", 280, 100);
text("On peut choisir de jouer par thèmes :", 185, 150);
text("- 5 thèmes différents ; 10 photos par thèmes :", 230, 200);
text("1er thème : Beauté", 230, 250);
text("2eme thème : Loisirs", 240, 280);
text("3eme thème : Voitures", 250, 310);
text("4eme thème : Voyages", 260, 340);
text("5eme thème : Objets du quotidien", 310, 370);
textSize(25);
text("retour",500,500);
if (mousePressed) {
if (mouseX>0 && mouseX < 500 && mouseY>400 && mouseY<540) {
retour=0;
}
}
}}
if(retour==0){
textSize(40);
text("Règles du jeu", width/2, 200);
textSize(40);
text("Thème 1", width/6, 300);
if (mousePressed) {
if (mouseX>width/6-80 && mouseX < (width/6-80)+150 && mouseY>250 && mouseY<300) {
running = true;// pour lancer le jeu
}}
textSize(40);
text("Thème 2", width/6, 375);
//rect(width/6-80,350,200,50);
if (mousePressed) {
if (mouseX>width/6-80 && mouseX < width/(6-80)+200 && mouseY>350 && mouseY<400) {
running = true;// pour lancer le jeu
}}
textSize(40);
text("Thème 3", width/6, 450);
//rect(width/6-80,425,200,50);
if (mousePressed) {
if (mouseX>width/6-80 && mouseX < (width/6-80)+200 && mouseY>425 && mouseY<475) {
running = true;// pour lancer le jeu
}}
textSize(40);
text("Thème 4", width/1.25, 300);
//rect(width/1.25-80,275,200,50);
if (mousePressed) {
if (mouseX>width/1.25-80 && mouseX < (width/1.25-80)+200 && mouseY>275 && mouseY<325) {
running = true;// pour lancer le jeu
}}
textSize(40);
text("Thème 5", width/1.25, 400);
//rect(width/1.25-80,375,200,50);
if (mousePressed) {
if (mouseX>width/1.25-80 && mouseX < (width/1.25-80)+200 && mouseY>375 && mouseY<425) {
running = true;// pour lancer le jeu
}}
}
}
import javax.swing.*;
PImage[]images=new PImage[50];
int[]prix= {5, 29, 31, 45, 50, 70, 84, 113, 149, 247, 199, 239, 250, 270, 300, 350, 399, 420, 749, 804, 110, 115, 132, 134, 138, 399, 571, 1082, 1375, 1700, 1, 2, 3, 10, 35, 39, 46, 50, 66, 460, 9000, 16790, 19640, 19950, 23390, 24200, 39600, 46800, 75250, 88310};
int compteur=0;
int i;
int nb_coup=0;
PFont police;
PImage fond;
boolean running=false;
boolean test=false;
int nombre;
PImage tmp;
int retour=0;
//////////////////////////////////////////////////////////////
void setup() {
fond=loadImage("fond.jpg");
police = loadFont("TwCenMT-Italic-48.vlw");
textFont(police, 60);
tmp=fond;
running=false;
compteur=(int)random(0, 50);
for (int i=0; i<images.length; i++) {
images[i]=loadImage("jeu_"+i+".jpg");
}
size(images[compteur].width, images[compteur].height+100);
image(tmp, 0, 0);
}
///////////////////////////////////////////////////////////////////
void draw() {
intro();
if (running==true) {
jeu1();
affichage();
compare();
}
}
/////////////////////////////////////////////////////////////////
void affichage() {
if (running==true) {
image(images[compteur], 0, 0);
test=true;
//mousePressed=false;
} else {
intro();
}
}
////////////////////////////////////////////////////////////////
void prix() {
String s= (String)JOptionPane.showInputDialog( null, "Entrez un prix entier :", "Dialog",
JOptionPane.PLAIN_MESSAGE);
nombre= Integer.parseInt(s);
println(nombre);
nb_coup=nb_coup+1;
println(nb_coup);
}
//////////////////////////////////////////////////////////////
void jeu1() {
if (test==true && mousePressed) {
prix();
}
}
///////////////////////////////////////////////////////////////
void compare() {
if (nombre<prix[compteur]) {
fill(0, 0, 0);
rect(0, images[compteur].height, images[compteur].width, images[compteur].height);
fill(255, 255, 255);
textSize(25);
text(nombre + " € : ", 100, images[compteur].height+50);
text("C'est plus !", 225, images[compteur].height+50);
}
if (nombre>prix[compteur]) {
fill(0, 0, 0);
rect(0, images[compteur].height, images[compteur].width, images[compteur].height);
fill(255, 255, 255);
textSize(25);
text(nombre + " € : ", 100, images[compteur].height+50);
text("C'est moins !", 225, images[compteur].height+50);
}
if (nombre==prix[compteur]) {
fill(0, 0, 0);
rect(0, images[compteur].height, images[compteur].width, images[compteur].height);
fill(random (255), random (255), random (255));
textSize(25);
text(nombre + " € : Bravo vous avez trouvé le juste prix en "+ nb_coup +" coups", images[compteur].width/2, images[compteur].height+50);
test=false;
text("Pressez espace pour rejouer", images[compteur].width/2, images[compteur].height+70);
if (keyPressed) {
setup();
nb_coup=0;
}
}
}
///////////////////////////////////////////////////////////////
void intro() {
if(retour==0){
image(fond, 0, 0, 600,500);//affichage du fond
fill(0, 0, 0);
textAlign(CENTER);
text("Le Juste Prix", width/2, 75);
textSize(40);
text("Jouer", width/2, 150);
}
if (mousePressed) {
if (mouseX>width/2-50 && mouseX < width/2+100 && mouseY>100 && mouseY<150) {
retour=1;
}
}
if(retour==1){
running=true;
}
if (mousePressed) {
if (mouseX>width/2-100 && mouseX < width/2+200 && mouseY>170 && mouseY<200) {
retour=2;
}
// pour afficher les regles du jeu
if (retour==2) {
test=false;
background(255);
text("Règles du jeu", width/2, 30);
line(150, 50, 450, 50);
textSize(20);
ellipse(20, 93, 10, 10);
ellipse(20, 145, 10, 10);
text("Lorsque l'image apparaît, cliquez dessus pour rentrer un prix.", 280, 100);
text("On peut choisir de jouer par thèmes :", 185, 150);
text("- 5 thèmes différents ; 10 photos par thèmes :", 230, 200);
text("1er thème : Beauté", 230, 250);
text("2eme thème : Loisirs", 240, 280);
text("3eme thème : Voitures", 250, 310);
text("4eme thème : Voyages", 260, 340);
text("5eme thème : Objets du quotidien", 310, 370);
textSize(25);
text("retour",500,500);
if (mousePressed) {
if (mouseX>0 && mouseX < 500 && mouseY>400 && mouseY<540) {
retour=0;
}
}
}}
if(retour==0){
textSize(40);
text("Règles du jeu", width/2, 200);
textSize(40);
text("Thème 1", width/6, 300);
if (mousePressed) {
if (mouseX>width/6-80 && mouseX < (width/6-80)+150 && mouseY>250 && mouseY<300) {
running = true;// pour lancer le jeu
}}
textSize(40);
text("Thème 2", width/6, 375);
//rect(width/6-80,350,200,50);
if (mousePressed) {
if (mouseX>width/6-80 && mouseX < width/(6-80)+200 && mouseY>350 && mouseY<400) {
running = true;// pour lancer le jeu
}}
textSize(40);
text("Thème 3", width/6, 450);
//rect(width/6-80,425,200,50);
if (mousePressed) {
if (mouseX>width/6-80 && mouseX < (width/6-80)+200 && mouseY>425 && mouseY<475) {
running = true;// pour lancer le jeu
}}
textSize(40);
text("Thème 4", width/1.25, 300);
//rect(width/1.25-80,275,200,50);
if (mousePressed) {
if (mouseX>width/1.25-80 && mouseX < (width/1.25-80)+200 && mouseY>275 && mouseY<325) {
running = true;// pour lancer le jeu
}}
textSize(40);
text("Thème 5", width/1.25, 400);
//rect(width/1.25-80,375,200,50);
if (mousePressed) {
if (mouseX>width/1.25-80 && mouseX < (width/1.25-80)+200 && mouseY>375 && mouseY<425) {
running = true;// pour lancer le jeu
}}
}
}