SpikedPlattforms1

This commit is contained in:
2026-09-15 20:24:24 +02:00
parent 086274bc82
commit 8eeb32af40
18 changed files with 280 additions and 19 deletions
+30
View File
@@ -0,0 +1,30 @@
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Spike here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Spike extends Actor
{
int speed;
public Spike(int pSpeed)
{
speed=pSpeed;
}
/**
* Act - do whatever the Spike 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.
this.setLocation(this.getX(), this.getY()+speed);
if(this.isTouching(Player.class))
{
Greenfoot.setWorld(new GameOverWorld());
}
}
}