Hi guys, I’m an experienced programmer (mostly OOP), new to Defold and 2D game development.
I’m trying to make a character that can change heads, various other visual details and weapons, using flipbook animations, and I’m not sure of the best approach. I’ve read some other threads, but I’m still not convinced.
Right now I have a game object for the character and managed to have it walking using multiple walking animation sprites for torso, legs, arms and weapon (sword). I’m now trying to add an attack animation, but because the new animations have different positions, I cannot reuse the existing sprites (i.e have the arm animation sprite used for walking, switch to the attack arm animation).
I can think of several approaches to solve this:
- Convert the game object to a collection and have the sprites that need moving attached to child GO’s, then reuse those sprites by changing position in script when changing the animation.
- Keeping the game object and having 1 sprite for each animation (lots and lots of sprites), that I can position in the editor, and then enable/disable as needed in script.
- Exporting the animations that should be interchangeable to fit a fixed size, but this sounds like a lot of work when changing the animations, adding new ones, etc.
I’m interested mostly in keeping the workflow manageable, while keeping the performance reasonable.