อันนี้ไม่รู้จะใส่ Function ยังไง ไม่ได้ออกแบบไว้เผื่อใส่ตั้งแต่ Lab 1 แฮะแฮะ
งั้นก็ใส่แบบนี้ละกัน
DrawMan(int Left_M); ฟังก์ชันนี้ไว้เพื่อวาดผู้ชาย โดยปรับ Left_M เพื่อขยับตำแหน่งผู้ชาย
DrawWoman(int Left_F); ฟังก์ชันนี้ไว้เพื่อวาดผู้หญิง โดยปรับ Left_F เพื่อขยับตำแหน่งผู้หญิง
void setup()
{
//variable
int Left_M,Left_F;
//assign variable
Left_M = 60; //inc = man to right , dec = man to left
Left_F = -60; //inc = woman to right , dec = woman to left
size(500,300);
background(134,255,74);
noStroke();
DrawMan(Left_M);
DrawWoman(Left_F);
//Draw HEART !!
beginShape();
fill(255,0,0);
vertex(250,100); //1
bezierVertex(200,60,220,20,250,40);
bezierVertex(280,20,300,60,250,100);
endShape();
}
void DrawMan(int Left_M){
//Draw man
fill(255,214,156); //face
ellipse(Left_M+150,100,30,30); //face
fill(0); //hair
beginShape(); //hair
vertex(Left_M+133,95);//1
bezierVertex(Left_M+138,82,Left_M+162,82,Left_M+167,95); //2
vertex(Left_M+133,95);//3
endShape();
fill(0,151,252); //shirt
beginShape(); //shirt
vertex(Left_M+135,115); //1
vertex(Left_M+165,115); //2
vertex(Left_M+190,140); //3
vertex(Left_M+180,150); //4
vertex(Left_M+165,135); //5
vertex(Left_M+165,180); //6
vertex(Left_M+135,180); //7
vertex(Left_M+135,135); //8
vertex(Left_M+120,150); //9
vertex(Left_M+110,140); //10
vertex(Left_M+135,115); //11,1
endShape();
fill(20,25,33); //jeans
beginShape(); //jeans
vertex(Left_M+165,180); //1
vertex(Left_M+170,245); //2
vertex(Left_M+155,245); //3
vertex(Left_M+150,200); //4
vertex(Left_M+145,245); //5
vertex(Left_M+130,245); //6
vertex(Left_M+135,180); //7
endShape();
}
void DrawWoman(int Left_F){
//Draw woman
fill(255,214,156); //face
ellipse(Left_F+350,100,30,30); //face
fill(255,0,238); //shirt
beginShape(); //shirt
vertex(Left_F+335,115); //1
vertex(Left_F+365,115); //2
vertex(Left_F+390,140); //3
vertex(Left_F+380,150); //4
vertex(Left_F+365,135); //5
vertex(Left_F+365,180); //6
vertex(Left_F+335,180); //7
vertex(Left_F+335,135); //8
vertex(Left_F+320,150); //9
vertex(Left_F+310,140); //10
vertex(Left_F+335,115); //11,1
endShape();
fill(0); //hair
beginShape(); //hair
vertex(Left_F+360,93); //1
vertex(Left_F+340,93); //2
vertex(Left_F+340,125); //3
vertex(Left_F+330,125); //4
vertex(Left_F+330,93); //5
bezierVertex(Left_F+335,72,Left_F+365,72,Left_F+370,93); //6
vertex(Left_F+370,125); //7
vertex(Left_F+360,125); //8
vertex(Left_F+360,93); //9
endShape();
fill(20,25,33); //skirt
beginShape(); //skirt
vertex(Left_F+365,180); //1
vertex(Left_F+380,245); //2
vertex(Left_F+320,245); //3
vertex(Left_F+335,180); //4
endShape();
}