xxxxxxxxxx
38
class Oblong {
constructor(tempX, tempY, tempR) {
this.x = tempX;
this.y = tempY;
this.r = tempR;
this.red = 255;
this.blue = 255;
this.green = 255;
}
designed() {
stroke(51);
strokeWeight(4);
fill(this.red,this.blue,this.green);
rect(this.x, this.y, this.r, this.r);
}
move() {
this.x = this.x + random(-3, 3);
this.y = this.y + random(-3, 3);
}
hover(px, py) {
let d = dist(px, py, this.x, this.y);
if (d < this.r) {
this.red = random(255);
this.blue = random(255);
this.green = random (255);
}
}
}