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);
} else if (!(ghost.currentBehaviour instanceof ReturnToBase)) {
pacmanCaught();
return true;
}
return true;
}
return false;
}
@ -454,13 +454,21 @@ public class PlayState extends LevelState {
}
}
break;
default:
stateTimer -= dt;
if (stateTimer <= 0) {
stateTransition();
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;
if (stateTimer <= 0) {
stateTransition();
}
}
}
private final class Controller extends InputAdapter {
@ -490,6 +498,7 @@ public class PlayState extends LevelState {
break;
case Input.Keys.N:
preNewGame();
setGameState(GameState.PRE_NEW_GAME);
break;
}
return super.keyDown(keycode);