• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

GameMaker 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