well, I presume this is a simple question, I have scanned the forums a bit and cannot seem to come up with any conclusions to my problem. I am making space invaders style game and I am using one of the tutorials from flashkit which uses the following code for shooting:
now, the code works fine for what it is supposed to do; however, my problem lies in the fact that I do not want it to be the case that if the user holds down the spacebar it will shoot the bullet at the maximum speed, I would like to figure out some way that(these times are not exact but just examples) if the spacebar is held down it will shoot a bullet every 2 seconds; and if the user taps the spacebar they can shoot up to one bullet every second. Hopefully this makes sense, I apologize greatly if this question is explained somewhere else but I did look around and could not find any examples.Code:onClipEvent(load){
_root.laser._visible=false;
laserCounter=1;
}
if (Key.isDown(Key.SPACE)) {
laserCounter++;
_root.laser.duplicateMovieClip( "laser"+laserCounter, laserCounter );
_root["laser"+laserCounter]._visible=true;
trace(laserCounter);
}
//this is in the bullet/laser action
onClipEvent (load) {
laserMoveSpeed=20;
this._y=_root.spaceship._y - ((_root.spaceship._height / 2) + (this._height));
this._x=_root.spaceship._x;
}
onClipEvent (enterFrame) {
this._y-=laserMoveSpeed;
if (this._y>600){
this.removeMovieClip();
}
}
Thanks in advance,
ChaseNYC
