• 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!

Click Tracker for Combos

Hi all, I'm attempting to write a script that will count the attacks the player makes in a certain state. More specifically, I need to track the number of mouse clicks while in the attack state and then halt any attack inputs once the counter is above 3. I'm aware of the object/event system, and that I can probably use a left click event for this, but I don't know how to code it. Can anyone help with this? Apologies if this has been covered before, I had trouble searching the forums for this issue because I wasn't sure how to phrase it exactly.
 

rytan451

Member
Have a variable to keep track of how many clicks have happened. When the mouse is clicked (perhaps in the global left mouse pressed event) then increment the variable. Finally, when handling attack inputs, only take action on attack inputs if the number of clicks is less than 3. Remember to reset your click count as needed.
 
Top