I’m experimenting with variables, and there is something I am missing or don’t quite understand yet it seems.
I have 2 variables that will control the players punching combo animations:
IS_PUNCHING checks whether the player is in the punch state triggered by pressing the “X” button
PUNCH_COMBO decides which type of punch animation is played.
The idea is that each time the player presses the “X” button on the gamepad, IS_PUNCH is set to 1 and PUNCH_COMBO gets + 1, and if PUNCH_COMBO goes above 2 it resets back to 1, so the game alternates between punch animation 1 and 2.
Any thoughts on my mistakes?:
One of your conditions to change the value of the punch is that your character’s variable IS_PUNCHING, must be 0, which you change when the X button is pressed. The next time you press X, the variable is 1, so the event doesn’t happen.
Maybe a timer could be useful.
- IF X button is pressed
- Variable Punch = Punch+1
- Reset Timer “Punch”
- Character animation = Variable (Punch)
IF Timer “Punch” > .1 secs or Varaible Punch > 2
You can adjust the delay in the timer so the combo may take less or more time to work as a combo.
I hope it helps
While changing and playing animation, always use Trigger Once.
You also don’t need this action
unless you paused the Animation somewhere.