bglga/TODO/GAL-56.md

1.6 KiB

id title status parent labels
GAL-56 Score resource does not reset on game restart Todo GAL-50
bug
ui

GAL-56: Score resource does not reset on game restart

The restart_game_system in src/game_state.rs only resets RestartPressed and transitions to Playing. It does not reset Score, PlayerLives, CurrentStage, or FormationState resources.

This means on subsequent games after the first, Score retains the previous game's final score. The Game Over screen shows the cumulative total ("Your Score") rather than the current game's score, and check_high_score (from GAL-53) compares against the accumulated score instead of the current game's score.

Acceptance criteria

  • Restarting from GameOver resets Score.value to 0.
  • Restarting resets PlayerLives.count to starting value.
  • Restarting resets CurrentStage.number to 1.
  • Restarting resets FormationState to default.
  • Restarting despawns all Enemy, Bullet, EnemyBullet, Explosion, and TractorBeam entities.

Code context

src/game_state.rs (restart system, current state):

pub fn restart_game_system(
    mut next_state: ResMut<NextState<AppState>>,
    mut restart: ResMut<RestartPressed>,
) {
    if restart.pressed {
        restart.pressed = false;
        next_state.set(AppState::Playing);
    }
}

No resource reset logic exists. The cleanup_game_entities system runs on OnExit(Playing) but does not reset resources.

Integration test hints

  • Build App, transition to Playing, set Score = 5000, transition to GameOver, restart, assert Score.value == 0.