var circles, rand, ticks, size, over;
createCanvas(windowWidth, windowHeight);
for(var i = 0; i < 40; i++) {
size:round(random(20,200)),
circles[i].x = random(0,windowWidth);
circles[i].y = -circles[i].size/2;
circles[i].xVel = random(-2,2);
circles[i].yVel = random(0,2);
circles[i].x = windowWidth+circles[i].size/2
circles[i].y = random(0,windowHeight);
circles[i].xVel = random(-2,0);
circles[i].yVel = random(-2,2);
circles[i].x = random(0,windowWidth);
circles[i].y = windowHeight+circles[i].size/2
circles[i].xVel = random(-2,2);
circles[i].yVel = random(-2,0);
circles[i].x = -circles[i].size/2
circles[i].y = random(0,windowHeight);
circles[i].xVel = random(0,2);
circles[i].yVel = random(-2,2);
for(var i = 0; i < circles.length; i++) {
if(circles[i].alive === true) {
fill(circles[i].colour,100,50);
ellipse(circles[i].x, circles[i].y, circles[i].size);
textAlign(CENTER, CENTER);
textSize(circles[i].size/2);
text(circles[i].size,circles[i].x,circles[i].y);
circles[i].x += circles[i].xVel;
circles[i].y += circles[i].yVel;
if(dist(mouseX,mouseY,circles[i].x,circles[i].y) < (circles[i].size+size)/3) {
if(size > circles[i].size) {
circles[i].alive = false;
size += floor(circles[i].size/5);
} else if (circles[i].size > size && millis() > 3000) {
if(size > 1500 && over === 0) {
ellipse(mouseX,mouseY,size);
rect(0,0,windowWidth,windowHeight);
text("L",windowWidth/2,windowHeight/2);
text("You beat this game",windowWidth/2,windowHeight/2);
if(over === 0) { text(size,mouseX,mouseY); }
size:round(random(size/5*3,constrain(size*3,200,1000))),
circles[i].x = random(0,windowWidth);
circles[i].y = -circles[i].size/2;
circles[i].xVel = random(-2,2);
circles[i].yVel = random(0,2);
circles[i].x = windowWidth+circles[i].size/2
circles[i].y = random(0,windowHeight);
circles[i].xVel = random(-2,0);
circles[i].yVel = random(-2,2);
circles[i].x = random(0,windowWidth);
circles[i].y = windowHeight+circles[i].size/2
circles[i].xVel = random(-2,2);
circles[i].yVel = random(-2,0);
circles[i].x = -circles[i].size/2
circles[i].y = random(0,windowHeight);
circles[i].xVel = random(0,2);
circles[i].yVel = random(-2,2);