Advertisement
Squid_

Agar.io+ [Agar.io Expansion]

Aug 25th, 2017
1,026
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.63 KB | None | 0 0
  1. import processing.net.*;
  2. import processing.sound.*;
  3.  
  4. PFont Righteous;
  5. SoundFile mainLoop;
  6. int lineChoice, bgChoice, k, textChoice, massBool, massRegrowChance, pMass;
  7. int gridLine[] = {224, 32};
  8. int bg[] = {255, 0};
  9. int textColor[] = {0, 255};
  10. float xPos, yPos, x, y, speed, transitionColor;
  11. ArrayList<Integer> xList;
  12. ArrayList<Integer> yList;
  13. ArrayList<Integer> colorList;
  14. color mainColor = color(random(40, 255), random(40, 255), random(40, 255));
  15.  
  16.  
  17.  
  18. void setup()
  19. {
  20. surface.setResizable(true);
  21. size(800, 600);
  22. x = width/2;
  23. y = height/2;
  24. speed = 5;
  25. pMass = 2;
  26. massRegrowChance = 500;
  27. Righteous = createFont("Righteous.otf", 32);
  28. textFont(Righteous);
  29.  
  30. mainLoop = new SoundFile(this, "Fluid Dynamics.mp3");
  31. xList = new ArrayList<Integer>();
  32. yList = new ArrayList<Integer>();
  33. colorList = new ArrayList<Integer>();
  34.  
  35. for (int i=0; i < 200; i++)
  36. {
  37. xList.add(int(random(0, width)));
  38. yList.add(int(random(0, height)));
  39. colorList.add(color(random(40, 255), random(40, 255), random(40, 255)));
  40. }
  41. mainLoop.loop();
  42. loadingScreen();
  43. frameRate(60);
  44. }
  45. void draw()
  46. {
  47. environment();
  48. massMovement();
  49. debug();
  50. }
  51. void massMovement()
  52. {
  53. xPos = mouseX;
  54. yPos = mouseY;
  55. xPos = map(xPos, 0, width, -speed, speed);
  56. yPos = map(yPos, 0, height, -speed, speed);
  57. for (int i=0; i < 50; i++)
  58. {
  59. noStroke();
  60. x = xList.set(i, int(xPos) + xList.get(i));
  61. y = yList.set(i, int(yPos) + yList.get(i));
  62. fill(colorList.get(i));
  63. if (xList.get(i) > width + 5 || xList.get(i) < -5 || yList.get(i) > height + 5|| yList.get(i) < -5)
  64. {
  65. massBool = int(random(-massRegrowChance, massRegrowChance));
  66. if (massBool == int(random(-massRegrowChance, massRegrowChance)))
  67. {
  68. xList.set(i, int(random(0, width)));
  69. yList.set(i, int(random(0, height)));
  70. }
  71. }
  72. massGrow();
  73. ellipse(x, y, 5, 5);
  74. }
  75. fill(mainColor);
  76. ellipse(width/2, height/2, 50, 50);
  77. fill(textColor[textChoice]);
  78. text("Agar.io+", (width/2) - 100, 80);
  79. }
  80. void environment()
  81. {
  82. if (key == '1')
  83. {
  84. lineChoice = 0;
  85. bgChoice = 0;
  86. k = 2;
  87. textChoice = 0;
  88. } else if (key == '2')
  89. {
  90. lineChoice = 1;
  91. bgChoice = 1;
  92. k = 1;
  93. textChoice = 1;
  94. }
  95. background(bg[bgChoice]);
  96.  
  97. for (int i=0; i < width; i++)
  98. {
  99. strokeWeight(3);
  100. stroke(gridLine[lineChoice]);
  101. line(25*i, 0, 25*i, height);
  102. line(0, 25*i, width, 25*i);
  103. }
  104. }
  105. void transition()
  106. {
  107. for (int i=0; i < width; i++)
  108. {
  109. transitionColor = color(random(40, 255), random(40, 255), random(40, 255));
  110. fill(transitionColor);
  111. ellipse(400, 300, i, i);
  112. }
  113. }
  114. void massGrow()
  115. {
  116. for (int i=0; i < 200; i++)
  117. {
  118. if (dist(width/2, height/2, (pMass/2), width/2) <= (dist(width/2, height/2, xList.get(i), yList.get(i))))
  119. {
  120. xList.set(i, int(random(0, width)));
  121. yList.set(i, int(random(0, height)));
  122. pMass++;
  123. }
  124. }
  125. }
  126. void debug()
  127. {
  128. stroke(252, 0, 0);
  129. line(width/2, height/2, (width/2) + (pMass/2), height/2);
  130. fill(textColor[textChoice]);
  131. text(pMass/2, 700, 50);
  132. text(int(dist(400, 300, (width/2 + pMass/2), pMass/2)), 0, 550);
  133. text(int(dist(width/2, height/2, xList.get(4), yList.get(4))), 0, 600);
  134. noFill();
  135. ellipse(xList.get(4), yList.get(4), 10, 10);
  136. }
  137. void titleScreen()
  138. {
  139. for (int i=0; i < 300; i++)
  140. {
  141. ellipse(width/2, height/2, i, i);
  142. }
  143. text("Agar.io+", 300, 380);
  144. }
  145.  
  146.  
  147. void multiplayer()
  148. {
  149. }
  150.  
  151.  
  152. void loadingScreen()
  153. {
  154. float easing = 0.05;
  155. float circleGrow = 5.0;
  156. for (int n=1; n < 500; n++)
  157. {
  158. ellipse(x, y, circleGrow, circleGrow);
  159. }
  160. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement