|
|
|
@ -18,10 +18,11 @@ import java.util.Objects;
|
|
|
|
|
public class TankFrame extends Frame {
|
|
|
|
|
|
|
|
|
|
Tank myTank = new Tank(100, 500, DirEnum.RIGHT, GroupEnum.GOOD, this);
|
|
|
|
|
Explode explode = new Explode(100, 100, this);
|
|
|
|
|
// Explode explode = new Explode(100, 100, this);
|
|
|
|
|
// Bullet bullet = new Bullet(200, 200, DirEnum.DOWN);
|
|
|
|
|
List<Bullet> bullets = new ArrayList<>();
|
|
|
|
|
List<Tank> tanks = new ArrayList<>(); //敌方坦克
|
|
|
|
|
List<Explode> explodes = new ArrayList<>(); //爆炸效果
|
|
|
|
|
public static final int GAME_WIDTH = 800;
|
|
|
|
|
public static final int GAME_HEIGHT = 600;
|
|
|
|
|
|
|
|
|
@ -55,7 +56,7 @@ public class TankFrame extends Frame {
|
|
|
|
|
g.setColor(color);
|
|
|
|
|
myTank.paint(g);
|
|
|
|
|
|
|
|
|
|
explode.paint(g);
|
|
|
|
|
// explode.paint(g);
|
|
|
|
|
|
|
|
|
|
//画出敌方坦克
|
|
|
|
|
for (int i=0; i<tanks.size(); i++) {
|
|
|
|
@ -72,6 +73,11 @@ public class TankFrame extends Frame {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//爆炸效果
|
|
|
|
|
for (int i=0; i<explodes.size(); i++) {
|
|
|
|
|
explodes.get(i).paint(g);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//双缓冲,解决闪烁现象
|
|
|
|
|