Switch animation when doing something

Godot Version

4.3

Question

How to switch animations (AnimatedSprite2D) when clicking screen or done an action?

AnimatedSprite2D’s have a built in method called ‘.play()’ that can be called whenever you want to play one of your animations. Something like

MySprite.play(“name_of_animation”) will work.