Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
So I think that the underlying issue is actually a system order ambiguity thing between `spawn_bonus` and `rotate_bonus`, but I'm not confident enough about `run_criteria`, `FixedTimeStep`, etc. to sort that out.
  • Loading branch information
rparrett committed Mar 22, 2021
1 parent cd8025d commit 3dc7b68
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions examples/game/alien_cake_addict.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,11 +330,12 @@ fn spawn_bonus(
// let the cake turn on itself
fn rotate_bonus(game: Res<Game>, time: Res<Time>, mut transforms: Query<&mut Transform>) {
if let Some(entity) = game.bonus.entity {
let mut cake_transform = transforms.get_mut(entity).unwrap();
cake_transform.rotate(Quat::from_rotation_y(time.delta_seconds()));
cake_transform.scale = Vec3::splat(
1.0 + (game.score as f32 / 10.0 * time.seconds_since_startup().sin() as f32).abs(),
);
if let Ok(mut cake_transform) = transforms.get_mut(entity) {
cake_transform.rotate(Quat::from_rotation_y(time.delta_seconds()));
cake_transform.scale = Vec3::splat(
1.0 + (game.score as f32 / 10.0 * time.seconds_since_startup().sin() as f32).abs(),
);
}
}
}

Expand Down

0 comments on commit 3dc7b68

Please sign in to comment.