SpikedPlattforms2

This commit is contained in:
2026-09-16 11:48:19 +02:00
parent 6127510ec8
commit 56b755b3d6
17 changed files with 244 additions and 79 deletions
+17 -1
View File
@@ -21,10 +21,26 @@ public class Spike extends Actor
public void act()
{
// Add your action code here.
this.setLocation(this.getX(), this.getY()+speed);
if(this.isTouching(Player.class))
{
Greenfoot.setWorld(new GameOverWorld());
}
this.bewege();
}
public void loescheMich()
{
MyWorld theWorld= (MyWorld) this.getWorld();
theWorld.removeObject(this);
}
public void bewege()
{
this.setLocation(this.getX(), this.getY()+speed);
MyWorld theWorld= (MyWorld) this.getWorld();
if(this.getY()>=theWorld.getHeight()-5)
{
this.loescheMich();
}
}
}