Hi there!
I have been testing a prototype for a 3 person melee combat system, and I have a hard time choosing the right way to handle combat.
By this, I mean things like :
When does the attack finish? When can you combo? When does it move you around? How do you handle cooldown?
I tried 2 system :
-
One with delta time and cooldown : Start the attack, start a timer, have value for each attack like : at .2 sec, does damage, and .4sec accept combo, attack finish at .6 sec. It worked alright, but timing the animation and the animation transition was touchy, and I didnt feel it. I could use a co-routine to do this, but didnt try yet.
-
Use Animation event called from the attack animation, sending parameter for each part of the attack. Like dash at frame 10, damage at frame 15, end at frame 20. I loved it, was quit cool. Sadly, I seems like event near the end of the animation sometime don’t triggers, or the timing is weird.
In the past, I think I did an hybrid system between animation event and state machine behavior script on each animation.
Is there a better option? What do you guys use?
Thanks!
I think animation events are pretty great for that. The problem with them not firing is usually because of transitions; if an animation is transitioning from one animation to another it might not fire the event from one of them. If you’re using events it’s best to use very short transition times into and out of animations, and make sure there aren’t any events during transition points (usually near the beginning or end of a clip). You can do this by clicking on the transition arrows in your Animator and messing with these settings:
You can even set the transition times to zero, and it will make the animation look a little less smooth, but that way you can guarantee that you always hit all the events even if they’re right near the beginning or end of an animation. Lots of fast-paced fighting games basically do this; you can switch and “cancel” animations almost instantly… looks weird but feels very responsive.
1 Like
Hi!
Thank you for the answer!
I tried hard to use it that way, but it seems even if I do it your way, I sometime get stuck.
it might be my code, I tried debugging it yesterday, but no success.
Do you now if tht methid is suited for LAN games? Does multiplayer handle well action based on animator event?
Thank you!