diff --git a/src/lib.rs b/src/lib.rs index 8567a2b..ae95e76 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,3 +1,7 @@ +//! Asteroids, implemented as a Bevy plugin. +//! +//! Compile-time configurables can be found in the [`config`] module. + pub mod config; mod events; mod machinery; @@ -24,6 +28,7 @@ use bevy_rapier2d::{ use machinery::Lifetime; use resources::{GameAssets, Lives, Score, WorldSize}; +/// The main game plugin. pub struct AsteroidPlugin; impl Plugin for AsteroidPlugin { @@ -90,6 +95,7 @@ fn debug_collision_event_printer(mut collision_events: EventReader>, mut query: Query<(&mut physics::Velocity, &Transform, &mut Children), With>, @@ -135,10 +141,10 @@ fn input_ship_thruster( } } -/* - Checks if "A" or "D" is pressed and updates the player's Rotation component accordingly - Does *not* rotate the graphical widget! (that's done by the `apply_rotation_to_mesh` system) -*/ +/// Player's rotation control system. +/// +/// Checks if "A" or "D" is pressed and updates the player's [`AngularVelocity`] +/// component accordingly. fn input_ship_rotation( keyboard_input: Res>, mut query: Query<&mut AngularVelocity, With>, @@ -157,6 +163,12 @@ fn input_ship_rotation( } } +/// Player's gun trigger. +/// +/// Checks if the spacebar has just been pressed, spawning a bullet if so. +/// +/// TODO: Hook up a timer to control weapon fire-rate. Something will have to +/// tick those timers. Maybe this system? fn input_ship_shoot( keyboard_input: Res>, ship: Single<(&Transform, &physics::Velocity), With>,