void setup()
{
size(400,400);//background
background(255);
rectMode(CORNERS);
}
void draw()
{
color c1=color(255,128,192);//pink
color c2=color(129,218,157);//green
color c3=color(85,162,198);//blue
building(50,120,100,c1);//building group one, row one. first two coordingats are the house coordinates, while the third denotes the height, the fourth is the color
building(180,120,75,c2);
building(310,120,50,c3);
building(50,250,50,c2);//building group two, row two
building(180,250,100,c3);
building(310,250,75,c1);
building(50,380,50,c1);//building group three, row three
building(180,380,75,c3);
building(310,380,100,c2);
}
void building(int x,int y,int h,color c)//calling the method
{
fill(c); //the fill is whatever color C is
rect(x,y,x+50,y-h);//making the parameters of the rectangle part of the building
triangle(x,y-h,x+50,y-h,x+25,y-h-15);//making the "roof" of the building
fill(color(219,226,131));//the color of the "roof", yellow
rect(x+10,y-15,x+20,y-35);//the "window" of the houses
}
Lena_I
on Monday, Oct 20, 2008 – 11:03 am