mirror of
https://github.com/bevyengine/bevy
synced 2024-11-22 20:53:53 +00:00
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
1 changed files with 4 additions and 1 deletions
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue