7
\$\begingroup\$

I'm making an ARPG (like Legend of Zelda but with more action), and this question raised during the development:

Should action and animation be coupled? Or should they be independent?

With this I mean, the process of executing an action (eg. Attacking) should be:

  1. Input
  2. Start Animation
  3. Frames 1-3 are transitioning, do nothing
  4. Frames 4-7 are attack moves, do the attack action during these (searching enemies in front of the character, pick the closest and deal the damage)
  5. Frames 7-10 are transitioning, do nothing again
  6. Animation finished, release input again.

This way, it's like the action is triggered by the frames, as events on the animation itself.

If it helps, I'm making the game on an Entity/Component System.

Should it be done this way? Why yes/no? What are the advantages/disadvantages?

\$\endgroup\$
  • \$\begingroup\$ I still don't like the only answer I have, but I'm going to accept it anyway. If anyone gives a better answer, I'll change it if possible. \$\endgroup\$ – Gustavo Maciel Oct 2 '14 at 19:57
4
\$\begingroup\$

You really don't have much choice. Ignoring some (IMO) terrible other options, you can either:

a) couple your behavior to specific animations - so artists don't make one attack animation, they make several that your behavior plays at the appropriate times

or

b) have animations emit events and export state variables that game logic is driven from - requires lots of effort put into tools to make the workflow nice, but lets gameplay be driven by art and design far more easily which is usually a very good thing

If you have the time and expertise to develop the tools, I'd go with the second option every time, but small indie/hobby/old-school games do tend to lean more towards the former.

\$\endgroup\$
  • \$\begingroup\$ What I fear the most of both of these options: I'd probably have to write some kind of external tool to author animations with events. \$\endgroup\$ – Gustavo Maciel Sep 22 '14 at 18:11
  • \$\begingroup\$ @GustavoMaciel: which you desperately want anyway. Quality tools should be near your highest priority for any game project. I do believe there are existing sprite animation tools that allow event hooks, though. \$\endgroup\$ – Sean Middleditch Sep 22 '14 at 18:49

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.