import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) /** * Write a description of class GameOverWorld here. * * @author (your name) * @version (a version number or a date) */ public class GameOverWorld extends World { /** * Constructor for objects of class GameOverWorld. * */ int score; public GameOverWorld(int score) { // Create a new world with 600x400 cells with a cell size of 1x1 pixels. super(400, 600, 1); this.score = score; prepare(); } /** * Prepare the world for the start of the program. * That is: create the initial objects and add them to the world. */ private void prepare() { Button button = new Button(); addObject(button,200,520); button.setImage("Neustart.png"); showScore(); } public void showScore(){ Color hintergrundFarbe = new Color(0,0,0,0); GreenfootImage scoreBild = new GreenfootImage("" + score, 75, Color.WHITE, hintergrundFarbe); Score score3 = new Score(); addObject(score3,200,76); score3.setImage(scoreBild); } }