Godot Version
4.2.1
Question
Hello all, I have an issue with the animation_finished(anim_name) signal
For some reason it won’t trigger and i don’t know why. I’ve encountered this issue before but circumvented it by using timers that match the animation time but i feel like this is bad practice to just keep adding timers. Anyway here is the code:
extends Player_State
@export var ground_state : Player_State
@export var Usable_ability_node : String = "Usable_ability"
@export var run_animation_node : String = "Run"
# current ability
func on_enter():
var ability1 = character.current_ability.instantiate()
character.add_sibling(ability1) # Adds to same parent as player
var ability1_offset = Vector2i(-100,0)
ability1.global_position = character.global_position + Vector2(ability1_offset)
print("Ability added: ", ability1)
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(_delta):
pass
func _on_animation_player_animation_finished(anim_name):
if anim_name == Usable_ability_node:
playback.travel(run_animation_node)
next_state = ground_state
The string is correct in everywhere it is used
Any and all help is appreciated