SpikedPlattforms2

This commit is contained in:
2026-09-16 11:48:19 +02:00
parent 6127510ec8
commit 56b755b3d6
17 changed files with 244 additions and 79 deletions
+9 -6
View File
@@ -10,7 +10,7 @@ public class MyWorld extends World
{
int PlattformCountdown;
int timer = 200; //Zeit, bevor das erste Projektil auftaucht
//kann später noch beliebig angepasst werden
//kann später noch beliebig angepasst werden
int targetTimer = 100;
/**
* Constructor for objects of class MyWorld.
@@ -22,7 +22,7 @@ public class MyWorld extends World
super(400, 600, 1);
prepare();
}
/**
* Prepare the world for the start of the program.
* That is: create the initial objects and add them to the world.
@@ -59,7 +59,7 @@ public class MyWorld extends World
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=50;
}
PlattformCountdown--;
if(Greenfoot.getRandomNumber(100000)>=99800)
@@ -78,9 +78,12 @@ public class MyWorld extends World
{
addObject(new BreakingPlattform(50), Greenfoot.getRandomNumber(400), 6); //Nach Links bewegende Plattform
}
if(Greenfoot.getRandomNumber(100000)>=99550)
{
addObject(new SpikedPlattform(50), Greenfoot.getRandomNumber(400), 6); //Nach Links bewegende Plattform
}
}
public void projectile(){
if(timer == 0){
Projectile projectile = new Projectile();
@@ -91,7 +94,7 @@ public class MyWorld extends World
timer = timer - 1;
}
}
public void targetingProjectile(){
if(targetTimer == 0){
TargetingProjectile targetingProjectile = new TargetingProjectile();