Godot Version
4.5.1
Question
When calling the Animation player’s play() command, it doesn’t seem to actually start playing until the frame after it’s called, causing a desync between what is supposed to happen and when it happens
My code looks like this:
func set_state(new_state):
delete_hitboxes() #remove errant hitboxes
state = new_state #set the state to the new state
state_timer = 0 #reset the state timer
play_animations() #play the animation
func play_animations():
if state == Idle: #if the player is idle
$AnimationPlayer.play("Idle") #play the idle animation
elif state in [Attack_Ground, Attack_Air]: #if the player is attacking
if attack.name == "5A": #if they're doing the attack 5A
$AnimationPlayer.play("5A") # play the "5A" animation
and whenever I press the button to do the 5A attack, the state immediately gets set but it takes an extra frame for the animation to actually start