Just an add-on to this - a cool way to do this is to create a “prime” clip, like “enemyShip”, that sits onscreen, out of view, and never moves. And, that clip itself can contain its own instructions for duplication - but you have to make sure you add one piece of code so that only the original piece duplicates itself x number of times, or your system will lock up, as each clip makes multiple copies.
so you can have a movie clip of a bullet called “enemyShip”, and within it:
onClipEvent (load) {
if (_name == "enemyShip) {
for (i = 1; i < 5; i ++) {
_root.enemyShip.duplicateMovieClip ([“enemyShip” + i], i);
}
}
}
So the original clip loads, makes five copies of itself, naming them enemyShip1 through enemyShip5, on levels 1 through 5, and then it just sits there. Very efficient.
You can do the same thing with bullets, giving the prime bullet all the code it needs to function (moving itself along the screen, detecting for hits) and use another piece of code in onClipEvent(enterFrame) { that says something like:
if (_name != “bullet”) {
So the original bullet could be duplicated by the enemy ships at certain intervals, given names like bullet1, bullet2, etc. but the movement/hit detect codes wouldn’t execute for the original, prime bullet.
Let me know if that makes sense. I’ve used this kind of functionality on a few games I’ve made like this one, which I’m still working on:
http://plasmicstudio.com/saucer_pilot