import java.awt.*;
public class wall{
private int xPos;
private int yPos;
private Rectangle[] border = new Rectangle[4];
private boolean[] shape = new boolean[16];
private boolean walldestoried;
private boolean bulletdestoried;
public wall(int a, int b){
xPos = a;
yPos = b;
border[0] = new Rectangle(xPos - 11, yPos - 11, 11, 11);
border[1] = new Rectangle(xPos + 1, yPos - 11, 11, 11);
border[2] = new Rectangle(xPos - 11, yPos + 1, 11, 11);
border[3] = new Rectangle(xPos + 1, yPos + 1, 11, 11);
}
public wall(int a, int b, int c){
xPos = a;
yPos = b;
if(c == 0){
border[0] = new Rectangle(xPos - 11, yPos - 11, 11, 11);
border[1] = new Rectangle(xPos + 1, yPos - 11, 11, 11);
for(int i = 8; i < 12; i ++)
shape[i] = true;
for(int i = 12; i < 16; i ++)
shape[i] = true;
}
if(c == 1){
border[2] = new Rectangle(xPos - 11, yPos + 1, 11, 11);
border[3] = new Rectangle(xPos + 1, yPos + 1, 11, 11);
for(int i = 0; i < 4; i ++)
shape[i] = true;
for(int i = 4; i < 8; i ++)
shape[i] = true;
}
if(c == 2){
border[0] = new Rectangle(xPos - 11, yPos - 11, 11, 11);
border[2] = new Rectangle(xPos - 11, yPos + 1, 11, 11);
for(int i = 3; i <= 15; i+=4)
shape[i] = true;
for(int i = 2; i <= 14; i+=4)
shape[i] = true;
}
if(c == 3){
border[1] = new Rectangle(xPos + 1, yPos - 11, 11, 11);
border[3] = new Rectangle(xPos + 1, yPos + 1, 11, 11);
for(int i = 1; i <= 13; i+=4)
shape[i] = true;
for(int i = 0; i <= 12; i+=4)
shape[i] = true;
}
}
public void damageWall(Rectangle bullet, int bulletpower, int bulletdirection){
if(bulletpower == 1){
if(border[0] != null && border[1] != null && bulletdirection == 1){
if(bullet.intersects(border[0]) && bullet.intersects(border[1])){
if(shape[1] && shape[2]){
for(int i = 4; i < 8; i ++)
shape[i] = true;
border[0] = null;
border[1] = null;
}
if(!shape[1] || !shape[2]){
for(int i = 0; i < 4; i ++)
shape[i] = true;
}
bulletdestoried = true;
}
}
if(border[0] != null && border[1] != null && bulletdirection == 0){
if(bullet.intersects(border[0]) && bullet.intersects(border[1])){
if(shape[5] && shape[6]){
for(int i = 0; i < 4; i ++)
shape[i] = true;
border[0] = null;
border[1] = null;
}
if(!shape[5] || !shape[6]){
for(int i = 4; i < 8; i ++)
shape[i] = true;
}
bulletdestoried = true;
}
}
if(border[2] != null && border[3] != null && bulletdirection == 1){
if(bullet.intersects(border[2]) && bullet.intersects(border[3])){
if(shape[9] && shape[10]){
for(int i = 12; i < 16; i ++)
shape[i] = true;
border[2] = null;
border[3] = null;
}
if(!shape[9] || !shape[10]){
for(int i = 8; i < 12; i ++)
shape[i] = true;
}
bulletdestoried = true;
}
}
if(border[2] != null && border[3] != null && bulletdirection == 0){
if(bullet.intersects(border[2]) && bullet.intersects(border[3])){
if(shape[13] && shape[14]){
for(int i = 8; i < 12; i ++)
shape[i] = true;
border[2] = null;
border[3] = null;
}
if(!shape[13] || !shape[14]){
for(int i = 12; i < 16; i ++)
shape[i] = true;
}
bulletdestoried = true;
}
}
if(border[0] != null && border[2] != null && bulletdirection == 3){
if(bullet.intersects(border[0]) && bullet.intersects(border[2])){
if(shape[4] && shape[8]){
for(int i = 1; i <= 13; i+=4)
shape[i] = true;
border[0] = null;
border[2] = null;
}
if(!shape[4] || !shape[8]){
for(int i = 0; i <= 12; i+=4)
shape[i] = true;
}
bulletdestoried = true;
}
}
if(border[0] != null && border[2] != null && bulletdirection == 2){
if(bullet.intersects(border[0]) && bullet.intersects(border[2])){
if(shape[5] && shape[9]){
for(int i = 0; i <= 12; i+=4)
shape[i] = true;
border[0] = null;
border[2] = null;
}
if(!shape[5] || !shape[9]){
for(int i = 1; i <= 13; i+=4)
shape[i] = true;
}
bulletdestoried = true;
}
}
if(border[1] != null && border[3] != null && bulletdirection == 3){
if(bullet.intersects(border[1]) && bullet.intersects(border[3])){
if(shape[6] && shape[10]){
for(int i = 3; i <= 15; i+=4)
shape[i] = true;
border[1] = null;
border[3] = null;
}
if(!shape[6] || !shape[10]){
for(int i = 2; i <= 14; i+=4)
shape[i] = true;
}
bulletdestoried = true;
}
}
if(border[1] != null && border[3] != null && bulletdirection == 2){
if(bullet.intersects(border[1]) && bullet.intersects(border[3])){
if(shape[7] && shape[11]){
for(int i = 2; i <= 14; i+=4)
shape[i] = true;
border[1] = null;
border[3] = null;
}
if(!shape[7] || !shape[11]){
for(int i = 3; i <= 15; i+=4)
shape[i] = true;
}
bulletdestoried = true;
}
}
}
if(bulletpower == 2){
if(border[0] != null && border[1] != null && (bulletdirection == 0 || bulletdirection == 1)){
if(bullet.intersects(border[0]) && bullet.intersects(border[1])){
for(int i = 0; i < 8; i++)
shape[i] = true;
border[0] = null;
border[1] = null;
bulletdestoried = true;
}
}
if(border[2] != null && border[3] != null && (bulletdirection == 0 || bulletdirection == 1)){
if(bullet.intersects(border[2]) && bullet.intersects(border[3])){
for(int i = 8; i < 16; i++)
shape[i] = true;
border[2] = null;
border[3] = null;
bulletdestoried = true;
}
}
if(border[0] != null && border[2] != null && (bulletdirection == 2 || bulletdirection == 3)){
if(bullet.intersects(border[0]) && bullet.intersects(border[2])){
for(int i = 0; i <= 12; i+=4)
shape[i] = true;
for(int i = 1; i <= 13; i+=4)
shape[i] = true;
border[0] = null;
border[2] = null;
bulletdestoried = true;
}
}
if(border[1] != null && border[3] != null && (bulletdirection == 2 || bulletdirection == 3)){
if(bullet.intersects(border[1]) && bullet.intersects(border[3])){
for(int i = 2; i <= 14; i+=4)
shape[i] = true;
for(int i = 3; i <= 15; i+=4)
shape[i] = true;
border[1] = null;
border[3] = null;
bulletdestoried = true;
}
}
}
//******************************************************************************************* if(border[0] != null ){
if(border[0] != null){
Rectangle a = new Rectangle(border[0].x, border[0].y, 5, 5);
Rectangle b = new Rectangle(border[0].x + 7, border[0].y, 5, 5);
Rectangle c = new Rectangle(border[0].x, border[0].y + 7, 5, 5);
Rectangle d = new Rectangle(border[0].x + 7, border[0].y + 7, 5, 5);
if(border[0] != null){
if(bullet.intersects(border[0]) && bulletdirection == 1 && !(bullet.intersects(b) && ((!shape[2] || !shape[6]) || (shape[1] && shape[2] && shape[5] && shape[6])))){
if(bullet.intersects(a) && shape[0] && !shape[4]){
shape[4] = true;
shape[5] = true;
bulletdestoried = true;
border[0] = null;
}
if(bullet.intersects(b) && shape[1] && !shape[5]){
shape[4] = true;
shape[5] = true;
bulletdestoried = true;
border[0] = null;
}
if(bullet.intersects(a) && !shape[0]) {
if(bulletpower == 1){
shape[0] = true;
shape[1] = true;
}
if(bulletpower == 2){
shape[0] = true;
shape[1] = true;
shape[4] = true;
shape[5] = true;
}
bulletdestoried = true;
if(shape[4] && shape[5])
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
坦克大战源代码 J2me (108个子文件)
CombatTank34.class 16KB
wall.class 14KB
Enemy4.class 7KB
Enemy2.class 6KB
Enemy1.class 6KB
Enemy3.class 6KB
Tank.class 6KB
levels.class 3KB
Steelwall.class 2KB
Ticker.class 2KB
bullet.class 1KB
powerup.class 1KB
smallBomb.class 978B
bigBomb.class 930B
grass.class 743B
base.class 625B
river.class 588B
Thumbs.db 79KB
Tank.html 120B
wall.java 30KB
CombatTank34.java 26KB
Enemy4.java 12KB
Enemy1.java 12KB
Enemy3.java 12KB
Enemy2.java 12KB
Tank.java 9KB
levels.java 4KB
Steelwall.java 3KB
Ticker.java 2KB
bullet.java 1KB
powerup.java 1KB
bigBomb.java 650B
smallBomb.java 647B
grass.java 630B
base.java 398B
river.java 382B
E412.jpg 605B
E410.jpg 604B
E49.jpg 601B
PU5.jpg 593B
E411.jpg 590B
T10.jpg 585B
T15.jpg 584B
T13.jpg 584B
T14.jpg 582B
T9.jpg 579B
T12.jpg 577B
PU2.jpg 575B
T8.jpg 574B
T16.jpg 573B
T11.jpg 572B
T6.jpg 572B
PU7.jpg 571B
T4.jpg 570B
T5.jpg 568B
T1.jpg 567B
T3.jpg 564B
T2.jpg 563B
T7.jpg 558B
PU1.jpg 556B
E416.jpg 555B
E413.jpg 554B
E415.jpg 554B
E414.jpg 547B
E420.jpg 540B
E23.jpg 539B
E24.jpg 538B
EN11.jpg 537B
E21.jpg 534B
E417.jpg 532B
E44.jpg 531B
E22.jpg 531B
E419.jpg 530B
E45.jpg 530B
E46.jpg 530B
E42.jpg 529B
EN14.jpg 529B
E48.jpg 529B
EN13.jpg 528B
E32.jpg 528B
E38.jpg 527B
E418.jpg 527B
EN17.jpg 526B
E34.jpg 526B
Base2.jpg 526B
EN12.jpg 525B
E37.jpg 525B
PU3.jpg 525B
E33.jpg 523B
E35.jpg 523B
E26.jpg 521B
E27.jpg 521B
E25.jpg 520B
EN15.jpg 520B
E43.jpg 520B
EN18.jpg 519B
E36.jpg 519B
E28.jpg 519B
E41.jpg 519B
E31.jpg 518B
共 108 条
- 1
- 2
资源评论
小哈哈
- 粉丝: 2
- 资源: 12
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功