class Attraction{ constructor(x, y, r, c){ this.r = r; this.pos = createVector(x, y); this.c = c; } show(){ noStroke(); fill(this.c); ellipse(this.pos.x, this.pos.y, this.r * 2); } grabbed(){ this.pos.x = mouseX + viewPort.x; this.pos.y = mouseY + viewPort.y; } checkGrab(){ if (dist(this.pos.x, this.pos.y, mouseX + viewPort.x, mouseY + viewPort.y) < this.r && !this.isGrabbed){ return true; } } }