//each building has different color and different height
void setup() {
size(400, 400);
smooth();
noLoop();
background(68, 15, 100);
}
void draw() {
//First column buildings
b(40, 50, 50, 10);
b(40, 180, 80, 40);
b(40, 280, 70, 70);
//Second column buildings
b(165, 50, 80, 100);
b(165, 180, 60, 130);
b(165, 280, 100, 160);
//Third column buildings
b(290, 50, 100, 190);
b(290, 180, 45, 220);
b(290, 280, 90, 250);
}
void b(int xcenter, int ycenter, int height, float c) {
//general shape
//c indicates the change of color
noStroke();
fill(242, 30, c);
rect(xcenter, ycenter, 70, height);
//shadow shape
noStroke();
fill(0);
triangle(xcenter, ycenter, xcenter+15,ycenter+height , xcenter, ycenter+height);
//roof shape
noStroke();
fill(200,160, 110);
rect(xcenter-5, ycenter-5, 80, 10);
//windows
stroke(255);
fill (109, 207, 246);
ellipse(xcenter +60, ycenter+15, 6, 6);
ellipse(xcenter +60, ycenter+25, 6, 6);
ellipse(xcenter +50, ycenter+25, 6, 6);
ellipse(xcenter +50, ycenter+15, 6, 6);
//ladders
stroke(255);
line(xcenter+5, ycenter-5, xcenter+5, ycenter+height);
line(xcenter+15, ycenter-5, xcenter+15, ycenter+height);
for(int i=5; i<height; i=i+5){
noFill();
rect(xcenter+5, ycenter+i, 10, 0.01);
}
//balcony
stroke(255);
line(xcenter+45, ycenter+32, xcenter+75, ycenter+32);
line(xcenter+45, ycenter+38, xcenter+75, ycenter+38);
for(int i=0; i<30; i=i+2) {
noFill();
rect(xcenter+i+45, ycenter+32,0.01 , 6);
}
//door
rect(xcenter+25, ycenter+height-17, 5, 15);
rect(xcenter+30, ycenter+height-17, 5, 15);
}
Justin - I
on Tuesday, Oct 21, 2008 – 7:16 pm
One Comment
i like the actual house design, very creative windows and such.