Sync projectiles animations (#51)

This commit is contained in:
extrawurst
2025-06-25 17:17:21 +02:00
committed by GitHub
parent 63dea78c4f
commit 5d00cede94
5 changed files with 35 additions and 10 deletions

View File

@@ -20,6 +20,7 @@ pub struct AnimationFlags {
pub jumping: bool,
pub just_jumped: bool,
pub shooting: bool,
pub restart_shooting: bool,
pub hit: bool,
}
@@ -110,12 +111,15 @@ fn update_animation(
.animation(anims.run_shoot.unwrap())
.unwrap()
.is_finished()
|| flags.restart_shooting
{
controller
.player
.animation_mut(anims.run_shoot.unwrap())
.unwrap()
.replay();
flags.restart_shooting = false;
}
} else if flags.shooting && anims.shoot.is_some() {
if !controller.is_playing(anims.shoot.unwrap()) {
@@ -130,12 +134,15 @@ fn update_animation(
.animation(anims.shoot.unwrap())
.unwrap()
.is_finished()
|| flags.restart_shooting
{
controller
.player
.animation_mut(anims.shoot.unwrap())
.unwrap()
.replay();
flags.restart_shooting = false;
}
} else if flags.hit {
if !controller.is_playing(anims.hit) {