Plattform Verssion 1
This commit is contained in:
@@ -8,25 +8,40 @@ import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
|
||||
*/
|
||||
public class BreakingPlattform extends Plattform
|
||||
{
|
||||
boolean IsBreaking= false;
|
||||
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()
|
||||
{
|
||||
super.act();
|
||||
if(this.PlayerOnPlattform() && IsBreaking==false)
|
||||
{
|
||||
IsBreaking= true;
|
||||
IsBreaking= true;
|
||||
//Greenfoot.playSound("...")
|
||||
this.setImage("BreakingPlattform2.png"); //untested
|
||||
|
||||
}
|
||||
if(IsBreaking)
|
||||
{
|
||||
BreakingCountdown--;
|
||||
if(BreakingCountdown==0)
|
||||
{
|
||||
this.breakPlattform();
|
||||
}
|
||||
}
|
||||
super.act();
|
||||
}
|
||||
|
||||
public void breakPlattform()
|
||||
{
|
||||
if(this.PlayerOnPlattform())
|
||||
{
|
||||
|
||||
}
|
||||
//Animation
|
||||
geloescht=true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user