Plattform Verssion 1

This commit is contained in:
2026-09-15 10:06:00 +02:00
parent ec0e80fe97
commit 46823901dd
12 changed files with 158 additions and 0 deletions
+38
View File
@@ -0,0 +1,38 @@
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class MovingPlattform here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class MovingPlattform extends Plattform
{
int speed;
public MovingPlattform(int pSpeed)
{
speed= pSpeed;
}
/**
* Act - do whatever the MovingPlattform wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
// Add your action code here.
super.act();
this.bewege();
}
public void bewege()
{
MyWorld theWorld= (MyWorld) this.getWorld();
move(speed);
if(this.getX()<5 || this.getX()<=theWorld.getWidth())
{
this.loescheMich();
}
}
}