Download

Alternating attacks in a time window

I’m trying to set up a sword attack to work similar to Dark Souls, where there is a certain window of time for you to follow up a right handed swing with a left handed swing (basically a combo). This is what I’ve set up, and it kinda works, but there has to be a better solution. Sorry its such a mess, was trying to fit it into the screenshot. Thanks!

c4e516c726665f6e09e16c930edc9858b803ded0.png

This sort of approach doesn’t scale very well. Once you start adding more attacks, for instance if you are in the air you might want different attacks to be available (and other not to be available) or if you are holding a weapon etc… I would consider setting up a state machine (or multiple state machines) and separate the logic of each state into its own function so at any one time, you only care about what is visible in the current blueprint graph.

For more:
http://gameprogrammingpatterns.com/state.html

Sweetness, I’ve been setting up a state machine and got a lot of it working. However, I’m having a lot of trouble making my attacks alternate correctly. I need the state machine to finish the current animation before stopping or going to a new animation. Once again I’ve created a complicated work around, but I know there has to be a better way.