48 lines
1.1 KiB
Java
48 lines
1.1 KiB
Java
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
|
|
|
|
/**
|
|
* Write a description of class BreakingPlattform here.
|
|
*
|
|
* @author (your name)
|
|
* @version (a version number or a date)
|
|
*/
|
|
public class BreakingPlattform extends Plattform
|
|
{
|
|
boolean IsBreaking= false;
|
|
int BreakingCountdown;
|
|
public BreakingPlattform(int pBreakingCountdown)
|
|
{
|
|
BreakingCountdown=pBreakingCountdown;
|
|
}
|
|
|
|
/**
|
|
* Act - do whatever the BreakingPlattform wants to do. This method is called whenever
|
|
* the 'Act' or 'Run' button gets pressed in the environment.
|
|
*/
|
|
public void act()
|
|
{
|
|
if(this.PlayerOnPlattform() && IsBreaking==false)
|
|
{
|
|
IsBreaking= true;
|
|
//Greenfoot.playSound("...")
|
|
this.setImage("Breaking2.png");
|
|
|
|
}
|
|
if(IsBreaking)
|
|
{
|
|
BreakingCountdown--;
|
|
if(BreakingCountdown==0)
|
|
{
|
|
this.breakPlattform();
|
|
}
|
|
}
|
|
super.act();
|
|
}
|
|
|
|
public void breakPlattform()
|
|
{
|
|
//Animation
|
|
geloescht=true;
|
|
}
|
|
}
|