At 5/6/09 12:08 AM, farfenwaffle wrote:
-whats the proper use for: _root.[movieclip].deleteMovieClip to make all of the spawned enemys go away?
for (i = 1; i<nrEnemies; i++){
_root["Enemy" + i].removeMovieClip();
}
-what the heck does my code mean?
This is a FOR loop that runs repeatedly.
It will start looping from the point where i (a counter) =1.
for (i = 1;
It will stop looping when i stops being less than max number of enemies (variable: nrEnemies).
i<nrEnemies;
Every loop, i will be incremented by one
i++){
Everything that's inside the curly brackets is the code that will be executed each loop - in the case of your code, it duplicates a new enemy on each loop.
for (i = 1; i<nrEnemies; i++){
//DO STUFF
}
-should I ever do something stupid like this ever again?
You should check out the Flash help files (press F1 in Flash) and maybe AS: Main if you're keen on learning how to code games.