2
\$\begingroup\$

Newbie question: I wonder if it is possible in terms of performance to generate characters in several layers in phaser (and in general). And overall if it is a good idea/practice in terms of pro/cons.

For instance, one character would be the sum of the following layers (from top to bottom)

  • Hairs
  • Face
  • Head
  • hands and forearms
  • clothes and shoes
  • arms, legs, neck and feet

I suppose that I will have to realize most of the animations for every layers and it will not be possible to change the layer orders during an animation, but by combining all these layers, I could generate more combinations, hence more characters.

\$\endgroup\$
1
\$\begingroup\$

The short answer is yes.

The long answer is that the specifics of how to do it massively depends on how you handle drawing your characters.

If you use skeletal animations (like when using spine), then you can easily exchange bits of your character by just replacing the texture of it. (Since in skeletal animation systems your character is separated into parts anyway).

You can do the same thing when you use sprite sheets too, but it is slightly more complicated. You already had the right general idea in your post. You split the animation up into the parts that you want to combine and you need to remember a draw order for all those parts for each animation. But then you can draw each frame of an animation easily by just combining the parts together.

The drawback is that you need to make a full set of animations for each part, since every hat for example has to move the same in every animation, otherwise some combinations will just look weird.

tl;dr: It is definitely possible and it is much easier if you use skeletal animation.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Thank you for your answer. I indeed plan to use skeletal animation with flash cs6. Am I right to assume that there is no way to batch every layer animation using a folder of svg assets per layer (e.g. hats)? To rephrase it, I have to change manually each hat graphic to re-generate all the animations for every hat? \$\endgroup\$ – Billybobbonnet Jan 26 '16 at 8:52
  • \$\begingroup\$ I fear I don't know anything about flash cs6, so I can't really give you an answer to that specific question. But generally if you use skeletal animation you should be fine by just replacing parts of the animation. \$\endgroup\$ – Nils Ole Timm Jan 26 '16 at 9:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.