From 71ec77f5b1820810f23aa6ab5617ea5ff1bdb2ba Mon Sep 17 00:00:00 2001 From: Robert Garrett Date: Tue, 29 Jul 2025 12:48:54 -0500 Subject: [PATCH] Move asteroid bits to another module Now to fix the visibility issues and make the program compile again... --- src/asteroids.rs | 51 ++++++++++++++++++++++++++++++++++++++++++++++++ src/lib.rs | 47 +------------------------------------------- 2 files changed, 52 insertions(+), 46 deletions(-) create mode 100644 src/asteroids.rs diff --git a/src/asteroids.rs b/src/asteroids.rs new file mode 100644 index 0000000..ca7e363 --- /dev/null +++ b/src/asteroids.rs @@ -0,0 +1,51 @@ +/// This is the module containing all the rock-related things +/// not... not the whole game. +use bevy::prelude::*; + +use crate::{GameAssets, Position, Rotation, Velocity}; + +#[derive(Component, Deref, DerefMut)] +struct Asteroid(AsteroidSize); + +enum AsteroidSize { + SMALL, + MEDIUM, + LARGE, +} + +#[derive(Resource)] +struct AsteroidSpawner { + timer: Timer, + // TODO: Configurables? + // - interval + // - density + // - size distribution +} + +/// Update the asteroid spawn timer and spawn any asteroids +/// that are due this frame. +fn tick_asteroid_manager( + mut commands: Commands, + mut spawner: ResMut, + game_assets: Res, + time: Res