I am making a 2D shooting game in flash mx using action script.
my sprite can fire bullets but only one at a time. I want to know how to continuously fire bullets.
This is some of the code:
--===FOR THE MISSILE:===--
onClipEvent (enterFrame) {
if (this != _level0.missile) {
if (_root.fire == 1) {
this._y -= 7;
this._visible = 5;
}
if (this._y<0) {
this.removeMovieClip();
}
}
}
onClipEvent (load) {
this._visible = 0;
if (_root.fire == 1) {
this._x = _root.samus._x;
this._y = _root.samus._y;
}
}
--===FOR THE SPRITE:===--
onClipEvent (load) {
i = 0;
}
onClipEvent(enterFrame){
if(Key.isDown(Key.RIGHT)){
this._x += 5;
}
if(Key.isDown(Key.LEFT)){
this._x -= 5;//
}
if(Key.isDown(Key.SPACE)) {
_root.fire = 1;
_root.i += 1;
duplicateMovieClip(_root.missile, "missile"+i, i);
}
}
my sprite can fire bullets but only one at a time. I want to know how to continuously fire bullets.
This is some of the code:
--===FOR THE MISSILE:===--
onClipEvent (enterFrame) {
if (this != _level0.missile) {
if (_root.fire == 1) {
this._y -= 7;
this._visible = 5;
}
if (this._y<0) {
this.removeMovieClip();
}
}
}
onClipEvent (load) {
this._visible = 0;
if (_root.fire == 1) {
this._x = _root.samus._x;
this._y = _root.samus._y;
}
}
--===FOR THE SPRITE:===--
onClipEvent (load) {
i = 0;
}
onClipEvent(enterFrame){
if(Key.isDown(Key.RIGHT)){
this._x += 5;
}
if(Key.isDown(Key.LEFT)){
this._x -= 5;//
}
if(Key.isDown(Key.SPACE)) {
_root.fire = 1;
_root.i += 1;
duplicateMovieClip(_root.missile, "missile"+i, i);
}
}