Hello, I make a 2d turn based game with various sprite animations. I have a simple animation component that plays a spritesheet animation.
I want to chain multiple animations in a row while waiting for the previous to finish before starting the next one. Ideally I want to do all of that from the same place (same function or context) so I have access to context variables. For now I got it working using a callback inside my Animation component. However it creates a callback hell when I chain more than 3 or 4 animations. What is a good way of designing this? I thought about using async programming. Could I control animations from an async task? Suggestions are welcome. Thanks
#Proper way to wait for animation to finish?
1 messages · Page 1 of 1 (latest)
You could create something like NextAnimation component that would store information about next animation(or even a list of all animations to play in given sequence). Then in the system where you manage your animations just query for this component and if the current animation finished playing take the next animation to start from there.