Advertisement
Guest User

Untitled

a guest
Nov 19th, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.95 KB | None | 0 0
  1. float x=0,y=0,h=0;
  2. int move1= 0, move2 =0, move3=0;
  3. int ende =0;
  4. int score = 0;
  5. int wtfmode= 0;
  6. int highscore = 0;
  7.  
  8. PImage wtf;
  9. PImage Pen;
  10.  
  11. float aa, ab, ba, bb,ca,cb;
  12.  
  13. void setup()
  14. {
  15. background(0);
  16. size(500,700);
  17. wtf = loadImage("14k.png");
  18. Pen = loadImage("pen.jpg");
  19. }
  20.  
  21. void draw()
  22. {
  23.  
  24.  
  25. if (keyPressed){
  26. if(key == 'r')
  27. {
  28. move1= 0;
  29. move2 =0;
  30. move3 = 0;
  31. x=0;
  32. y=0;
  33. h=0;
  34. ende=0;
  35. score=0;
  36. }
  37.  
  38. if(key == 'w') wtfmode = 1;
  39. }
  40.  
  41.  
  42. if (ende == 1)
  43. {
  44.  
  45. if (keyPressed){
  46. if(key == 'r')
  47. {
  48. move1= 0;
  49. move2 =0;
  50. move3 = 0;
  51. x=0;
  52. y=0;
  53. h=0;
  54. ende=0;
  55. score=0;
  56. }
  57.  
  58. }
  59. return;
  60. }
  61. background(0);
  62. textSize(50);
  63. fill(255,0,0);
  64. text(score,10,50);
  65.  
  66. fill(255);
  67. if(wtfmode ==0) rect(250,height/2+h,40,40);
  68.  
  69.  
  70.  
  71.  
  72. if(move1 == 1)
  73. {
  74. aa = random(0,500);
  75. ab = aa + 180;
  76. }
  77.  
  78. rect(500-move1,0,75,aa);
  79. rect(500-move1,ab,75,500);
  80.  
  81.  
  82.  
  83. if(500-move1 < 290 && 500-move1 >165){
  84. if (height/2+h < aa || height/2+h > ab-40){
  85. textSize(90);
  86. fill(255,0,0);
  87. text("Game Over",10,300);
  88. textSize(50);
  89. text("highscore:", 10,400);
  90. text(highscore ,300,400);
  91. ende=1;
  92.  
  93. }
  94. }
  95. if (move1 == 725) move1 = 0;
  96. move1++;
  97.  
  98. if (move1 == 250 || move2 == 500) score++;
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105. if(move2 == 1)
  106. {
  107. ba = random(0,500);
  108. bb = ba + 180;
  109. }
  110.  
  111. rect(750-move2,0,75,ba);
  112. rect(750-move2,bb,75,500);
  113.  
  114.  
  115.  
  116. if(750-move2 < 290 && 750-move2 >165){
  117. if (height/2+h < ba || height/2+h > bb-40){
  118. textSize(90);
  119. fill(255,0,0);
  120. text("Game Over",10,300);
  121. textSize(50);
  122. text("highscore:", 10,400);
  123. text(highscore ,300,400);
  124. ende=1;
  125.  
  126. }
  127. }
  128. if (move2 == 975)
  129. {
  130. move2 = 250;
  131. ba = random(0,500);
  132. bb = ba + 180;
  133. }
  134. move2++;
  135.  
  136.  
  137. if (move2== 750) score++;
  138.  
  139.  
  140. if(move3 == 1)
  141. {
  142. ca = random(0,500);
  143. cb = ca + 180;
  144. }
  145.  
  146. rect(1000-move3,0,75,ca);
  147. rect(1000-move3,cb,75,500);
  148.  
  149.  
  150.  
  151. if(1000-move3 < 290 && 1000-move3 >165){
  152. if (height/2+h < ca || height/2+h > cb-40){
  153. textSize(90);
  154. fill(255,0,0);
  155. text("Game Over",10,300);
  156. textSize(50);
  157. text("highscore:", 10,400);
  158. text(highscore ,300,400);
  159. ende=1;
  160.  
  161. }
  162. }
  163. if (move3 == 1225)
  164. {
  165. move3 = 500;
  166. ca = random(0,500);
  167. cb = ca + 180;
  168. }
  169. move3++;
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176. x=x+y;
  177.  
  178. if(y<30) y++;
  179.  
  180. h = x/4;
  181.  
  182. if (y > 40)
  183. {
  184. y = 40;
  185. }
  186.  
  187. if (y < -30)
  188. {
  189. y= -30;
  190. }
  191.  
  192. if (wtfmode==1)
  193. {
  194. background(0);
  195. image(wtf, 250,height/2+h);
  196. image(Pen, 500-move1,aa+190);
  197. image(Pen, 500-move1,aa-1150);
  198.  
  199. image(Pen, 750-move2,ba+190);
  200. image(Pen, 750-move2,ba-1150);
  201.  
  202. image(Pen, 1000-move3,ca+190);
  203. image(Pen, 1000-move3,ca-1150);
  204.  
  205.  
  206.  
  207.  
  208.  
  209.  
  210.  
  211. }
  212.  
  213.  
  214.  
  215.  
  216.  
  217.  
  218. if (score >= highscore) highscore = score;
  219.  
  220. text(score,10,50);
  221. }
  222.  
  223. void mousePressed() {
  224.  
  225. y-=50;
  226. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement