diff --git a/assets/flappy/background-gradient.png b/assets/flappy/background-gradient.png new file mode 100644 index 0000000..e4e9378 --- /dev/null +++ b/assets/flappy/background-gradient.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e24240ebb6644199079d978a812afff04c426575d8b24e52fa142ff5d10c5d56 +size 18485 diff --git a/assets/flappy/background-gradient.xcf b/assets/flappy/background-gradient.xcf new file mode 100644 index 0000000..7e4f268 --- /dev/null +++ b/assets/flappy/background-gradient.xcf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1f6eb3a46a651fcdde87e96769ee86c3a9c94c1344137233555ae7d412829b85 +size 48657 diff --git a/src/bin/flappy/main.rs b/src/bin/flappy/main.rs index b27f188..8ced864 100644 --- a/src/bin/flappy/main.rs +++ b/src/bin/flappy/main.rs @@ -90,7 +90,7 @@ fn main() { (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::), + move_batches.run_if(on_event::.or(on_event::)), manage_score.run_if(on_event::.or(on_event::)), shimmer_button::.run_if(in_state(PlayerState::Stasis)), shimmer_button::.run_if(in_state(PlayerState::Pause)), @@ -240,7 +240,7 @@ fn update_batch_position( mut root_changes: Query<(&mut Transform, &Batch), (Changed, Without)>, ) { root_changes.iter_mut().for_each(|(mut t, Batch(idx))| { - info!("Updating batch {:?}", idx); + debug!("Updating batch {:?}", idx); t.translation.x = 500.0 * (*idx) as f32; }); } @@ -939,12 +939,16 @@ fn manage_score( /// This includes root batch entities as well as pipes and hitboxes fn move_batches( mut start: EventReader, + mut end: EventReader, hitboxes: Query>, batches: Query<(Entity, &Batch)>, state: Res>, mut commands: Commands, ) { - start.read().for_each(|CollisionStarted(a, b)| { + let s = start.read().map(|CollisionStarted(a, b)| (a, b)); + let e = end.read().map(|CollisionEnded(a, b)| (a, b)); + let c = s.chain(e); + c.for_each(|(a, b)| { debug!("[batches] Collision {a} -> {b}"); let target = { @@ -959,7 +963,7 @@ fn move_batches( let (_, Batch(curr)) = batches.get(target).unwrap(); - info!("[batches] Current: {curr}"); + debug!("[batches] Current: {curr}"); let (old_batch, new_batch) = match state.get() { PlayerState::Alive => (curr.saturating_sub(2), curr.saturating_add(2)), PlayerState::Rewind => (curr.saturating_add(2), curr.saturating_sub(2)), @@ -972,7 +976,7 @@ fn move_batches( // Filter to just entities with this batch ID .filter_map(|(e, Batch(id))| (*id == old_batch).then_some(e)) .for_each(|old| { - info!("Moving batch {old_batch}({old}) -> {new_batch}"); + debug!("Moving batch {old_batch}({old}) -> {new_batch}"); commands.entity(old).insert(Batch(new_batch)); }) }