I'm creating flash game. Here are 3 different attacks with different animations (keyboard bind z, x, c).
Problem #1
For example If I use attack1 (by clicking "z") It shows animation with ~100 frames, but If during animation I clicking attack2 (x) It cancels attack1 animation and start playing attack2 animation. I need to make that when during animation It can't be interrupted by using other animation.
Problem #2
If I use attack1 (by clicking "z") and hold "z" animation freezes till I release "z" button. I need to make that If I click any attack button once started play animation and It can't be interrupted/paused by clicking the same button.
In every attack MovieClip in last frame I added code MovieClip(this.parent).gotoAndStop("stay");
that after attack animation played It started playing "stay" animation (this part working).
key_down function:
private function key_down(event:KeyboardEvent)
{
if (event.keyCode == 90)
{
attack1 = true;
}
if (event.keyCode == 88)
{
attack2 = true;
}
if (event.keyCode == 67)
{
attack3 = true;
}
}
key_up function:
private function key_up(event:KeyboardEvent)
{
if (event.keyCode == 90)
{
attack1 = false;
}
if (event.keyCode == 88)
{
attack2 = false;
}
if (event.keyCode == 67)
{
attack3 = false;
}
}
startAttack() function
private function startAttack() {
if (attack1)
{
Hero.gotoAndStop("attack1");
}
if (attack2)
{
Hero.gotoAndStop("attack2");
}
if (attack3)
{
Hero.gotoAndStop("attack3");
}
}