xxxxxxxxxx
26
class Button {
constructor(x, y, w, h, v, ex = 0, ey = 0) {
this.x = x;
this.y = y;
this.w = w;
this.h = h;
this.v = v;
this.ex = ex;
this.ey = ey;
}
changeV() {
if (this.v == 3) this.v = 0;
else this.v++;
}
isOn(px, py) {
return (px > this.x && px < this.x+this.w && py > this.y && py < this.y+this.h)
}
show() {
//rect(this.x, this.y, this.w, this.h);
textAlign(CENTER, CENTER)
text(this.v, this.x+this.w/2, this.y+80);
}
}