diff --git a/examples/game/breakout.rs b/examples/game/breakout.rs index 23169838dc..5fc2ccf143 100644 --- a/examples/game/breakout.rs +++ b/examples/game/breakout.rs @@ -1,19 +1,25 @@ use bevy::{ + core::FixedTimestep, prelude::*, render::pass::ClearColor, sprite::collide_aabb::{collide, Collision}, }; /// An implementation of the classic game "Breakout" +const TIME_STEP: f32 = 1.0 / 60.0; fn main() { App::build() .add_plugins(DefaultPlugins) .insert_resource(Scoreboard { score: 0 }) .insert_resource(ClearColor(Color::rgb(0.9, 0.9, 0.9))) .add_startup_system(setup.system()) - .add_system(paddle_movement_system.system()) - .add_system(ball_collision_system.system()) - .add_system(ball_movement_system.system()) + .add_system_set( + SystemSet::new() + .with_run_criteria(FixedTimestep::step(TIME_STEP as f64)) + .with_system(paddle_movement_system.system()) + .with_system(ball_collision_system.system()) + .with_system(ball_movement_system.system()), + ) .add_system(scoreboard_system.system()) .run(); } @@ -175,7 +181,6 @@ fn setup( } fn paddle_movement_system( - time: Res