Learning processing

Using the mouses location to draw a custom shape called house.

void setup(){
size(800,400);
}

void draw(){

if(mousePressed){
house(mouseX+1,mouseY+int(random(120)));
}
}

void house(int x, int y){
triangle(x+15,y,x,y+15,x+30,y+15);
rect(x,y+15,30,30);
rect(x+12,y+30,10,15);
}

houseclick

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s