Projektil und Game Over Transition bei Kollision

This commit is contained in:
2026-09-15 10:21:16 +02:00
parent ec0e80fe97
commit 07c5614d44
16 changed files with 126 additions and 12 deletions
+26
View File
@@ -0,0 +1,26 @@
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Projectile here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Projectile extends Actor
{
/**
* Act - do whatever the Projectile wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
falling();
}
public void falling(){
setLocation(getX(), getY() + 5);
if(getY() > getWorld().getHeight() -5){
getWorld().removeObject(this);
}
}
}