Advertisement
Guest User

Ok

a guest
Nov 18th, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.83 KB | None | 0 0
  1. void setup() {
  2. size(displayWidth, displayHeight ) ;
  3. orientation(LANDSCAPE) ;
  4. noStroke() ;
  5. textFont(createFont("Arial", 200));
  6. }
  7.  
  8. int px = 860;
  9. int py = 440;
  10. float ok = -15;
  11. int ok1 = 0;
  12. int ok2 = 0;
  13. int text = 200;
  14. int cx = 1830;
  15. int cx1 = 1830;
  16. int cx2 = 1830;
  17. int cx3 = 1830;
  18. int cx4 = 1830;
  19.  
  20. boolean jump = false;
  21. boolean start = true;
  22. boolean play = false;
  23. boolean dead = false;
  24.  
  25. void draw() {
  26. fill(0, 0, 100);
  27. rect(0, 0, displayWidth, displayHeight ) ;
  28. fill(0,0,200);
  29. rect(random(0,1870),random(0,490),50,50);
  30. rect(random(0,1870),random(0,490),50,50);
  31. rect(random(0,1870),random(0,490),50,50);
  32. fill(10,25,35);
  33. rect(0, 540, displayWidth, 540);
  34. fill(7,20,30);
  35. rect(0,640,displayWidth, 440);
  36. fill(5,15,20);
  37. rect(0,740,displayWidth, 340);
  38. fill(3,10,15);
  39. rect(0,840,displayWidth, 240);
  40. fill(1, 5,6);
  41. rect(0,940,displayWidth, 140);
  42. fill(0);
  43. rect(0,1040,displayWidth, 40);
  44. fill(44,155,173);
  45. rect(px, py, 100, 100);
  46. fill(32,191,218);
  47. rect(px+10,py+10,80,80);
  48. fill(22,207,230);
  49. rect(px+20,py+20,60,60);
  50. fill(0,227,255);
  51. rect(px+30,py+30,40,40);
  52.  
  53.  
  54. if (start &&! play) {
  55. cx1 = 1830;
  56. dead = false;
  57. px = 860;
  58. fill(0, 100, 100, text);
  59. text("START", 610, 340);
  60. ok1++;
  61. if (ok1 ==25) {
  62. if (text ==0) {
  63. text = 200;
  64. } else {
  65. text = 0;
  66. }
  67. ok1 = 0;
  68. }
  69. if (mouseX >=600 && mouseX <= 1280 && mouseY <=350 && mouseY >=150) {
  70. start = false;
  71. play = true;
  72. cx = 1830;
  73. }
  74. }
  75.  
  76. if (play) {
  77. fill(71, 0, 255);
  78. rect(cx, 490, 50, 50) ;
  79. cx-=10;
  80. if (cx <= 1000) {
  81. fill(133,0,0);
  82. rect(cx1, 440, 100, 100);
  83.  
  84.  
  85. cx1-=10;
  86. if (px+100>=cx1 && px+100<=cx1+100 && py<=440) {
  87. if (! mousePressed) {
  88. jump = false;
  89. }
  90. }
  91. if(py+100>=441&&px+100>cx1&&px+100<=cx1+100){
  92. dead = true;
  93. }
  94. if (px>=cx1+100 && py<=440 && py<=859 && ! jump) {
  95. py+=10;
  96. }
  97. }
  98. if ((px >= cx && px <= cx+50 && py+100>=490) || (px +100>= cx && px +100<= cx+50 && py + 100>=490) ) {
  99. dead = true;
  100. play = false;
  101. }
  102.  
  103. if(cx1<=1650){
  104. fill(0) ;
  105. rect(cx2, 400,100,140);
  106. fill(71,0,255);
  107. rect(cx2+20,410,60, 120);
  108. cx2-=10;
  109. if(((px+90 >= cx2 && px +100 <= cx2+100)||(px<=cx2+100 && px >= cx2)) && py +100 >= 400){
  110. dead = true;
  111. play = false;
  112. }
  113. }
  114. }
  115.  
  116. if (dead) {
  117. start = true;
  118. play = false;
  119. cx = 1880;
  120. py = 440;
  121. cx1 = 1830;
  122. cx2 = 1830;
  123. }
  124.  
  125. if (mousePressed) {
  126. jump = true;
  127. }
  128.  
  129. if (jump) {
  130. py+=ok;
  131. ok+=1;
  132. if (py>=440) {
  133. ok = -15.0;
  134. jump = false;
  135. }
  136. }
  137. else{
  138. ok = - 15;
  139. }
  140.  
  141. if(py>440){
  142. py = 440;
  143. }
  144. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement