I'm working on my combo system and I keep getting this weird problem. It's a pretty basic setup: when the player hits the attack button it changes the character's current action to "attack", if the player hits an enemy then an int (f) is set to the next combo number, after the attack finishes the character's current action turns to "standing" and an if statement makes the combo int equal to f.
So basically it reads like this:
switch (action)
{
case "attack":
if (combo == 0)
{
if (enemy.Hit(playerSquare))
{
f = 1;
}
else
{
f = 0;
}
if (animationDone)
{
action = "stand";
}
}
else if (combo == 1)
{
same
}
else if (combo == 2)
{
same
}
break;
}
if (action != "attack")
{
combo = f;
}
My setup works, however, if I press the attack button too quickly it either doesn't add to the combo int (keeping it at the same number as before) or adds to it twice (depending on whether or not I slow it's update rate.) I'm sure there's probably an easy way to fix this and I'm not seeing it or maybe there's a better way to do this that I haven't considered yet, so I'm hoping you guys can help out. Any suggestions?