Stacking multiple attacks. Combo attacks.

2

Attached Files

The following files have been attached to this tutorial:

.capx

stackedattack.capx

Download now 203.8 KB

Stats

3,631 visits, 5,532 views

Tools

Translations

This tutorial hasn't been translated.

License

This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

Published on 1 Mar, 2015. Last updated 19 Feb, 2019

Info

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)

Tutorial

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.

.CAPX

stackedattack.capx

Download now 203.8 KB
  • 0 Comments

Want to leave a comment? Login or Register an account!