PDA

View Full Version : [help] Running and firing...



the_crowbar_kid
July 14th, 2005, 09:14 AM
Hey i have a common code, its running idle and idling firing, i also have a seperate animation for running and firing but it doesnt work, it just stays on one frame. Heres the code...

onClipEvent (load) {
moveSpeed = 8;
shooting=false;
scale = _xscale;
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT)) {
this.gotoAndstop(2);
this._x += moveSpeed;
_xscale = scale;
}
if (Key.isDown(Key.LEFT)) {
this.gotoAndstop(2);
this._x -= moveSpeed;
_xscale = -scale;
}
if (Key.isDown(Key.CONTROL)) {
shooting=true;
this.gotoAndstop(3);
}
if (Key.isDown(Key.CONTROL)&& Key.isDown(Key.RIGHT)) {
shooting=true;
this.gotoandstop(4);
_xscale = scale;

}
if (Key.isDown(Key.CONTROL)&& Key.isDown(Key.LEFT)) {
shooting=true;
this.gotoandstop(4);
_xscale = -scale;

}
if (!Key.isDown(Key.RIGHT) && !Key.isDown(Key.LEFT) && !Key.isDown(Key.SPACE) && !Key.isDown(Key.CONTROL)) {
this.gotoandstop(1);
}
}

thanks guys

dinner dog
July 14th, 2005, 11:06 AM
the last called frame in the stack of if statements is the one shown as flash is told to 'goto' it last.
can you post a fla so I can see what is happening?