2D Toolkit Forum
2D Toolkit => Support => Topic started by: Copywright on April 19, 2013, 10:47:52 pm
-
Hey,
I'm preparing sprites for a fighting game, and I have a quick question about how to best handle animating combos in tk2D. I imagine that I'd have the whole combo in one animation and have triggers to check if what's needed to go onto the next chain in the combo is fulfilled (ex, pressing attack once plays only the first chain defined by the trigger in the animation editor, pressing attack twice gets you to the second chains, etc.).
However, I just wanted to ask if there'd be a better way to handle this. Thanks.
-
I don't think triggers will be suitable for this, unless you're willing to go in and put a lot of markers, or your triggers naturally only last for 1-2 frames. The idea is you want to know if input on a particular frame corresponds to the correct frame to continue a combo.
Also, if you think about potential combo trees - things get a bit more complicated there, as the data would have to identify more than just one bit of data.
You can extend the data system to store more complex information - perhaps use the int value to index into a combo tree table or something like that.
Just my 2c :)
-
Hm, can you explain how exactly I'd implement this? What I gather is having an FSM for combos, and switch the the animation playing based on the previous and current states. Instead of just one animation for the complete combo, I'd chop the chains into different clips? Would I be able to have a trigger at the end of the animation, that'd be used to check the state in the combo FSM, and transition to the next chain?
Is this what you mean, or am I missing this entirely? If you could explain a bit more, or reference with psuedocode, I'd be grateful!
-
Thats pretty much it - you can have triggers at the end of the animations / middle of animations to trigger states in your FSM.
-
Thanks for the help! Also, it'd be possible to set triggers on animations for when game objects containing compound colliders should be set active/inactive?