PDA

View Full Version : Attacking to the Left?


Lorithon
04-21-2009, 08:30 PM
Hey Guys here's something a little different

remember that guy in my previous post well i'm still working on him


my new problem is that when the guy is standing still i can get it so that when he has moved to the left, he stands still facing the left and visa versa

however whenever he is standing still and attks with his bat he always swings to the right because tha's what i told him to do that on that frame

how can i make it so that when he is standing still and facing Left he attks Left

Here's what i have so far

standStill.onEnterFrame = function() {
if(Key.isDown(68)) {
this._x+=4;
this.gotoAndPlay(3);
}

//Moves Right

else if(Key.isDown(65)) {
this._x-=4;
this.gotoAndPlay(14);
}

//Moves Left

else if(Key.isDown(1)) {
this.gotoAndPlay(25);
}

//attks Right while standing still

else if(Key.isDown(1) && Key.isDown(68)) {
this._x+=4;
this.gotoAndPlay(40);
}

//Moves right while attking Right (not working)

else if(Key.isDown(1) && Key.isDown(65)) {
this._x-=4;
this.gotoAndPlay(55);}

//Moves Left while attking Left (Also not working)

}



P.S ---- rrh how do i make it so that a & b are true so he can move while attking???:confused:

bluemagica
04-22-2009, 07:14 AM
just use a boolean to see which direction he is facing! Also i think instead of different animations for left and right, you should use xscale, which will make things a lot easier!

PS: next time, please put the code in the code tags!

Cauterize
04-22-2009, 01:38 PM
Read what I wrote here about changing which way the character is facing:
http://www.actionscript.org/forums/showthread.php3?p=875313#post875313