public class ScoreCounter extends Actor { int score = 0; /** * Act - do whatever the ScoreCounter wants to do. This method is called whenever * the 'Act' or 'Run' button gets pressed in the environment. */ public void act() { setImage(new GreenfootImage("Score : " + score,60, Color.GREEN, Color.YELLOW)); } public void addScore() { score++; } public void loseScore() { score--; } }