I’ve been trying to make an asteroids game but when I use the following script to attach asteroid movie clips in random positions I cannot figure how to stagger the attaching process. What I mean by this is say I’m going to have 25 asteroids come down from the top of the screen in total how do I properly script this so they come down not all at once but, with delay in between each one. This is the script I have been trying so far but I cannot get it to work:
[AS]
lastAsteroid = 0;
for (i=0; i<=25; i++) {
if (lastAsteroid<=getTimer()) {
myAsteroid = attachMovie(“asteroid”, “asteroid”+_root.getNextHighestDepth(), _root.getNextHighestDepth());
myAsteroid._x = random(550);
myAsteroid._y = random(-100);
myAsteroid._xscale = random(80)+80;
myAsteroid._yscale = _root[“asteroid”+i]._xscale;
myAsteroid._rotation += random(50)+20;
myAsteroid.onEnterFrame = function() {
this._y += random(7)+3;
};
}
lastAsteroid++;
}
[/AS]
Any help on how to resolve this would be greatly appreciated :D!
Thanks,
Fargate