xxxxxxxxxx
26
function preload() {
smileImg = loadImage("smile.png");
}
class Smile {
constructor(x, y, r) {
this.x = x;
this.y = y;
this.r = r;
this.xspeed = random(-1,1);
this.yspeed = random(-1,1);
this.g = random(85, 256);
this.b = random(85, 256);
}
move() {
this.x = this.x + this.xspeed;
this.y = this.y + this.yspeed;
}
show() {
tint(this.r, this.g, this.b)
image(smileImg, this.x, this.y);
}
}