Specific frame condition (or frame based inputs / combo timing)

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By BenThrottle

To put it simple I have a character with, let’s say, three sword attacks that can only be chained in a combo, each one with different animations. The only way it can do the second is after the first, and the third after the second one.

It’s easy to make it combo out of input, however, the character will stop the first attack and get into the second and (eventually) the third one with constant button presses.

So…The first attack has, say, 6 frames.

I want the player to be able to chain the second attack into the first, only between the 3rd and 6th frame (of the first attack).
The player can’t make the second attack before that. Same thing with the 2nd-3rd attack part of the combo.

I tried to figure out an easy solution for that, like, If I could point in-engine if that particular frame and/or window of animation is/are playing as a condition, but I don’t know if I understood well what I found so far.

What simple solution for that would be?

I’m using animationplayer (animation.play(“animation”)) with spritesheet atlas for all animations so far.

If I’m able to make it work, I could even try to create a condition to prevent “button smashing”, like you would have to be really tight on that frame input to be able to combo, if not, the character would “drop” the combo at that attempt.
That’s my intention but first I need to understand how could I use the animation frames as “pointers”.

(or maybe I could try to create a “time-based” solution where the first attack would start with a “time-value”, then delta would substract from it, and if it was <=0 it could be used as condition for the next attack, but I hope someone has a easier solution lol)

:bust_in_silhouette: Reply From: BenThrottle

Just saying I went with the “time-based solution”