From fc601a1da3340c8eb511370d831e7fcf7ab9dd92 Mon Sep 17 00:00:00 2001 From: Elijah Voigt Date: Sun, 27 Jul 2025 15:04:19 -0700 Subject: [PATCH] Auto-start if player presses space bar --- src/bin/flappy/main.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/bin/flappy/main.rs b/src/bin/flappy/main.rs index 9912375..b8393d9 100644 --- a/src/bin/flappy/main.rs +++ b/src/bin/flappy/main.rs @@ -46,6 +46,9 @@ fn main() { camera_follow_bird.run_if(any_component_changed::), // Pause when the player presses Escape pause_game.run_if(input_just_pressed(KeyCode::Escape)), + // Transition out of the pause screen if the player presses space + un_pause_game.run_if(input_just_pressed(KeyCode::Space)) + .run_if(in_state(PlayerState::Pause)), ), ) .run(); @@ -212,6 +215,12 @@ fn pause_game( next.set(PlayerState::Pause); } +fn un_pause_game( + mut next: ResMut>, +) { + next.set(PlayerState::Alive); +} + // TODO: Create floor (and ceiling?) // Q: Move bird + camera or move world around bird & camera? // TODO: Obstacles