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:
parent
86dd6f065d
commit
4967351842
@ -229,6 +229,10 @@ fn keyboard_animation_control(
|
|||||||
foxes.speed *= 0.8;
|
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() {
|
for mut player in animation_player.iter_mut() {
|
||||||
if keyboard_input.just_pressed(KeyCode::Space) {
|
if keyboard_input.just_pressed(KeyCode::Space) {
|
||||||
if player.is_paused() {
|
if player.is_paused() {
|
||||||
@ -259,7 +263,6 @@ fn keyboard_animation_control(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if keyboard_input.just_pressed(KeyCode::Return) {
|
if keyboard_input.just_pressed(KeyCode::Return) {
|
||||||
*current_animation = (*current_animation + 1) % animations.0.len();
|
|
||||||
player
|
player
|
||||||
.play(animations.0[*current_animation].clone_weak())
|
.play(animations.0[*current_animation].clone_weak())
|
||||||
.repeat();
|
.repeat();
|
||||||
|
Loading…
Reference in New Issue
Block a user