Bilder, Score Anzeige und Dauer der Plattform

This commit is contained in:
2026-09-17 16:06:17 +02:00
parent 40d5295716
commit 8a15fa5a51
17 changed files with 116 additions and 91 deletions
+13 -2
View File
@@ -13,10 +13,12 @@ public class GameOverWorld extends World
* Constructor for objects of class GameOverWorld.
*
*/
public 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();
}
@@ -27,7 +29,16 @@ public class GameOverWorld extends World
private void prepare()
{
Button button = new Button();
addObject(button,200,320);
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);
}
}