i created a shooter game, and in this the enemy is supposed to spawn to the right of the stage and move left on the x axis (see attachment). my dilemma is that these duplicated instances are removing themselves. i think this may be related to depth issues…not sure. please help. Here’s the code I have placed on the original movie clip:
onClipEvent (load) {
var jeepspeed = 7;
var jeeplife = 300;
//var totalBullets = _root.tank_mc.i;
var i = 1; // used for jeep instance name and depth
}
onClipEvent (enterFrame) {
var dificulty = .01;
var rand1 = Math.random();
var rand = Math.random();
trace("rand = " + rand);
if (rand <= dificulty) {
_root.jeep_mc.duplicateMovieClip(“jeep_mc” + i, i);
trace(“i = " + i);
eval(”_root.jeep_mc" + i)._x = 570;
eval("_root.jeep_mc" + i)._y = rand1 * 400;
i++;
}
//totalBullets = _root.tank_mc.i;
this._x -= jeepspeed;
for (var j = 0; j < totalBullets; j++) {
if (_root.jeep_mc.hitTest("_root.shell_mc" + j)) {
jeeplife -= 50;
//help from kumbar
}
}
if (jeeplife <= 0) {
trace(“test”);
_root.jeep_mc.removeMovieClip();
}
}