import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Health here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Score extends Actor
{
public int life = 0;
public Score()
{
setImage(new GreenfootImage("Score: 0", 50, Color.BLACK, Color.WHITE));
}
/**
* Increase the total amount displayed on the counter, by a given amount.
*/
public void bumpCount(int amount)
{
life = life + amount;
setImage(new GreenfootImage("Score: " + life, 50, Color.RED, Color.WHITE));
}
}
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Health here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Health extends Actor
{
private int health = 5;
public Health()
{
setImage(new GreenfootImage("Health: 5", 50, Color.BLACK, Color.WHITE));
}
/**
* Increase the total amount displayed on the counter, by a given amount.
*/
public void bumpCount(int amount)
{
health -= amount;
setImage(new GreenfootImage("Health: " + health, 50, Color.RED, Color.WHITE));
}
}

