int wing;
void setup() {
size(500, 500);
strokeWeight(5);
}
void draw() {
background(#FF1493);
wing = mouseY;
if (frameCount%40>20) {
wing+=40;
} else {
wing-=50;
}
if (mouseY > 0 && mouseY < 500) {
wing+= 0;
} else {
wing-= 60;
}
draw_bird(mouseX, mouseY, 3, 3);
}
//bird
void draw_bird(float x, float y, int row, int flocks) {
int rx = 10;
int ry = 10;
int mx = 0;
int my = 0;
int n = 0;
int f = 0;
int k = 70; //ค่าคงที่ ระยะห่างของแต่ละแถว
while (n<row) {
while (f < flocks) {
fill(#000080);
ellipse(x+mx, y+my, rx, ry); //หัว
line(x+10+mx, y+my, x+20+mx, wing+my); //ปีกขวา
line(x-10+mx, y+my, x-20+mx, wing+my); //ปีกซ้าย
f++;
mx += 150;
}
f=0;
mx=k;
k+=70;
n++;
my+=50;
}
}
void setup() {
size(500, 500);
strokeWeight(5);
}
void draw() {
background(#FF1493);
wing = mouseY;
if (frameCount%40>20) {
wing+=40;
} else {
wing-=50;
}
if (mouseY > 0 && mouseY < 500) {
wing+= 0;
} else {
wing-= 60;
}
draw_bird(mouseX, mouseY, 3, 3);
}
//bird
void draw_bird(float x, float y, int row, int flocks) {
int rx = 10;
int ry = 10;
int mx = 0;
int my = 0;
int n = 0;
int f = 0;
int k = 70; //ค่าคงที่ ระยะห่างของแต่ละแถว
while (n<row) {
while (f < flocks) {
fill(#000080);
ellipse(x+mx, y+my, rx, ry); //หัว
line(x+10+mx, y+my, x+20+mx, wing+my); //ปีกขวา
line(x-10+mx, y+my, x-20+mx, wing+my); //ปีกซ้าย
f++;
mx += 150;
}
f=0;
mx=k;
k+=70;
n++;
my+=50;
}
}
ไม่มีความคิดเห็น:
แสดงความคิดเห็น