I have a simple attack system in which when you press E, it switches to the next attack. There are 7 attacks and I can’t figure out how to make a system for it. Here’s what I tried, but it doesn’t seem to work.
I think I see the issue. Let’s say your “Next Attack” variable is equal to 0. If you press the “E” key you would do 0 + 1 = 1 which will trigger the attack on slot 1 in the switch node. Since “Next Attack” is still 0, pressing “E” again will still be 1.
The way to fix this is to add 1 to “Next Attack” before you play the animation. That way after playing the first attack, your “Next Attack” variable is now 1. Pressing “E” again will be 1 + 1 = 2 which will play the animation on the slot 2 of the switch node. Do this for all the slots and then on the last attack of your combo you want to set your “Next Attack” variable to 0 so it will loop back to the first attack.