Fix: Game Crashed nicht mehr wenn das PlayerProjectile das Fenster verlässt

This commit is contained in:
2026-09-16 12:06:59 +02:00
parent cdc2e107d5
commit ce7d999b0f
3 changed files with 97 additions and 37 deletions
+2 -2
View File
@@ -15,14 +15,14 @@ public class PlayerProjectile extends Actor
public void act()
{
move(7);
checkForEnemyCollision();
if (!isProjectileOnScreen()){
getWorld().removeObject(this);
}
checkForEnemyCollision();
}
public void checkForEnemyCollision(){
if (getOneIntersectingObject(Enemy.class) != null){
if (getOneIntersectingObject(Enemy.class) != null){
getWorld().removeObject(getOneIntersectingObject(Enemy.class));
getWorld().removeObject(this);
}