Hi, so i am making a game where a man in space walks around and shoot monsters. I am trying to give him lives.
So when he gets hit by a monster (worm), he will lose a life (Heart1). Right now he dies after hitting three mosnters.
But i want to show it some how. I have a heart, that i want to go away, when he has lost a live.
Thx in advance.
private int hearts = 3;
public void losingHealth()
{
Actor worm = getOneIntersectingObject(worm.class);
Healthbar heart1 = new Healthbar();
getWorld().addObject(heart1, 200, 200);
if (worm != null)
{
getWorld().removeObject(worm);
hearts--;
}
if (hearts == 2)
{
getWorld().removeObject(heart1);
}
if (hearts == 0)
{
getWorld().removeObject(this);
}
