File tree 1 file changed +3
-5
lines changed 1 file changed +3
-5
lines changed Original file line number Diff line number Diff line change @@ -16,9 +16,7 @@ fn main() {
16
16
. add_stage (
17
17
FixedUpdateStage ,
18
18
SystemStage :: parallel ( )
19
- . with_run_criteria (
20
- FixedTimestep :: step ( TIME_STEP as f64 )
21
- )
19
+ . with_run_criteria ( FixedTimestep :: step ( TIME_STEP as f64 ) )
22
20
. with_system ( paddle_movement_system. system ( ) )
23
21
. with_system ( ball_collision_system. system ( ) )
24
22
. with_system ( ball_movement_system. system ( ) ) ,
@@ -202,15 +200,15 @@ fn paddle_movement_system(
202
200
203
201
let translation = & mut transform. translation ;
204
202
// move the paddle horizontally
205
- translation. x += direction * paddle. speed ;
203
+ translation. x += direction * paddle. speed * TIME_STEP ;
206
204
// bound the paddle within the walls
207
205
translation. x = translation. x . min ( 380.0 ) . max ( -380.0 ) ;
208
206
}
209
207
}
210
208
211
209
fn ball_movement_system ( mut ball_query : Query < ( & Ball , & mut Transform ) > ) {
212
210
if let Ok ( ( ball, mut transform) ) = ball_query. single_mut ( ) {
213
- transform. translation += ball. velocity ;
211
+ transform. translation += ball. velocity * TIME_STEP ;
214
212
}
215
213
}
216
214
You can’t perform that action at this time.
0 commit comments