xxxxxxxxxx
26
function Bubble(x, y) {
this.x = x;
this.y = y;
this.col = color(255, 150);
this.d = 0;
this.r = random(255);
this.g = random(255);
this.b = random(255);
this.display = function() {
stroke(255);
fill(this.col);
strokeWeight(2);
ellipse(this.x, this.y, 48, 48);
}
this.move = function() {
this.x += random(-1, 1);
this.y += random(-1, 1);
}
this.clicked = function() {
this.d = dist(mouseX, mouseY, this.x, this.y);
if (this.d <= 24)
this.col = color(this.r, this.g, this.b);
}
}