PDA

View Full Version : trying to make astroids move down the screen in random places


anthony88guy
10-21-2004, 10:05 PM
i am trying to make movieclips come down the screen. I am making an astroids game, here is the code...


onClipEvent (load) {
speedastroid = 2;

}
onClipEvent (enterFrame) {
this._y += speedastroid;
count = 1;
while (count<2) {
_root.astroid.duplicateMovieClip("astroids"+count, count);
_root["astroids"+count]._x = random(650);
_root["astroids"+count]._y += speedastroid;
count += 1;
}
if (this._y>500) {
this.removeMovieClip();
}
}

so the astroid moves down the screen, but the random x corrdinate gets reset, so the astroid come down the screen and moves in differ places on the x axis. I want just one random number per astroid, i don;t want it getting reset on each frame.

can u plz help me

here is the link to see what i mean with the astroids.
http://www.gamespro.i8.com
click on play game, u have to wait like 10 seconds for the astroids to start coming down. Also the laser doesn't work ever since i added the astroids, but its works in the instructions.

-thxs

Gibberish
10-21-2004, 11:21 PM
don't use onEnterFrame then cause that will change it every frame.