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

Lab3_Doraemon

Doraemon

//MY FAV MOVIE
//int posX=0;//fill value to move(Horizontal)
//int posY=0;//fill value to move(Vertical)
int posX;
int posY;
void setup() {
  size(500, 500);
}
void draw() {
  background(#FACFF4);
  doraemon();
  if (keyPressed) {
    if (key =='a' || key =='A') {
      posX--;
    }if (key =='d' || key =='D') {
      posX++;
    }  if (key =='w' || key =='W') {
      posY--;
    }  if (key =='s' || key =='S') {
      posY++;
    }
  }
}
void doraemon() {
  stroke(#0054A5);
  strokeWeight(3);
  fill(#236ED6);//blue
  ellipse(250+posX, 180+posY, 350, 295);//head
  fill(255);//white
  ellipse(250+posX, 210+posY, 250, 205);//face
  ellipse(210+posX, 120+posY, 80, 100);//right hand
  ellipse(290+posX, 120+posY, 80, 100);//left hand
  fill(#F21D1D);//red
  rect(110+posX, 300+posY, 280, 30);//cat collar
  fill(255);//white
  ellipse(120+posX, 300+posY, 60, 60);//right eye
  ellipse(380+posX, 300+posY, 60, 60);//left eye
  fill(#FF292D);//red
  ellipse(250+posX, 175+posY, 45, 40);//nose
  fill(255);//white
  arc(250+posX, 235+posY, 180, 50, 0, PI);//cute smile <3
  fill(#FAD449);//gold or yellow
  ellipse(250+posX, 300+posY, 40, 40);//bell
  fill(#3C60B9);//blue
  ellipse(225+posX, 135+posY, 20, 20);//inner eye(right)
  ellipse(275+posX, 135+posY, 20, 20);//inner eye(left)
  line(250+posX, 194+posY, 250+posX, 260+posY);//mouth (line)
  line(210+posX, 210+posY, 140+posX, 210+posY);// cat's whiskers mid right
  line(290+posX, 210+posY, 360+posX, 210+posY);// cat's whiskers mid left
  line(210+posX, 220+posY, 140+posX, 230+posY);// cat's whiskers below right
  line(290+posX, 220+posY, 360+posX, 230+posY);// cat's whiskers below left
  line(210+posX, 200+posY, 140+posX, 190+posY);// cat's whiskers above right
  line(290+posX, 200+posY, 360+posX, 190+posY);// cat's whiskers mid left
  line(232+posX, 290+posY, 267+posX, 290+posY);//bell line1
  line(210+posX, 300+posY, 290+posX, 300+posY);//bell line2
  strokeWeight(7);
  line(250+posX, 302+posY, 250+posX, 320+posY);//bell line3
  stroke(255);//white line
  fill(255);//white
  ellipse(258+posX, 170+posY, 12, 12);//reflect nose
}

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

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