B
Blaize
Guest
Hey all,
So, I'm branching my code skills a little here and so I have a one button combo mechanic in my game where you just press one key to do a three-hit combo and each stage of the combo is a separate animation. Pretty simple, right? Problem is, occasionally I get this weird thing where it plays only part of the animation (sometimes not at all!), not the whole thing but it still registers input. Here is the demo if you need to try it out for yourself (W-key to play the animations) hopefully you can get the issue.
Here is the code I'm using:
Create:
EDIT: I'm using keyboard_check_pressed() to check for input if that helps any. I have a feeling that it might be an in-between-frames thing and that is beyond me at this moment.
Step:
Animation End:
I also have a custom timer (in the end step event) instead of using alarms that cancels the combo if you're too slow.
So, I'm branching my code skills a little here and so I have a one button combo mechanic in my game where you just press one key to do a three-hit combo and each stage of the combo is a separate animation. Pretty simple, right? Problem is, occasionally I get this weird thing where it plays only part of the animation (sometimes not at all!), not the whole thing but it still registers input. Here is the demo if you need to try it out for yourself (W-key to play the animations) hopefully you can get the issue.
Here is the code I'm using:
Create:
Code:
Combo[0]=Combo0; //animations
Combo[1]=Combo1;
Combo[2]=Combo2;
ComboTimer = 0; //when this hits 0, go back to idle animation
ComboStep = 0; //which stage of the combo we're at
AttackAgain = true;
Attacking = false; //playing the animation?
ChainEnd = false; //at the end of the combo?
image_speed = 0.2;
EDIT: I'm using keyboard_check_pressed() to check for input if that helps any. I have a feeling that it might be an in-between-frames thing and that is beyond me at this moment.
Step:
Code:
if (_attackKey && !Attacking && (ComboStep < array_length_1d(Combo)))
{
ChainEnd = false;
Attacking = !Attacking; //flip the bool
AttackAgain = !AttackAgain;
sprite_index = Combo[ComboStep];
ComboStep ++;
ComboTimer = 6;
}
Code:
if (Attacking)
{
Attacking = !Attacking; //flip the bool again
AttackAgain = !AttackAgain;
sprite_index = vIdle;
}
if (ComboStep >= array_length_1d(Combo)) //since we've hit the end of the combo, we need to reset
{
ComboStep = 0;
sprite_index = vIdle;
}
Last edited by a moderator: