This example is written to make it possible for a character to execute several attacks (or other actions) consecutivly.
I've used it for making my character able to do combo attacks. Clicking the mouse once will trigger the first attack. Clicking twice will trigger the second attack followed by the first and clicking three times will trigger the third attack followed by the second and first.
(keep in mind this is the first tutorial I've written)
First you need two global variables, one for controlling how many attacks will stack and one for checking if stacking is possible.
You will also need to create an object and give it the timer behavior. Next decide how long time the player gets to stack attacks. In my example clicking within 0.25 seconds will stack a new attack but the attack chain will be triggered if the player waits for longer than 0.25 second. The timer should be triggered once!
The last step is the function that will repeat while there are attacks stacked. Each loop through the function decreases one attack and changes the attack on the next ireration. If there are no attacks left the loop ends and new stacking is possible.
(I wanted the attacks to stack but you may also use this to trigger different attacks based on the amount of clicks. To change this simply change Subtract 1 from ATTACK with Set ATTACK to 0 and also remove the function call in event 9)
Lastly, as a bonus, if you remove the canStack from the code you will be able to stack new attacks while attacks are executed.