//// Lenny Taveras Project 0
//// 9-30-2019 CST 112

String title=  "A Dogs Awakening ";
String author=  "Lenny Taveras";

float sunX;
float sunY;

  void setup() { 
   size (600, 600);
   reset ();
}

  void reset () {
   sunX=0;
   sunY=40;
  
}
  void draw () {
   background(150,200,240);
   action ();
   scene ();
   house ();
   dog ();
   hero ();
   credit ();
   
   
}  
  
  void scene() {
   fill ( 0, 253, 0);
   rect ( 0 , 400, 600, 550);// grass
   fill ( 223, 255, 0);
   ellipse( sunX, sunY, 150, 150 ); // Sun
   fill ( 173, 99, 21);
   rect ( 140, 330 , 20, 70); ///Trunk for the tree
   fill(24, 201, 93);
   ellipse ( 150, 320, 70, 70); // leaves for tree
 
 
}

  void house() {
    fill ( 255, 30, 30);
    rect ( 280, 300, 100, 100); // house body
    fill( 127, 0, 0);
    triangle ( 270, 310, 330, 255, 390,310 ); // roof
    fill (23,0,150);
    rect ( 315, 350, 25, 50); // door

    
}    
  
  void hero () {
    fill ( 59, 178, 232);
    rect ( 325, 450, 30, 60); //body
    fill ( 200);
    ellipse ( 340, 446, 35, 35); //head
    fill ( 63, 184, 216); 
    ellipse ( 334, 445, 6, 6);  // left eye
    ellipse ( 346, 445, 6, 6);  // right eye
    line (335, 452, 345, 452);
    
}    

  void dog () { 
    fill (227, 153, 16);
    rect ( 100, 450, 50, 25); // dog body
    fill (0);
    rect ( 100 , 475, 10, 13);// legs
    rect ( 140 , 475, 10, 13);
    fill (227, 153, 16);
    rect ( 150, 450, 20, 15); // head
    fill (0);
    ellipse ( 155, 455, 3, 3); // eyes
    line ( 170, 460, 165, 460); //lips
  
}
  void action() {
    sunX =  sunX + 1;  // Sun moves across sky
  
   if (sunX > 675) { 
   reset();}           // Sun resets greater than 675p 
   
}
  
  void credit () {
    
    fill(0);
    textSize(20);
    text( title, width/3, 24); 
    textSize(12);
    fill(150,0,0);
    text( author, 20, height-20);
}    