PowerUp Items bewegen sich jetzt nach unten und lösen auch nur noch das richtige PowerUp aus
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user