Combo Input Command

0 favourites
  • 6 posts
From the Asset Store
Combo
$10 USD
Button Combinations like in fightings, supports both keyboard and gamepads
  • I'm trying to figure out how to do a combo for

    example: Hold Shift and press, Forward, Forward, Jump = Something

    Sorta Like Mortal Kombat if you dont press it in sequence fast enough it wont work thats what I want.

    <img src="smileys/smiley1.gif" border="0" align="middle" /> <img src="smileys/smiley1.gif" border="0" align="middle" /> <img src="smileys/smiley1.gif" border="0" align="middle" /> <img src="smileys/smiley1.gif" border="0" align="middle" /> <img src="smileys/smiley1.gif" border="0" align="middle" />

    Thanks

  • Bump

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Create a variable that stores the different commands.

    Maybe this is a bit complicated, but its off the top of my head.

    Have a variable which counts down, lets call it V:Time.

    Then have variables for each action, punch, jump, kick etc...

    The Time value is constantly counting down.

    When ever a key is pressed, V:Time is set to 5.

    If punch is presses set V:Punch to +1

    If another action is then pressed, for each action variable greater than 1, add 1, as well as adding to that action variable.

    -----------

    To demonstrate:

    V:Time = 0

    V:Punch = 0

    V:Kick = 0

    V:Jump = 0

    Punch is pressed

    V:Time = 5

    V:Punch = 1

    V:Kick = 0

    V:Jump = 0

    Punch is pressed again withing 5 seconds (Before V:Time =<0)

    V:Time = 5

    V:Punch = 3

    V:Kick = 0

    V:Jump = 0

    Kick is pressed within 5 seconds

    V:Time = 5

    V:Punch = 4

    V:Kick = 1

    V:Jump = 0

    Jump is pressed within 5 seconds

    V:Time = 5

    V:Punch = 5

    V:Kick = 2

    V:Jump = 1

    Kick is pressed within 5 seconds

    V:Time = 5

    V:Punch = 6

    V:Kick = 4

    V:Jump = 2

    Special move:

    If shift is pressed and (V:Punch = 6) (V:Kick = 4) (V:Jump = 2) Perform special move XYZ

    The V:Time is just to make sure the combo is done within the time, if V:Time ever =0 then reset all the other values.

    ---------------

    Or something there abouts.

  • Thanks I'll give it a shot, n post back. The logic seems sound.

  • thats over complicating it. All you have to do is make a global var and everytime a control is pressed append its text to that global.

    Then to see if the right combo has been entered you see if the global var = the required combo.

    To give it a time limit on input you set the global var to "" every x amount of time thats passed. The longer that time is the more time you have to input the combos

    The text your going to append to the global needs to be an identifier of the control used. Like L for left and R for right. You can use the whole name of the control like Punch or Kick but this stuff is all happening constantly so its best to keep it as short and identifiable as possible.

  • I basically combined both your ideas into a hybrid lol

    Add 1 by N7Effect, on Flickr

    Combo System1 by N7Effect, on Flickr

    Every 1 Second: "Shift" is Down

       Add "+1" to value "Shift F F J"

    Wen this group is beyond or greater then "3 seconds" all

    variables reset to DEFAULT values "0" including itself.

    Before Jump if first two variables are correct will cancel out the "just jumping while holding shift". Command, and complete.

    Notice bottom pic, FrontJump is inverted to check if False. If "false" it will complete. If true will ignore and complete other.

    If and only if combo done in correct order "Hold Shift + Front + Front + Jump" it will kill me lol.

    you can easily change "Front" "Jump" "Hold Shift" detectors to punch kick etc... and add different Global Variable Combo Counters.

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