Random object generation

I guess this is a little vague, but always worth a shot :slight_smile:

Anyone have a good idea for what kind of script framework I should use to:

  1. Make a movieClip appear in a random place (I’ve got this down fine, but…)

  2. Make other instances of the movie clip appear in other random places while the first one is still on-screen, but at random intervals?

Keep in mind the basis for this question is that I’m making a game where targets must appear and disappear if not shot, but I want other targets to be able to appear on-screen at the same time if the user hasn’t gotten around to destroying the first, second, etc. yet.

Well, thanks for any suggestions! :slight_smile:

  • wobbly

establish a frequency.

nFreq= Math.round(Math.random()*10)

then use an if statement to check when the value is a number, I used 5.


_root.onEnterFrame = function(){
     nFreq = Math.round(Math.random()*10)
     if(nFreq == 5){
          //
          //Here you would duplicate the movieclip
          //Or attach the MovieClip
          //
     }
}

Here:

Replied together, hmm, 4 min difference!

Hey, this is great… you’re all so responsive and helpful :slight_smile:

Jubba, thanks, I learned a new trick :slight_smile:

h88 … I must say, after being on the board a little while, you’re awesome :beam:

Thanks again :slight_smile:

  • wobbly

No problem. :slight_smile: