1. Hey! Guest! The 36th GMC Jam will take place between February 27th, 12:00 UTC - March 2nd, 12:00 UTC. Why not join in! Click here to find out more!
    Dismiss Notice

GMS 2 Making combos system?

Discussion in 'Programming' started by IcyZ1ne, Mar 18, 2019.

  1. IcyZ1ne

    IcyZ1ne Member

    Jan 22, 2019
    So im trying to make a combo system in which the game detects when you press , for example, 3 buttons one after the other, and if done succsefuly then do this attack. Here is my try on it:
    if (keyboard_check_pressed(ord("S")) and (keyboard_check_pressed(ord("A")) and (keyboard_check_pressed(ord("X"))
       image.index = 5;
    (Step event)
    This somewhat works, but the problem is that you have to press all 3 buttons on the same frame, but what I want is to give you a breif moment between each button press. Please help!
    Last edited: Mar 18, 2019
  2. roozilla

    roozilla Member

    Feb 4, 2017
    I think there are multiple ways of doing this. One solution might be using alarms. I'm thinking of this on the spot as I have not implemented one but you could try a combo Queue that over time will dequeue/queue attack keys pressed. The dqueue time could be reset when another attack key is pressed before the timer finishes. Then you can have the logic that will see if the count is X and add your bonus damage/special effects etc.
    SnotWaffle Studios likes this.
  3. Taddio

    Taddio Member

    Nov 16, 2018
    I would save the button pressed in a list.
    All the combos would be linked to a Combinaison variable, which could be for example "0,0,3" for a triple punch (or triple jump, or whatever).
    You loop through the button_list, and if the combinaison is the same as a combo combinaison, you perform the move and clear the button_list.
    You could add a timer/alarm system if you want it tweak further.
    For frame perfect combos, you would have to do a bunch of image_index check as well.

Share This Page