I press space bar to launch some missiles up the screen.
My code works it is just I cant fire 1 missile at a time because pressing space bar to fire , then 2-3 missiles go at once.
//main
I press space bar to launch some missiles up the screen.
My code works it is just I cant fire 1 missile at a time because pressing space bar to fire , then 2-3 missiles go at once.
//main
if (dict[Keyboard.SPACE]==true ) {
myplayer.firemissile(mybackList);
}
//player
public function firemissile(mybackList:Array)
{
for each (var el:ClassMissile in myMissileList) {
if (el.fire ==false){
el.startMissile (_x,(_y+_height));
trace("fire" + el.No );
break;
}
}
}
//missile class
public function startMissile(sx:int,sy:int)
{
//trace("smssile2");
img1.visible =true;
_x=sx;
_y=sy;
img1.y=posY(_y);
img1.x=_x;
_fire=true;
}