Skip to content

Commit

Permalink
Merge pull request #474 from rparrett/changed-animation
Browse files Browse the repository at this point in the history
Fix animated tiles not being updated when AnimatedTile changes
  • Loading branch information
StarArawn authored Dec 17, 2023
2 parents 94da41d + f2b9964 commit 3ee9862
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions examples/animation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,5 +146,14 @@ fn main() {
.add_systems(Startup, create_background)
.add_systems(Startup, create_animated_flowers)
.add_systems(Update, helpers::camera::movement)
.add_systems(Update, pause_animation)
.run();
}

fn pause_animation(mut query: Query<&mut AnimatedTile>, keys: Res<Input<KeyCode>>) {
if keys.just_pressed(KeyCode::P) {
for mut anim in &mut query {
anim.speed = if anim.speed == 0.0 { 1.0 } else { 0.0 }
}
}
}
1 change: 1 addition & 0 deletions src/render/extract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ pub fn extract(
Changed<TileTextureIndex>,
Changed<TileFlip>,
Changed<TileColor>,
Changed<AnimatedTile>,
)>,
>,
>,
Expand Down

0 comments on commit 3ee9862

Please sign in to comment.