diff --git a/src/asteroids.rs b/src/asteroids.rs index 909d01c..42344e9 100644 --- a/src/asteroids.rs +++ b/src/asteroids.rs @@ -2,7 +2,7 @@ use std::time::Duration; /// This is the module containing all the rock-related things /// not... not the whole game. -use bevy::prelude::*; +use bevy::{math::VectorSpace, prelude::*}; use crate::{GameAssets, Position, Rotation, Velocity}; @@ -32,16 +32,40 @@ impl AsteroidSpawner { } } +#[derive(Event)] +pub struct SpawnAsteroid { + pos: Vec2, + vel: Vec2, + size: AsteroidSize, +} + /// Update the asteroid spawn timer and spawn any asteroids /// that are due this frame. pub fn tick_asteroid_manager( - mut commands: Commands, + mut events: EventWriter, mut spawner: ResMut, - game_assets: Res, time: Res