I'm currently making a two player fighting game, and right now I'm trying to implement combos and I've run into a bit of a problem.
I have a sequence of events for attacks that are similar to this (this is a bit simplified for clarity)
"Player 1" presses Button 1
+"CharacterBottom" is overlapping backdrop
+"Character.ComboValue"=0
* create "Punch" object at (0,0) from "Character"
* set direction of "Punch" to direction of "Character"
* set "Character.ComboValue"=1
and it also sets animations and variables which determine how much damage is dealt for the "Punch" object. (also if the "Punch" object finishes any of it's animations "Character.ComboValue" is reset back to 0)
This event works fine on it's own.
But then I add other events that are the same except it checks if "Character.ComboValue" is equal to different numbers and runs different slightly accordingly, adding another point to "Character.ComboValue"
The problem I am facing is that when I have these extra events added in for anything but the first attack, any time the player presses Button1 it just cycles through each punch faster than you can see.
I thought at first my 'Player one presses...' were 'Repeat while pressed...' events, but they're not, does anyone know how to stop it from running these events in rapid succesion like this?
Maybe every of your event is executed in ONE loop.
For example: there's very well known problem about "ON/OFF switch". When you make these 2 events:
1. If pressed "K"
-> Set Flag #0 ON
2. If pressed "K"
-> Set Flag #0 OFF
That events will every time make the Flag OFF (1st event is executed, and the 2nd is executed AFTER 1st, but still IN ONE loop).
Maybe you have to insert some "blocking" variable.
To solve problem shown up I'll use one more flag: #1.
1. Always
-> Set Flag #1 OFF
2. If pressed "K" AND Flag #1 OFF
-> Set Flag #0 ON
-> Set Flag #1 ON
3. If pressed "K" AND Flag #1 OFF
-> Set Flag #0 OFF
-> Set Flag #1 ON
This "blocking" flag makes it unable to execute these 2 events in one loop. Perhaps you should make this "block" to prevent executing few ComboHist in ONE loop.