Let ghosts already returning continue when another ghost is caught

Only catch one ghost per frame
Fix new game shortcut
This commit is contained in:
Matt Low 2020-01-05 23:28:23 +04:00
parent 2bc78baa74
commit 13d1948d48

View File

@ -407,8 +407,8 @@ public class PlayState extends LevelState {
ghostCaught(ghost); ghostCaught(ghost);
} else if (!(ghost.currentBehaviour instanceof ReturnToBase)) { } else if (!(ghost.currentBehaviour instanceof ReturnToBase)) {
pacmanCaught(); pacmanCaught();
return true;
} }
return true;
} }
return false; return false;
} }
@ -454,12 +454,20 @@ public class PlayState extends LevelState {
} }
} }
break; break;
default: case GHOST_CAUGHT_POINTS_WAIT:
for (Ghost ghost : ghosts) {
if (ghost.currentBehaviour instanceof ReturnToBase && ghost != lastGhostCaptured) {
ghost.update(dt);
}
}
break;
}
if (state.timer > 0) {
stateTimer -= dt; stateTimer -= dt;
if (stateTimer <= 0) { if (stateTimer <= 0) {
stateTransition(); stateTransition();
} }
break;
} }
} }
@ -490,6 +498,7 @@ public class PlayState extends LevelState {
break; break;
case Input.Keys.N: case Input.Keys.N:
preNewGame(); preNewGame();
setGameState(GameState.PRE_NEW_GAME);
break; break;
} }
return super.keyDown(keycode); return super.keyDown(keycode);