|
|
@ -8,6 +8,9 @@ public class Tank {
|
|
|
|
private Dir dir = Dir.DOWN;
|
|
|
|
private Dir dir = Dir.DOWN;
|
|
|
|
private static final int SPEED = 5;
|
|
|
|
private static final int SPEED = 5;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static final int WIDTH = ResourceMgr.tankD.getWidth();
|
|
|
|
|
|
|
|
private static final int HEIGHT = ResourceMgr.tankD.getHeight();
|
|
|
|
|
|
|
|
|
|
|
|
private boolean moving = false;
|
|
|
|
private boolean moving = false;
|
|
|
|
|
|
|
|
|
|
|
|
private TankFrame tf = null;
|
|
|
|
private TankFrame tf = null;
|
|
|
@ -79,6 +82,8 @@ public class Tank {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void fire(){
|
|
|
|
public void fire(){
|
|
|
|
tf.bullets.add(new Bullet(this.x, this.y, this.dir, this.tf));
|
|
|
|
int bX = this.x + Tank.WIDTH >> 1 - Bullet.WIDTH >> 1;
|
|
|
|
|
|
|
|
int bY = this.y + Tank.HEIGHT >> 1 - Bullet.HEIGHT >> 1;
|
|
|
|
|
|
|
|
tf.bullets.add(new Bullet(bX, bY, this.dir, this.tf));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|