GMS 2 Making combos system?

I

IcyZ1ne

Guest
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:
Code:
if (keyboard_check_pressed(ord("S")) and (keyboard_check_pressed(ord("A")) and (keyboard_check_pressed(ord("X"))
{
   hitbox_create(...);
   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 by a moderator:

roozilla

Member
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.
 
T

Taddio

Guest
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.
 
Top