//Exercise I
//Greg Batha DESMA 28 Interactivity
PShape window;
PShape house;
PShape chimney;
PShape door;
int numWindows;
void setup(){
size(400, 400);
smooth();
house = loadShape("house.svg");
window = loadShape("window.svg");
chimney = loadShape("chimney.svg");
door = loadShape("door.svg");
}
void draw(){
drawHouse(50, 120, 50, 120);
drawHouse(190, 120, 200, 200);
drawHouse(350, 120, 100, 50);
drawHouse(55, 250, 100, 100);
drawHouse(200, 250, 150, 150);
drawHouse(350, 250, 99, 100);
drawHouse(55, 390, 100, 200);
drawHouse(210, 390, 200, 100);
drawHouse(350, 390, 50, 80);
}
void drawHouse(int xPos, int yPos, int Hwidth, int Hheight){
int x = xPos;
int y = yPos;
int houseWidth = Hwidth;
int houseHeight = Hheight;
float newX;
float newY;
newX = x-houseWidth/2;
newY = y-houseHeight/2;
shape(chimney, x-houseWidth/2.5, y-(houseHeight/2)-(houseHeight/20),
houseWidth/5, (houseHeight/2)+(houseHeight/20));
shape(house, newX, newY, houseWidth, houseHeight/2);
shape(door, x+houseWidth/5, y-houseHeight/4, houseWidth/7, houseHeight/4);
numWindows = houseWidth/50;
for(int i = numWindows; i>0; i--){
shape(window, (x-houseWidth/8*i)+(houseWidth/10),
(y-houseHeight/6) - (houseWidth/20), houseWidth/10, houseWidth/10);
}
}Gregory - I
on Wednesday, Oct 22, 2008 – 1:59 am
One Comment
nice shading