Sign in to follow this  
Enyalios

Animation and User Input

Recommended Posts

Hi. I've a question about animations. In my current system, I have different enums like "STAND", "WALK" and enums for the direction, like "UP", "LEFT". I check for user input every frame. If the user uses the cursor keys, the enums for the player are set to "WALK" and the corresponding direction. If no key is used, the enum for the player is set to "STAND". These enums are given to my Animation Class and this class returns the coordinates I need to render the sprite. Well, as long as the sprite just has to walk or stand, this system works fine. But it gets more complicated if I want the sprite to attack (for example with a sword), because normally the attack button is used and released almost instantly. And if I have another attack for which you have to use the attack button twice (let's say if you use it for the first time, the sword swings from the left to the right, the second time you use the attack button it swings back to the left), it get's annoying. Not even to think of some kind of special attacks with multiple strikes or something like that. Simply said: I don't like my current system. That's why I want to know how your Animation Class and the user input work together.

Share this post


Link to post
Share on other sites
What you'll basically want to do is tie certain runs of frames from certain animations to different target animations, based on keystate.

Let's take that double-slash attack. The "first slash" animation takes, say, 20 frames to make its complete arc. There's three "segments" to that attack... the first is "mid-swing", from frame 1 to frame 10. The second is "late swing", frame 11 to 16, and the third is "follow-through", frame 17 to 20.

The trick is to tie the attack button during "late swing" to a different action. During mid-swing, you can't do anything except maybe move; the attack button is ineffective. During follow-through, you can't attack, but maybe you can start a block. During late swing, however, if you press attack then you'll start a second swing back the other way at the end of late swing; start the "second slash" animation instead of continuing on to the follow-through of "first slash".

You can also tie character reaction to the environment into this system. Maybe during an entire animation, the character reacts the same way to being hit with a ball of fire, but during a certain set of frames, he's vulnerable to low or sweeping attacks which he's impervious to during the rest of a particular animation, and will react with a falling-down animation.

Complex formulations of these kinds are how the better class of fighting games are made. When I say "better class", think Soul Calibur... DO NOT think Mortal Kombat, Tekken, or Street Fighter (any of the 40); they use much simpler and less fluid or intuitive combo systems.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this