|
|
|
@ -6,8 +6,8 @@ public class Bullet {
|
|
|
|
|
private int x, y;
|
|
|
|
|
private Direction direction;
|
|
|
|
|
private static final int SPEED = 5;
|
|
|
|
|
private static final int WIDTH = 20;
|
|
|
|
|
private static final int HEIGHT = 20;
|
|
|
|
|
public static final int WIDTH = ResourceManager.bulletD.getWidth();
|
|
|
|
|
public static final int HEIGHT = ResourceManager.bulletD.getHeight();
|
|
|
|
|
private boolean live = true;
|
|
|
|
|
private TankFrameV3 tf;
|
|
|
|
|
|
|
|
|
@ -22,10 +22,20 @@ public class Bullet {
|
|
|
|
|
if(!live){
|
|
|
|
|
tf.bullets.remove(this);
|
|
|
|
|
}
|
|
|
|
|
Color color = g.getColor();
|
|
|
|
|
g.setColor(Color.RED);
|
|
|
|
|
g.fillOval(x, y, WIDTH, HEIGHT);
|
|
|
|
|
g.setColor(color);
|
|
|
|
|
switch (direction){
|
|
|
|
|
case UP:
|
|
|
|
|
g.drawImage(ResourceManager.bulletU, x, y, null);
|
|
|
|
|
break;
|
|
|
|
|
case DOWN:
|
|
|
|
|
g.drawImage(ResourceManager.bulletD, x, y, null);
|
|
|
|
|
break;
|
|
|
|
|
case LEFT:
|
|
|
|
|
g.drawImage(ResourceManager.bulletL, x, y, null);
|
|
|
|
|
break;
|
|
|
|
|
case RIGHT:
|
|
|
|
|
g.drawImage(ResourceManager.bulletR, x, y, null);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
move();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|