// Also acts as a test to ensure that the alpha of the underlying sprite is being utilized // correctly use bevy::prelude::*; use bevy_flicker::prelude::*; const FIXED_TIMESTEP: f64 = 1.0; const FLICKER_LENGTH: f32 = 0.5; #[derive(Component, Default)] pub struct Marker; fn main() { App::new() .add_plugins(DefaultPlugins) .add_plugins(FlickerPlugin) .add_systems(Startup, setup) .add_systems(FixedUpdate, tick) .insert_resource(Time::::from_seconds(FIXED_TIMESTEP)) .run(); } fn setup(mut commands: Commands, asset_server: Res) { commands.spawn(Camera2dBundle::default()); commands .spawn(SpriteBundle { texture: asset_server.load("asteroid_round.png"), ..default() }) .insert(Marker); } fn tick(query: Query>, mut event_writer: EventWriter) { for e in query.iter() { info!("Flickering the square!"); event_writer.send( FlickerStartEvent::builder(e) .with_secs(FLICKER_LENGTH) .with_color(LinearRgba::new(0.0, 0.0, 1.0, 0.2).into()) .build(), ); } }