Startplattform (nicht in MyWorld)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user