diff --git a/src/GamePanel.java b/src/GamePanel.java index cdd49eb..5224c5b 100644 --- a/src/GamePanel.java +++ b/src/GamePanel.java @@ -49,15 +49,23 @@ public class GamePanel extends JPanel implements Runnable, KeyListener{ public static ArrayListparticleTiles = new ArrayList(); public static ArrayListenemy = new ArrayList(); + public static ArrayListbombs = new ArrayList<>(); public static ArrayListparticles = new ArrayList(); - public static StickyBomb b; public static Camera camera; // image imports begin here public BufferedImage backgroundImage = getImage("img/backgrounds/pointyMountains.png"); public BufferedImage box = getImage("img/tiles/boxes/box.png"); public BufferedImage boxCoin = getImage("img/tiles/boxes/boxCoin.png"); - public BufferedImage bomb = getImage("img/misc/bomb.png"); + public static BufferedImage bomb; + + static { + try { + bomb = getImage("img/misc/bomb.png"); + } catch (IOException e) { + throw new RuntimeException(e); + } + } public GamePanel(JPanel gameFrame) throws IOException, SpriteException, UnsupportedAudioFileException, LineUnavailableException { @@ -112,7 +120,6 @@ public class GamePanel extends JPanel implements Runnable, KeyListener{ addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent e) { player.mousePressed(e); - b.mousePressed(e); } }); this.setPreferredSize(new Dimension(GAME_WIDTH, GAME_HEIGHT)); @@ -156,7 +163,15 @@ public class GamePanel extends JPanel implements Runnable, KeyListener{ enemy.get(i).draw(g, enemyFrame); } playerFrameCounter += player.draw(g, playerFrame); - b.draw(g); + for(int i=0; i= 2) { @@ -118,6 +118,8 @@ public class StickyBomb extends GenericSprite{ g.drawImage(explosionSpriteArray[explosionPixel], x - GamePanel.camera.x - 10*explosionPixel, y-10*explosionPixel, length+10*explosionPixel, length+10*explosionPixel, null); explosionCounter += 1; + } else { + erase = true; } } }