From 73c76e75beea1a33c367832703f2ca0f3089e9cb Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Sat, 9 May 2026 09:55:05 +0200 Subject: [PATCH] =?UTF-8?q?chore(todo):=20add=20GAL-56=20=E2=80=94=20Score?= =?UTF-8?q?=20resource=20does=20not=20reset=20on=20game=20restart?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TODO/GAL-50.md | 1 + TODO/GAL-56.md | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 TODO/GAL-56.md diff --git a/TODO/GAL-50.md b/TODO/GAL-50.md index 5692921..c819aca 100644 --- a/TODO/GAL-50.md +++ b/TODO/GAL-50.md @@ -17,3 +17,4 @@ Score, lives, stage, high-score, start menu, and restart UI. - [x] [GAL-53](GAL-53.md) — Implement a High Score system (saving/loading). - [x] [GAL-54](GAL-54.md) — Create a Start Menu state with a "Start Game" button. - [ ] [GAL-55](GAL-55.md) — Add a "Press R to Restart" message to the `GameOver` screen and implement restart logic. +- [ ] [GAL-56](GAL-56.md) — Score resource does not reset on game restart. diff --git a/TODO/GAL-56.md b/TODO/GAL-56.md new file mode 100644 index 0000000..4d828e8 --- /dev/null +++ b/TODO/GAL-56.md @@ -0,0 +1,42 @@ +--- +id: GAL-56 +title: Score resource does not reset on game restart +status: Todo +parent: GAL-50 +labels: [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): +```rust +pub fn restart_game_system( + mut next_state: ResMut>, + mut restart: ResMut, +) { + 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`.