Hi I wanna do a game where I shoot different enemies with different number of health. I wanna do it neatly so all the removing objects and subtracting health must be in the bullet class.
As of now all I got this.
But it keeps forgetting the health count.
public void kill()
{
destroy(Enemy1.class, 100, 2);
destroy(Enemy2.class, 100, 2);
}
public void destroy(Class enemy, int point, int health)
{
lives = health;
Actor hit = getOneIntersectingObject(enemy);
if(hit != null)
{
lives--;
if (lives == 0)
{
getWorld().addObject(explo, getX(), getY());
getWorld().removeObject(hit);
points.add(point);
}
}
}
