1.6 KiB
1.6 KiB
| id | title | status | parent | labels | ||
|---|---|---|---|---|---|---|
| GAL-56 | Score resource does not reset on game restart | Todo | GAL-50 |
|
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
GameOverresetsScore.valueto 0. - Restarting resets
PlayerLives.countto starting value. - Restarting resets
CurrentStage.numberto 1. - Restarting resets
FormationStateto default. - Restarting despawns all
Enemy,Bullet,EnemyBullet,Explosion, andTractorBeamentities.
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 toPlaying, setScore = 5000, transition toGameOver, restart, assertScore.value == 0.