📄 thunderboltact.java
字号:
this.battposx -= (int)(this.STEP*4);
if(this.battposx < 0) this.battposx = 0;
}else
if(this.right) {
this.battarray = 2;
this.battposx += (int)(this.STEP*4);
if(this.battposx > (this.screenw-10)) this.battposx = (this.screenw-10);
}else{ this.battarray = 0;}
}
//我机开枪
private void sendSulg(int x,int y) {
if(ballnum < (int)(MAXBALLNUM-1)) {
ballnum ++;
ballpos[ballnum-1][0] = (int)(x + 8);
ballpos[ballnum-1][1] = (int)(y - 2);
}
}
//敌机爆炸图
private void addBomb(int x,int y,int z) {
this.bombnum ++;
this.bombpos[this.bombnum-1][0] = x;
this.bombpos[this.bombnum-1][1] = y;
this.bombcort[this.bombnum-1] = z;
}
//我机子弹
private void battSulg() {
for(int i = 0; i < this.ballnum; i ++) {
ballpos[i][1] -= (int)(this.STEP*4);
}
int kill_sulg = 0;
for(int i = 0; i < this.ballnum; i ++) {
//我机子弹打中敌机
for(int j = 0; j < this.copternum; j ++) {
if((ballpos[i][0] < (int)(copterpos[j][0])+10)&&
(ballpos[i][0] > (int)(copterpos[j][0]))&&
(ballpos[i][1] < (int)(copterpos[j][1])+8)&&
(ballpos[i][1] > (int)(copterpos[j][1]))) {
//爆炸图
addBomb(copterpos[j][0],copterpos[j][1],coptercort[j]);
//敌机销毁
killCopter(j);
//我机子弹销毁
for(int l = j+1; l <= this.ballnum; l ++) {
ballpos[l-1][0] = ballpos[l][0];
ballpos[l-1][1] = ballpos[l][1];
}
this.copternum --;
kill_sulg ++;
}
}
}
this.ballnum -= kill_sulg;
kill_sulg = 0;
for(int i = 0; i < this.ballnum; i ++) {
//我机子弹到顶
if(ballpos[i][1] < this.STEP) {
for(int j = i+1; j <= this.ballnum; j ++) {
ballpos[j-1][0] = ballpos[j][0];
ballpos[j-1][1] = ballpos[j][1];
}
kill_sulg ++;
}
}
this.ballnum -= kill_sulg;
}
//敌机
private void copterEnemy() {
int m = this.copternum;
if(m < MINCOPTER) this.romdan = 0;
else this.romdan = 90;
if(m < MAXCOPTERNUM) {
this.math = (int)(random.nextInt());
if((math+"").length()>4)
this.math = (int)(Integer.parseInt((math+"").substring(2,4)));
else this.math = (int)(screenw/2);
if(this.math >= romdan) {
this.math = (int)(random.nextInt());
if(this.math < 0) this.coptercort[m+1] = -1;
else if(math > 0) this.coptercort[m+1] = 1;
else if(math==0) this.coptercort[m+1] = 0;
if((math+"").length()>4)
this.math = (int)(Integer.parseInt((math+"").substring(2,4)));
else math = (int)(this.screenw/2);
m ++;
this.copterpos[m][0] = this.math;
this.copterpos[m][1] = (int)(this.STEP-1);
}
}
this.copternum = m;
for(int i = 0; i <this.copternum; i ++) {
this.copterpos[i][0] += (int)(this.coptercort[i]);
this.copterpos[i][1] += (int)(this.STEP*2);
}
int kill_copter = 0;
for(int i = 0; i < this.copternum; i ++) {
//敌机打中我机
if((copterpos[i][0] < (int)(battposx)+15)&&
(copterpos[i][0] > (int)(battposx))&&
(copterpos[i][1] < (int)(battposy)+13)&&
(copterpos[i][1] > (int)(battposy))) {
//爆炸图
addBomb(battposx,battposy,coptercort[i]);
//敌机销毁
for(int l = i+1; l <= this.copternum; l ++) {
copterpos[l-1][0] = copterpos[l][0];
copterpos[l-1][1] = copterpos[l][1];
}
//我机销毁
killBattleplan();
kill_copter ++;
}
}
this.copternum -= kill_copter;
kill_copter = 0;
for(int i = 0; i < this.copternum; i ++) {
if((this.copterpos[i][0] > this.screenw)||
(this.copterpos[i][1] > this.screenh)||
(this.copterpos[i][0] < (int)(this.STEP-10))) {
for(int j = i+1; j <= this.copternum; j ++) {
this.copterpos[j-1][0] = this.copterpos[j][0];
this.copterpos[j-1][1] = this.copterpos[j][1];
}
kill_copter ++;
}
}
this.copternum -= kill_copter;
}
//敌机子弹
private void copterSulg() {
int m = this.copterballnum;
if(m < (int)(MINCOPTER+1)) this.romdan = 0;
else this.romdan = 95;
if(m < MAXCOPTERBALLNUM) {
for(int i = 0; i < this.copternum; i ++) {
this.math = (int)(random.nextInt());
if((math+"").length()>4)
this.math = (int)(Integer.parseInt((math+"").substring(2,4)));
else this.math = (int)(screenw/2);
if(this.math >= romdan) {
this.math = (int)(random.nextInt());
if(this.math < 0) this.copterballcort[m+1] = -1;
else if(math > 0) this.copterballcort[m+1] = 1;
else if(math==0) this.copterballcort[m+1] = 0;
if((math+"").length()>4)
this.math = (int)(Integer.parseInt((math+"").substring(3,4)));
m ++;
this.copterballpos[m][0] = (int)(this.copterpos[i][0]+8);
this.copterballpos[m][1] = (int)(this.copterpos[i][1]+15);
}
}
}
this.copterballnum = m;
for(int i = 0; i <this.copterballnum; i ++) {
this.copterballpos[i][0] += (int)(this.copterballcort[i]);
this.copterballpos[i][1] += (int)(this.STEP*3);
}
int kill_copterball = 0;
for(int i = 0; i < this.copterballnum; i ++) {
//敌机子弹打中我机
if((copterballpos[i][0] < (int)(battposx)+10)&&
(copterballpos[i][0] > (int)(battposx))&&
(copterballpos[i][1] < (int)(battposy)+8)&&
(copterballpos[i][1] > (int)(battposy))) {
//爆炸图
addBomb(battposx,battposy,coptercort[i]);
//敌机子弹销毁
for(int l = i+1; l <= this.copterballnum; l ++) {
copterballpos[l-1][0] = copterballpos[l][0];
copterballpos[l-1][1] = copterballpos[l][1];
}
//我机销毁
killBattleplan();
kill_copterball ++;
}
}
this.copterballnum -= kill_copterball;
kill_copterball = 0;
for(int i = 0; i < this.copterballnum; i ++) {
if((this.copterballpos[i][0] > this.screenw)||
(this.copterballpos[i][1] > this.screenh)||
(this.copterballpos[i][0] < (int)(this.STEP-1))) {
for(int j = i+1; j <= this.copterballnum; j ++) {
this.copterballpos[j-1][0] = this.copterballpos[j][0];
this.copterballpos[j-1][1] = this.copterballpos[j][1];
}
kill_copterball ++;
}
}
this.copterballnum -= kill_copterball;
}
//打掉所有敌机
private void killAllCopter() {
if(this.killAll > 0) {
this.killAll --;
this.kill_poing += (int)(this.copternum * 10);
for(int i = 0; i < this.copterballnum; i ++) {
this.copterballpos[i][0] = 0;
this.copterballpos[i][1] = 0;
this.copterballcort[i] = 0;
}
for(int i = 0; i < this.copternum; i ++) {
this.copterpos[i][0] = 0;
this.copterpos[i][1] = 0;
this.coptercort[i] = 0;
}
for(int i = 0; i < this.bombnum; i ++) {
this.bombpos[i][0] = 0;
this.bombpos[i][1] = 0;
this.bombcort[i] = 0;
}
this.copternum = 0;
this.copterballnum = 0;
this.bombnum = 0;
}
}
//爆炸位置
private void bomb() {
for(int i = 0; i <this.bombnum; i ++) {
this.bombpos[i][0] += this.bombcort[i];
this.bombpos[i][1] += (int)(this.STEP*2);
}
int kill_bombball = 0;
for(int i = 0; i < this.bombnum; i ++) {
if((this.bombpos[i][0] > this.screenw)||
(this.bombpos[i][1] > this.screenh)||
(this.bombpos[i][0] < (int)(this.STEP-1))) {
for(int j = i+1; j <= this.bombnum; j ++) {
this.bombpos[j-1][0] = this.bombpos[j][0];
this.bombpos[j-1][1] = this.bombpos[j][1];
}
kill_bombball ++;
}
}
this.bombnum -= kill_bombball;
}
//打掉一架敌机
private void killCopter(int pos) {
for(int j = pos+1; j <= this.copternum; j ++) {
this.copterpos[j-1][0] = this.copterpos[j][0];
this.copterpos[j-1][1] = this.copterpos[j][1];
}
kill_poing += 10;
this.copternum --;
}
//我机销毁
private void killBattleplan() {
this.battacount --;
if(this.battacount > 0) {
this.battposx = (int)((this.screenw/2)-5);
this.battposy = 85;
}
}
public int getKillPoint() {
return this.kill_poing;
}
public int getSpeed() {
return this.speed;
}
public void setSpeed(int speed) {
this.speed = speed;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -