Skip to content

Is it possible to pause tile animation? #473

Answered by rparrett
ifbsj asked this question in Q&A
Discussion options

You must be logged in to vote

This looks like a bug. I opened a pull request to fix it here: #474

You can work around it by triggering change detection on another tile property like color:

fn pause_animation(
    mut query: Query<(&mut AnimatedTile, &mut TileColor)>,
    keys: Res<Input<KeyCode>>,
) {
    if keys.just_pressed(KeyCode::P) {
        for (mut anim, mut color) in &mut query {
            anim.speed = if anim.speed == 0.0 { 1.0 } else { 0.0 };
            color.set_changed();
        }
    }
}

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@ifbsj
Comment options

Answer selected by ifbsj
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants