diff --git a/core/src/com/me/pacman/state/PlayState.java b/core/src/com/me/pacman/state/PlayState.java index 957d5bd..6af6dad 100644 --- a/core/src/com/me/pacman/state/PlayState.java +++ b/core/src/com/me/pacman/state/PlayState.java @@ -106,7 +106,7 @@ public class PlayState extends LevelState { if (pacman.alive && newGameTimer <= 0) { for (Ghost ghost : ghosts) { - if (ghost == null || (pointsTimer > 0 && ghost == lastGhostCaptured)) { + if (pointsTimer > 0 && ghost == lastGhostCaptured) { continue; } ghost.render(game.batch, 0, 16); @@ -174,7 +174,7 @@ public class PlayState extends LevelState { frightTimer -= dt; if (frightTimer <= 0) { for (Ghost ghost : ghosts) { - if (ghost == null || ghost.currentBehaviour instanceof ReturnToBase) continue; + if (ghost.currentBehaviour instanceof ReturnToBase) continue; ghost.caught = false; ghost.currentBehaviour = ghost.chaseBehaviour; ghost.speed = Ghost.GHOST_SPEED; @@ -216,9 +216,6 @@ public class PlayState extends LevelState { if (!pacmanCaught) { for (Ghost ghost : ghosts) { - if (ghost == null) { - continue; - } ghost.update(dt); if (ghost.onSameTile(pacman)) { @@ -377,7 +374,7 @@ public class PlayState extends LevelState { public void eatPowerPellet(float x, float y) { pelletEaten(x, y); for (Ghost ghost : ghosts) { - if (ghost == null || ghost.currentBehaviour instanceof ReturnToBase) continue; + if (ghost.currentBehaviour instanceof ReturnToBase) continue; ghost.caught = false; ghost.currentBehaviour = ghost.frightBehaviour; ghost.currDirection = ghost.currDirection.getOpposite();