  //project 2
  //Enrico Fucci
  
    //global variables
    float horizon,sunX,sunY;
    float houseX,houseY;
    float zoogX, zoogY, shoulder, headY,hip,tilt,eyeR, eyeG, eyeB;
    float monsterX, monsterY;
    
    
    //start of sketch 
    //setup
    void setup() {
      size(600,600);
      smooth();
      horizon = height/4;
      frameRate(15);
    }
    
    void draw() {
      
      
      scene();
      zoog();
      monster();
      txt();
    }
    
    void txt() {
      fill(0);
      textSize(15);
        text("Created By Enrico Fucci", 10,590);
      textSize(20);
        text("ZOOOOOG",300,20);
        text("PRESS Q TO EXIT",10,20);
    }
    
    void keyPressed() {
    if(key=='q') exit();
    if(key=='Q') exit();
    }
    
    void scene() {
     
      sky();
      sun();
      house();
      grass();
    }
      
     void sky() {
       background(58,153,203);
     }
     
     void grass() { //break between grass and sky, creating horizon
       fill(15,165,26);
       rect(0, horizon, width, height + 3/4); 
     }
     
     void sun() {
      sunX = sunX + .5; //movement to the right
      sunX = sunX % width; // re draws sun after it sets 
      sunY = horizon - 100 * sin(PI * sunX/width); //rise and set
       fill(#F0DA11); //yellow color of sun
       ellipse(sunX,sunY,60,60);
     }
     
     void house() {
      houseX = width*2/3;
      houseY = horizon-50;
       fill(#5A5A59);
       rectMode(CORNER);
       //base of house
       rect(houseX,houseY,120,80);
       //roof
       triangle(houseX, houseY, houseX +120, houseY, houseX+60, houseY-45);
       //window
       fill(255);//white
       rect( houseX+5,horizon-50, 20, 30 );// left
          line(houseX+25,horizon-35,houseX+5,horizon-35);
         rect( houseX+95,horizon-50, 20, 30 );//right
           line(houseX+115, horizon-35,houseX+95,horizon-35);
        //door 
        rect( houseX+50,horizon-50, 20, 50 );
     }
       
      void zoog() {
      zoogX = zoogX + (pmouseX - zoogX);
      zoogY = pmouseY + (pmouseX - zoogX);
      shoulder = zoogY;
      headY = shoulder - 30;
      hip = zoogY + 40;
      tilt = (mouseX - pmouseX);
      eyeR = random(255);
      eyeG = random(255);
      eyeB = random(255);
      //body
        fill(150); //body color 
        rectMode(CENTER);
        rect(zoogX,zoogY,20,100);//zoogs body
        fill(0);
      //head
        fill(0,150,35); //green
        ellipse(zoogX,headY,60,60); //head
      //eyes
        fill(0);
        ellipse( zoogX-19,headY, 16,32 );//left eye
        ellipse( zoogX+19,headY, 16,32 );//right eye
      //eye balls
        fill(eyeR,eyeG,eyeB);
        ellipse( zoogX-19, headY, 6,10 );//eyeball left
        ellipse( zoogX+19, headY, 6,10 );// eyeball right
      //mouth
        fill(255,0,0);
        ellipse(zoogX,headY+15,17,7);
      //arms
        line(zoogX+10,zoogY+10,zoogX+25,zoogY+30);
        line(zoogX-10,zoogY+10,zoogX-25,zoogY+30);
      //legs
        fill( 255,0,0);
        line( zoogX-10,hip, zoogX-10+tilt,hip+40 );//left leg
        line( zoogX+10,hip, zoogX+10+tilt,hip+40 );//right leg
      }
     
      void monster() {
        monsterX=  monsterX + (zoogX-monsterX) / 30;
        monsterY=  monsterY + (zoogY-monsterY) / 30;
      
          fill(0);
          ellipse(monsterX,monsterY, 100, 50); 
          fill(eyeR);
          ellipse(monsterX,monsterY,75,75);
          
  }
      
        