I'm trying to make a superclass method that gets passed a max HP value from a subclass calling the method from the act(), but the value keeps resetting each act() cycle. Is this an issue that needs instance variables instead of ones local to the method? Any help is appreciated.
// ***from super class
public void health(Integer HP)
{
//health & removal of this
Integer health = HP;
boolean remove = false;//declare false by default
Bullet b = (Bullet)getOneIntersectingObject(Bullet.class);//get Bullet actor
Bomb bomb = (Bomb)getOneIntersectingObject(Bomb.class);//get Bullet actor
if(b != null || bomb !=null){//when returns Bullet or Bomb...
health--; //...decrement health counter by 1
}
//display health
if(health < 0) //health depleted
remove = true;
if(remove){//when either above condition is true
getWorld().removeObject(this); //remove Target from World
}
//display HP to test if it decrements w/o resetting
getWorld().showText("DragonHealth: "+ health.toString(), 60, 100);
}
//***from subclass (everything else is empty)
public void act()
{
health(75); //max HP value for subclass object
}

