Verfolgungsprojektil

This commit is contained in:
2026-09-15 20:06:13 +02:00
parent 293c235352
commit bbd34812cb
6 changed files with 49 additions and 9 deletions
+11 -9
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;
int targetTimer = 900;
/**
* Constructor for objects of class MyWorld.
*
@@ -22,6 +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.
@@ -31,6 +32,7 @@ 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
@@ -63,14 +65,14 @@ public class MyWorld extends World
else{
timer = timer - 1;
}
//if(timer == 0){
// TargetingProjectile targetingProjectile = new TargetingProjectile();
// addObject(targetingProjectile, Greenfoot.getRandomNumber(300)+50,0);
// timer = 1000;
//}
//else{
// timer = timer - 1;
//}
if(targetTimer == 0){
TargetingProjectile targetingProjectile = new TargetingProjectile();
addObject(targetingProjectile, Greenfoot.getRandomNumber(300)+50,0);
targetTimer = 900;
}
else{
targetTimer = targetTimer - 1;
}
}
}