Advertisement
Guest User

Untitled

a guest
Mar 31st, 2020
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.69 KB | None | 0 0
  1. int i;
  2. boolean rectOverFeed = false;
  3. boolean changetofeeding = false;
  4. boolean changetobath = false;
  5. boolean rectOverBath = false;
  6. Feeding feed = new Feeding();
  7. int hunger = 185;
  8. int exp = 105;
  9. int level = 1;
  10. int exp_need = 10;
  11. Bath bath = new Bath();
  12. int option;
  13.  
  14.  
  15. void setup(){
  16. size(700,900);
  17. background(122);
  18. thread( "do_stuff" );
  19. }
  20.  
  21.  
  22. void draw(){
  23. background(122);
  24. if(changetobath == true){
  25. bath.draw();
  26. }else if(changetofeeding == true){
  27. feed.draw();
  28. hungerBar();
  29. }
  30.  
  31. else {
  32. feedButton();
  33. bathButton();
  34. fill(0);
  35. pet();
  36. hungerBar();
  37. hexagonButton();
  38. text1();
  39. }
  40.  
  41. }
  42.  
  43. void hungerBar(){
  44.  
  45. strokeWeight(5);
  46. rect(25,180,10,490);
  47. rect(675,180,-10,490);
  48. rect(100,40,500,10);
  49. stroke(150,75,0);
  50. strokeWeight(3);
  51. line(670,hunger+i,670,665);
  52.  
  53. strokeWeight(1);
  54. stroke(0);
  55.  
  56. }
  57.  
  58. void text1(){
  59. fill(0);
  60. String name = "Johnny Sins";
  61. textAlign(CENTER,TOP);
  62. text(name,(width/2) - name.length() ,10);
  63. text(exp_need + " more exp to level up" ,(width/2) - name.length() ,50);
  64. text(level, 620 , 35);
  65. textSize(20);
  66. text("Hunger",620,180);
  67. text("HP",30,155);
  68. textSize(24);
  69.  
  70. line(670,hunger+i,670,665);
  71. line(105,45,exp,45); //595 max
  72. text("FEED IT", 140,810);
  73. text("CLEAN",560,810);
  74. text("FIGHT",350,750);
  75. }
  76. void exp_mode(){
  77. int multiplier = 1;
  78. if (exp_need == 0){
  79. level+=1;
  80. exp_need = 10 * multiplier;
  81. multiplier += 1;
  82. }
  83. }
  84.  
  85. void do_stuff() {
  86.  
  87. while ( i < 480 ) {
  88. for (int k =0; k/5<100000; k++) {
  89. print( i, k );
  90. }
  91. i++;
  92. }
  93. }
  94.  
  95. void pet(){
  96. fill(0);
  97. ellipse(280,470,100,300);
  98. ellipse(420,470,100,300);
  99. fill(255);
  100. ellipse(280,470,60,260);
  101. ellipse(420,470,60,260);
  102. fill(0);
  103. ellipse(350,500,300,300);
  104.  
  105. fill(255,98,135);
  106. ellipse(350,560,150,100);
  107.  
  108. fill(0);
  109. ellipse(360,510,140,80);
  110.  
  111. fill(255,5,9);
  112. ellipse(350,585,102,52);
  113.  
  114.  
  115. fill(255);
  116. ellipse(300,450,80,80);
  117. ellipse(400,450,80,80);
  118.  
  119. fill(98,107,250);
  120. ellipse(310,450,40,60);
  121. ellipse(410,450,40,60);
  122.  
  123. fill(255);
  124. ellipse(315,450,20,40);
  125. ellipse(415,450,20,40);
  126. }
  127.  
  128. void hexagonButton(){
  129. stroke(0);
  130. strokeWeight(5);
  131. fill(255,201,14);
  132. beginShape();
  133. translate(350,845);
  134. vertex(0, -150);
  135. vertex(80,-100);
  136. vertex(80, 0);
  137. vertex(0, 50);
  138. vertex(-80, 0);
  139. vertex(-80, -100);
  140. endShape(CLOSE);
  141. translate(-350,-845);
  142. strokeWeight(0);
  143. }
  144.  
  145. void feedButton(){
  146. if (overRectFeed(40, 740, 200, 110)) {
  147. rectOverFeed = true;
  148. } else rectOverFeed = false;
  149. if (rectOverFeed){
  150. fill(255,231,30);
  151. } else fill(255,201,14);
  152. strokeWeight(5);
  153. rect(40, 740, 200, 110, 13);
  154. strokeWeight(0);
  155.  
  156.  
  157. }
  158.  
  159. void bathButton(){
  160. if ( overRectBath(460, 740, 200, 110) ) {
  161. rectOverBath = true;
  162. } else rectOverBath = false;
  163. if (rectOverBath){
  164. fill(255,231,30);
  165. } else fill(255,201,14);
  166. strokeWeight(5);
  167. rect(460, 740, 200, 110, 13);
  168. strokeWeight(0);
  169. }
  170.  
  171. void mousePressed() {
  172. if (rectOverFeed && option == 0) {
  173. changetofeeding = true;
  174. changetobath = false;
  175. option = 1;
  176. } else if (rectOverFeed && option == 1) {
  177. changetofeeding = false;
  178. changetobath = false;
  179. option = 0;
  180. } else if (rectOverBath){
  181. changetofeeding = false;
  182. changetobath = true;
  183. }
  184. }
  185.  
  186. boolean overRectBath(int x, int y, int width, int height) {
  187. if (mouseX >= x && mouseX <= x+width &&
  188. mouseY >= y && mouseY <= y+height) {
  189. return true;
  190. } else {
  191. return false;
  192. }
  193. }
  194. boolean overRectFeed(int x, int y, int width, int height) {
  195. if (mouseX >= x && mouseX <= x+width &&
  196. mouseY >= y && mouseY <= y+height) {
  197. return true;
  198. } else {
  199. return false;
  200. }
  201. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement