|
|
|
@ -17,9 +17,10 @@ import java.util.Objects;
|
|
|
|
|
*/
|
|
|
|
|
public class TankFrame extends Frame {
|
|
|
|
|
|
|
|
|
|
Tank tank = new Tank(200, 200, DirEnum.RIGHT, this);
|
|
|
|
|
Tank tank = new Tank(100, 500, DirEnum.RIGHT, this);
|
|
|
|
|
// Bullet bullet = new Bullet(200, 200, DirEnum.DOWN);
|
|
|
|
|
List<Bullet> bullets = new ArrayList<>();
|
|
|
|
|
List<Tank> tanks = new ArrayList<>(); //敌方坦克
|
|
|
|
|
public static final int GAME_WIDTH = 800;
|
|
|
|
|
public static final int GAME_HEIGHT = 600;
|
|
|
|
|
|
|
|
|
@ -51,6 +52,12 @@ public class TankFrame extends Frame {
|
|
|
|
|
g.drawString("子弹的数量:" + bullets.size(), 10, 60);
|
|
|
|
|
g.setColor(color);
|
|
|
|
|
tank.paint(g);
|
|
|
|
|
|
|
|
|
|
//画出敌方坦克
|
|
|
|
|
for (Tank tank : tanks) {
|
|
|
|
|
tank.paint(g);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (int i=0; i<bullets.size(); i++) {
|
|
|
|
|
bullets.get(i).paint(g);
|
|
|
|
|
}
|
|
|
|
|