Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions examples/game/breakout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ struct Scoreboard {
enum Collider {
Solid,
Scorable,
Paddle,
}

fn setup(
Expand All @@ -53,7 +54,7 @@ fn setup(
..Default::default()
})
.with(Paddle { speed: 500.0 })
.with(Collider::Solid)
.with(Collider::Paddle)
// ball
.spawn(SpriteComponents {
material: materials.add(Color::rgb(1.0, 0.5, 0.5).into()),
Expand Down Expand Up @@ -240,7 +241,10 @@ fn ball_collision_system(
*velocity.y_mut() = -velocity.y();
}

break;
// break if this collide is on a solid, otherwise continue check whether a solid is also in collision
if let Collider::Solid = *collider {
break;
}
}
}
}
Expand Down