xxxxxxxxxx
25
class Num {
constructor(x, y, speed, first, opacity) {
this.x = x;
this.y = y;
this.value = 0;
this.speed = speed;
this.first = first;
this.opacity = opacity;
this.switchInterval = round(random(2, 25));
}
setToRandomSymbol() {
if (frameCount % this.switchInterval == 0) {
this.value = floor(random(0, 10));
}
}
fall() {
if (this.y >= height) {
this.y = 0;
} else {
this.y += this.speed;
}
}
}