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
+37
View File
@@ -0,0 +1,37 @@
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class StarPowerUp here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Groundflower extends PowerUps
{
int duration= 60*8; //15 Sekunden
/**
* Act - do whatever the StarPowerUp wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
bewegeNachUnten();
this.touchedByPlayer();
// Add your action code here.
}
@ Override void collect()
{
Player player = getIntersectingObjects(Player.class).get(0);
player.reveivePowerUp(duration, "GroundPower");
}
public void bewegeNachUnten()
{
this.setLocation(this.getX(), this.getY()+2);
if(this.getY()>=this.getWorld().getHeight())
{
this.getWorld().removeObject(this);
}
}
}