Projectile fix

This commit is contained in:
2026-09-15 19:17:14 +02:00
parent 95e96d7e44
commit 293c235352
4 changed files with 121 additions and 62 deletions
+17 -6
View File
@@ -11,7 +11,7 @@ public class MyWorld extends World
int PlattformCountdown;
int timer = 200; //Zeit, bevor das erste Projektil auftaucht
//kann später noch beliebig angepasst werden
int targetTimer = 1000;
/**
* Constructor for objects of class MyWorld.
*
@@ -51,15 +51,26 @@ public class MyWorld extends World
{
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)
if(timer == 0){
Projectile projectile = new Projectile();
addObject(projectile,Greenfoot.getRandomNumber(300)+50,0);
timer = 200; //zeitlicher Abstand
}
else{
timer = timer - 1;
}
//if(timer == 0){
// TargetingProjectile targetingProjectile = new TargetingProjectile();
// addObject(targetingProjectile, Greenfoot.getRandomNumber(300)+50,0);
// timer = 1000;
//}
//else{
// timer = timer - 1;
//}
}
}