View Full Version : disabling enemies
Myctapeiro
December 7th, 2004, 10:26 AM
i need help disabling my enemies after a certain score is reached. I want my enemies to disappear after i reach a score of 10000. i tried the removeMovieClip method and it's not working. I'm not sure what else i could do.
SeiferTim
December 7th, 2004, 01:18 PM
attachMovie() all your enemies into one clip, and then remove that clip.
something like:
_root.attachMovie("blank","enemies",depth);
_root.enemies.attachMovie("enemy","enemy1",depth);
_root.enemies.attachMovie("enemy","enemy2",depth);
_root.enemies.attachMovie("enemy","enemy3",depth);
//and then later
_root.enemies.removeMovieClip();
Note: this works if you have 2 MovieClips: one called "enemy", and one called "blank" - which would be a completely blank MC - and they are both set to "Export for AS" under "Linkage".
Myctapeiro
December 7th, 2004, 01:33 PM
will this work if all my enemies are a single duplicated movie clip that plays over and over again??
SeiferTim
December 7th, 2004, 03:11 PM
Try it in a new movie.
Make 2 movieclips, enemy, and blank
then make a button that "kills" them all
It should work, but it really depends on your code.
bbwd
December 10th, 2004, 01:33 PM
A simpler way would be to set a 'death' variable - when death is 1 then enemies die! So:
Invisible MC on the stage (or a MC that sets variables - or you could set them in frame 1)
onClipEvent(load){
_root.deathfromabove = 0;
}
Then you have some other MC which sets _root.deathfromabove to 1 when you hit 1000 score.
Then in your enemy MCs:
onClipEvent(enterFrame){
if (_root.deathfromabove == 1){
this.removeMovieClip();
}
}
Myctapeiro
January 5th, 2005, 03:43 PM
seifertim, where would i put that code, on the timeline somewhere or on the enemy itself??
SeiferTim
January 6th, 2005, 04:35 PM
Um... if you make a button, it would be in the main timeline... bbwd's method will also work, though - and would probably be better for your code.
Myctapeiro
January 7th, 2005, 03:38 PM
bbwd, would "some other MC" be another invisible MC or does it really matter, can it be any other MC that is on the stage or what??
SeiferTim
January 7th, 2005, 05:17 PM
It could go in any MC. Probably in whatever MC sets your score, but yes, an Invisible one would work.
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.