Spiel für das Medientheater HBK Saar, Teil des Projektes "Fun Palace" (Reupload der Repository von 2017)
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

class_button.pde 1.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. class Button {
  2. int x, y, z, w, h;
  3. int xspeed;
  4. PImage img;
  5. String WhatToDo;
  6. boolean hover() {
  7. if (laserX>x && laserX< x +w&& laserY>y && laserY<y+h) {
  8. return true;
  9. } else {
  10. return false;
  11. }
  12. }
  13. Button (int X, int Y, int Z, int W, int H, int Xspeed, PImage Img, String WTD) {
  14. x= X;
  15. y = Y;
  16. z=Z;
  17. xspeed=Xspeed;
  18. w = W;
  19. h = H;
  20. img = Img.get();
  21. WhatToDo = WTD;
  22. }
  23. void clicked() {
  24. if (WhatToDo.equals("color")) {
  25. for (int i=0; i< t1.length; i++) {
  26. t1[i].apparition();
  27. t2[i].apparition();
  28. t3[i].apparition();
  29. stocks[i].apparition();
  30. }
  31. }
  32. if (WhatToDo.equals("virus")) {
  33. for (int i=0; i< t1.length; i++) {
  34. t1[i].crazy();
  35. t2[i].crazy();
  36. t3[i].crazy();
  37. }
  38. }
  39. if (WhatToDo.equals("sound")) {
  40. song =minim.loadFile ("door24.mp3");
  41. song.play();
  42. }
  43. if (WhatToDo.equals("intro")) {
  44. start = true;
  45. }
  46. if (WhatToDo.equals("levelone")) {
  47. level1 =! level1;
  48. }
  49. if (WhatToDo.equals("leveltwo")) {
  50. level2 =! level2;
  51. }
  52. if (WhatToDo.equals("leveltree")) {
  53. level3 =! level3;
  54. }
  55. if (WhatToDo.equals("doorbutton")) {
  56. //THIS IS THE GAMES ENDING!! YOU CLICKED THE DOOR!! WHAT HAPPENS NOW?
  57. win = true;
  58. //play second door video.
  59. door.stop();
  60. door = new Movie (app, "part2.mov");
  61. door.play();
  62. }
  63. }
  64. void display() {
  65. if (WhatToDo.equals("doorbutton")) {
  66. img = door.get();
  67. println(img.width);
  68. }
  69. image(img, x, y, w, h);
  70. }
  71. void randomPosition() {
  72. x = int(random(0, width - w));
  73. y = int(random(0, height - h));
  74. }
  75. void move() {
  76. x=x+xspeed;
  77. if (x < 0 || x > width-w) {
  78. xspeed=-xspeed;
  79. }
  80. }
  81. }