miss and Game over
void miss(int r) {
if (miss==1) {
if (ten1_Boy>=ball) {
ten2_Boy = 0;
ten1_Girl = 0;
ten2_Girl = 0;
over = set_ten1+1;
}
else if (ten2_Boy>=ball2) {
ten1_Boy = Ball_Boy[4].length+1;
ten1_Girl = 0;
ten2_Girl = 0;
over = set_ten2+1;
}
else if (ten1_Girl>=ball3) {
ten2_Boy = 0;
ten1_Boy = Ball_Boy[4].length+1;
ten2_Girl = 0;
over = set_ten3+1;
}
else if (ten2_Girl>=ball4) {
ten2_Boy = 0;
ten1_Boy = Ball_Boy[4].length+1;
ten1_Girl = 0;
over = set_ten4+1;
}
fill(0);
if (over==1) {
ellipse(width-90, 300, r, 2*r/3);
}
if (over==2) {
ellipse(width-90, 200, r, 2*r/3);
}
if (over==3) {
ellipse(width-90, 100, r, 2*r/3);
}
}
if (ten1_Boy>=ball||ten2_Boy>=ball2||ten1_Girl>=ball3&&step3==0||ten2_Girl>=ball4&&step4==0) {
if (life==1) {
background(0);
sceen();
fill(255);
textFont(createFont("Arial", 50));
text("Game Over", 150, 150);
textFont(createFont("Arial", 20));
text("score = "+score, 230, 200);
textFont(createFont("Arial", 20));
text("Plese Key S To Restart Game", 150, 250);
drawSnoopyover(560, 300);
drawBoyover(280, 380);
}
else if (miss==4) {
if (speed%40==0) {
boy = 7;
}
if (speed%120==0) {
sno = 0;
snoopyY = 300;
boy = 1;
space = 80;
life = life-1;
step = 0;
step2 = 0;
step3 = 1;
step4 = 1;
ten1_Boy = 0;
ten2_Boy = 0;
ten1_Girl = 1;
ten2_Girl = 1;
ball3 = 1;
ball4 = 1;
speed = 0;
miss = 0;
}
}
else {
if (speed%ten_Go==1) {
boy = 5;
space = space+60;
}
if (speed%ten_Go==0) {
if (miss==2) {
sno = 9;
}
if (miss==3) {
boy = 6;
}
miss++;
}
}
}
}
ไม่มีความคิดเห็น:
แสดงความคิดเห็น