How do I make multiple sequence key commands?

0 favourites
  • 6 posts
From the Asset Store
Voice command game
$9.50 USD
50% off
In this game you will command the character by voice command.
  • Hello everyone,

    I searched the forums but could not find a suitable answer for this: how do I implement multiple sequence keys commands, like in SF2's Hadouken (down, down+front, front - punch)?

    Is there any tutorial I may have missed? Any tips/help?

    Thanks in advance,

    Marcelo

  • Hi thealchemistbr - Let's take the "down, down+front, front, punch" example:

    Set up a string global variable to store sequence of keys pressed - initial value "".

    On key press "down" set variable to "down,"

    On key press "down+front" if variable is already "down" then change to "down, down+front" else (whatever appropriate)

    On key press "front" if variable is already "down, down+front" then change to "down, down+front, front" else (whatever appropriate)

    On key press "punch" if variable is already "down, down+front, front" then do the SF2 Hadouken thing else (whatever appropriate)

    If you have many such multi-key commands than you might want to plan a matrix of these before coding them up.

    Hope that helps.

  • Sure it does. Just thinking - how would I properly determine is the first down should put the player to down animation or start the sequence? Maybe a tick-based flag?

  • You could try including a time element, like if they don't press the second key within so many ticks you just do the down animation and reset the variable to "".

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Will try that approach. Thanks a lot!

  • No problem - let me know how you get on.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)