/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package Sprites;

import tankattack.*;

/**
 *
 * @author Ruslan
 */
public abstract class Enemy extends Sprite {
    
    public Enemy(String image, double x, double y, World world) {
        
        super(image, x, y, world);
                
    }
    
    public abstract void updateEnemyXY();
    public abstract boolean isFiring();
    
    public double getBulletOffsetX() {
        
        return (this.getTranslateX() + this.width()/2 );
        
    }
    
    public double getBulletOffsetY() {
        
        return (this.getTranslateY() + this.height());
        
    }
    
    public void checkForDeathAndReactAppropriately() {

        if (this.health <= 0) {

            displayDeath();
            addSelfToSpritesToRemove();
            removeSelfFromWorldAfterDelay();

        }

    }
    
    public void removeSelfFromWorldAfterDelay() {
        
        Timeline fiveSecondDelay = new Timeline(new KeyFrame(Duration.seconds(5), new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent event) {

            // Remove Self From World
            World.sharedInstance.removeSpritesToRemove();

        }
            
        }));
        
        fiveSecondDelay.setCycleCount(1);
        fiveSecondDelay.play();
        
    }
}

@@ -293,24 +293,57 @@
 rite %7B%0A    %0A
+    public boolean isAlive;%0A    %0A
     public E
@@ -440,16 +440,45 @@
 world);%0A
+        this.isAlive = true;%0A
         

isAlive boolean