Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.04 KB | None | 0 0
  1. PImage zirkles, sulinys, popierius;
  2. int chose = 0;
  3. int other ;
  4. float k = random(0,3);
  5. int screen = 0;
  6. float lauk = 0;
  7. void setup()
  8. {
  9. size(600,600);
  10. zirkles = loadImage("zirkles.png");
  11. popierius = loadImage("popierius.png");
  12. sulinys = loadImage("sulinys.png");
  13. background(25);
  14. }
  15. void draw()
  16. {
  17.  
  18. if(screen == 0)
  19. {
  20. if (chose == 0)
  21. {
  22.  
  23. image(zirkles, 50, height-200);
  24. image(popierius, 250, height-200);
  25. image(sulinys, 450, height-200);
  26.  
  27. }
  28. else
  29. {
  30.  
  31. {
  32. if(chose == 1)
  33. {
  34. image(zirkles, 250, 400);
  35. }
  36. if(chose == 2)
  37. {
  38. image(popierius, 250, 400);
  39. }
  40. if(chose == 3)
  41. {
  42. image(sulinys, 250, 400);
  43. }
  44. if(k < 1)
  45. {
  46. image(zirkles, 250, 100);
  47. other = 1;
  48. }
  49. if(k > 1 && k < 2)
  50. {
  51. image(popierius, 250, 100);
  52. other = 2;
  53. }
  54. if(k > 2)
  55. {
  56. image(sulinys, 250, 100);
  57. other = 3;
  58. }
  59. lauk = millis();
  60. if(lauk > 7000)
  61. {
  62. if(other == chose)
  63. {
  64. screen = 1;
  65. }
  66. if(other == 1 && chose == 2 || other == 2 && chose == 3 ||
  67. other == 3 && chose == 1)
  68. {
  69. screen = 2;
  70. }
  71. if(other == 2 && chose == 1 || other == 3 && chose == 2 ||
  72. other == 1 && chose == 3)
  73. {
  74.  
  75. screen = 3;
  76. }
  77.  
  78. }
  79. }
  80. }
  81. if (screen == 1)
  82. {
  83. background(0);
  84. fill(255);
  85. textSize(50);
  86. textAlign(CENTER, CENTER);
  87. text("Tie", width/2, height/2);
  88. }
  89. if (screen == 2)
  90. {
  91. background(0);
  92. fill(255);
  93. textSize(50);
  94. textAlign(CENTER, CENTER);
  95. text("Enemy wins", width/2, height/2);
  96. }
  97. if (screen == 3)
  98. {
  99. background(0);
  100. fill(255);
  101. textSize(50);
  102. textAlign(CENTER, CENTER);
  103. text("You win", width/2, height/2);
  104. }
  105. }
  106. }
  107. void mousePressed()
  108. {
  109. if(mouseY > 400 && mouseY < 500)
  110. {
  111.  
  112. if(mouseX > 50 && mouseX < 150 )
  113. {
  114. chose = 1;
  115. }
  116. if(mouseX > 250 && mouseX < 350 )
  117. {
  118. chose = 2;
  119. }
  120. if(mouseX > 450 && mouseX < 550 )
  121. {
  122. chose = 3;
  123. }
  124. }
  125. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement