You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
439 B
26 lines
439 B
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;
|
|
}
|
|
}
|
|
|
|
} |