import Greenfoot.*; import java.awt.Color; public class GameOver extends Actor { String msgTxt = "GAME OVER" public GameOver() { updateImage(); } public GameOver(String txt) { msgTxt = txt; updateImage(); } private void updateImage() { GreenfootImage image = new GreenfootImage(getWorld().getWidth(), getWorld().getHeight()); // or whatever size you want the object image.setColor(Color.cyan); // color of your choice image.fill(); GreenfootImage txtImg = new GreenfootImage(msgTxt, 36, Color.black, new Color(0, 0, 0, 0)); // colors and font size of your choice image.drawImage(txtImg, (image.getWidth() - txtImg.getWidth()) / 2, (image.getHeight() - txtImg.getHeight) / 2); // whatever else you might want to do for the image setImage(image); } }