- Edited
So I'm following a tutorial where they're using state machines to change states and I'm now working on an attack animation. Note that I'm not a very experienced programmer, still trying to learn.
The difference is that I'm using animatedsprite2D instead of the animation player. My problem is that I'm trying to reference a specific animation, but I have no idea how as it seems to be different between the two methods. If you wonder why animatedsprite2D, it's because I don't have that many animations and also the animations messed up for some reason when I moved them to the animation player/tree, but work on the animated sprites.
My code:
extends State
@export var return_state : State
@export var animated_attack : AnimatedSprite2D (not sure if this is even necessary)
func _on_animated_sprite_2d_2_animation_finished(anim_name):
if(anim_name == "my animation"):
next_state = return_state
This seems quite simple in the animation player, but how do I reference "if this thing equals this animation then change state" in an animated 2d sprite?