47 lines
1.8 KiB
Markdown
47 lines
1.8 KiB
Markdown
---
|
|
id: GAL-56
|
|
title: Score resource does not reset on game restart
|
|
status: Done
|
|
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
|
|
|
|
- [x] Restarting from `GameOver` resets `Score.value` to 0.
|
|
- [x] Restarting resets `PlayerLives.count` to starting value.
|
|
- [x] Restarting resets `CurrentStage.number` to 1.
|
|
- [x] Restarting resets `FormationState` to default.
|
|
- [x] 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.
|
|
|
|
## Comments
|
|
|
|
- 2026-05-09 — Status set to In Progress.
|
|
- 2026-05-09 — Branch `opencode/clever-wolf`, commit 933d23c — Score, lives, stage, and formation reset on restart; explosions despawned on cleanup
|
|
|
|
## Integration test hints
|
|
|
|
- Build `App`, transition to `Playing`, set `Score = 5000`, transition to `GameOver`, restart, assert `Score.value == 0`.
|