Erm lately I’m working on a game, and i encountered a problem . My main character has an idling animation and an attacking animation. I am suppose to slash my enemy once only and immediately shift back to my idling animation. But my movement controls are something like this:
if(Key.isDown(Key.Left))
{
this.gotoAndStop(“MoveLeft”);
}
else if(Key.isDown(Key.Right))
{
this.gotoAndStop(“MoveRight”);
}
else if(Key.isDown(Key.Space))
{
this.gotoAndStop(“Attack”);
}
else
{
this.gotoAndStop(“Idle”);
}
//------------------------------
But if I press down the spacebar it will continue to attack non-stop, which i didn’t want it to, I only want it to attack once. If I change to onKeyUp for the attack button. My main character will crashes as it can’t decide whether to play the idle animations or attack animations. My main character is a movieClip and all the codes are inside it. Please help me… thanks…