-
i have a little shooty game and i have 1 'enemy' in it that is duplicated with this script:
actions on the frame:
numEnemy = 3;
for (i=2; i<=numEnemy; i++) {
enemy1.duplicateMovieClip("enemy"+i, i+1000);
}
actions on a clip:
onClipEvent (enterFrame) {
for (i=1; i<=_root.numEnemy; i++) {
what i can't do is after you have won the game and it goes to the congratulations screen, the original enemy goes away, but the duplicates keep on coming.... anyone know how i can cancel the duplicating?
cheers
-
removeMovieClip(name);
will get rid of the copies.
-
and will that also stop it from generating new duplicates?
-
no it won't. but where is your code for duplicateMovieClip?
when you get to the congrats screen, you should no longer be executing that code. you should be jumping to another frame where that code does not exist.
-
thats just it... there is no duplicate script on the congrats frame, but the little buggers just keep on duplicating flying right in front of the well done message, like they were never killed at all
-
(i've even tried putting the congrats stuff on a different scene and when the score hits a certain level to go to that scene (just as a test) and the little gits STILL kept coming)
-
are they actually being duplicated? or just repositioned?
if they are being duplicated, some code somewhere is doing that. if not, removing them (removeMovieClip) should effectively exterminate the little pests.
-
it is 1 movie clip being duplicated whenever there are less than 2 other duplicates on the screen (script used should be at the top) so that way there are always 3 baddies on the screen.... once it goes past the last frame that the baddies are actualy in , the original goes away, but the 2 duplicates keep occuring and flying down the screen... once they erach the bottom they are removed by the script, but then 2 more duplicates automatically start down from the top again.... you got any universal way of telling it to never duplicate again?... if you want to know any more of the script, just tell me what you want to see....
thanks for the help so far...
-
ok, i see. so you just need to set a flag that says whether or not the game is done, and check that flag before you duplicate.
when you start the game, say: _root.playing=true;
then when you go to duplicate the bad guys, check it:
if(_root.playing){
....code to duplicate here....
}
and when the game is over:
_root.playing=false;
-
gotcha... that sounds like a good idea... i will give it a go and i'm pretty sure it will work... thank you very very much for your help...
cheers
mt
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|