Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.14 KB | None | 0 0
  1. boolean game;
  2. int jouer = 1;
  3. int z=0,w=0;
  4. int Grid[][] = new int[18][25];
  5. int background[][] = new int[50][60];
  6. PFont police;
  7. int timeBuff;
  8. int currentPos[];
  9.  
  10.  
  11. void setup() {
  12.  
  13. size(700, 800); //taile fenetre 704 pixels en X pour complet un careau pareille pour Y avec 809 pixels
  14.  
  15. for (int x = 0; x < 47; x++) //nombres careaux dans dans la fenetre en X
  16. for (int y = 0; y < 54; y++) //nombres careaux dans dans la fenetre en Y
  17. 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
  18. if (game) {
  19. for (int x = 0; x < 18; x++) {
  20. for (int y = 0; y < 25; y++) {
  21. if (Grid[x][y] == 0) fill(100);
  22. else if (Grid[x][y] == 1) fill(50, 150, 255);
  23. else if (Grid[x][y] == 2) fill(0, 0, 255);
  24. else if (Grid[x][y] == 3) fill(255, 150, 0);
  25. else if (Grid[x][y] == 4) fill(255, 255, 0);
  26. else if (Grid[x][y] == 5) fill(100, 255, 0);
  27. else if (Grid[x][y] == 6) fill(150, 0, 150);
  28. else fill(255, 0, 0);
  29. rect(x*15, y*15, 16, 16);
  30. }
  31. }
  32.  
  33.  
  34. }
  35. else {
  36. for (int x = 0; x < 50; x++) {
  37. for (int y = 0; y < 60; y++) {
  38. if (background[x][y] == 0) fill(100);
  39. else if (background[x][y] == 1) fill(50, 150, 255);
  40. else if (background[x][y] == 2) fill(0, 0, 255);
  41. else if (background[x][y] == 3) fill(255, 150, 0);
  42. else if (background[x][y] == 4) fill(255, 255, 0);
  43. else if (background[x][y] == 5) fill(100, 255, 0);
  44. else if (background[x][y] == 6) fill(150, 0, 150);
  45. else fill(255, 0, 0);
  46. rect(x*15, y*15, 16, 16);
  47. }
  48. }
  49. }
  50.  
  51. stroke(0,51,102);
  52. strokeWeight(5);
  53. fill(255,255,255);
  54. rect(151,332,401,100);
  55.  
  56.  
  57. fill(0);
  58. textSize(56);
  59. text("Jouer",width/2-75,height/2);
  60. fill(255);
  61.  
  62.  
  63. fill(0,100,102);
  64. strokeWeight(5);
  65. rect(182,550,340,80);
  66. textSize(28);
  67. fill(0);
  68. text("Quitter",300,600);
  69.  
  70.  
  71.  
  72. }
  73.  
  74. void draw(){
  75.  
  76.  
  77. PImage P; //on définit a comme contenant une image
  78. P = loadImage("PARAMETRE.jpg"); //on charge l'image, et on la stocke dans a
  79. image(P, 586, 660, 75, 75);
  80.  
  81.  
  82. }
  83.  
  84.  
  85. void mousePressed(){
  86.  
  87. if(!game){
  88. if(mouseX<522 && mouseX>182 && mouseY<630 && mouseY>550){ //ouvrir rectangle et le temporiser puis appuyer sur non = revient menu vs oui = exit()
  89.  
  90. z=1;
  91. fill(255,255,255);
  92. rect(width/2-264,height/2-106,530,168);
  93. fill(0,0,0);
  94. text("Voulez-vous vraiment quitter le jeu ?",100,330);
  95.  
  96.  
  97. fill(255,255,255);
  98. rect(100,360,200,90,30);
  99. rect(404,360,200,90,30);
  100. fill(0,0,0);
  101. text("OUI", 175, 415);
  102. text("NON", 475, 415);
  103.  
  104.  
  105. }
  106.  
  107. if(mouseX > 100 && mouseX < 300 && mouseY > 360 && mouseY < 450 && z==1){
  108. exit();
  109. }
  110.  
  111. else if(mouseX > 404 && mouseX < 604 && mouseY > 360 && mouseY < 450 && z==1){ //Demande de confirmation (clic sur "NON")
  112.  
  113. if(mousePressed==true){
  114.  
  115.  
  116. setup();
  117. }
  118. }
  119.  
  120. }
  121.  
  122.  
  123.  
  124. if(mouseX > 584 && mouseX < 659 && mouseY > 660 && mouseY < 735){
  125. w=1;
  126. rect(width/2-250,height/2-300,500,500,30);
  127. rect(100,100,166,100);
  128. rect(266,100,166,100);
  129. rect(432,100,166,100);
  130. fill(255);
  131. text("Mode Solo",110,160);
  132. text("Mode Duo",276,160);
  133. text("Règles",470,140);
  134. text("du jeu",470,170);
  135. }
  136.  
  137. if(mouseX < 552 && mouseX > 151 && mouseY > 332 && mouseY < 432){
  138. jouer = 1;
  139. }
  140.  
  141. }
  142. void mouseMoved(){
  143.  
  144. if(mouseX > 432 && mouseX < 598 && mouseY > 100 && mouseY < 200 && w==1){
  145.  
  146. text("Pacman doit éviter les fantômes.",130,230);
  147. text("En mangeant la pillule de puissance",105,260);
  148. text("Il peut manger les fantômes",150,290);
  149. }
  150. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement