// Bullet Class // Bullet.java // Imports import java.awt.*; import java.applet.Applet; import java.util.BitSet; public class Bullet extends Sprite { protected static Image[] image = new Image[2]; /**Constructor*/ public Bullet(Component comp, Point pos, Point vel) { super(comp, image, 0, 1, 1, pos, vel, 1, Sprite.BA_DIE); } /** Initialize the images.*/ public static void initResources(Applet app, MediaTracker tracker, int id) { for (int i = 0; i < 2; i++) { image[i] = app.getImage(app.getCodeBase(), "Res/Bullet" + i + ".gif"); tracker.addImage(image[i], id); } } public BitSet update() { /** Updates the status of the bullet.*/ BitSet action = super.update(); if (action.get(Sprite.SA_KILL)) WarMan.bulletcount--; return action; } }