piratefish
03-03-2006, 04:14 AM
I'm trying to have a constant flow of duplicated movieclips to be created while a variable is beneath a certain fixed amount.
while (_root.monCount<13) {
trace("Monster Count is="+monCount)
//Duplicates the monster movieclip
duplicateMovieClip("monster_mc", "monster"+monCount, monDepth);
There's more various positioning code for each new clip, but that's not important. It does increase the monCount and the monDepth when the end of the cycle is reached.
My only problem is when I remove a movieclip (via a hitTest) and subtract from the monCount. It doesn't work at all.
if (this.hitTest(_root.warrior_mc.sword)) {
// Drop loot here with a duplicated movieclip
removeMovieClip(this);
_root.monCount-=1
}
The monDepth keeps being added to so nothings on the same depth. But anyways if ten of the movieClips are removed I'm lucky to get about three of them to reappear. Does anyone have some advice to offer in this? Thanks for any help.
while (_root.monCount<13) {
trace("Monster Count is="+monCount)
//Duplicates the monster movieclip
duplicateMovieClip("monster_mc", "monster"+monCount, monDepth);
There's more various positioning code for each new clip, but that's not important. It does increase the monCount and the monDepth when the end of the cycle is reached.
My only problem is when I remove a movieclip (via a hitTest) and subtract from the monCount. It doesn't work at all.
if (this.hitTest(_root.warrior_mc.sword)) {
// Drop loot here with a duplicated movieclip
removeMovieClip(this);
_root.monCount-=1
}
The monDepth keeps being added to so nothings on the same depth. But anyways if ten of the movieClips are removed I'm lucky to get about three of them to reappear. Does anyone have some advice to offer in this? Thanks for any help.