Endscreen erstellt

This commit is contained in:
2026-09-15 19:27:12 +02:00
parent 6b842a7b75
commit cce1abcc81
6 changed files with 92 additions and 15 deletions
Binary file not shown.
+9
View File
@@ -0,0 +1,9 @@
#BlueJ class context
comment0.target=EndWorld
comment0.text=\r\n\ Write\ a\ description\ of\ class\ GameOverWorld\ here.\r\n\ \r\n\ @author\ (your\ name)\ \r\n\ @version\ (a\ version\ number\ or\ a\ date)\r\n
comment1.params=pSieger
comment1.target=EndWorld(java.lang.String)
comment1.text=\r\n\ Constructor\ for\ objects\ of\ class\ GameOverWorld.\r\n\ \r\n
comment2.params=
comment2.target=void\ act()
numComments=3
+30
View File
@@ -0,0 +1,30 @@
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 EndWorld extends World
{
/**
* Constructor for objects of class GameOverWorld.
*
*/
public EndWorld(String pSieger)
{
// Create a new world with 600x400 cells with a cell size of 1x1 pixels.
super(600, 400, 1);
showText("GAME OVER", 300, 60);
showText("the winner is " + pSieger, 300, 200);
showText("Drücke R für einen Neustart", 300, 220);
}
public void act(){
if (Greenfoot.isKeyDown("r")){
Greenfoot.setWorld(new StartWorld());
}
}
}
Binary file not shown.
+2 -2
View File
@@ -38,11 +38,11 @@ public class StartWorld extends World
cursor1 = new Pfeil();
cursor1.setImage("cursor.png");
addObject(cursor1, 50, 160);
addObject(cursor1, 50, 100);
cursor2 = new Pfeil();
cursor2.setImage("cursor.png");
addObject(cursor2 , 450, 160);
addObject(cursor2 , 450, 100);
}
+51 -13
View File
@@ -1,20 +1,30 @@
#Greenfoot project file
class.MyWorld.image=crumpled-paper.jpg
class.Pfeil.image=cursor.png
class.Player1.image=man01.png
class.Player2.image=man01.png
dependency1.from=MyWorld
dependency1.to=Player1
dependency1.from=StartWorld
dependency1.to=Pfeil
dependency1.type=UsesDependency
dependency2.from=MyWorld
dependency2.to=Player2
dependency2.from=StartWorld
dependency2.to=MyWorld
dependency2.type=UsesDependency
dependency3.from=MyWorld
dependency3.to=Player1
dependency3.type=UsesDependency
dependency4.from=MyWorld
dependency4.to=Player2
dependency4.type=UsesDependency
dependency5.from=EndWorld
dependency5.to=StartWorld
dependency5.type=UsesDependency
editor.fx.0.height=737
editor.fx.0.width=814
editor.fx.0.x=117
editor.fx.0.y=30
editor.fx.0.x=151
editor.fx.0.y=18
height=686
package.numDependencies=2
package.numTargets=3
package.numDependencies=5
package.numTargets=7
project.charset=UTF-8
publish.hasSource=false
publish.locked=true
@@ -30,28 +40,56 @@ readme.x=10
readme.y=10
simulation.speed=48
target1.height=70
target1.name=Player2
target1.name=Pfeil
target1.showInterface=false
target1.type=ClassTarget
target1.width=120
target1.x=0
target1.y=0
target2.height=70
target2.name=Player1
target2.name=EndWorld
target2.showInterface=false
target2.type=ClassTarget
target2.width=120
target2.x=0
target2.y=0
target3.height=70
target3.name=MyWorld
target3.name=StartWorld
target3.showInterface=false
target3.type=ClassTarget
target3.width=120
target3.x=0
target3.y=0
target4.height=70
target4.name=startScreen
target4.showInterface=false
target4.type=ClassTarget
target4.width=120
target4.x=0
target4.y=0
target5.height=70
target5.name=Player2
target5.showInterface=false
target5.type=ClassTarget
target5.width=120
target5.x=0
target5.y=0
target6.height=70
target6.name=Player1
target6.showInterface=false
target6.type=ClassTarget
target6.width=120
target6.x=0
target6.y=0
target7.height=70
target7.name=MyWorld
target7.showInterface=false
target7.type=ClassTarget
target7.width=120
target7.x=0
target7.y=0
version=3.1.0
width=1294
world.lastInstantiated=MyWorld
world.lastInstantiated=StartWorld
xPosition=0
yPosition=0
yPosition=12