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

Lab 3 : Game (follow mouse and keyPressed)


int c=#6A3205;

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

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

void draw_brown(int x,int y){
background(#58D1F4);

fill(c);                              //ear l
stroke(c);
ellipse(x-50,y+30,120,120);

fill(c);                              //ear r
stroke(c);
ellipse(x+150,y+30,120,120);

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

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

fill(c);                              //head
stroke(c);
ellipse(x+50,y+170,340,320);

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

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

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

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

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

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


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

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

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

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

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

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

fill(#FEAF04);                            //sun
stroke(#FEAF04);
ellipse(x+260,y-270,250,250);

}

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

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

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