diff --git a/SMIMS-Game/GameOverWorld.class b/SMIMS-Game/GameOverWorld.class index 613d6aa..7accb9f 100644 Binary files a/SMIMS-Game/GameOverWorld.class and b/SMIMS-Game/GameOverWorld.class differ diff --git a/SMIMS-Game/GameOverWorld.ctxt b/SMIMS-Game/GameOverWorld.ctxt index aabdc54..08eea3d 100644 --- a/SMIMS-Game/GameOverWorld.ctxt +++ b/SMIMS-Game/GameOverWorld.ctxt @@ -1,10 +1,11 @@ #BlueJ class context comment0.target=GameOverWorld 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= -comment1.target=GameOverWorld() -comment1.text=\r\n\ Constructor\ for\ objects\ of\ class\ GameOverWorld.\r\n\ \r\n +comment1.params=score +comment1.target=GameOverWorld(int) comment2.params= comment2.target=void\ prepare() comment2.text=\r\n\ Prepare\ the\ world\ for\ the\ start\ of\ the\ program.\r\n\ That\ is\:\ create\ the\ initial\ objects\ and\ add\ them\ to\ the\ world.\r\n -numComments=3 +comment3.params= +comment3.target=void\ showScore() +numComments=4 diff --git a/SMIMS-Game/GameOverWorld.java b/SMIMS-Game/GameOverWorld.java index c93053a..cf5781e 100644 --- a/SMIMS-Game/GameOverWorld.java +++ b/SMIMS-Game/GameOverWorld.java @@ -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); } } diff --git a/SMIMS-Game/Groundflower.class b/SMIMS-Game/Groundflower.class index 0874a3f..4753ff9 100644 Binary files a/SMIMS-Game/Groundflower.class and b/SMIMS-Game/Groundflower.class differ diff --git a/SMIMS-Game/Groundflower.java b/SMIMS-Game/Groundflower.java index 266dfad..d504012 100644 --- a/SMIMS-Game/Groundflower.java +++ b/SMIMS-Game/Groundflower.java @@ -8,7 +8,7 @@ import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) */ public class Groundflower extends PowerUps { - int duration= 60*8; //15 Sekunden + int duration= 60*4; //15 Sekunden /** * Act - do whatever the StarPowerUp wants to do. This method is called whenever * the 'Act' or 'Run' button gets pressed in the environment. diff --git a/SMIMS-Game/MyWorld.class b/SMIMS-Game/MyWorld.class index 84d2f4b..d888b4e 100644 Binary files a/SMIMS-Game/MyWorld.class and b/SMIMS-Game/MyWorld.class differ diff --git a/SMIMS-Game/MyWorld.java b/SMIMS-Game/MyWorld.java index 22df2ce..0ccd72b 100644 --- a/SMIMS-Game/MyWorld.java +++ b/SMIMS-Game/MyWorld.java @@ -35,12 +35,12 @@ public class MyWorld extends World { Player player = new Player(); addObject(player,302,320); - Score score = new Score(); - addObject(score, 200, 30); - score.setImage("Score1.png"); Score score1 = new Score(); - addObject(score1, 200, 60); - score1.setImage("Score2.png"); + addObject(score1, 200, 30); + score1.setImage("Score1.png"); + Score score2 = new Score(); + addObject(score2, 200, 60); + score2.setImage("Score2.png"); Plattform plattform = new Plattform(); addObject(plattform,285,577); plattform.setLocation(286,492); @@ -65,7 +65,7 @@ public class MyWorld extends World Heart heart3 = new Heart(); addObject(heart3,314,27); - addObject(new TemporaryGround(60*50), 200, 575); + addObject(new TemporaryGround(60*8), 200, 575); } public void act() @@ -73,12 +73,12 @@ public class MyWorld extends World if (getObjects(Score.class).size() > 0){ removeObjects(getObjects(Score.class)); } - Score score = new Score(); - addObject(score, 200, 30); - score.setImage("Score1.png"); Score score1 = new Score(); - addObject(score1, 200, 60); - score1.setImage("Score2.png"); + addObject(score1, 200, 30); + score1.setImage("Score1.png"); + Score score2 = new Score(); + addObject(score2, 200, 60); + score2.setImage("Score2.png"); showScore(); projectile(); spawnEnemies(); @@ -185,4 +185,5 @@ public class MyWorld extends World score = time/60; showText("" + score, 200, 60); } + } diff --git a/SMIMS-Game/Player.class b/SMIMS-Game/Player.class index 275d704..4bf7088 100644 Binary files a/SMIMS-Game/Player.class and b/SMIMS-Game/Player.class differ diff --git a/SMIMS-Game/Player.java b/SMIMS-Game/Player.java index a08741f..7a8203f 100644 --- a/SMIMS-Game/Player.java +++ b/SMIMS-Game/Player.java @@ -38,7 +38,8 @@ public class Player extends Actor //Check ob der Spieler am unteren Fensterrand ist if (getY()+1 >= getWorld().getHeight()){ - Greenfoot.setWorld(new GameOverWorld()); + MyWorld world = (MyWorld) getWorld(); + Greenfoot.setWorld(new GameOverWorld(world.score)); } //Check ob der Spieler an der Seite vom Fenster ist if (getX() <= 0){ @@ -127,7 +128,8 @@ public class Player extends Actor public void checkHealth(){ if (health <= 0){ - Greenfoot.setWorld(new GameOverWorld()); + MyWorld world = (MyWorld) getWorld(); + Greenfoot.setWorld(new GameOverWorld(world.score)); } } diff --git a/SMIMS-Game/SpikedPlattform.class b/SMIMS-Game/SpikedPlattform.class index 4ccb4ad..144c752 100644 Binary files a/SMIMS-Game/SpikedPlattform.class and b/SMIMS-Game/SpikedPlattform.class differ diff --git a/SMIMS-Game/SpikedPlattform.java b/SMIMS-Game/SpikedPlattform.java index 4b7ae8d..85c1609 100644 --- a/SMIMS-Game/SpikedPlattform.java +++ b/SMIMS-Game/SpikedPlattform.java @@ -38,7 +38,8 @@ public class SpikedPlattform extends Plattform } if(isSpiked && this.PlayerOnPlattform()) { - Greenfoot.setWorld(new GameOverWorld()); + MyWorld world = (MyWorld) getWorld(); + Greenfoot.setWorld(new GameOverWorld(world.score)); } super.act(); } diff --git a/SMIMS-Game/StartWorld.class b/SMIMS-Game/StartWorld.class index cb02421..28249d7 100644 Binary files a/SMIMS-Game/StartWorld.class and b/SMIMS-Game/StartWorld.class differ diff --git a/SMIMS-Game/StartWorld.java b/SMIMS-Game/StartWorld.java index 59c091d..b475da4 100644 --- a/SMIMS-Game/StartWorld.java +++ b/SMIMS-Game/StartWorld.java @@ -26,7 +26,7 @@ public class StartWorld extends World private void prepare() { Button button = new Button(); - addObject(button,200,320); + addObject(button,200,310); button.setImage("Start.png"); } } diff --git a/SMIMS-Game/images/JUMP ‘N’ RUNj.png b/SMIMS-Game/images/JUMP ‘N’ RUNj.png new file mode 100644 index 0000000..7a49a05 Binary files /dev/null and b/SMIMS-Game/images/JUMP ‘N’ RUNj.png differ diff --git a/SMIMS-Game/images/Neustart.png b/SMIMS-Game/images/Neustart.png index 26e2b95..6900685 100644 Binary files a/SMIMS-Game/images/Neustart.png and b/SMIMS-Game/images/Neustart.png differ diff --git a/SMIMS-Game/images/Startbild.png b/SMIMS-Game/images/Startbild.png new file mode 100644 index 0000000..bacf8ed Binary files /dev/null and b/SMIMS-Game/images/Startbild.png differ diff --git a/SMIMS-Game/project.greenfoot b/SMIMS-Game/project.greenfoot index 07a5f84..2e63f11 100644 --- a/SMIMS-Game/project.greenfoot +++ b/SMIMS-Game/project.greenfoot @@ -3,7 +3,7 @@ class.BreakingPlattform.image=Breaking1.png class.Button.image=button-red.png class.Enemy.image=Enemy.png class.EnemyProjectile.image=EnemyProjectile.png -class.GameOverWorld.image=GameOverBackground.png +class.GameOverWorld.image=JUMP\ \u2018N\u2019\ RUNj.png class.Ground.image=weave.jpg class.Groundflower.image=flower2.png class.HealthItem.image=Health.png @@ -17,7 +17,7 @@ class.PlayerProjectile.image=PlayerProjectile.png class.Projectile.image=Projectile1.png class.Spike.image=singleSpike.png class.SpikedPlattform.image=Spikes2.png -class.StartWorld.image=StartBackground.png +class.StartWorld.image=Startbild.png class.TargetingProjectile.image=TargetProjectile.png class.TemporaryGround.image=Ground.png class.UnactiveSpike.image=Spike_Copy.png @@ -34,122 +34,131 @@ dependency12.from=MyWorld dependency12.to=Groundflower dependency12.type=UsesDependency dependency13.from=MyWorld -dependency13.to=Enemy +dependency13.to=HealthItem dependency13.type=UsesDependency dependency14.from=MyWorld -dependency14.to=Projectile +dependency14.to=JumpBoostItem dependency14.type=UsesDependency dependency15.from=MyWorld -dependency15.to=TargetingProjectile +dependency15.to=Enemy dependency15.type=UsesDependency -dependency16.from=GameOverWorld -dependency16.to=Button +dependency16.from=MyWorld +dependency16.to=Projectile dependency16.type=UsesDependency -dependency17.from=StartWorld -dependency17.to=Button +dependency17.from=MyWorld +dependency17.to=TargetingProjectile dependency17.type=UsesDependency -dependency18.from=UnactiveSpike -dependency18.to=SpikedPlattform +dependency18.from=GameOverWorld +dependency18.to=Button dependency18.type=UsesDependency -dependency19.from=UnactiveSpike -dependency19.to=MyWorld +dependency19.from=GameOverWorld +dependency19.to=Score dependency19.type=UsesDependency dependency2.from=PlayerTestWorld dependency2.to=Player dependency2.type=UsesDependency -dependency20.from=UnactiveSpike -dependency20.to=Spike +dependency20.from=StartWorld +dependency20.to=Button dependency20.type=UsesDependency -dependency21.from=Button -dependency21.to=MyWorld +dependency21.from=UnactiveSpike +dependency21.to=SpikedPlattform dependency21.type=UsesDependency -dependency22.from=PowerUps -dependency22.to=Player +dependency22.from=UnactiveSpike +dependency22.to=MyWorld dependency22.type=UsesDependency -dependency23.from=HealthItem -dependency23.to=Player +dependency23.from=UnactiveSpike +dependency23.to=Spike dependency23.type=UsesDependency -dependency24.from=JumpBoostItem -dependency24.to=Player +dependency24.from=Button +dependency24.to=MyWorld dependency24.type=UsesDependency -dependency25.from=Groundflower +dependency25.from=PowerUps dependency25.to=Player dependency25.type=UsesDependency -dependency26.from=Enemy +dependency26.from=HealthItem dependency26.to=Player dependency26.type=UsesDependency -dependency27.from=Enemy -dependency27.to=EnemyProjectile +dependency27.from=JumpBoostItem +dependency27.to=Player dependency27.type=UsesDependency -dependency28.from=Spike -dependency28.to=MyWorld +dependency28.from=Groundflower +dependency28.to=Player dependency28.type=UsesDependency -dependency29.from=Player -dependency29.to=GameOverWorld +dependency29.from=Enemy +dependency29.to=Player dependency29.type=UsesDependency dependency3.from=PlayerTestWorld dependency3.to=JumpBoostItem dependency3.type=UsesDependency -dependency30.from=Player -dependency30.to=Plattform +dependency30.from=Enemy +dependency30.to=EnemyProjectile dependency30.type=UsesDependency -dependency31.from=Player -dependency31.to=PlayerProjectile +dependency31.from=Spike +dependency31.to=MyWorld dependency31.type=UsesDependency dependency32.from=Player -dependency32.to=TemporaryGround +dependency32.to=MyWorld dependency32.type=UsesDependency dependency33.from=Player -dependency33.to=Projectile +dependency33.to=GameOverWorld dependency33.type=UsesDependency dependency34.from=Player -dependency34.to=Enemy +dependency34.to=Plattform dependency34.type=UsesDependency dependency35.from=Player -dependency35.to=Spike +dependency35.to=PlayerProjectile dependency35.type=UsesDependency dependency36.from=Player -dependency36.to=Heart +dependency36.to=TemporaryGround dependency36.type=UsesDependency -dependency37.from=Plattform -dependency37.to=MyWorld +dependency37.from=Player +dependency37.to=Projectile dependency37.type=UsesDependency -dependency38.from=Plattform -dependency38.to=Player +dependency38.from=Player +dependency38.to=Enemy dependency38.type=UsesDependency -dependency39.from=MovingPlattform -dependency39.to=MyWorld +dependency39.from=Player +dependency39.to=Spike dependency39.type=UsesDependency dependency4.from=MyWorld dependency4.to=Player dependency4.type=UsesDependency -dependency40.from=MovingPlattform -dependency40.to=Player +dependency40.from=Plattform +dependency40.to=MyWorld dependency40.type=UsesDependency -dependency41.from=TemporaryGround +dependency41.from=Plattform dependency41.to=Player dependency41.type=UsesDependency -dependency42.from=SpikedPlattform -dependency42.to=Spike +dependency42.from=MovingPlattform +dependency42.to=MyWorld dependency42.type=UsesDependency -dependency43.from=SpikedPlattform -dependency43.to=GameOverWorld +dependency43.from=MovingPlattform +dependency43.to=Player dependency43.type=UsesDependency -dependency44.from=SpikedPlattform -dependency44.to=MyWorld +dependency44.from=TemporaryGround +dependency44.to=Player dependency44.type=UsesDependency dependency45.from=SpikedPlattform -dependency45.to=UnactiveSpike +dependency45.to=Spike dependency45.type=UsesDependency -dependency46.from=TargetingProjectile -dependency46.to=Player +dependency46.from=SpikedPlattform +dependency46.to=MyWorld dependency46.type=UsesDependency -dependency47.from=PlayerProjectile -dependency47.to=Enemy +dependency47.from=SpikedPlattform +dependency47.to=GameOverWorld dependency47.type=UsesDependency +dependency48.from=SpikedPlattform +dependency48.to=UnactiveSpike +dependency48.type=UsesDependency +dependency49.from=TargetingProjectile +dependency49.to=Player +dependency49.type=UsesDependency dependency5.from=MyWorld dependency5.to=Score dependency5.type=UsesDependency +dependency50.from=PlayerProjectile +dependency50.to=Enemy +dependency50.type=UsesDependency dependency6.from=MyWorld dependency6.to=Plattform dependency6.type=UsesDependency @@ -163,11 +172,11 @@ dependency9.from=MyWorld dependency9.to=MovingPlattform dependency9.type=UsesDependency editor.fx.0.height=737 -editor.fx.0.width=814 -editor.fx.0.x=535 -editor.fx.0.y=44 -height=408 -package.numDependencies=47 +editor.fx.0.width=808 +editor.fx.0.x=204 +editor.fx.0.y=64 +height=830 +package.numDependencies=50 package.numTargets=25 project.charset=UTF-8 publish.hasSource=false @@ -359,7 +368,7 @@ target9.width=120 target9.x=0 target9.y=0 version=3.1.0 -width=1550 -world.lastInstantiated=StartWorld -xPosition=0 -yPosition=48 +width=700 +world.lastInstantiated=GameOverWorld +xPosition=850 +yPosition=0