Okay, so please note that I am a beginner in as3. Here is the main code for my as3 fighting game. Sure, it’s probably not the most efficient way, but just stay focused on the problem
When you press right and release, it will do said animations and walk accordingly. but if the player presses down, it stays that way no matter what, even if you press other keys. and I tried to make a release statement. No movement works either, changing the “ducking” animation to an “idle” does the same thing, allowing no other key press or animation. I hope I was clear on this.
EDIT: I only posted the portion of it.
if ((isPressingRight) && (isPressingLeft != true) && (isPressingDown != true))
{
fighter.x+=3;
if (currentAnimationState != "walkingright")
{
fighter.gotoAndPlay("walkingright");
currentAnimationState = "walkingright";
}
}
else if ((isPressingRight!= true) && (isPressingLeft!= true) && (isPressingDown))
{
if (currentAnimationState !="duckingright")
{
fighter.gotoAndPlay("duckingright");
currentAnimationState = "duckingright";
}
}
else if ((isPressingRight != true) && (isPressingLeft!= true) && (isPressingDown != true))
{
if (currentAnimationState !="idleright")
{
fighter.gotoAndPlay("idleright");
currentAnimationState = "idleright";
}
}
}