xxxxxxxxxx
22
class Player {
constructor(pos, colour = color(random(255), random(255), random(255))) {
this.pos = pos;
this.clr = colour
}
show() {
rect(this.pos.x, this.pos.y, 5);
}
loop() {
this.pos.x += random(-50, 50);
this.pos.y += random(-50, 50);
}
reset() {
this.pos.x = width / 2;
this.pos.y = height / 2;
this.clr = color(random(255), random(255), random(255))
}
}