diff --git a/CHANGELOG.md b/CHANGELOG.md index de39dc6..7981bc4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Added + +- UI damage indicators appear when a ship is hit + ### Changed - Camera scaling to 1.5, more zoomed out, see enemies on screen for longer diff --git a/src/core/mod.rs b/src/core/mod.rs index e1b3993..fd54b3b 100644 --- a/src/core/mod.rs +++ b/src/core/mod.rs @@ -5,12 +5,18 @@ pub mod resources; use self::{ effects::{animate::AnimatePlugin, blink::EffectsPlugin}, - resources::{game_time::GameTimePlugin, state::StatePlugin}, + resources::{despawn_timer::DespawnTimerPlugin, game_time::GameTimePlugin, state::StatePlugin}, }; pub struct CorePlugin; impl Plugin for CorePlugin { fn build(&self, app: &mut App) { - app.add_plugins((GameTimePlugin, StatePlugin, EffectsPlugin, AnimatePlugin)); + app.add_plugins(( + GameTimePlugin, + StatePlugin, + EffectsPlugin, + AnimatePlugin, + DespawnTimerPlugin, + )); } } diff --git a/src/core/resources/despawn_timer.rs b/src/core/resources/despawn_timer.rs new file mode 100644 index 0000000..9ce31d0 --- /dev/null +++ b/src/core/resources/despawn_timer.rs @@ -0,0 +1,26 @@ +use bevy::prelude::*; + +use crate::core::resources::state::GameState; + +#[derive(Component)] +pub struct DespawnTimer(pub Timer); + +pub struct DespawnTimerPlugin; +impl Plugin for DespawnTimerPlugin { + fn build(&self, app: &mut App) { + app.add_systems(Update, despawn_system.run_if(in_state(GameState::Active))); + } +} + +fn despawn_system( + mut commands: Commands, + time: Res