many foxes: only change animation once (#5076)

# Objective

- When changing animation, all the foxes didn't play the same animation

## Solution

- Update the animation index only once
This commit is contained in:
François 2022-06-23 02:00:45 +00:00
parent 86dd6f065d
commit 4967351842

View file

@ -229,6 +229,10 @@ fn keyboard_animation_control(
foxes.speed *= 0.8;
}
if keyboard_input.just_pressed(KeyCode::Return) {
*current_animation = (*current_animation + 1) % animations.0.len();
}
for mut player in animation_player.iter_mut() {
if keyboard_input.just_pressed(KeyCode::Space) {
if player.is_paused() {
@ -259,7 +263,6 @@ fn keyboard_animation_control(
}
if keyboard_input.just_pressed(KeyCode::Return) {
*current_animation = (*current_animation + 1) % animations.0.len();
player
.play(animations.0[*current_animation].clone_weak())
.repeat();