How do I create an animation precedence system

  • First off, I'm not sure what else to call this other than animation precedence . If there's a more common industry term please let me know. But this has always been the bane of my game dev skills.

    I have some physics based characters that have different states such as "walking", "climbing", "running", etc. Each of these states have associated animations. Where I'm running into problems is on the animations that aren't tied to a state. For example an "attack" animation should have a higher precedence than "walking" so it should immediately animate then return back to the walking animation. Further still a "take damage" animation would have a higher precedence than "attack" which means it would play then return to walking.

    So one, am I looking at this wrong? Should each one of my animations -including the one shot triggered animations like "attack"- be a state? Then I could just craft my FSM as usual and only have to worry about playing an animation that matches the state.

    or

    Is there a better way of looking at or handling this whole thing? I know in Unity there's a animation tree that takes care of most of this but I searched the forums and tutorials and didn't find a quick answer.

    THANKS!!!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I'm not able to answer you, because I have the same doubt. although I always worked with the animations exactly like this.

    There is a hierarchy between the animations which few animations have preference to play before others, like taking damage or attacking should not be playing in order to walk animation to play.

    I can't tell you if this is right or wrong, or if it's the best way to do it. But I can tell you that I work just like this and I never had problems with this.

    So if anyone has a better way of handling this whole thing I would be glad to know it to.

    So.... UP!

  • Here's how I did it. It's just nested if statement. The character can't do anything if he's dead so I check that first, and than I work my way to the top. First if he is climbing, because he can't use items while climbing, and then, finally, I do regular animations like walking, standing and jumping.

    You'll notice that everything that I want my character to do while dead is put into an else statement.

  • Awesome! Thanks tarik00555! That's kinda what I've done in the past. It can just get messy if you're not careful.

    I guess I was hoping for something a bit more procedural since a lot of my characters will share the same base animations. But I guess depending on how I use families it could be a little more general.

    Anyone have any other takes on it?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)