feat: add scrolling starfield background

Add 150 stars with randomized positions, sizes, speeds, and brightness.
Stars scroll downward with parallax depth effect and wrap around at
screen edges. Also fixes Bevy 0.13 API issues in game_state.rs
(KeyCode::R → KeyR, Input → ButtonInput).
This commit is contained in:
Harald Hoyer 2026-05-06 15:05:32 +02:00
parent c9188f58f6
commit 9d80626cc6
7 changed files with 72 additions and 6 deletions

View file

@ -10,6 +10,7 @@ pub mod enemy;
pub mod bullet;
pub mod stage;
pub mod systems;
pub mod starfield;
use constants::{PLAYER_RESPAWN_DELAY, STARTING_LIVES, WINDOW_HEIGHT, WINDOW_WIDTH};
use resources::{ // Added StageConfigurations
@ -36,6 +37,7 @@ use bullet::{
};
use stage::check_stage_clear;
use systems::{player_exists, player_vulnerable, setup, should_respawn_player, update_window_title};
use starfield::scroll_starfield;
fn main() {
App::new()
@ -115,6 +117,8 @@ fn main() {
.chain() // Ensure these run in order if needed, check_formation first
.run_if(in_state(AppState::Playing)),
)
// Starfield runs in all states
.add_systems(Update, scroll_starfield)
// UI and state management systems
.add_systems(OnEnter(AppState::StartMenu), setup_start_menu_ui)
.add_systems(OnExit(AppState::StartMenu), cleanup_start_menu_ui)