--- id: GAL-55 title: Add Press R to Restart message and restart logic status: Todo parent: GAL-50 labels: [polish, ui] --- # GAL-55: Add a "Press R to Restart" message to the `GameOver` screen and implement restart logic Add a "Press R to Restart" message to the `GameOver` screen and implement restart logic. ## Acceptance criteria - [ ] "Press R to Restart" rendered as part of `GameOverUI` (`RestartMessage` component already exists in `components.rs`). - [ ] Pressing R while in `GameState::GameOver` transitions back to `GameState::Playing`. - [ ] On restart, these reset to defaults: `Score`, `PlayerLives`, `CurrentStage`, `FormationState`, `AttackDiveTimer`, `EnemySpawnTimer`, `RestartPressed`. - [ ] On restart, all `Enemy`, `Bullet`, `EnemyBullet`, `Explosion`, and `TractorBeam` entities are despawned. - [ ] Player respawns at default position with invincibility window. - [ ] R is ignored in `Playing` and `StartMenu` states. ## Integration test hints - Build `App` in `GameOver`; insert a fake `Score = 1234`, `CurrentStage = 4`; simulate `KeyCode::KeyR` press via `ButtonInput`; tick; assert state is `Playing` and resources reset. - Pre-spawn enemies/bullets/explosions before restart; after restart tick, assert their entity counts are zero. - Negative test: send `KeyR` while in `Playing`; assert no resource reset and no state change.