24 ตุลาคม 2556

Assignment 2_B

..# Assignment 2_B #.. 
~ ~ Assignment 2_B ~

 
Assignment 2_B  Processing.js code


ชื่อฟังก์ และ ตัวแแปร ให้มีความสมเหตุสมผล  -- นุ่น 6 ชม.

แก้ไขแนวทางเดินของลูก เช็คค่าลูก  -- ยุ้ย  10 ชม.

ท่าตีลูกของ boy & snoopy -- ฝน  10 ชม.




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

/////////////////////
int button(String s, int number) {
  fill(60, 227, 69);
  rect(150, 100, 300, 200);
  fill(255, 10, 47);
  textFont(createFont("Arial", 50));
  text(s, 220, 210);
  if (mousePressed&&mouseX>150&&mouseX<450&&mouseY>100&&mouseY<300) {
    if (number==0) {
      number=1;
    }
  }
  return number;
}
///////////////////

ตัวแปร  global  ทั้งหมด


float h = 45; //ตัวที่ตัองรีค่าใหม่
float y = 260;
int x = 100;

int l = 40; //ระยะ l
int r = 20; //รัศมีลูกบอล

int b; //สุตำแหน่งลูก

int po = 0; //pow ท่าตี
int poo =0; //ตีลูกกลับ
int step; //นับคะแนน

int snoopyY = 300;
int sno = 0;

int pass = 1; //คววามเร็ว
int level; //ระดับ
int life = 3; //ชีวิตที่หลือ

int number = 0; //หน้าเริ่ม

float g;
int G;
int snogirl=0;
int powgirl;
float xi = 100;
float hi = 45;
float yi = 160;

int i = 0;

////////////////////
void keyPressed() {
  if (keyCode == UP&&sno>=0&&sno<2) {
    sno = sno+1;
    snogirl = snogirl+1;
    snoopyY = snoopyY-100;
  }
  if (keyCode == DOWN&&sno>0&&sno<=2) {
    sno = sno-1;
    snogirl = snogirl-1;
    snoopyY = snoopyY+100;
  }
  if (width-250<=x&&x<=width-150&&sno==b) {
    if (key=='T'||key=='t') {
      step = step+2; //score
      po = po+1; //ท่าตี snoopy
      poo = sno+1; //ตีกลับ boy
      x = 380;
      h = 45;
      if (step%8==0) {
        level = level+1;
        g = random(0, 3);
      }
      if (step==8||step==18||step>=40&&step%17==0) {
        pass = pass+1;
        life = life+1;
      }
    }
  }

  if (width-250<=xi&&xi<=width-150&&snogirl==G-1) {
    if (key=='T'||key=='t') {
      step = step+2; //score
      po = po+1; //ท่าตี snoopy
      powgirl = snogirl+1; //ตีกลับ Girl
      xi = 380;
      hi = 45;
    }
  }
}

///////////////////////////

void draw() {
  if (number==0) {
    background(0);
    number = button("START", number);
    Life(3, width-200, 50);
    Boy2(420, 300);
    Girl(200, 150);
  }
  else if (number==1) {
    background(195, 255, 230);
    scene();
    Boy1(50, height-25); /////////// ตำแหน่ง snoopy
    if (sno==0||snogirl==0) {
      if (po==1) {
        pow1(width-200, 300);
      }
      else {
        tennis(width-200, 300);
      }
      Snoopy(width-200, 300);
    }
    else if (sno==1||snogirl==1) {
      if (po==1) {
        pow1(width-200, 200);
      }
      else {
        tennis(width-200, 200);
      }
      Snoopy1(width-200, 200); //เปลี่ยนภาพได้
    }
    else if (sno==2||snogirl==2) {
      if (po==1) {
        pow1(width-200, 100);
      }
      else {
        tennis1(width-200, 100);
      }
      Snoopy2(width-200, 100);
    }
    po = 0;

    Life(life, width-160, 15);
    textFont(createFont("Arial", 17));
    fill(0, 0, 255);
    text("score = "+step+"   Level "+level+"   Life "+life, 30, 30);

    //////////// ตำแหน่ง บอล
    if (x>=100&&x<=width-50&&b==2) {
      if (poo==3) {
        fill(0);
        frameRate(pass);
        ellipse(x, y, r, 2*r/3);
        x = x-l-10;
        y = y-h+25;
        h = h-10;
      }
      else {
        fill(0);
        frameRate(pass);
        ellipse(x, y, r, 2*r/3);
        x = x+l;
        y = y-h;
        h = h-7;
      }
    }

    if (x>=100&&x<=width-50&&b==1) {
      if (poo==2) {
        fill(0);
        frameRate(pass);
        ellipse(x, y, r, 2*r/3);
        x = x-l-10;
        y = y-h+10;
        h = h-10;
      }
      else {
        fill(0);
        x = x+l+10;
        frameRate(pass);
        ellipse(x, y, r, 2*r/3);
        y = y-h;
        h = h-13;
      }
    }

    if (x>=100&&x<=width-50&&b==0) {
      if (poo==1) {
        fill(0);
        y = y-h-20;
        frameRate(pass);
        ellipse(x, y, r, 2*r/3);
        x = x-15-l;
        h = h-12;
      }
      else {
        fill(0);
        frameRate(pass);
        ellipse(x, y, r, 2*r/3);
        x = x+l+15;
        y = y-h;
        h = h-25;
      }
    } //////////////////
    if (xi>=100&&xi<=width-50&&G==1) {
      if (powgirl==1) {
        fill(0);
        yi = yi-hi-20;
        frameRate(pass);
        ellipse(xi, yi, r, 2*r/3);
        xi = xi-15-l;
        hi = hi-12;
      }
      else {
        fill(0);
        frameRate(pass);
        ellipse(xi, yi, r, 2*r/3);
        xi = xi+l;
        yi = yi-hi+25;
        hi = hi-10;
      }
    }

    if (xi>=100&&xi<=width-50&&G==2) {
      if (powgirl==2) {
        fill(0);
        frameRate(pass);
        ellipse(xi, yi, r, 2*r/3);
        xi = xi-l-10;
        yi = yi-hi+10;
        hi = hi-10;
      }
      else {
        fill(0);
        frameRate(pass);
        ellipse(x, y, r, 2*r/3);
        x = x+l+10;
        y = y-h+25;
        h = h-10;
      }
    }

    if (xi>=100&&xi<=width-50&&G==3) {
      if (powgirl==3) {
        fill(0);
        frameRate(pass);
        ellipse(xi, yi, r, 2*r/3);
        xi = xi-l-10;
        yi = yi-hi+25;
        hi = hi-10;
      }
      else {
        fill(0);
        frameRate(pass);
        ellipse(xi, yi, r, 2*r/3);
        xi = xi+l+10;
        yi = yi-hi+20;
        hi = hi-5;
      }
    } /////////////
    if (x<100) { //สุ่มตำแน่ง
      float a = random(0, 3);
      if (a<=1) {
        b = 0;
      }
      if (a<=2&&a>1) {
        b = 1;
      }
      if (a<=3&&a>2) {
        b = 2;
      }
      if (g>0&&g<=3) {
        if (g>0&&g<=1) {
          G = 1;
        }
        if (g>1&&g<=2) {
          G = 2;
        }
        if ( g>2&&g<=3) {
          G = 3;
        }
        yi =160;
        hi = 45;
        xi = 100;
        g = 0;
        Girl(100, 50);
      }
      x = 100;
      h = 45;
      y =260;
      poo = 0;
    }

    if (xi<100) {
      G = 0;
    }

    ////////// miss
    if (x>=width-50||xi>=width-50) {
      if (life==0) {
        background(0);
        scene();
        fill(252, 120, 252);
        textFont(createFont("Arial", 50));
        text("Game Over", 150, 150);
        textFont(createFont("Arial", 15));
        text("score = "+step+"    Level "+level, 200, 200);
        Snoopyover(560, 300);
        Boy2(300, 350);
      }
      else {
        x = 99;
        G = 0;
        poo = 0;
        life = life-1;
      }
    }
  }
}

/////////////////////
void tennis(float x, float y) {
  stroke(0);
  noFill();
  strokeWeight(3);
  ellipse(x+100, y, 36, 46);
  line(x+82, y-5, x+118, y+5);
  line(x+88, y-18, x+114, y-9);
  line(x+86, y+9, x+112, y+18);
  strokeWeight(6);
  line(x+86, y+20, x+73, y+35);
  fill(255);
  strokeWeight(0);
  ellipse(x+65, y+35, 15, 10);
}

void tennis1(float x, float y) {
  stroke(0);
  noFill();
  strokeWeight(3);
  ellipse(x+100, y+70, 36, 46);
  line(x+82, y+80, x+118, y+60);
  line(x+86, y+62, x+112, y+50);
  line(x+93, y+88, x+116, y+75);
  strokeWeight(6);
  line(x+86, y+50, x+67, y+35);
  strokeWeight(0);
  fill(255);
  ellipse(x+65, y+35, 15, 10);
}


void pow1(float x, float y) {
  stroke(0);
  fill(0);
  ellipse(x, y-10, 10, 46);
  strokeWeight(3);
  line(x, y-15, x, y+30);
  fill(255);
  noStroke();
  quad(x, y+33, x, y+28, x+35, y+37, x+35, y+43);
  stroke(0);
  strokeWeight(0);
  ellipse(x, y+30, 20, 15);
}

void pow2(float x, float y) {
  noFill();
  strokeWeight(3);
  ellipse(x-20, y+63, 46, 36);
  line(x-40, y+63, x-23, y+78);
  line(x-35, y+50, x-7, y+78);
  line(x-20, y+45, x, y+68);
  strokeWeight(6);
  line(x+30, y+43, x, y+50);
  fill(255);
  strokeWeight(0);
  ellipse(x+25, y+43, 15, 10);
}


void Snoopy(float x, float y) {
  strokeWeight(0);
  fill(255);
  noStroke();
  ellipse(x+55, y, 35, 45);
  ellipse(x+40, y+3, 60, 38);
  ellipse(x+45, y+39, 28, 35);
  ellipse(x+52, y+50, 20, 5);
  quad(x+46, y+50, x+57, y+70, x+64, y+70, x+53, y+50);
  quad(x+36, y+50, x+32, y+70, x+39, y+70, x+43, y+50);
  fill(0);
  ellipse(x+10, y+7, 10, 7);
  ellipse(x+45, y-5, 5, 10);
  ellipse(x+70, y+10, 20, 35);
  stroke(0);
  fill(255);
  ellipse(x+30, y+70, 25, 15);
  ellipse(x+60, y+70, 25, 15);
  ellipse(x+40, y+40, 10, 10);
}


void Snoopy1(float x, float y) {
  strokeWeight(0);
  fill(255);
  noStroke();
  ellipse(x+55, y, 40, 50);
  ellipse(x+40, y+5, 60, 40);
  ellipse(x+45, y+41, 28, 35);
  ellipse(x+52, y+55, 20, 5);
  rect(x+46, y+50, 7, 20);
  quad(x+36, y+50, x+32, y+70, x+39, y+70, x+43, y+50);
  fill(0);
  ellipse(x+10, y+10, 10, 7);
  ellipse(x+45, y-5, 5, 10);
  ellipse(x+70, y+10, 20, 35);
  stroke(0);
  fill(255);
  ellipse(x+35, y+70, 25, 15);
  ellipse(x+48, y+70, 25, 15);
  ellipse(x+50, y+50, 10, 10);
}


void Snoopy2(float x, float y) {
  strokeWeight(0);
  fill(255);
  noStroke();
  ellipse(x+50, y, 50, 50);
  ellipse(x+40, y+10, 60, 40);
  ellipse(x+45, y+45, 28, 35);
  ellipse(x+55, y+55, 20, 5);
  fill(0);
  ellipse(x+30, y+10, 10, 7);
  ellipse(x+40, y-5, 5, 10);
  ellipse(x+48, y-5, 5, 10);
  ellipse(x+70, y+10, 20, 35);
  stroke(0);
  fill(255);
  ellipse(x+30, y+50, 15, 25);
  ellipse(x+40, y+50, 15, 25);
  ellipse(x+55, y+50, 10, 10);
}


void Snoopyover(int s, int p) {
  noStroke();
  fill(255); //head
  ellipse(s-40, p-20, 50, 45);
  ellipse(s-35, p-30, 40, 60);
  ellipse(s, p-15, 35, 25); //body
  rect(s+13, p-15, 15, 10); //leg
  ellipse(s+28, p-15, 10, 25); //foot
  fill(0, 0, 0); //nose
  ellipse(s-35, p-60, 10, 10 );
  ellipse(s-50, p+15, 10, 35); //ear
  stroke(0, 0, 0);
  fill(255);
  ellipse(s+5, p-5, 10, 10); //hand
  line(s-50, p-35, s-45, p-30); //eye
}


void Boy1(int b, int o) {
  fill(255, 250, 205);
  stroke(255, 250, 205); //neck
  rect(b-5, o-80, 7, 10); //head
  ellipse(b, o-100, 50, 50); //nose
  ellipse(b+28, o-100, 10, 10); //ear
  stroke(0);
  ellipse(b-10, o-100, 10, 10); //eye
  fill(0);
  ellipse(b+15, o-105, 6, 8);
  ellipse(b+50, o-110, 15, 15);

  //arm1
  fill(255, 250, 205);
  stroke(255, 250, 205);
  ellipse(b+20, o-60, 40, 10);
  ellipse(b+40, o-65, 15, 15);

  //arm2
  ellipse(b+20, o-50, 10, 10);
  ellipse(b+30, o-45, 15, 15);

  //leg
  fill(255, 250, 205);
  stroke(255, 250, 205);
  rect(b, o-25, 10, 20);
  rect(b-15, o-20, 10, 20);

  //pant
  fill(0, 0, 128);
  stroke(0, 0, 128);
  rect(b-20, o-30, 40, 15);

  //foot
  fill(28, 28, 28);
  stroke(255, 250, 205);
  ellipse(b+10, o, 20, 10);
  ellipse(b-5, o+3, 20, 10);

  //body
  fill(255, 255, 0);
  stroke(255, 255, 0);
  rect(b-10, o-70, 15, 15);
  quad(b-10, o-70, b+10, o-70, b+20, o-30, b-20, o-30);
  stroke(205, 155, 29);
  rect(b+10, o-70, 15, 15);
  stroke(0);
  strokeWeight(5);
  line(b-15, o-45, b-10, o-37);
  line(b-10, o-37, b-5, o-45);
  line(b-5, o-45, b, o-37);
  line(b, o-37, b+5, o-45);
  line(b+5, o-45, b+10, o-37);
  line(b+10, o-37, b+15, o-45);

  //tennis
  strokeWeight(2);
  fill(255);
  line(b+35, o-40, b+45, o-30);
  ellipse(b+47, o-20, 20, 40);
  strokeWeight(1);
  line(b+42, o-35, b+56, o-25);
  line(b+39, o-27, b+56, o-15);
  line(b+36, o-19, b+55, o-5);

  line(b+44, o-37, b+40, o-17);
  line(b+50, o-37, b+42, o-3);
  line(b+56, o-35, b+50, o-3);

  //hair
  line(b+15, o-120, b+25, o-130);
  line(b-25, o-90, b-35, o-95);
}

void Boy2(int b, int o) {
  fill(255, 250, 205);
  stroke(255, 250, 205);
  rect(b-5, o-80, 7, 10);//neck
  ellipse(b, o-100, 50, 50); //head
  ellipse(b+28, o-100, 10, 10); //ear
  ellipse(b-27, o-100, 10, 10);
  stroke(0); //nose
  ellipse(b, o-95, 7, 7);
  fill(0);//eye
  ellipse(b+10, o-100, 4, 6);
  ellipse(b-10, o-100, 4, 6);
  line(b-5, o-85, b+5, o-85);//mouse
  fill(255, 250, 205); //arm1
  stroke(255, 250, 205);
  ellipse(b+20, o-60, 40, 10);
  ellipse(b+40, o-65, 15, 15);
  ellipse(b-20, o-60, 40, 10); //arm2
  ellipse(b-40, o-65, 15, 15);
  fill(255, 250, 205); //leg
  stroke(255, 250, 205);
  rect(b, o-25, 10, 20);
  rect(b-15, o-20, 10, 20);
  fill(0, 0, 128); //pant
  stroke(0, 0, 128);
  rect(b-20, o-30, 40, 15);
  fill(28, 28, 28); //foot
  stroke(255, 250, 205);
  ellipse(b+10, o, 20, 10);
  ellipse(b-5, o+3, 20, 10);
  fill(255, 255, 0); //body
  rect(b-10, o-70, 15, 15);
  stroke(205, 155, 29);
  rect(b+10, o-70, 15, 15);
  rect(b-25, o-70, 15, 15);
  stroke(255, 255, 0);
  quad(b-10, o-70, b+10, o-70, b+20, o-30, b-20, o-30);
  stroke(0);
  strokeWeight(5);
  fill(255);
  line(b-15, o-45, b-10, o-37);
  line(b-10, o-37, b-5, o-45);
  line(b-5, o-45, b, o-37);
  line(b, o-37, b+5, o-45);
  line(b+5, o-45, b+10, o-37);
  line(b+10, o-37, b+15, o-45);
  strokeWeight(3);
  line(b-5, o-120, b, o-115); //hair
  line(b, o-120, b+5, o-115);
  strokeWeight(1);
}

void Girl(int g, int l) {
  fill(255, 250, 205);
  stroke(255, 250, 205); //neck
  rect(g-55, l+70, 7, 10); //nose
  ellipse(g-22, l+50, 10, 10); //head
  ellipse(g-50, l+50, 50, 50);
  fill(0);
  stroke(0); //hair
  ellipse(g-40, l+25, 25, 15);
  ellipse(g-60, l+30, 35, 25);
  ellipse(g-70, l+45, 25, 35);
  ellipse(g-70, l+65, 40, 20); //mouse
  line(g-40, l+60, g-30, l+65); //eye
  line(g-40, l+40, g-35, l+46);
  line(g-35, l+40, g-35, l+46); //tennis
  strokeWeight(2);
  line(g-5, l+55, g-5, l+80);
  fill(255);
  stroke(0);
  ellipse(g-5, l+40, 20, 50);
  strokeWeight(1);
  line(g-10, l+20, g-10, l+60);
  line(g-5, l+15, g-5, l+65);
  line(g, l+20, g, l+60);
  line(g-15, l+30, g+5, l+30);
  line(g-15, l+40, g+5, l+40);
  line(g-15, l+50, g+5, l+50); //arm2
  fill(255, 250, 205);
  stroke(255, 250, 205);
  ellipse(g-30, l+90, 50, 10);
  ellipse(g-10, l+85, 25, 15); //leg
  fill(255, 250, 205);
  stroke(255, 250, 205);
  rect(g-40, l+130, 10, 20);
  rect(g-65, l+135, 20, 10); //foot2
  fill(139, 58, 98);
  stroke(139, 58, 98);
  ellipse(g-30, l+150, 20, 10);
  ellipse(g-60, l+143, 10, 20); //body
  fill(255, 110, 180);
  stroke(255, 110, 180);
  quad(g-60, l+80, g-40, l+80, g-20, l+130, g-75, l+130);
  ellipse(g-50, l+130, 65, 15); //arm1
  fill(255, 250, 205);
  stroke(255, 250, 205);
  ellipse(g-60, l+110, 10, 40);
  ellipse(g-60, l+130, 15, 15);
  fill(255, 110, 180);
  stroke(139, 58, 98);
  ellipse(g-60, l+90, 20, 20);
}

void Life(int count, int x, int y) {
  int n = 0;
  while (n<count) {
    strokeWeight(0);
    fill(255);
    noStroke();
    ellipse(x+50, y, 20, 25);
    ellipse(x+43, y+3, 30, 20);
    fill(0);
    ellipse(x+28, y+5, 5, 4);
    ellipse(x+45, y-2, 5, 7);
    ellipse(x+58, y+5, 13, 22);
    x = x+40;
    n = n+1;
  }
}

//Background

void scene() {
  Pole(80, 10);
  Tree(width-130, height-25, 60, 40, 20);
  Crate(width-80, height-100, 40, 30);
}
void Tree(int x, int y, int b, int h, int r) {
  noStroke();
  //leaf
  fill(46, 160, 26);
  ellipse(x+2*b, y-5*h-h/3, 2*r/3, r);  //middle
  ellipse(x+2*b+r/2, y-5*h, r, 2*r/3);
  ellipse(x+2*b, y-5*h+h/3, 2*r/3, r);
  ellipse(x+2*b-r, y-5*h-h/4, r, 3*r/2);
  ellipse(x+2*b-2*r/3, y-5*h+2*h/3, r, 2*r/3);
  ellipse(x+2*b-3*r/2, y-4*h, r, 3*r/2);
  ellipse(x+b, y-5*h, 4*r/3, r);
  ellipse(x+b+r/2, y-5*h-h/2, 2*r/3, r);
  ellipse(x+b+r, y-5*h, 2*r/3, r);
  ellipse(x+2*b-b/4, y-9*h, 2*r/3, r);  //top left
  ellipse(x+2*b, y-9*h-h/5, 2*r/3, r);
  ellipse(x+2*b+r/2, y-9*h+h/5, r, 2*r/3);
  ellipse(x+2*b-b/3, y-7*h-h/3, r, 3*r/2);
  ellipse(x+2*b, y-8*h+h/5, 3*r/2, r);
  ellipse(x+b+b/3, y-8*h+h/2, r, 2*r/3);
  ellipse(x+8*b/3, y-8*h-h/4, r, 2*r/3);
  ellipse(x+7*b/3+r/3, y-8*h, 2*r/3, r);
  ellipse(x-2*b+b/3, y-9*h, r, 2*r/3);  //top right
  ellipse(x-2*b, y-9*h-h/5, 2*r/3, r);
  ellipse(x-2*b-r/2, y-9*h+h/5, r, 2*r/3);
  ellipse(x-2*b, y-8*h+h/4, r, 2*r/3);
  ellipse(x-2*b+b/5, y-7*h-h/3, 2*r/3, r);
  ellipse(x-2*b-b/6, y-7*h-h/3, r, 2*r/3);
  ellipse(x-2*b+b/4, y-8*h, 2*r/3, r);
  ellipse(x, y-8*h-h/4, 3*r/2, r);
  ellipse(x-2*b/5, y-8*h-h/3, 2*r/3, r);
  ellipse(x-b/2, y-9*h-h/5, 2*r/3, r);
  ellipse(x-b/3, y-9*h+h/5, r, 2*r/3);
  ellipse(x-4*b/5, y-9*h+h/5, r, 2*r/3);
  ellipse(x-b-b/4, y-9*h, r, 3*r/2);
  ellipse(x-b/2, y-7*h, r, 3*r/2);
  ellipse(x-4*b/5, y-7*h-h/3, 2*r/3, r);
  ellipse(x-5*b/4, y-7*h-h/4, 3*r/2, r);
  //stem
  stroke(157, 64, 14);
  fill(157, 64, 14);
  quad(x, y, x+5*b/4, y, x+4*b/3, y-h, x+b/3, y-4*h/3);
  quad(x+b/3, y-4*h/3, x+4*b/3, y-h, x+b, y-5*h/2, x, y-2*h);
  quad(x+b, y-5*h/2, x, y-2*h, x-b, y-2*h, x-4*b/3, y-9*h/4);  //pole
  quad(x+b, y-5*h/2, x, y-2*h, x+b/4, y-3*h, x+5*b/4, y-7*h/2);
  quad(x+b/4, y-3*h, x+5*b/4, y-7*h/2, x+4*b/5, y-5*h, x, y-4*h-h/2);
  quad(x+b/2, y-5*h, x-b-b/4, y-5*h, x-b-b/2, y-5*h-h/2, x-b, y-5*h-h/4);  //pole
  quad(x-b, y-5*h-h/4, x+b/2, y-5*h, x+b/2, y-5*h-h/4, x-b, y-5*h-h/4);  //pole
  quad(x, y-4*h-h/2, x+4*b/5, y-5*h, x+2*b/3, y-6*h-h/4, x, y-6*h);
  quad(x, y-6*h, x+2*b/3, y-6*h-h/4, x+b, y-7*h-h/2, x+b/5, y-7*h);
  quad(x+b/5, y-7*h, x+b, y-7*h-h/2, x-b/2, y-8*h, x-b, y-8*h+h/5);
  quad(x-b, y-8*h+h/5, x-b/2, y-8*h, x-2*b+b/4, y-9*h+h/5, x-2*b, y-9*h);
  quad(x+b/5, y-7*h, x+b, y-7*h-h/2, x+3*b, y-9*h+h/4, x+b/2, y-8*h);
  //branch
  quad(x+b, y-4*h, x+2*b, y-5*h, x+3*b/2, y-5*h+h/4, x+b, y-4*h-h/4);
  triangle(x-2*b, y-8*h+h/2, x-b, y-8*h+h/5, x-b, y-8*h);
  triangle(x-b, y-8*h+h/5, x-2*b/3, y-8*h, x-b/2, y-9*h);
  triangle(x+2*b, y-9*h, x+2*b-b/4, y-8*h-h/3, x+3*b/2, y-8*h-h/4);
  //bird
  noStroke();
  fill(62, 30, 12);
  arc(x+b, y-8*h-h/2, 3*r, 3*r, 0, PI);
}
void Crate(int x, int y, int l, int r) {
  fill(106);
  stroke(0);
  strokeWeight(3);
  rect(x, y, 2*r, 2*l);
  quad(x, y, x-r, y+l, x+3*r, y+l, x+2*r, y);
}
void Pole(int l, int r) {
  fill(62, 30, 12);
  noStroke();
  quad(0, height/2+3*r, 0, height/2+4*r, l/2+2*r, height/2, l/2+r, height/2);
  rect(0, height/2, l, r);
  fill(15, 165, 58);
  rect(0, height-50, width, 50);
}

ไม่มีความคิดเห็น:

แสดงความคิดเห็น