|
|
|
@ -15,7 +15,7 @@ import java.util.Objects;
|
|
|
|
|
*/
|
|
|
|
|
public class TankFrame extends Frame {
|
|
|
|
|
|
|
|
|
|
Tank tank = new Tank(200, 200, DirEnum.RIGHT);
|
|
|
|
|
Tank tank = new Tank(200, 200, DirEnum.RIGHT, this);
|
|
|
|
|
Bullet bullet = new Bullet(200, 200, DirEnum.DOWN);
|
|
|
|
|
public static final int GAME_WIDTH = 800;
|
|
|
|
|
public static final int GAME_HEIGHT = 600;
|
|
|
|
@ -92,6 +92,7 @@ public class TankFrame extends Frame {
|
|
|
|
|
case KeyEvent.VK_RIGHT : bR = false; break;
|
|
|
|
|
case KeyEvent.VK_UP : bU = false; break;
|
|
|
|
|
case KeyEvent.VK_DOWN : bD = false; break;
|
|
|
|
|
case KeyEvent.VK_SPACE: tank.fire(); break;
|
|
|
|
|
default: break;
|
|
|
|
|
}
|
|
|
|
|
setDir();
|
|
|
|
|