let r, g, b;
const radius = 100;
let x, y;
let score = 0;
function setup() {
createCanvas(400, 400);
createCanvas(windowWidth, windowHeight);
x = random(windowWidth);
y = random(windowHeight);
r = random(255);
g = random(255);
b = random(255);
}
function draw() {
background(220);
fill(255, 0, 255);
noStroke();
ellipse(x, y, radius*2, radius*2);
text("Score: " + score, 10, 20);
}
function mousePressed() {
let d = dist(mouseX, mouseY, x, y);
if (d < radius) {
newCircle();
score++;
if (score == 10) {
radius /= 2;
}
}
}
function newCircle() {
x = random(windowWidth);
y = random(windowHeight);
r = random(255);
g = random(255);
b = random(255);
}
setInterval(newCircle, 1000);