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