xxxxxxxxxx
61
let mrscloud
let mrcloud
let babycloud
let seniorcloud
let sistercloud
function setup() {
createCanvas(600, 600);
mrscloud = new Cloud(200,300,200,20)
mrcloud = new Cloud( 300,400,30,50)
babycloud = new Cloud (400,500,50,80)
seniorcloud = new Cloud (100,200, 60,70)
sistercloud = new Cloud (50,100,80,90)
}
function draw() {
background(52, 210, 235);
mrscloud.drawCloud();
mrscloud.runCloud();
mrcloud.drawCloud();
mrcloud.runCloud();
babycloud.drawCloud();
babycloud.runCloud();
seniorcloud.drawCloud();
seniorcloud.runCloud();
sistercloud.drawCloud();
sistercloud.runCloud();
}
class Cloud{
constructor(xPos,yPos,white){
this.x = xPos;
this.y = yPos;
this.z = white;
this.speed = random(5,40);
}
// functions
drawCloud(){
strokeWeight(0);
ellipse(this.x+40, this.y, 80, 50);
strokeWeight(0);
ellipse(this.x, this.y,90,80);
strokeWeight(0);
ellipse(this.x-20, this.y, 80, 50)
}
runCloud(){
this.x = this.x + this.speed/5;
if (this.x > width + 50) {
this.x = -50 / 2;
}
}
}