How do I apply if statements in order to end the game?
public class Counter extends Actor
{
int health = 5;
/**
* Act - do whatever the Counter wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
setImage(new GreenfootImage("Lives : " + health, 24, Color.BLUE, Color.BLACK));
}
public void loseHealth(int amount)
{
health += amount;
setImage(new GreenfootImage("Lives : " + health, 24, Color.BLUE, Color.BLACK));
}
}
