我需要一些帮助。我这里有这段代码,它会发射子弹,但每次我按下键时,子弹都会越来越快。这是我正在处理的部分...
stage.addEventListener(KeyboardEvent.KEY_DOWN, kDown);
stage.addEventListener(KeyboardEvent.KEY_UP, kUp);
stage.addEventListener(Event.ENTER_FRAME, moveChar);
//character functionality keys//
function kDown(event:KeyboardEvent):void
{
var mainSpeed:int = 5;
if (event.keyCode == 88){
gun_mc.gotoAndPlay(2);
BlueBullet_mc.x = gun_mc.x;
BlueBullet_mc.y = gun_mc.y;
addChild(BlueBullet_mc);
BlueBullet_mc.addEventListener(Event.ENTER_FRAME,moveBlueBullet);
}
function moveBlueBullet(e:Event):void{
e.target.y -=5;
if (e.target == 0){
e.target.removeEventListener(Event.ENTER_FRAME,moveBlueBullet);
removeChild(MovieClip(e.target));
}
}