วันพุธที่ 2 กันยายน พ.ศ. 2558

[LAB3] FlyingBird

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

void draw()
{
  background(255);
  if(frameCount%10 < 5)
  {
    flying_bird = 30;
  }
  else
  {
    flying_bird = -30;
  }
  draw_BodyBird(mouseX,mouseY);
}

void draw_BodyBird(int xContral ,int yContral)
{
  int sizeBody = 100;
  int xMouth1 = 0;
  int yMouth1 = 55;
  int xMouth2 = -25;
  int yMouth2 = 5;
  int xMouth3 = 25;
  int yMouth3 = 5;
  int xEyeL = -25;
  int yEyeL = -25;
  int xEyeR = 25;
  int yEyeR = -25;
  int sizeEye =50;
  int length_Fly = 100;
  line(xContral,yContral,xContral +length_Fly ,flying_bird+mouseY);
  line(xContral,yContral,xContral -length_Fly ,flying_bird+mouseY);
  strokeWeight(1);
  fill(0);
  ellipse(xContral,yContral,sizeBody,sizeBody);
  fill(#FFF92C);
  triangle(xContral,yMouth1+yContral,xMouth2+xContral,yMouth2+yContral,xMouth3+xContral,yMouth3+yContral);
  fill(255);
  ellipse(xEyeL+xContral,yEyeL+yContral,sizeEye,sizeEye);
  fill(255);
  ellipse(xEyeR+xContral,yEyeR+yContral,sizeEye,sizeEye);
  strokeWeight(5);
  point(xEyeL+xContral,yEyeL+yContral);
  point(xEyeR+xContral,yEyeR+yContral);
}

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

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