diff --git a/src/bin/flappy/main.rs b/src/bin/flappy/main.rs index ab30558..ad7e5d5 100644 --- a/src/bin/flappy/main.rs +++ b/src/bin/flappy/main.rs @@ -87,10 +87,7 @@ fn main() { sync_resource_to_ui::.run_if(resource_changed::), sync_resource_to_ui::.run_if(resource_changed::), ), - ( - update_tooltip, - debug_trail, - ).run_if(in_state(DebuggingState::On)), + (update_tooltip, debug_trail).run_if(in_state(DebuggingState::On)), // TODO: Add run_if to this system update_batch_position.run_if(any_component_changed::), move_batches.run_if(on_event::), @@ -143,10 +140,7 @@ struct Tape { rotations: Vec, } -fn init_bird( - mut commands: Commands, - bird_assets: Res, -) { +fn init_bird(mut commands: Commands, bird_assets: Res) { let name = Name::new("bird"); let t = Transform::from_xyz(0.0, 0.0, 0.0).with_scale(Vec3::splat(50.0)); @@ -534,17 +528,16 @@ fn init_ui(mut commands: Commands) { next.set(PlayerState::Alive); } - commands - .spawn(( - Node { - align_self: AlignSelf::Center, - justify_self: JustifySelf::Center, - flex_direction: FlexDirection::Column, - ..default() - }, - PlayerState::Pause, - children![Text::new("Go!")], - )); + commands.spawn(( + Node { + align_self: AlignSelf::Center, + justify_self: JustifySelf::Center, + flex_direction: FlexDirection::Column, + ..default() + }, + PlayerState::Pause, + children![Text::new("Go!")], + )); commands .spawn(Node { @@ -566,7 +559,12 @@ fn init_ui(mut commands: Commands) { .observe(end_rewind); parent - .spawn((Node { ..default() }, Button, FlapButton, children![Text::new("Flap!"),])) + .spawn(( + Node { ..default() }, + Button, + FlapButton, + children![Text::new("Flap!"),], + )) .observe(flap_button); }); @@ -637,7 +635,10 @@ fn flap( // Play flap sfx commands.spawn(( AudioPlayer::new(server.load("flappy/bonk.ogg")), - PlaybackSettings { mode: PlaybackMode::Despawn, ..default() }, + PlaybackSettings { + mode: PlaybackMode::Despawn, + ..default() + }, BonkSfx, )); } @@ -795,7 +796,10 @@ fn detect_dead( // Play bonk sfx commands.spawn(( AudioPlayer::new(server.load("flappy/flap.ogg")), - PlaybackSettings { mode: PlaybackMode::Despawn, ..default() }, + PlaybackSettings { + mode: PlaybackMode::Despawn, + ..default() + }, FlapSfx, )); } @@ -927,7 +931,7 @@ fn move_batches( } else if hitboxes.contains(*a) { *a } else { - return + return; } }; @@ -977,7 +981,7 @@ fn update_tooltip( } fn debug_trail( - mut physics_objects: Query<(Entity ,&Transform), With>, + mut physics_objects: Query<(Entity, &Transform), With>, mut gizmos: Gizmos, mut positions: Local>>, ) { @@ -999,21 +1003,18 @@ fn debug_trail( }) } -fn start_rewinding( - server: ResMut, - mut commands: Commands, -) { +fn start_rewinding(server: ResMut, mut commands: Commands) { commands.spawn(( AudioPlayer::new(server.load("flappy/rewind-start.ogg")), - PlaybackSettings { mode: PlaybackMode::Despawn, ..default() }, + PlaybackSettings { + mode: PlaybackMode::Despawn, + ..default() + }, RewindSfx, )); } -fn shimmer_button( - mut bg: Single<&mut BackgroundColor, With>, - time: Res