PowerUp Items bewegen sich jetzt nach unten und lösen auch nur noch das richtige PowerUp aus

This commit is contained in:
2026-09-17 09:39:47 +02:00
parent 3d047538f1
commit c0c5151c41
17 changed files with 190 additions and 119 deletions
+3 -1
View File
@@ -8,6 +8,7 @@ import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
*/
public class PlayerProjectile extends Actor
{
boolean deleteAfterActCycle = false;
/**
* Act - do whatever the PlayerProjectile wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
@@ -16,7 +17,7 @@ public class PlayerProjectile extends Actor
{
move(7);
checkForEnemyCollision();
if (!isProjectileOnScreen()){
if (deleteAfterActCycle || !isProjectileOnScreen()){
getWorld().removeObject(this);
}
}
@@ -24,6 +25,7 @@ public class PlayerProjectile extends Actor
public void checkForEnemyCollision(){
if (getOneIntersectingObject(Enemy.class) != null){
getWorld().removeObject(getOneIntersectingObject(Enemy.class));
deleteAfterActCycle = true;
}
}