📄 boss.java
字号:
if (!boss3_Xl) {
boss3[4].paint(g);
if (boss3_f >= 5 & boss3_f < 240) {
if (X_fire == 42)
paint_boss3_zidan1(g, 3);
if (X_fire == 82 || X_fire == 2)
paint_boss3_zidan1(g, 1);
if (X_fire == 122)
paint_boss3_zidan1(g, 2);
}
}
if (!boss3_Xr) {
boss3[5].paint(g);
if (boss3_f >= 5 & boss3_f < 240) {
if (X_fire == 42)
paint_boss3_zidan2(g, 2);
if (X_fire == 82 || X_fire == 2)
paint_boss3_zidan2(g, 1);
if (X_fire == 122)
paint_boss3_zidan2(g, 3);
}
}
}
void boss3_run() {
if (!boss3_run_t) {
boss3_y+=2;
boss3_y1+=2;
boss3_y2+=2;
boss3_y3+=2;
boss3_y4+=2;
boss3_y5+=2;
}
if (boss3_run_b) {
boss3_y += 2;
boss3_y3 += 2;
}
if (boss3_y == 10) {
boss3_run_t = true;
boss3_run_a = true;
}
if (boss3_run_a) {
boss3_f++;
if (boss3_f >= 5 & boss3_f < 240) {
X_fire_t = false;
}
if (boss3_f >= 260)
X_fire_t = true;
if (boss3_f >= 240 & boss3_f < 260) {
boss3_fire = 1;
boss3_x--;
boss3_x1--;
boss3_x2--;
boss3_x3--;
boss3_x4--;
boss3_x5--;
}
if (boss3_f >= 250) {
boss3_fire = 1;
}
if (boss3_f >= 280 & boss3_f < 300) {
boss3_fire = 2;
boss3_x++;
boss3_x1++;
boss3_x2++;
boss3_x3++;
boss3_x4++;
boss3_x5++;
}
if (boss3_f >= 300 & boss3_f < 320) {
boss3_fire = 3;
}
if (boss3_f >= 330 & boss3_f < 355) {
boss3_y += 3;
boss3_y1 += 3;
boss3_y2 += 3;
boss3_y3 += 3;
boss3_y4 += 3;
boss3_y5 += 3;
}
if (boss3_f >= 355 & boss3_f < 380) {
boss3_y -= 3;
boss3_y1 -= 3;
boss3_y2 -= 3;
boss3_y3 -= 3;
boss3_y4 -= 3;
boss3_y5 -= 3;
}
if (boss3_f >= 405) {
if (boss3_Xl == false || boss3_Xr == false)
boss3_f = 0;
if (boss3_Xl == true || boss3_Xr == true)
boss3_f = 240;
}
if (boss3_xrming == 0 & boss3_xlming == 0 & boss3_dlming == 0
& boss3_drming == 0) {
boss3_run_a = false;
boss3_run_b = true;
}
}
}
void boss3_jishu(int kill, int body) {
switch (body) {
case 1:
boss3_dlming -= kill;
if (boss3_dlming <= 0) {
boss3_dlming = 0;
boss3_dl = true;
}
break;
case 2:
boss3_drming -= kill;
if (boss3_drming <= 0) {
boss3_drming = 0;
boss3_dr = true;
//boss3_mingrd=true;
}
break;
case 3:
boss3_xlming -= kill;
if (boss3_xlming <= 0) {
boss3_xlming = 0;
boss3_Xl = true;
}
break;
case 4:
boss3_xrming -= kill;
if (boss3_xrming <= 0) {
boss3_xrming = 0;
boss3_Xr = true;
}
break;
}
}
void boss3_bulletRun() {
for (int i = 0; i < boss3_b3.length; i++) {
if (boss3_b3[i].live == true)
boss3_b3[i].move33();
boss3_b3[i].nextFrame();
}
}
void boss3_dboom() {
if (boss3_dl) {
boss3_y1 += 3;
boss3_minglq = false;
if (boss3_y1 >= 60 & boss3_y1 < 100) {
boss3_dlboom = true;
}
if (boss3_y1 > 100) {
boss3_mingld = true;
boss3_dlboom = false;
}
}
if (boss3_dr) {
boss3_y2 += 3;
boss3_mingrq = false;
if (boss3_y2 >= 60 & boss3_y2 < 100) {
boss3_drboom = true;
}
if (boss3_y2 > 100) {
boss3_mingrd = true;
boss3_drboom = false;
}
}
}
void paint_boss3_zidan1(Graphics g, int type) {
for (int i = 0; i < boss3_b3.length; i++) {
if (boss3_b3[i].live == false) {
boss3_b3[i].x = boss3_x4 + 2;
boss3_b3[i].y = boss3_y4 + 10;
boss3_b3[i].bulletType = type;
boss3_b3[i].live = true;
return;
}
}
}
void paint_boss3_zidan2(Graphics g, int type) {
for (int i = 0; i < boss3_b3.length; i++) {
if (boss3_b3[i].live == false) {
boss3_b3[i].x = boss3_x5 + 2;
boss3_b3[i].y = boss3_y5 + 10;
boss3_b3[i].bulletType = type;
boss3_b3[i].live = true;
return;
}
}
}
//boss4*****************************************************************
void paint_boss4(Graphics g) {
boss4[0].setPosition(boss4_i, boss4_j);
boss4[1].setPosition(boss4_x[0], boss4_y[0]);
boss4[2].setPosition(boss4_x[0] - 10, boss4_y[0] + 20);
boss4[3].setPosition(boss4_x[0] - 100, boss4_y[0] + 22);
boss4[5].setPosition(boss4_x[0] + 5, boss4_y[0] + 2);
boss4[6].setPosition(boss4_x[0], boss4_y[0]);
if (boss4_x[1] >= 100 & boss4_x[1] < 120)
boss4[3].setFrame(0);
if (boss4_x[1] >= 120 & boss4_x[1] < 140)
boss4[3].setFrame(1);
if ((boss4_x[1] >= 20 && boss4_x[1] < 40)
|| (boss4_x[1] >= 60 && boss4_x[1] < 80)) {
boss4[1].setFrame(1);
} else {
boss4[1].setFrame(0);
}
if (boss4_x[1] == 30 || boss4_x[1] == 70) {
paint_zidan(g, 8);
}
if (boss4_bt[0]) {
boss4[1].paint(g);
if (boss4_x[1] >= 90 & boss4_x[1] < 100) {
boss4[2].paint(g);
boss4[2].nextFrame();
}
if (boss4_x[1] >= 100 & boss4_x[1] < 140){
boss4[3].paint(g);
m = true;
} else
m = false;
}
boss4[0].paint(g);
if (boss4_bt[4]) {
boss4[5].paint(g);
boss4[5].nextFrame();
boss4[6].paint(g);
boss4[6].nextFrame();
}
for (int i = 0; i < boss4_b1.length; i++) {
if (boss4_b1[i].live == true){
boss4_b1[i].paint(g);
}
}
}
void boss4_run() {
if (boss4_bt[1])
boss4_x[1]++;
if (boss4_x[1] == 60)
boss4_bt[2] = true;
if (boss4_x[1] == 140)
boss4_bt[3] = true;
if (boss4_x[1] >= 150)
boss4_x[1] = 0;
}
void boss4_trun() {
if (boss4_bt[2])
boss4_y[0]--;
if (boss4_y[0] == boss4_j + 15) {
boss4_y[0]++;
boss4_x[0]++;
}
if (boss4_x[0] == boss4_i + 10) {
boss4_bt[2] = false;
}
if (boss4_bt[3])
boss4_x[0]--;
if (boss4_x[0] == boss4_i - 3) {
boss4_x[0]++;
boss4_y[0]++;
}
if (boss4_y[0] == boss4_j + 20) {
boss4_bt[3] = false;
}
}
void boss4_Jishu(int kill) { //player_bullet与boss2[3]碰撞
boss4_x[2] -= kill;
if (boss4_x[2] <= 0) {
boss4_x[2] = 0;
boss4_bt[4] = true;
boss4_bt[5] = true;
boss4_bt[1] = false;
}
}
void boss4_bulletRun() {
for (int i = 0; i < boss4_b1.length; i++) {
if (boss4_b1[i].live == true)
boss4_b1[i].boss4_bullet_move();
boss4_b1[i].nextFrame();
}
}
void boss4_tRun() {
if (boss4_bt[5])
boss4_x[3]++;
if (boss4_x[3] >= 20) {
boss4_bt[0] = false;
boss4_bt[4] = false;
}
}
// boss5**********************************************************
void paint_boss5_zidan1(Graphics g, int type) {
for (int i = 0; i < boss5b_1.length; i++) {
if (boss5b_1[i].live == false) {
boss5b_1[i].x = boss5_x2 - 2;
boss5b_1[i].y = boss5_y2 + 12;
boss5b_1[i].bulletType = type;
boss5b_1[i].live = true;
return;
}
}
}
void paint_boss5_zidan2(Graphics g, int type) {
for (int i = 0; i < boss5b_1.length; i++) {
if (boss5b_1[i].live == false) {
boss5b_1[i].x = boss5_x3 + 20;
boss5b_1[i].y = boss5_y3 + 12;
boss5b_1[i].bulletType = type;
boss5b_1[i].live = true;
return;
}
}
}
void paint_boss5_zidan3(Graphics g, int type) {
for (int i = 0; i < boss5b_1.length; i++) {
if (boss5b_1[i].live == false) {
boss5b_1[i].x = boss5_x2 + 20;
boss5b_1[i].y = boss5_y2 + 12;
boss5b_1[i].bulletType = type;
boss5b_1[i].live = true;
return;
}
}
}
void paint_boss5_zidan4(Graphics g, int type) {
for (int i = 0; i < boss5b_1.length; i++) {
if (boss5b_1[i].live == false) {
boss5b_1[i].x = boss5_x3 - 2;
boss5b_1[i].y = boss5_y3 + 12;
boss5b_1[i].bulletType = type;
boss5b_1[i].live = true;
return;
}
}
}
void paint_boss5_zidan5(Graphics g, int type) {
for (int i = 0; i < boss5b_2.length; i++) {
if (boss5b_2[i].live == false) {
boss5b_2[i].x = boss5_x + 50;
boss5b_2[i].y = boss5_y;
boss5b_2[i].type = type;
boss5b_2[i].live = true;
return;
}
}
}
void paint_boss5(Graphics g) {
boss5[0].setPosition(boss5_x, boss5_y);
boss5[1].setPosition(boss5_x1, boss5_y1);
boss5[2].setPosition(boss5_x2, boss5_y2);
boss5[3].setPosition(boss5_x3, boss5_y3);
boss5[4].setPosition(boss5_x2 + 6, boss5_y2 + 22);
boss5[5].setPosition(boss5_x3 + 6, boss5_y3 + 22);
boss5[11].setPosition(boss5_x1 - 10, boss5_y1 + 20);
boss5[12].setPosition(boss5_x1 + 16, boss5_y1 - 5);
for (int i = 0; i < boss5b_1.length; i++) {
if (boss5b_1[i].live == true)
boss5b_1[i].paint(g);
if (boss5b_2[i].live == true)
boss5b_2[i].paint(g);
}
boss5[1].paint(g);
boss5[0].paint(g);
boss5[2].paint(g);
boss5[3].paint(g);
if ((boss5_run >= 10 & boss5_run < 35)
|| (boss5_run >= 100 & boss5_run < 120)) {//
boss5[2].setFrame(0);
boss5[3].setFrame(0);
boss5[4].paint(g);
boss5[5].paint(g);
k=true;
mm = true;
} else {
boss5[2].setFrame(1);
boss5[3].setFrame(1);
k=false;
mm = false;
}
if (boss5_run == 5 || boss5_run == 45 || boss5_run == 95
|| boss5_run == 125) {
paint_boss5_zidan3(g, 3);
paint_boss5_zidan4(g, 2);
paint_boss5_zidan1(g, 2);
paint_boss5_zidan2(g, 3);
}
if (boss5_run == 140 || boss5_run == 180) {
paint_boss5_zidan5(g, 1);
paint_boss5_zidan5(g, 2);
paint_boss5_zidan5(g, 3);
paint_boss5_zidan5(g, 4);
paint_boss5_zidan5(g, 5);
}
for (int i = 0; i < boss5b_1.length; i++) {
if (boss5b_1[i].live == true)
boss5b_1[i].paint(g);
if (boss5b_2[i].live == true)
boss5b_2[i].paint(g);
}
if (boss5_boom) {
boss5[11].paint(g);
boss5[11].nextFrame();
boss5[12].paint(g);
boss5[12].nextFrame();
}
}
//boolean boss5_run_t3=false;
void boss5_run() {
if (boss5_run_t1) {
boss5_y1++;
}
if (boss5_y1 == 35) {
boss5_run_t1 = false;
boss5_run_t2 = true;
}
if (boss5_run_t2) {
boss5_run++;
}
if ((boss5_run >= 10 & boss5_run < 35)
|| (boss5_run >= 55 & boss5_run < 95)) {
boss5_x2++;
boss5_x3--;
}
if (boss5_run >= 130 & boss5_run < 195) {
boss5_x2--;
boss5_x3++;
}
if (boss5_run >= 130 & boss5_run < 150) {
boss5_y1--;
}
if (boss5_run >= 190 & boss5_run < 210) {
boss5_y1++;
}
if (boss5_run >= 230) {
boss5_run = 0;
}
}
void boss5_bulletRun() {
for (int i = 0; i < boss5b_1.length; i++) {
if (boss5b_2[i].live == true) {
boss5b_2[i].move5();
boss5b_2[i].nextFrame();
}
if (boss5b_1[i].live == true) {
boss5b_1[i].move33();
boss5b_1[i].nextFrame();
}
}
}
void boss5_boom() {
if (boss5_r) {
boss5_y1--;
if (boss5_y1 <= 5) {
boss5_y1 += 2;
yong++;
}
if (yong > 30)
boss5_boom = true;
if (yong > 40)
boss5_r = false; //boss5全部消失 胜利下
}
}
void boss5_Jishu(int kill) { //player_bullet与boss5[1]碰撞
boss5_ming -= kill;
if (boss5_ming <= 0) {
boss5_ming = 0;
mm = false;
boss5_run_t2 = false;
boss5_r = true;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -