Plattform Verssion 1
This commit is contained in:
@@ -8,6 +8,7 @@ import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
|
||||
*/
|
||||
public class Plattform extends Actor
|
||||
{
|
||||
boolean geloescht= false;
|
||||
/**
|
||||
* Act - do whatever the Plattform wants to do. This method is called whenever
|
||||
* the 'Act' or 'Run' button gets pressed in the environment.
|
||||
@@ -15,6 +16,10 @@ public class Plattform extends Actor
|
||||
public void act()
|
||||
{
|
||||
this.scrollNachUnten();
|
||||
if(geloescht)
|
||||
{
|
||||
this.loescheMich();
|
||||
}
|
||||
// Add your action code here.
|
||||
}
|
||||
|
||||
@@ -24,7 +29,7 @@ public class Plattform extends Actor
|
||||
setLocation(this.getX(),this.getY()+2); // Nach unten turnen
|
||||
if(this.getY()>= welt.getHeight()-5 ||this.getY()<=0)
|
||||
{
|
||||
this.loescheMich();
|
||||
geloescht= true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,12 +40,12 @@ public class Plattform extends Actor
|
||||
|
||||
public boolean PlayerOnPlattform()
|
||||
{
|
||||
Actor Spieler= getOneObjectAtOffset(0, 5, Player.class);
|
||||
if(Spieler!= null)
|
||||
Player Spieler= (Player) getOneIntersectingObject(Player.class);
|
||||
if(this.isTouching(Player.class))
|
||||
{
|
||||
if(Spieler.equals(Player.class))
|
||||
if(Spieler.getY()<this.getY()-20)
|
||||
{
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -51,5 +56,6 @@ public class Plattform extends Actor
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user