diff --git a/img/misc/flame/flameLeft.png b/img/misc/flame/flameLeft.png new file mode 100644 index 0000000..661a64c Binary files /dev/null and b/img/misc/flame/flameLeft.png differ diff --git a/src/FireBall.java b/src/FireBall.java index 6a3e054..82db012 100644 --- a/src/FireBall.java +++ b/src/FireBall.java @@ -1,14 +1,22 @@ import java.awt.*; +import java.io.IOException; public class FireBall extends GenericSprite{ - public FireBall(int x, int y, int height, int width, int xv, int yv) { + public String spritePath; + public FireBall(int x, int y, int height, int width, int xv, int yv, String dir) { super(x, y, height, width); xVelocity = xv; yVelocity = yv; + if(dir.equals("left")){ + spritePath = "src/img/misc/flame/flameLeft.png"; + } } - public void draw(Graphics g){ - - + public void move(){ + x += xVelocity; + y += yVelocity; + } + public void draw(Graphics g) throws IOException { + g.drawImage(GamePanel.getImage(spritePath),x-GameFrame.game.camera.x,y,null); } } diff --git a/src/GamePanel.java b/src/GamePanel.java index 7df3277..3c030ba 100644 --- a/src/GamePanel.java +++ b/src/GamePanel.java @@ -61,6 +61,8 @@ public class GamePanel extends JPanel implements Runnable, KeyListener, Serializ public ArrayListparticleTiles = new ArrayList(); public ArrayListshootingTiles = new ArrayList(); + + public ArrayListfireballs = new ArrayList(); public ArrayListenemy = new ArrayList(); public ArrayListbombs = new ArrayList<>(); public BombDirectionShow bombDir = null; @@ -319,6 +321,11 @@ public class GamePanel extends JPanel implements Runnable, KeyListener, Serializ particles.get(i).move(); } } + for(int i=0; i= 1){ if ((!isPaused && !isDialogue) && MenuPanel.gameStart) { @@ -393,6 +401,9 @@ public class GamePanel extends JPanel implements Runnable, KeyListener, Serializ } checkCollision(); updateEnemy(); + if(fireballCounter == 0) { + updateShootingBlock(); + } try { updateParticle(); } catch (IOException e) { @@ -433,6 +444,14 @@ public class GamePanel extends JPanel implements Runnable, KeyListener, Serializ } } } + + public void updateShootingBlock(){ + for(Tile i: shootingTiles){ + if(i.shootingDir.equals("left")){ + //fireballs.add(new FireBall(i.x,i.y,80,41,-1,0)) + } + } + } public void updateParticle() throws IOException { if(particles.size()<10) { for (int i = 0; i < particleTiles.size(); i++) { diff --git a/src/GenericSprite.java b/src/GenericSprite.java index 125e15f..bb611ba 100644 --- a/src/GenericSprite.java +++ b/src/GenericSprite.java @@ -109,7 +109,7 @@ public class GenericSprite extends Rectangle implements Serializable { } //called frequently from the GamePanel class //draws the current location of the ball to the screen - public void draw(Graphics g){ + public void draw(Graphics g) throws IOException { }