Merge remote-tracking branch 'origin/main'
# Conflicts: # SMIMS-Game/MyWorld.class # SMIMS-Game/MyWorld.java # SMIMS-Game/Player.class # SMIMS-Game/Player.ctxt # SMIMS-Game/project.greenfoot
This commit is contained in:
+25
-5
@@ -8,9 +8,10 @@ import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
|
||||
*/
|
||||
public class MyWorld extends World
|
||||
{
|
||||
int PlattformCountdown;
|
||||
int timer = 200; //Zeit, bevor das erste Projektil auftaucht
|
||||
//kann später noch beliebig angepasst werden
|
||||
|
||||
|
||||
/**
|
||||
* Constructor for objects of class MyWorld.
|
||||
*
|
||||
@@ -30,16 +31,35 @@ public class MyWorld extends World
|
||||
Player player = new Player();
|
||||
addObject(player,302,320);
|
||||
}
|
||||
|
||||
public void act(){
|
||||
if(timer > 0){
|
||||
timer = timer - 1;
|
||||
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
|
||||
}
|
||||
else{
|
||||
Projectile projectile = new Projectile();
|
||||
addObject(projectile,Greenfoot.getRandomNumber(300)+50,0);
|
||||
timer = 200; //zeitlicher Abstand
|
||||
if(Greenfoot.getRandomNumber(100000)>=99750)
|
||||
{
|
||||
addObject(new BreakingPlattform(50), Greenfoot.getRandomNumber(400), 6); //Nach Links bewegende Plattform
|
||||
}
|
||||
//zwischen den x Werten 50 und 350 spawnen die Projektile (anpassbar)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user