Dead enemies dont kill
parent
deed563819
commit
f7b071b624
|
@ -7,11 +7,12 @@ public class BombDirectionShow extends StickyBomb{
|
|||
}
|
||||
|
||||
public void draw(Graphics g){
|
||||
update();
|
||||
isMove = true;
|
||||
int loopCounter = 0;
|
||||
while(isMove&&loopCounter<10) {
|
||||
super.move();
|
||||
if(isMove) {
|
||||
if(isMove&&canUpdate(0,0)) {
|
||||
g.drawRect(x - GamePanel.camera.x + Player.PLAYER_WIDTH / 2, y + Player.PLAYER_HEIGHT / 2, 2, 2);
|
||||
}
|
||||
loopCounter++;
|
||||
|
|
|
@ -241,7 +241,7 @@ public class GamePanel extends JPanel implements Runnable, KeyListener{
|
|||
for (NonPlayer n: enemy) {
|
||||
n.update();
|
||||
n.isGrounded = false;
|
||||
if(n.collidePlayer(player)){
|
||||
if(n.collidePlayer(player)&&!n.isDead){
|
||||
player.alive = false;
|
||||
}
|
||||
}
|
||||
|
@ -295,6 +295,7 @@ public class GamePanel extends JPanel implements Runnable, KeyListener{
|
|||
throw new RuntimeException(e);
|
||||
}
|
||||
checkCollision();
|
||||
updateEnemy();
|
||||
try {
|
||||
updateParticle();
|
||||
} catch (IOException e) {
|
||||
|
@ -312,6 +313,16 @@ public class GamePanel extends JPanel implements Runnable, KeyListener{
|
|||
}
|
||||
}
|
||||
|
||||
public void updateEnemy(){
|
||||
for(int i=0; i<enemy.size(); i++){
|
||||
if(enemy.get(i).isDead){
|
||||
enemy.get(i).fadeCounter--;
|
||||
if(enemy.get(i).fadeCounter<=0){
|
||||
enemy.remove(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public void updateParticle() throws IOException {
|
||||
for(Tile t: particleTiles){
|
||||
if(GlobalState.randInt(1,10)==1) {
|
||||
|
|
|
@ -36,7 +36,7 @@ public class NonPlayer extends GenericSprite {
|
|||
HEIGHT = npcHeight;
|
||||
|
||||
xVelocity = 3;
|
||||
fadeCounter = GlobalState.second*3;;
|
||||
fadeCounter = 100;;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -64,12 +64,7 @@ public class StickyBomb extends GenericSprite{
|
|||
if(eHypo<200){
|
||||
GamePanel.enemy.get(i).isDead = true;
|
||||
}
|
||||
if(GamePanel.enemy.get(i).isDead){
|
||||
GamePanel.enemy.get(i).fadeCounter--;
|
||||
if(GamePanel.enemy.get(i).fadeCounter<=0){
|
||||
GamePanel.enemy.remove(i);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue