Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- boolean game;
- int jouer = 1;
- int z=0,w=0;
- int Grid[][] = new int[18][25];
- int background[][] = new int[50][60];
- PFont police;
- int timeBuff;
- int currentPos[];
- void setup() {
- size(700, 800); //taile fenetre 704 pixels en X pour complet un careau pareille pour Y avec 809 pixels
- for (int x = 0; x < 47; x++) //nombres careaux dans dans la fenetre en X
- for (int y = 0; y < 54; y++) //nombres careaux dans dans la fenetre en Y
- if (random(100) < 45) background[x][y] = int(random(1, 8)); //45 est le % carreaux en couleure et 1 et 8 sont la plages de couleur des carreaux
- if (game) {
- for (int x = 0; x < 18; x++) {
- for (int y = 0; y < 25; y++) {
- if (Grid[x][y] == 0) fill(100);
- else if (Grid[x][y] == 1) fill(50, 150, 255);
- else if (Grid[x][y] == 2) fill(0, 0, 255);
- else if (Grid[x][y] == 3) fill(255, 150, 0);
- else if (Grid[x][y] == 4) fill(255, 255, 0);
- else if (Grid[x][y] == 5) fill(100, 255, 0);
- else if (Grid[x][y] == 6) fill(150, 0, 150);
- else fill(255, 0, 0);
- rect(x*15, y*15, 16, 16);
- }
- }
- }
- else {
- for (int x = 0; x < 50; x++) {
- for (int y = 0; y < 60; y++) {
- if (background[x][y] == 0) fill(100);
- else if (background[x][y] == 1) fill(50, 150, 255);
- else if (background[x][y] == 2) fill(0, 0, 255);
- else if (background[x][y] == 3) fill(255, 150, 0);
- else if (background[x][y] == 4) fill(255, 255, 0);
- else if (background[x][y] == 5) fill(100, 255, 0);
- else if (background[x][y] == 6) fill(150, 0, 150);
- else fill(255, 0, 0);
- rect(x*15, y*15, 16, 16);
- }
- }
- }
- stroke(0,51,102);
- strokeWeight(5);
- fill(255,255,255);
- rect(151,332,401,100);
- fill(0);
- textSize(56);
- text("Jouer",width/2-75,height/2);
- fill(255);
- fill(0,100,102);
- strokeWeight(5);
- rect(182,550,340,80);
- textSize(28);
- fill(0);
- text("Quitter",300,600);
- }
- void draw(){
- PImage P; //on définit a comme contenant une image
- P = loadImage("PARAMETRE.jpg"); //on charge l'image, et on la stocke dans a
- image(P, 586, 660, 75, 75);
- }
- void mousePressed(){
- if(!game){
- if(mouseX<522 && mouseX>182 && mouseY<630 && mouseY>550){ //ouvrir rectangle et le temporiser puis appuyer sur non = revient menu vs oui = exit()
- z=1;
- fill(255,255,255);
- rect(width/2-264,height/2-106,530,168);
- fill(0,0,0);
- text("Voulez-vous vraiment quitter le jeu ?",100,330);
- fill(255,255,255);
- rect(100,360,200,90,30);
- rect(404,360,200,90,30);
- fill(0,0,0);
- text("OUI", 175, 415);
- text("NON", 475, 415);
- }
- if(mouseX > 100 && mouseX < 300 && mouseY > 360 && mouseY < 450 && z==1){
- exit();
- }
- else if(mouseX > 404 && mouseX < 604 && mouseY > 360 && mouseY < 450 && z==1){ //Demande de confirmation (clic sur "NON")
- if(mousePressed==true){
- setup();
- }
- }
- }
- if(mouseX > 584 && mouseX < 659 && mouseY > 660 && mouseY < 735){
- w=1;
- rect(width/2-250,height/2-300,500,500,30);
- rect(100,100,166,100);
- rect(266,100,166,100);
- rect(432,100,166,100);
- fill(255);
- text("Mode Solo",110,160);
- text("Mode Duo",276,160);
- text("Règles",470,140);
- text("du jeu",470,170);
- }
- if(mouseX < 552 && mouseX > 151 && mouseY > 332 && mouseY < 432){
- jouer = 1;
- }
- }
- void mouseMoved(){
- if(mouseX > 432 && mouseX < 598 && mouseY > 100 && mouseY < 200 && w==1){
- text("Pacman doit éviter les fantômes.",130,230);
- text("En mangeant la pillule de puissance",105,260);
- text("Il peut manger les fantômes",150,290);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement