diff --git a/SMIMS-Game/Spike.class b/SMIMS-Game/Spike.class new file mode 100644 index 0000000..1f74616 Binary files /dev/null and b/SMIMS-Game/Spike.class differ diff --git a/SMIMS-Game/Spike.ctxt b/SMIMS-Game/Spike.ctxt new file mode 100644 index 0000000..3b85240 --- /dev/null +++ b/SMIMS-Game/Spike.ctxt @@ -0,0 +1,9 @@ +#BlueJ class context +comment0.target=Spike +comment0.text=\r\n\ Write\ a\ description\ of\ class\ Spike\ here.\r\n\ \r\n\ @author\ (your\ name)\ \r\n\ @version\ (a\ version\ number\ or\ a\ date)\r\n +comment1.params=pSpeed +comment1.target=Spike(int) +comment2.params= +comment2.target=void\ act() +comment2.text=\r\n\ Act\ -\ do\ whatever\ the\ Spike\ wants\ to\ do.\ This\ method\ is\ called\ whenever\r\n\ the\ 'Act'\ or\ 'Run'\ button\ gets\ pressed\ in\ the\ environment.\r\n +numComments=3 diff --git a/SMIMS-Game/Spike.java b/SMIMS-Game/Spike.java new file mode 100644 index 0000000..2c53b13 --- /dev/null +++ b/SMIMS-Game/Spike.java @@ -0,0 +1,30 @@ +import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) + +/** + * Write a description of class Spike here. + * + * @author (your name) + * @version (a version number or a date) + */ +public class Spike extends Actor +{ + int speed; + public Spike(int pSpeed) + { + speed=pSpeed; + } + + /** + * Act - do whatever the Spike wants to do. This method is called whenever + * the 'Act' or 'Run' button gets pressed in the environment. + */ + public void act() + { + // Add your action code here. + this.setLocation(this.getX(), this.getY()+speed); + if(this.isTouching(Player.class)) + { + Greenfoot.setWorld(new GameOverWorld()); + } + } +} diff --git a/SMIMS-Game/SpikedPlattform.class b/SMIMS-Game/SpikedPlattform.class new file mode 100644 index 0000000..71b8cc1 Binary files /dev/null and b/SMIMS-Game/SpikedPlattform.class differ diff --git a/SMIMS-Game/SpikedPlattform.ctxt b/SMIMS-Game/SpikedPlattform.ctxt new file mode 100644 index 0000000..7f43c74 --- /dev/null +++ b/SMIMS-Game/SpikedPlattform.ctxt @@ -0,0 +1,11 @@ +#BlueJ class context +comment0.target=SpikedPlattform +comment0.text=\r\n\ Write\ a\ description\ of\ class\ SpikedPlattform\ here.\r\n\ \r\n\ @author\ (your\ name)\ \r\n\ @version\ (a\ version\ number\ or\ a\ date)\r\n +comment1.params=pSpikeCountdown +comment1.target=void\ act(int) +comment1.text=\r\n\ Act\ -\ do\ whatever\ the\ SpikedPlattform\ wants\ to\ do.\ This\ method\ is\ called\ whenever\r\n\ the\ 'Act'\ or\ 'Run'\ button\ gets\ pressed\ in\ the\ environment.\r\n +comment2.params= +comment2.target=void\ activateSpikes() +comment3.params= +comment3.target=void\ spikeTheSurface() +numComments=4 diff --git a/SMIMS-Game/SpikedPlattform.java b/SMIMS-Game/SpikedPlattform.java new file mode 100644 index 0000000..efc2a57 --- /dev/null +++ b/SMIMS-Game/SpikedPlattform.java @@ -0,0 +1,61 @@ +import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) + +/** + * Write a description of class SpikedPlattform here. + * + * @author (your name) + * @version (a version number or a date) + */ +public class SpikedPlattform extends Plattform +{ + int SpikeCountdown; + boolean spikesActivated=false; + boolean isSpiked=false; + Spike[] hasSpikes= new Spike[5]; + /** + * Act - do whatever the SpikedPlattform wants to do. This method is called whenever + * the 'Act' or 'Run' button gets pressed in the environment. + */ + public void act(int pSpikeCountdown) + { + // Add your action code here. + if(this.PlayerOnPlattform() && spikesActivated== false) + { + this.activateSpikes(); + } + if(spikesActivated) + { + SpikeCountdown--; + } + if(SpikeCountdown==0) + { + this.spikeTheSurface(); + } + if(isSpiked && this.PlayerOnPlattform()) + { + Greenfoot.setWorld(new GameOverWorld()); + } + super.act(); + } + + public void activateSpikes() + { + spikesActivated=true; + //Sound + //setImage + + } + + public void spikeTheSurface() + { + isSpiked=true; + MyWorld theWorld= (MyWorld) this.getWorld(); + for(int i=0; i<3; i++) + { + theWorld.addObject(new Spike(2), this.getX()-this.getImage().getWidth()+ i*this.getImage().getWidth()/3, this.getX()-this.getImage().getHeight()/2); + } + //Sound + //setImage + } + +} \ No newline at end of file diff --git a/SMIMS-Game/UnactiveSpike.class b/SMIMS-Game/UnactiveSpike.class new file mode 100644 index 0000000..d21a187 Binary files /dev/null and b/SMIMS-Game/UnactiveSpike.class differ diff --git a/SMIMS-Game/UnactiveSpike.ctxt b/SMIMS-Game/UnactiveSpike.ctxt new file mode 100644 index 0000000..2494fd4 --- /dev/null +++ b/SMIMS-Game/UnactiveSpike.ctxt @@ -0,0 +1,7 @@ +#BlueJ class context +comment0.target=UnactiveSpike +comment0.text=\r\n\ Write\ a\ description\ of\ class\ UnactiveSpike\ here.\r\n\ \r\n\ @author\ (your\ name)\ \r\n\ @version\ (a\ version\ number\ or\ a\ date)\r\n +comment1.params= +comment1.target=void\ act() +comment1.text=\r\n\ Act\ -\ do\ whatever\ the\ UnactiveSpike\ wants\ to\ do.\ This\ method\ is\ called\ whenever\r\n\ the\ 'Act'\ or\ 'Run'\ button\ gets\ pressed\ in\ the\ environment.\r\n +numComments=2 diff --git a/SMIMS-Game/UnactiveSpike.java b/SMIMS-Game/UnactiveSpike.java new file mode 100644 index 0000000..256c2fb --- /dev/null +++ b/SMIMS-Game/UnactiveSpike.java @@ -0,0 +1,19 @@ +import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) + +/** + * Write a description of class UnactiveSpike here. + * + * @author (your name) + * @version (a version number or a date) + */ +public class UnactiveSpike extends Actor +{ + /** + * Act - do whatever the UnactiveSpike wants to do. This method is called whenever + * the 'Act' or 'Run' button gets pressed in the environment. + */ + public void act() + { + // Add your action code here. + } +} diff --git a/SMIMS-Game/images/BreakingPlattform2.png b/SMIMS-Game/images/BreakingPlattform2.png index 431e591..cc15e35 100644 Binary files a/SMIMS-Game/images/BreakingPlattform2.png and b/SMIMS-Game/images/BreakingPlattform2.png differ diff --git a/SMIMS-Game/images/Plattform.png b/SMIMS-Game/images/Plattform.png index 96dbd34..3f7b818 100644 Binary files a/SMIMS-Game/images/Plattform.png and b/SMIMS-Game/images/Plattform.png differ diff --git a/SMIMS-Game/images/Spike.png b/SMIMS-Game/images/Spike.png new file mode 100644 index 0000000..2e2b277 Binary files /dev/null and b/SMIMS-Game/images/Spike.png differ diff --git a/SMIMS-Game/images/SpikeUnactive.png b/SMIMS-Game/images/SpikeUnactive.png new file mode 100644 index 0000000..12ad442 Binary files /dev/null and b/SMIMS-Game/images/SpikeUnactive.png differ diff --git a/SMIMS-Game/images/SpikedPlattform.png b/SMIMS-Game/images/SpikedPlattform.png new file mode 100644 index 0000000..365538f Binary files /dev/null and b/SMIMS-Game/images/SpikedPlattform.png differ diff --git a/SMIMS-Game/images/Unbenannt.png b/SMIMS-Game/images/Unbenannt.png index fd65da7..26fdca2 100644 Binary files a/SMIMS-Game/images/Unbenannt.png and b/SMIMS-Game/images/Unbenannt.png differ diff --git a/SMIMS-Game/images/Unbenannt2.png b/SMIMS-Game/images/Unbenannt2.png index 6b3f7a3..96de1a0 100644 Binary files a/SMIMS-Game/images/Unbenannt2.png and b/SMIMS-Game/images/Unbenannt2.png differ diff --git a/SMIMS-Game/images/test.png b/SMIMS-Game/images/test.png new file mode 100644 index 0000000..1849d5f Binary files /dev/null and b/SMIMS-Game/images/test.png differ diff --git a/SMIMS-Game/project.greenfoot b/SMIMS-Game/project.greenfoot index f079710..031640b 100644 --- a/SMIMS-Game/project.greenfoot +++ b/SMIMS-Game/project.greenfoot @@ -1,25 +1,79 @@ #Greenfoot project file +class.BreakingPlattform.image=Unbenannt2.png class.Ground.image=weave.jpg +class.MovingPlattform.image=Unbenannt.png +class.Plattform.image=Plattform.png class.Player.image=ppl2.png +class.Spike.image=Spike.png +class.SpikedPlattform.image=Unbenannt.png +class.UnactiveSpike.image=SpikeUnactive.png dependency1.from=PlayerTestWorld dependency1.to=Ground dependency1.type=UsesDependency +dependency10.from=Player +dependency10.to=GameOverWorld +dependency10.type=UsesDependency +dependency11.from=Player +dependency11.to=Ground +dependency11.type=UsesDependency +dependency12.from=Player +dependency12.to=Projectile +dependency12.type=UsesDependency +dependency13.from=Plattform +dependency13.to=MyWorld +dependency13.type=UsesDependency +dependency14.from=Plattform +dependency14.to=Player +dependency14.type=UsesDependency +dependency15.from=MovingPlattform +dependency15.to=MyWorld +dependency15.type=UsesDependency +dependency16.from=SpikedPlattform +dependency16.to=Spike +dependency16.type=UsesDependency +dependency17.from=SpikedPlattform +dependency17.to=GameOverWorld +dependency17.type=UsesDependency +dependency18.from=SpikedPlattform +dependency18.to=MyWorld +dependency18.type=UsesDependency +dependency19.from=PowerUps +dependency19.to=Player +dependency19.type=UsesDependency dependency2.from=PlayerTestWorld dependency2.to=Player dependency2.type=UsesDependency -dependency3.from=MyWorld -dependency3.to=Player +dependency20.from=JumpBoostItem +dependency20.to=Player +dependency20.type=UsesDependency +dependency3.from=PlayerTestWorld +dependency3.to=JumpBoostItem dependency3.type=UsesDependency -dependency4.from=Player -dependency4.to=Ground +dependency4.from=MyWorld +dependency4.to=Player dependency4.type=UsesDependency -editor.fx.0.height=737 -editor.fx.0.width=814 -editor.fx.0.x=360 -editor.fx.0.y=26 -height=830 -package.numDependencies=4 -package.numTargets=4 +dependency5.from=MyWorld +dependency5.to=Plattform +dependency5.type=UsesDependency +dependency6.from=MyWorld +dependency6.to=MovingPlattform +dependency6.type=UsesDependency +dependency7.from=MyWorld +dependency7.to=BreakingPlattform +dependency7.type=UsesDependency +dependency8.from=Spike +dependency8.to=GameOverWorld +dependency8.type=UsesDependency +dependency9.from=Spike +dependency9.to=Player +dependency9.type=UsesDependency +editor.fx.0.height=810 +editor.fx.0.width=816 +editor.fx.0.x=647 +editor.fx.0.y=172 +height=736 +package.numDependencies=20 +package.numTargets=14 project.charset=UTF-8 publish.hasSource=false publish.locked=true @@ -35,35 +89,105 @@ readme.x=10 readme.y=10 simulation.speed=50 target1.height=70 -target1.name=Player +target1.name=Spike target1.showInterface=false target1.type=ClassTarget target1.width=120 target1.x=0 target1.y=0 +target10.height=70 +target10.name=Plattform +target10.showInterface=false +target10.type=ClassTarget +target10.width=120 +target10.x=0 +target10.y=0 +target11.height=70 +target11.name=Projectile +target11.showInterface=false +target11.type=ClassTarget +target11.width=120 +target11.x=0 +target11.y=0 +target12.height=70 +target12.name=PowerUps +target12.showInterface=false +target12.type=ClassTarget +target12.width=120 +target12.x=0 +target12.y=0 +target13.height=70 +target13.name=SpikedPlattform +target13.showInterface=false +target13.type=ClassTarget +target13.width=120 +target13.x=0 +target13.y=0 +target14.height=70 +target14.name=MyWorld +target14.showInterface=false +target14.type=ClassTarget +target14.width=120 +target14.x=0 +target14.y=0 target2.height=70 -target2.name=Ground +target2.name=Player target2.showInterface=false target2.type=ClassTarget target2.width=120 target2.x=0 target2.y=0 target3.height=70 -target3.name=PlayerTestWorld +target3.name=MovingPlattform target3.showInterface=false target3.type=ClassTarget target3.width=120 target3.x=0 target3.y=0 target4.height=70 -target4.name=MyWorld +target4.name=Ground target4.showInterface=false target4.type=ClassTarget target4.width=120 target4.x=0 target4.y=0 +target5.height=70 +target5.name=UnactiveSpike +target5.showInterface=false +target5.type=ClassTarget +target5.width=120 +target5.x=0 +target5.y=0 +target6.height=70 +target6.name=JumpBoostItem +target6.showInterface=false +target6.type=ClassTarget +target6.width=120 +target6.x=0 +target6.y=0 +target7.height=70 +target7.name=BreakingPlattform +target7.showInterface=false +target7.type=ClassTarget +target7.width=120 +target7.x=0 +target7.y=0 +target8.height=70 +target8.name=GameOverWorld +target8.showInterface=false +target8.type=ClassTarget +target8.width=120 +target8.x=0 +target8.y=0 +target9.height=70 +target9.name=PlayerTestWorld +target9.showInterface=false +target9.type=ClassTarget +target9.width=120 +target9.x=0 +target9.y=0 version=3.1.0 -width=1550 -world.lastInstantiated=PlayerTestWorld -xPosition=0 -yPosition=0 +width=856 +world.lastInstantiated=MyWorld +xPosition=418 +yPosition=223