Startplattform (nicht in MyWorld)

This commit is contained in:
2026-09-16 17:16:52 +02:00
parent bfada2dbc2
commit a0de2fb58d
16 changed files with 287 additions and 75 deletions
+17 -7
View File
@@ -10,10 +10,10 @@ public class Player extends Actor
{
int jumpBoostDuration = -1;
int jumpBoostStrength = 5;
boolean projectileReady = false;
int projectileTimer;
private int speed = 6;
private int currentJumpStrength;
private int defaultJumpStrength = 15;
@@ -30,7 +30,7 @@ public class Player extends Actor
fall();
handlePowerUps();
shootProjectile();
//Check ob der Spieler am unteren Fensterrand ist
if (getY()+1 >= getWorld().getHeight()){
Greenfoot.setWorld(new GameOverWorld());
@@ -89,8 +89,8 @@ public class Player extends Actor
}
}
onGround = landed;
}
}
public void shootProjectile(){
projectileTimer++;
MouseInfo mouse = Greenfoot.getMouseInfo();
@@ -118,7 +118,7 @@ public class Player extends Actor
return false;
}
}
public void handlePowerUps(){
if (jumpBoostDuration >= 0){
jumpBoostDuration -= 1;
@@ -126,7 +126,7 @@ public class Player extends Actor
currentJumpStrength = defaultJumpStrength;
}
}
public void reveivePowerUp(int duration, String type){
switch(type){
case "dummy":
@@ -135,6 +135,16 @@ public class Player extends Actor
currentJumpStrength = defaultJumpStrength;
currentJumpStrength += jumpBoostStrength;
jumpBoostDuration = duration;
case "GroundPower":
World theWorld= this.getWorld();
if(!theWorld.getObjects(TemporaryGround.class).isEmpty())
{
theWorld.getObjects(TemporaryGround.class).get(0).RefreshLifeToDuration(duration);
}
else
{
theWorld.addObject((new TemporaryGround(duration)), 200, 550);
}
}
}
}