Fireball but not really
parent
4dd2f808b8
commit
5ae603cb06
|
@ -8,15 +8,15 @@ public class FireBall extends GenericSprite{
|
|||
xVelocity = xv;
|
||||
yVelocity = yv;
|
||||
if(dir.equals("left")){
|
||||
spritePath = "src/img/misc/flame/flameLeft.png";
|
||||
spritePath = "img/misc/flame/flameLeft.png";
|
||||
}
|
||||
}
|
||||
|
||||
public void move(){
|
||||
x += xVelocity;
|
||||
y += yVelocity;
|
||||
// x += xVelocity;
|
||||
// y += yVelocity;
|
||||
}
|
||||
public void draw(Graphics g) throws IOException {
|
||||
g.drawImage(GamePanel.getImage(spritePath),x-GameFrame.game.camera.x,y,null);
|
||||
//g.drawImage(GamePanel.getImage(spritePath),x-GameFrame.game.camera.x,y,null);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -253,6 +253,10 @@ public class GamePanel extends JPanel implements Runnable, KeyListener, Serializ
|
|||
}
|
||||
}
|
||||
}
|
||||
for(int i=0; i<fireballs.size(); i++){
|
||||
fireballs.get(i).draw(g);
|
||||
}
|
||||
|
||||
for(int i=0; i<particles.size(); i++){
|
||||
// todo: find cause of particles being null
|
||||
if(i<particles.size()&&particles.get(i)!=null) {
|
||||
|
@ -306,6 +310,7 @@ public class GamePanel extends JPanel implements Runnable, KeyListener, Serializ
|
|||
// throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
g.drawString(player.xVelocity+"",400,400);
|
||||
}
|
||||
|
||||
//call the move methods in other classes to update positions
|
||||
|
@ -390,8 +395,8 @@ public class GamePanel extends JPanel implements Runnable, KeyListener, Serializ
|
|||
now = System.nanoTime();
|
||||
delta = delta + (now-lastTime)/ns;
|
||||
lastTime = now;
|
||||
if(fireballCounter<0){fireballCounter = 20;}
|
||||
fireballCounter--;
|
||||
// if(fireballCounter<0){fireballCounter = 20;}
|
||||
// fireballCounter--;
|
||||
//only move objects around and update screen if enough time has passed
|
||||
if(delta >= 1){
|
||||
if ((!isPaused && !isDialogue) && MenuPanel.gameStart) {
|
||||
|
@ -403,9 +408,7 @@ public class GamePanel extends JPanel implements Runnable, KeyListener, Serializ
|
|||
}
|
||||
checkCollision();
|
||||
updateEnemy();
|
||||
if(fireballCounter == 0) {
|
||||
updateShootingBlock();
|
||||
}
|
||||
//wwwwwwww
|
||||
try {
|
||||
updateParticle();
|
||||
} catch (IOException e) {
|
||||
|
@ -433,7 +436,7 @@ public class GamePanel extends JPanel implements Runnable, KeyListener, Serializ
|
|||
repaint();
|
||||
delta--;
|
||||
}
|
||||
System.out.println(Thread.currentThread());
|
||||
//System.out.println(Thread.currentThread());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -452,7 +455,7 @@ 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))
|
||||
//fireballs.add(new FireBall(i.x,i.y,80,41,-1,0,"left"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue