Use chain in breakout example (#10124)

# Objective

- We should encourage of the simpler to reason about chain.

## Solution

- Use it in the breakout example

---

## Changelog

- Switch breakout to use `chain` instead of `before` and `after`
This commit is contained in:
Mike 2023-10-16 15:15:32 -07:00 committed by GitHub
parent 490699c311
commit 88599d7fa0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -59,13 +59,13 @@ fn main() {
.add_systems( .add_systems(
FixedUpdate, FixedUpdate,
( (
apply_velocity,
move_paddle,
check_for_collisions, check_for_collisions,
apply_velocity.before(check_for_collisions), play_collision_sound,
move_paddle )
.before(check_for_collisions) // `chain`ing systems together runs them in order
.after(apply_velocity), .chain(),
play_collision_sound.after(check_for_collisions),
),
) )
.add_systems(Update, (update_scoreboard, bevy::window::close_on_esc)) .add_systems(Update, (update_scoreboard, bevy::window::close_on_esc))
.run(); .run();