I’m making a game that makes lines after a moving object. First I used the dulpicateMovieClip(); function but that made it lag. So then I modified the script to attachMovieClip(); this still makes it lag after awhile. None of the movie clips I am duplicating have script in them. Also after awhile I use the unloadMovieClip(); function but it still lags. I have also used the removeMovieClip(); function
Here is some of the script:
if (mySpeed>.5) {
_root.trail1.createEmptyMovieClip("1trail"+i, count);
_root.trail1["1trail"+i].lineStyle(10, 0x0099FF, 20);
_root.trail1["1trail"+i].moveTo(car._x, car._y);
_root.trail1["1trail"+i].lineTo(newcarX, newcarY);
count += 1;
i++;
_root.trail1array[_root.trail1arraySize] = i;
_root.trail1arraySize++;
updateAfterEvent();
}
and
for (l=0; l<_root.lazerarraySize; l++) {
if (_root.wall1.hitTest(_root["bluelaz"+_root.lazerarray[l]]._x, _root["bluelaz"+_root.lazerarray[l]]._y, true)) {
_root["bluelaz"+_root.lazerarray[l]].play();
} else {
_root["bluelaz"+_root.lazerarray[l]]._x += Math.cos(Math.PI/180*(90-_root["bluelaz"+_root.lazerarray[l]]._rotation))*8;
_root["bluelaz"+_root.lazerarray[l]]._y += -Math.sin(Math.PI/180*(90-_root["bluelaz"+_root.lazerarray[l]]._rotation))*8;
}
}
Note: in the one above blueLaz.play(); plays the movieclip and the at the end removes it.
Thanks for any help.