xxxxxxxxxx
44
class Thingy {
constructor(x, y) {
this.x = x;
this.y = y;
}
move() {
if (mouseX > 200) {
this.x = this.x + 0.75;
} else {
this.x = this.x - 0.75;
}
if (mouseY > 200) {
this.y = this.y - 0.75;
} else {
this.y = this.y + 0.75;
}
}
show() {
stroke(255);
strokeWeight(3);
if (this.x > 300 || this.x < 100 || this.y > 300 || this.y < 100) {
fill(255);
} else {
fill(0);
}
ellipse(this.x, this.y, 20, 20);
}
notHappy() {
if (this.x > 200 || this.x < 100 || this.y > 300 || this.y < 100){
stroke(0);
line(150, 250, 250, 250);
} else {
stroke(0);
fill(255);
ellipse(200, 250, 75, 25);
}
}
}