Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import processing.net.*;
- import processing.sound.*;
- PFont Righteous;
- SoundFile mainLoop;
- int lineChoice, bgChoice, k, textChoice, massBool, massRegrowChance, pMass;
- int gridLine[] = {224, 32};
- int bg[] = {255, 0};
- int textColor[] = {0, 255};
- float xPos, yPos, x, y, speed, transitionColor;
- ArrayList<Integer> xList;
- ArrayList<Integer> yList;
- ArrayList<Integer> colorList;
- color mainColor = color(random(40, 255), random(40, 255), random(40, 255));
- void setup()
- {
- surface.setResizable(true);
- size(800, 600);
- x = width/2;
- y = height/2;
- speed = 5;
- pMass = 2;
- massRegrowChance = 500;
- Righteous = createFont("Righteous.otf", 32);
- textFont(Righteous);
- mainLoop = new SoundFile(this, "Fluid Dynamics.mp3");
- xList = new ArrayList<Integer>();
- yList = new ArrayList<Integer>();
- colorList = new ArrayList<Integer>();
- for (int i=0; i < 200; i++)
- {
- xList.add(int(random(0, width)));
- yList.add(int(random(0, height)));
- colorList.add(color(random(40, 255), random(40, 255), random(40, 255)));
- }
- mainLoop.loop();
- loadingScreen();
- frameRate(60);
- }
- void draw()
- {
- environment();
- massMovement();
- debug();
- }
- void massMovement()
- {
- xPos = mouseX;
- yPos = mouseY;
- xPos = map(xPos, 0, width, -speed, speed);
- yPos = map(yPos, 0, height, -speed, speed);
- for (int i=0; i < 50; i++)
- {
- noStroke();
- x = xList.set(i, int(xPos) + xList.get(i));
- y = yList.set(i, int(yPos) + yList.get(i));
- fill(colorList.get(i));
- if (xList.get(i) > width + 5 || xList.get(i) < -5 || yList.get(i) > height + 5|| yList.get(i) < -5)
- {
- massBool = int(random(-massRegrowChance, massRegrowChance));
- if (massBool == int(random(-massRegrowChance, massRegrowChance)))
- {
- xList.set(i, int(random(0, width)));
- yList.set(i, int(random(0, height)));
- }
- }
- massGrow();
- ellipse(x, y, 5, 5);
- }
- fill(mainColor);
- ellipse(width/2, height/2, 50, 50);
- fill(textColor[textChoice]);
- text("Agar.io+", (width/2) - 100, 80);
- }
- void environment()
- {
- if (key == '1')
- {
- lineChoice = 0;
- bgChoice = 0;
- k = 2;
- textChoice = 0;
- } else if (key == '2')
- {
- lineChoice = 1;
- bgChoice = 1;
- k = 1;
- textChoice = 1;
- }
- background(bg[bgChoice]);
- for (int i=0; i < width; i++)
- {
- strokeWeight(3);
- stroke(gridLine[lineChoice]);
- line(25*i, 0, 25*i, height);
- line(0, 25*i, width, 25*i);
- }
- }
- void transition()
- {
- for (int i=0; i < width; i++)
- {
- transitionColor = color(random(40, 255), random(40, 255), random(40, 255));
- fill(transitionColor);
- ellipse(400, 300, i, i);
- }
- }
- void massGrow()
- {
- for (int i=0; i < 200; i++)
- {
- if (dist(width/2, height/2, (pMass/2), width/2) <= (dist(width/2, height/2, xList.get(i), yList.get(i))))
- {
- xList.set(i, int(random(0, width)));
- yList.set(i, int(random(0, height)));
- pMass++;
- }
- }
- }
- void debug()
- {
- stroke(252, 0, 0);
- line(width/2, height/2, (width/2) + (pMass/2), height/2);
- fill(textColor[textChoice]);
- text(pMass/2, 700, 50);
- text(int(dist(400, 300, (width/2 + pMass/2), pMass/2)), 0, 550);
- text(int(dist(width/2, height/2, xList.get(4), yList.get(4))), 0, 600);
- noFill();
- ellipse(xList.get(4), yList.get(4), 10, 10);
- }
- void titleScreen()
- {
- for (int i=0; i < 300; i++)
- {
- ellipse(width/2, height/2, i, i);
- }
- text("Agar.io+", 300, 380);
- }
- void multiplayer()
- {
- }
- void loadingScreen()
- {
- float easing = 0.05;
- float circleGrow = 5.0;
- for (int n=1; n < 500; n++)
- {
- ellipse(x, y, circleGrow, circleGrow);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement