You are on page 1of 1

void setup() {

size(800, 800);
background(255);
}

void draw() {
let i=0;
let b=0;
let p=0;
while(i<5){
p =int(random(2));
House(100+b, 100, 100, color(255,0+b,0), color(0, 255, 0+b), p);
i=i+1;
b = b+110;
};
noLoop();
}
void House(x, y, a, c, v, d){
noStroke();
let colorR=int(random(255));
let colorG=int(random(255));
let colorB=int(random(255));
fill(colorR, colorG, colorB);
rect(x+a/4, y-a/2, a/5, a);
fill(v);
triangle(x, y, a+x, y, x+a/2, y-a/2);
stroke(3);
fill(c);
rect(x, y, a, a);
if(d==1){
fill(255, 255, 0);
}
else{
fill(255);
};
rect(x+a/5, y+a/4, a/4, a/4);
rect(x+3*a/5, y+a/4, a/4, a/4);
fill(0);
rect(x+a/2, y+2*a/3,a/4, a/3);
}

You might also like