Hi. I've been working on a game where an enemy spawns somewhere every second or so. I want to know a way where I can duplicated one movieclip at a time, be able to have as many as I want on the screen at a time, and be able to remove each and every one when the player gets a game over. So far I have found nothing that works. Could someone explain to me how I could do this? I can write the code myself, just tell me the basic idea of the code.
If enemy spawns (timer activated if every second or so), then duplicate enemy movie clip. The enemy mc needs code for collision so the enemies don't overlap each other. When the player gets game over unload all instances of the enemy mc.
This is the basic idea of how you will have to write the code.
You need to make a class. They are a little complicated when you first make one, but then you can duplicate them for any use you want.
In a class, you make each enemy have the exact same code (which is located in a .as file in the same folder in your .fla file), and you assign a Movie Clip to this class (so it would make this class move and do stuff with the enemy movieclip), and then you create multiple of the class. I can't explain it that well without writing out all of the code, but I have done a TON of what you are trying to do, and I know classes work best. Try to find a tutorial online.
Perhaps this might be a good one, I haven't read through it, though. http://flash-creations.com/notes/actionscript_aboutclasses.php