Sword animations now sync

This commit is contained in:
Twirpytherobot
2025-11-21 22:59:41 +00:00
parent b1f1016475
commit 2ec7d56511
4 changed files with 26 additions and 9 deletions
+10 -5
View File
@@ -16,7 +16,7 @@ func animate(_velocity: Vector3) -> void:
return
# Don't override attack animation if it's playing
if animation_player.is_playing() and animation_player.current_animation == "Attack_OneHand":
if animation_player.is_playing() and animation_player.current_animation.begins_with("Attack"):
return
# Check if we're dashing
@@ -54,9 +54,14 @@ func _play_animation(anim_name: String):
animation_player.play(anim_name)
# Silently ignore if animation doesn't exist
func play_attack() -> void:
func play_attack(anim_name: String = "Attack_OneHand") -> void:
if animation_player:
# Play attack animation once (don't loop)
animation_player.play("Attack_OneHand", -1, 1.0)
# Ensure it doesn't loop
animation_player.animation_set_next("Attack_OneHand", "")
if animation_player.has_animation(anim_name):
animation_player.play(anim_name, -1, 1.0)
animation_player.animation_set_next(anim_name, "")
else:
# Fallback to default if animation doesn't exist
push_warning("Animation '%s' not found, using Attack_OneHand" % anim_name)
animation_player.play("Attack_OneHand", -1, 1.0)
animation_player.animation_set_next("Attack_OneHand", "")