diff --git a/SMIMS-Game/MyWorld.class b/SMIMS-Game/MyWorld.class index c9c4726..005c0be 100644 Binary files a/SMIMS-Game/MyWorld.class and b/SMIMS-Game/MyWorld.class differ diff --git a/SMIMS-Game/MyWorld.ctxt b/SMIMS-Game/MyWorld.ctxt index 25b6c20..a71706b 100644 --- a/SMIMS-Game/MyWorld.ctxt +++ b/SMIMS-Game/MyWorld.ctxt @@ -7,4 +7,6 @@ comment1.text=\r\n\ Constructor\ for\ objects\ of\ class\ MyWorld.\r\n\ \r\n 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\ act() +numComments=4 diff --git a/SMIMS-Game/MyWorld.java b/SMIMS-Game/MyWorld.java index b18d2c8..cd992fd 100644 --- a/SMIMS-Game/MyWorld.java +++ b/SMIMS-Game/MyWorld.java @@ -8,7 +8,7 @@ import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) */ public class MyWorld extends World { - + int PlattformCountdown; /** * Constructor for objects of class MyWorld. * @@ -28,4 +28,30 @@ public class MyWorld extends World Player player = new Player(); addObject(player,302,320); } + public void act() + { + if(PlattformCountdown==0) //Damit in regelmäßigen Abständen auf jeden Fall eine Plattform auftaucht + { + addObject(new Plattform(), Greenfoot.getRandomNumber(400), 5); + PlattformCountdown=100; + } + PlattformCountdown--; + if(Greenfoot.getRandomNumber(100000)>=99800) + { + addObject(new Plattform(), Greenfoot.getRandomNumber(400), 5); + } + if(Greenfoot.getRandomNumber(100000)>=99900) + { + addObject(new MovingPlattform(2), Greenfoot.getRandomNumber(400), 6); //Nach Rechts bewegende Plattform + } + if(Greenfoot.getRandomNumber(100000)>=99900) + { + addObject(new MovingPlattform(-2), Greenfoot.getRandomNumber(400), 6); //Nach Links bewegende Plattform + } + if(Greenfoot.getRandomNumber(100000)>=99750) + { + addObject(new BreakingPlattform(50), Greenfoot.getRandomNumber(400), 6); //Nach Links bewegende Plattform + } + } + }