Files
SMIMS_2026_2/SMIMS-Game/Groundflower.java
T

38 lines
978 B
Java

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);
}
}
}