Here is the script from the "bullet1":
onClipEvent (load) {
spd = 50;
// bullet speed
_x = _root.Player1._x;
// Move to player _x
_y = _root.Player1._y;
// Move to player _y
_rotation = _root.Player1._rotation;
// Point in same direction as player
}
onClipEvent (enterFrame) {
if (_name == "bullet1") {
_x = -1000;
// Move the original bullet MC offstage
} else {
// Run this movement code on all dupes
if (_rotation>180) {
_y += (spd*Math.cos(Math.PI/180*_rotation));
_x -= (spd*Math.sin(Math.PI/180*_rotation));
} else {
_y -= (spd*Math.cos(Math.PI/180*_rotation));
_x += (spd*Math.sin(Math.PI/180*_rotation));
}
// if(hitTest(_root.enemy)){ blahh; } Not going to address this here, check AS: Main for hitTest threads.
}
if (_x>Stage.width || _x<0 || _y<0 || _y>Stage.height) {
// If off-stage, delete the dupe to save CPU
this.removeMovieClip();
}
}
And here is the code from frame:
var bc = 1000;
// bulletcount
_root.onMouseDown = function() {
bc++;
if (bc>1010) {
bc = 1000;
}
// Reset bulletcount
duplicateMovieClip("bullet1", "b"+bc, bc);
// Create dupe bullet
};