chore(todo): add GAL-56 — Score resource does not reset on game restart

This commit is contained in:
Harald Hoyer 2026-05-09 09:55:05 +02:00
parent 0c23dfde84
commit 73c76e75be
2 changed files with 43 additions and 0 deletions

View file

@ -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.

42
TODO/GAL-56.md Normal file
View file

@ -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<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`.