For some context, my game features a number of units that all share a number of identical animations in terms of logic. One animation, for example, is the "damaged" animation, where the unit will flicker between two frames. Really simple, identical logic but involves different sprites for each unit.
I know for this simple case I can just reuse a function to play an animation by name in the different AnimatedSprites, but the problem is when I want to reuse a more complex animation, which would have to be created in the AnimationPlayer.
I tried saving an animation in the AnimationPlayer and reusing it among the different unit nodes. It worked for something simple like manipulating the opacity of the parent node, but it didn't work for when I tried to reuse an animation for jumping between 0 and 1 frames of the respective AnimatedSprite, even though the animation names, node names, and frame counts were all the same.
So this really a two-parter question: how exactly does saving and loading animations work when it involves different nodes with different resources, and if that's not the way to go about this, then what's the cleanest way of solving this problem? Is there a programmatic way of doing this?
Thanks!