Hey,
I have a code that if you press right and down it changes a movieclips frame. It works but if i hold down down and right it just stops on first frame but when you release it plays. I want it so when you hold it down it goes to that frame and plays not just stop on first frame. Probley really easy to fix but im stuck and this is VERY important to get it working.. Please.
Here is ALL the code (it might have to do with some other part) :
NOTE: yspeed is not actually _y it is just a term i used for left (_x-). It is just temporary.
slideStopStance and slideStopStanceL are frames inside frame 1 of main movieclip.
CODE
onClipEvent(load){
power=1;
friction=0.95;
xspeed=0;
yspeed=0;
}
onClipEvent(enterFrame){
if(Key.isDown(Key.RIGHT)){
_root.hero.gotoAndStop(2);
xspeed +=power;
}
if(Key.isDown(Key.LEFT)){
_root.hero.gotoAndStop(3);
yspeed +=power;
}
if(Key.isDown(Key.DOWN) && Key.isDown(Key.LEFT)){
xspeed = 1;
yspeed = 0;
power = 0;
_root.hero.gotoAndStop(1);
}
if(Key.isDown(Key.DOWN) && Key.isDown(Key.RIGHT)){
xspeed = 0;
yspeed = 1;
power = 0;
_root.hero.gotoAndStop(1);
}
if(Key.isDown(Key.LEFT) && Key.isDown(Key.DOWN)){
xspeed = 1;
yspeed = 0;
_root.hero.stopStance.gotoAndPlay("slideStopStanceL");
_root.hero._x-=.95;
}
if(Key.isDown(Key.RIGHT) && Key.isDown(Key.DOWN)){
xspeed = 0;
yspeed = 1;
_root.hero.stopStance.gotoAndPlay("slideStopStance");
_root.hero._x+=.95;
}
if(_root.hero.stopStance){
xspeed = 0;
yspeed = 0;
power = 1;
}
xspeed *= friction;
yspeed *= friction;
_x += xspeed;
_x -= yspeed;
}
onClipEvent(keyUp){
_root.hero.gotoAndStop(1);
}
Thanks in advance !
Oh and also if possible i want it so only if your xspeed or yspeed is more than 0 it goes to slideStopStance. Else if it's 0 i want to to got to stopStance. I tried
CODE
if(Key.isDown(Key.RIGHT) && Key.isDown(Key.DOWN) && (xspeed>0)){
_root.hero.stopStance.gotoAndPlay("slideStopStance");
}
if(Key.isDown(Key.RIGHT) && Key.isDown(Key.DOWN) && (xspeed==0)){
_root.hero.gotoAndStop(1);
}
But it doesn't work..
Please help will be MUCH appreciated.