I am working on a 2D action platformer and I am currently implementing an upwards slash.

For a normal horizontal slash, the player must press the attack button. For an upwards slash, the player must hold up and press the attack button.

I notice that when trying to do an upwards slash, players often press the attack button a few milliseconds before the up button, causing the player to do a normal slash rather than the intended upwards slash. It feels bad.

I am wondering what are some techniques I could use to get a more reliable-feeling upwards slash?

I considered waiting for some interval (for example, 20 milliseconds) after attack is pressed to see if up is pressed. If it is pressed in that interval, do upwards slash, otherwise do regular slash at the end of the interval. But this made the game feel unresponsive.

For a similar reason, I want the attacks to happen on button press rather than button release.

  • 1
    \$\begingroup\$ Hmm there are a few possible tricks here but all I see would damage your game feel. As I see it your requirements for a upwards slash are not super fancy (hold up + attack) so I think players will get it. They might do it wrong a couple of times at first but their brain will end up wiring the right neurons and everything will be fine in a matter of minutes. \$\endgroup\$ – lvictorino Oct 23 '19 at 5:21

Usually the way we handle this is to introduce a new move that's a "slash precursor" whose short ~2-frame animation reads plausibly as the lead-in for either a horizontal or vertical slash.

When the button is pressed without the up button held, we immediately start the slash precursor move.

If the up button is pressed while we're in the slash precursor, we transition into the upward slash, starting partway into its animation since the precursor already gave us the lead-in. This way the attack still lands with the same timing, even if we hit the up button a tiny bit late.

If we hit the end of the precursor animation and up still hasn't been pressed, we continue into the payoff of the horizontal slash, again skipping any lead-in since the precursor animation handled that role.

This does impose some constraints on your moves' gameplay and visible/audible feedback. Your horizontal slash move needs a delay before it hits that's at least as long as your window of opportunity for a late up-press. And your first few frames of motion, animation, and sound have to work decently for either attack, with the differentiation pushed toward the end of the move.

If those constraints aren't acceptable for your needs, then you may need to change your control scheme so that both moves can be unambiguously distinguished in the initial press event.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.