First, I know, I'm still using AS 2, I should get with the times, but for now I'm using AS2. I had this programmed on a different game, but for some reason, I can't duplicate the result, and I accidentally deleted the other game. My problem is I am trying to make the player do 3 different attacks, one for each time you hit the "A" key, but all it does is the first attack.
Here's my set up.
I have a movie clip with 4 keyframes inside it, one keyframe has an idle player movie clip labeled "idle", one with a walking movie clip labeled "walking", one with a jumping player movie clip labeled "jumping, and finally, one for attacking which, you guessed it, is labeled "attack". In my attack movie clip, i have the animation for 3 attacks, with the last frame of each attack having a stop command, followed by a check if the key "A" is pushed, and if it is pushed, then it plays again. This is repeated for each attack.
In my main player movie clip (the one containing all the others) I have the following code written.
onClipEvent(enterFrame){
var walkspd = 5;
var sprintspd = 2;
var gravity = 5;
var decel = .1;
//walking
if (Key.isDown(Key.RIGHT)){
this.gotoAndStop("walk");
this._xscale = 100
this._x += walkspd;
}
if (Key.isDown(Key.LEFT)){
this.gotoAndStop("walk");
_xscale = -100;
_x -= walkspd;
}
else {
if(Key.isDown(Key.RIGHT) == false && Key.isDown(Key.LEFT) == false && Key.isDown(65) == false){
this.gotoAndStop("idle");
}
}
//attacking
if (Key.isDown(65)){
gotoAndStop("attack")
}
}
How do I get this to work properly?