Skip to content

Commit

Permalink
Document the BouncingPromptComponent and its associated system
Browse files Browse the repository at this point in the history
  • Loading branch information
varoonp123 committed Mar 6, 2024
1 parent 30b0c4a commit c8c5d98
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/ui/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,16 @@ fn pprint_mob_kills_from_data(data: &MobsKilledByPlayerCacheT) -> String {
}
}

/// A component that will cause the assocaited entity to bounce up and down at a rate determined by
/// `Self::flash_timer.duration` while `Self::is_active`.
#[derive(Component)]
pub(super) struct BouncingPromptComponent {
pub flash_timer: Timer,
/// Set this to `false` to pause the animation
pub is_active: bool,
}
/// Manipulate the `Transform` to make it look like the component is bouncing. This needs to be run
/// as frequently as possible for the animation to be smooth.
fn bouncing_prompt_system(
mut flashing_prompt_query: Query<(&mut Transform, &mut BouncingPromptComponent)>,
time: Res<Time>,
Expand Down

0 comments on commit c8c5d98

Please sign in to comment.