Here is the code of Counter Actpr. It is a greenfoot generated Image. I want the finals score of the player to be shown when it is game over or when the player wins. HELP TO JUST DISPLAY THE FINAL SCORE :)
import greenfoot.*;
import java.awt.Color;
public class Counter extends Actor
{
int score = 0;
private GreenfootSound gain = new GreenfootSound("score.wav");
public void act()
{
setImage(new GreenfootImage("Score : " + score, 30, greenfoot.Color.BLACK, greenfoot.Color.WHITE));
}
public void gainScore(){
gain.play();
score = score+1;
}
public void foodScore(){
gain.play();
score = score+5;
}
}

