I’ve got the bullets to fire out of a turret…
But they will fire one right after another with no pause
I was thinkin maybe someone could help me limit the bullets…?
heres the script…
shoot = false;
allowMove = false;
for (k=0; k<99; k++) {
_root.mS.onEnterFrame = function() {
Xx = mS._x;
Yy = mS._y;
rx = _root.target1._x;
ry = _root.target1._y;
cx = _root.mS._x;
cy = _root.mS._y;
angle = Math.atan2(ry-cy, rx-cx)/(Math.PI/180);
if (allowMove == true) {
_root.mS._rotation = angle;
}
distance = 125;
bx = _root.target1._x;
by = _root.target1._y;
lx = _root.mS._x;
ly = _root.mS._y;
if (Math.sqrt((bx-lx)*(bx-lx)+(by-ly)*(by-ly))<distance) {
allowMove = true;
} else {
allowMove = false;
}
};
}
onEnterFrame = function () {
if (_root.target1.hitTest(_root.mS) == true) {
Tf = attachMovie("bullet1", "bullet1_"+_root.getNextHighestDepth(), _root.getNextHighestDepth(), {_x:Ts, _y:Ty});
_root.Tf._rotation = angle;
Ts = _root.mS._x;
Ty = _root.mS._y;
Tf.dirx = Math.cos(angle*Math.PI/180)*200;
Tf.diry = Math.sin(angle*Math.PI/180)*200;
Tf.onEnterFrame = function() {
this._x += this.dirx/50;
this._y += this.diry/50;
if (this._x>=230) {
removeMovieClip(this);
fired = 0;
}
if (this._y>=350) {
removeMovieClip(this);
fired = 0;
}
if (this._x<=0) {
removeMovieClip(this);
fired = 0;
}
if (this._y<=0) {
removeMovieClip(this);
fired = 0;
}
};
}
};
Thanks