LOLAR

Untitled

Apr 21st, 2016
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.13 KB | None | 0 0
  1. class Room18 {
  2. PImage room18;
  3. PImage arrow;
  4. PImage openBook;
  5. PImage tornPage;
  6. PImage ritualBg1;
  7. PImage ritualBg2;
  8. PImage lamp;
  9. PImage dagger;
  10. PImage lightbringer;
  11. PImage elixir;
  12. PImage glove;
  13. PImage amulet;
  14. PImage kruisje;
  15. PImage flashing1;
  16. PImage flashing2;
  17. PImage lore7_1_1, lore7_1_2, lore7_1_3, lore7_2_1, lore7_2_2, lore7_2_3;
  18. PImage nextpage, previouspage;
  19. boolean firstTime;
  20. boolean openLoreBook;
  21. boolean ritual;
  22. boolean flashingImg1;
  23. boolean flashingImg2;
  24. boolean flash1;
  25. boolean flash2;
  26. boolean cured1;
  27. boolean playSound;
  28. boolean hint;
  29. String loadText;
  30. int timer1;
  31. int timer2;
  32. int time1;
  33. int time2;
  34. int stopFlash1;
  35. int stopFlash2;
  36. int x = 0;
  37. int y = 1;
  38.  
  39. Room18() {
  40. room18 = loadImage("Room 18 - The_Ritual.jpg");
  41. openBook = loadImage("lore_open_book.png");
  42. tornPage = loadImage("torn_page.png");
  43. ritualBg1 = loadImage("ritual_background_1.png");
  44. ritualBg2 = loadImage("ritual_background_2.png");
  45. lamp = loadImage("genie_lamp.png");
  46. dagger = loadImage("dagger.png");
  47. lightbringer = loadImage("lightbringer.png");
  48. elixir = loadImage("vial_02.png");
  49. glove = loadImage("glove.png");
  50. amulet = loadImage("amulet.png");
  51. kruisje = loadImage("kruisje.png");
  52. flashing1 = loadImage("ritual.png");
  53. flashing2 = loadImage("flashing_eyes.png");
  54. arrow = loadImage("ARROWDOWN.png");
  55. lore7_1_1 = loadImage("Lore7_1_1.png");
  56. lore7_1_2 = loadImage("Lore7_1_2.png");
  57. lore7_1_3 = loadImage("Lore7_1_3.png");
  58. lore7_2_1 = loadImage("Lore7_2_1.png");
  59. lore7_2_2 = loadImage("Lore7_2_2.png");
  60. lore7_2_3 = loadImage("Lore7_2_3.png");
  61. nextpage = loadImage("nextpage_right.png");
  62. previouspage = loadImage("nextpage_left.png");
  63. }
  64. void Roomload() {
  65. isRepeating = true;
  66. playSound = true;
  67. background(room18);
  68. if (mouseX > 111 && mouseX <166 && mouseY > 664 && mouseY < 800) {
  69. image (arrow, 90, 670, 420/5, 600/5);
  70. }
  71. if (openLoreBook) {
  72. image(openBook, 140, 34);
  73. image(lore7_1_1, 202, 50, 420, 670);
  74. image(lore7_1_2, 685, 50, 420, 670);
  75. image(tornPage, 1030, 690, 60, 60);
  76. image(nextpage, 912, 725);
  77. }
  78. if (openLoreBook && y == 2) {
  79. image(openBook, 140, 34);
  80. image(tornPage, 1030, 690, 60, 60);
  81. image(previouspage, 202, 725);
  82. image(nextpage, 912, 725);
  83. image(lore7_1_3, 202, 50, 420, 492);
  84. image(lore7_2_1, 685, 50, 420, 670);
  85. }
  86. if (openLoreBook && y == 3) {
  87. image(openBook, 140, 34);
  88. image(tornPage, 1030, 690, 60, 60);
  89. image(lore7_2_2, 202, 50, 420, 436);
  90. image(lore7_2_3, 685, 50, 420, 298);
  91. image(previouspage, 202, 725);
  92. }
  93.  
  94. if (ritual) {
  95. image(ritualBg1, 452, 163);
  96. image(kruisje, 765, 570, 50, 50);
  97. }
  98. if (mouseX > 607 && mouseX <688 && mouseY > 546 && mouseY <600 && ritual) {
  99. image(ritualBg2, 452, 163);
  100. image(kruisje, 765, 570, 50, 50);
  101. }
  102. if (room2.vial && ritual) {
  103. image(elixir, 537, 344);
  104. }
  105. if (room9.glove && ritual) {
  106. image(glove, 619, 346);
  107. }
  108. if (room4.lightbringer && ritual) {
  109. image(lightbringer, 706, 345);
  110. }
  111. if (!room5.puzzleSolved && ritual) {
  112. image(dagger, 530, 440);
  113. }
  114. if (room6.lamp && ritual) {
  115. image(lamp, 614, 453);
  116. }
  117. if (room3.amulet && ritual) {
  118. image(amulet, 720, 441);
  119. }
  120. if (flashingImg1) {
  121. if (flash1) {
  122. image (flashing1, 0, 0);
  123. }
  124. if (!flash1) {
  125. background(0);
  126. }
  127. if (millis()/100 > time1) {
  128. flash1 = !flash1;
  129. time1= time1 + 1;
  130. if (stopFlash1 + 6 == time1) {
  131. flashingImg1 = false;
  132. flashingImg2 = true;
  133. time2 = millis()/100;
  134. stopFlash2 = time1;
  135. }
  136. }
  137. }
  138. if (flashingImg2) {
  139. delay(20);
  140. if (flash2) {
  141. image (flashing2, 490, 334);
  142. }
  143. if (!flash2) {
  144. background(0);
  145. }
  146.  
  147. if (millis()/100 > time2) {
  148. flash2 = !flash2;
  149. time2= time2 + 1;
  150. if (stopFlash2 + 12 == time2) {
  151. flashingImg2 = false;
  152. loadText = "ritual";
  153. timer2 = millis();
  154. cured.play();
  155. }
  156. }
  157. }
  158. if (hint && difficulty.hints && x == 1) {
  159. imageMode(CENTER);
  160. image(hintScroll, 640, 100);
  161. imageMode(CORNER);
  162. loadText = "hint1";
  163. showtext();
  164. loadText = "hint2";
  165. showtext();
  166. image(kruisje, 966, 80, 40, 40);
  167. }
  168. if (difficulty.room_cleared && cured1) {
  169. loadText="cleared";
  170. timer2 = millis();
  171. hint = false;
  172. }
  173. if (millis() - timer2 < 3500) {
  174. showtext();
  175. }
  176. if (millis () - timer1 < 6000) {
  177. fill(255);
  178. textAlign(CENTER);
  179. textFont(font1);
  180. text("The Ritual", 640, 50);
  181. textAlign(BASELINE);
  182. fill(138, 7, 7);
  183. }
  184. if (difficulty.hints){
  185. image(hintIcon, 1201, 49);
  186. }
  187. timer();
  188. if (mouseX > 862 && mouseX < 941 && mouseY > 418 && mouseY < 494 && !ritual && !cured1 && !openLoreBook) {
  189. cursor(cursor4, 5, 5);
  190. } else if (!(mouseX > 862 && mouseX < 941 && mouseY > 418 && mouseY < 494)) {
  191. cursor(cursor1, 5, 5);
  192. }
  193. }
  194.  
  195. void keyCheck() {
  196.  
  197. if (!openLoreBook) {
  198. if (mouseX > 975 && mouseX < 1004 && mouseY > 87 && mouseY < 123)
  199. {
  200. hint = false;
  201. }
  202. if (mouseX > 1208 && mouseX < 1253 && mouseY > 55 && mouseY < 101)
  203. {
  204. hint = true;
  205. x++;
  206. if (x==2) {
  207. x=1;
  208. }
  209. }
  210.  
  211. if (!cured1) {
  212. if (mouseX > 776 && mouseX < 815 && mouseY > 576 && mouseY < 622 && ritual) {
  213. ritual = false;
  214. }
  215. if ((mouseX > 614 && mouseX < 677 && mouseY > 548 && mouseY < 594 && ritual) && (!room2.vial || !room9.glove || !room4.lightbringer || room5.puzzleSolved || !room6.lamp || !room3.amulet)) {
  216. loadText = "incomplete";
  217. timer2 = millis(); // bij toevoegen puzzel voorwaarde aanpassen.
  218. }
  219. if (mouseX > 614 && mouseX < 677 && mouseY > 548 && mouseY < 594 && ritual && room2.vial && room9.glove && room4.lightbringer && !room5.puzzleSolved && room6.lamp && room3.amulet) {
  220. ritual = false;
  221. inventory.elixirV = false;
  222. inventory.amuletV = false;
  223. inventory.daggerV = false;
  224. inventory.gloveV = false;
  225. inventory.genieLampV = false;
  226. cured1 = true;
  227. flashingImg1 = true;
  228. time1 = millis()/100;
  229. stopFlash1 = time1;
  230. }
  231. if (mouseX > 862 && mouseX < 941 && mouseY > 418 && mouseY < 494) {
  232. ritual = true;
  233. }
  234. }
  235. if (mouseX > 706 && mouseX < 756 && mouseY > 425 && mouseY < 501 && !lorebook.lore07 && !ritual) {
  236. openLoreBook = true;
  237. lorebook.lore07 = true;
  238.  
  239. timerPause = true;
  240. }
  241. if (mouseX > 111 && mouseX < 166 && mouseY > 664 && mouseY < 800) {
  242. song1room16.play();
  243. song1room16.rewind();
  244. kamer = 16;
  245. room16.timer1 = millis();
  246. timer2 = 0;
  247. whisper.pause();
  248. }
  249. }
  250. if (mouseX > 820 && mouseX < 1008 && mouseY > 725 && mouseY < 760 && openLoreBook)
  251. {
  252. y++;
  253. if (y >= 1 && y <= 4) {
  254. pageflip.play();
  255. pageflip.rewind();
  256. }
  257. if (y==4) {
  258. y=3;
  259. }
  260. }
  261. if (mouseX > 202 && mouseX < 300 && mouseY > 725 && mouseY < 760 && openLoreBook)
  262. {
  263. y--;
  264. if (y >= 1 && y <= 4) {
  265. pageflip.play();
  266. pageflip.rewind();
  267. }
  268. if (y==0) {
  269. y=1;
  270. }
  271. }
  272. if (mouseX > 862 && mouseX < 941 && mouseY > 418 && mouseY < 494 && cured1) {
  273. loadText = "alreadyCured";
  274. timer2 = millis();
  275. }
  276. if (mouseX > 1000 && mouseX < 1086 && mouseY > 678 && mouseY < 783 && openLoreBook ) {
  277. openLoreBook = false;
  278. firstTime = true;
  279. timerPause = false;
  280. loadText = "tornPage";
  281. timer2 = millis();
  282. song5.play();
  283. song5.rewind();
  284. }
  285. }
  286.  
  287. void showtext() {
  288. fill(255);
  289. textAlign(CENTER);
  290. textFont(font2);
  291. switch (loadText) {
  292. case "tornPage" :
  293. text("You tear these pages from the book and add them to the Book of Eye.", 640, 785);
  294. break;
  295. case "incomplete" :
  296. text("You do not possess all required items to perform the Ritual.", 640, 785);
  297. break;
  298. case "ritual" :
  299. text("You cleanse yourself from the curse.", 640, 785);
  300. break;
  301. case "alreadyCured" :
  302. text("You have already been cured...", 640, 785);
  303. break;
  304. case "hint1" :
  305. fill(0);
  306. text("1. Use the burning tray to perform the ritual", 600, 75);
  307. break;
  308. case "hint2" :
  309. fill(0);
  310. text("and cure yourself.", 600, 115);
  311. break;
  312. case "cleared":
  313. fill(255);
  314. text("The Ritual - Cleared", 640, 80 );
  315. break;
  316. }
  317. textAlign(BASELINE);
  318. fill(138, 7, 7);
  319. }
  320. }
Advertisement
Add Comment
Please, Sign In to add comment