Verfolgungsprojektil

This commit is contained in:
2026-09-15 20:39:10 +02:00
parent 4013820d8d
commit aae6ac5e41
7 changed files with 165 additions and 15 deletions
+26 -1
View File
@@ -33,10 +33,29 @@ public class MyWorld extends World
addObject(player,302,320);
Score score = new Score();
addObject(score, 200, 50);
Plattform plattform = new Plattform();
addObject(plattform,285,577);
plattform.setLocation(286,492);
plattform.setLocation(293,379);
removeObject(plattform);
Plattform plattform2 = new Plattform();
addObject(plattform2,291,373);
Plattform plattform3 = new Plattform();
addObject(plattform3,123,268);
plattform3.setLocation(136,306);
Plattform plattform4 = new Plattform();
addObject(plattform4,294,204);
Plattform plattform5 = new Plattform();
addObject(plattform5,105,112);
plattform2.setLocation(320,367);
plattform2.setLocation(312,371);
plattform2.setLocation(308,382);
}
public void act()
{
projectile();
targetingProjectile();
if(PlattformCountdown==0) //Damit in regelmäßigen Abständen auf jeden Fall eine Plattform auftaucht
{
addObject(new Plattform(), Greenfoot.getRandomNumber(400), 5);
@@ -59,6 +78,10 @@ public class MyWorld extends World
{
addObject(new BreakingPlattform(50), Greenfoot.getRandomNumber(400), 6); //Nach Links bewegende Plattform
}
}
public void projectile(){
if(timer == 0){
Projectile projectile = new Projectile();
addObject(projectile,Greenfoot.getRandomNumber(300)+50,0);
@@ -67,6 +90,9 @@ public class MyWorld extends World
else{
timer = timer - 1;
}
}
public void targetingProjectile(){
if(targetTimer == 0){
TargetingProjectile targetingProjectile = new TargetingProjectile();
addObject(targetingProjectile, Greenfoot.getRandomNumber(300)+50,0);
@@ -76,5 +102,4 @@ public class MyWorld extends World
targetTimer = targetTimer - 1;
}
}
}