วันอาทิตย์ที่ 13 กันยายน พ.ศ. 2558

Lab 4 : Game


int c=#6A3205;

void setup(){
size(500,500);
}

void draw(){
  draw_brown(mouseX,mouseY);
}

void draw_brown(int x,int y){
  int n=1;
  int sx=0;                          //space
  int sy=0;
  
  background(#58D1F4);
  
  while(n<5){

  fill(c);                              //ear l
  stroke(#4C2404);
    ellipse((x-50)+sx,(y+30)+sy,120,120);

  fill(c);                              //ear r
  stroke(#4C2404);
    ellipse((x+150)+sx,(y+30)+sy,120,120);

  fill(#4C2404);                              //in ear l
  stroke(#4C2404);
    ellipse((x-50)+sx,(y+30)+sy,75,75);

  fill(#4C2404);                              //in ear r
  stroke(#4C2404);
    ellipse((x+150)+sx,(y+30)+sy,75,75);

  fill(c);                              //head
  stroke(#4C2404);
    ellipse((x+50)+sx,(y+170)+sy,340,320);

  fill(#EFF804);                              //petal1
  stroke(#EFF804);
    ellipse((x-25)+sx,(y+35)+sy,50,50);

  fill(#EFF804);                              //petal2
  stroke(#EFF804);
    ellipse((x-55)+sx,(y+60)+sy,50,50);

  fill(#EFF804);                              //petal3
  stroke(#EFF804);
    ellipse((x+5)+sx,(y+60)+sy,50,50);

  fill(#EFF804);                              //petal4
  stroke(#EFF804);
    ellipse((x-5)+sx,(y+95)+sy,50,50);

  fill(#EFF804);                              //petal5
  stroke(#EFF804);
    ellipse((x-45)+sx,(y+95)+sy,50,50);

  fill(#522F03);                              //pollen
  stroke(#522F03);
    ellipse((x-25)+sx,(y+70)+sy,30,30);

  fill(0);                                        //eye l
  stroke(0);
    ellipse((x+30)+sx,(y+140)+sy,25,25);

  fill(0);                                        //eye r
  stroke(0);
    ellipse((x+80)+sx,(y+140)+sy,25,25);

  fill(#FDCF86);                            //mouth
  stroke(#FDCF86);
    ellipse((x+55)+sx,(y+200)+sy,80,95);

  fill(0);                                        //nose
  stroke(0);
    ellipse((x+55)+sx,(y+185)+sy,15,15);

  noFill();                                     //continue nose
  stroke(0);
  strokeWeight(2);
    line((x+55)+sx,(y+185)+sy,(x+55)+sx,(y+220)+sy);

  curve((x+130)+sx,(y+110)+sy,(x+30)+sx,(y+210)+sy,(x+80)+sx,(y+210)+sy,(x-20)+sx,(y+110)+sy);

  fill(#FEAF04);                            //sun
  stroke(#FEAF04);
    ellipse((x+260)+sx,(y-270)+sy,250,250);
  
  n++;
  sx = sx+200;
  sy = sy+100;

  }
}

void keyPressed(){
  c=#7808BF;
}

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

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