2

I am making a game in Flash CS4 (actionscript 3) and I would like to be able to make "copies" of an instance that would randomly appear at the top of the screen and fall. For example, multiple objects(that are the same one) are falling from the top of the screen continuously, starting at random X positions. (i think this would be considered Real-Time effect).

P.S., please tell me if the information is insufficient for an answer, I couldn't think of much more to add to it.

Thanks for your time and answers,

       -Custard
Jackson Curtis
  • 91
  • 1
  • 1
  • 6
  • 2
    It might be easier to create multiple instances of a class than multiple copies of an instance. – mob Apr 02 '10 at 19:01
  • Ya, your right, I havent really done too much with classes, so I was hoping to avoid them, but if there is no other way, then I guess I can learn them. I'll pick up a few good skills messing around with them. – Jackson Curtis Apr 03 '10 at 16:25

2 Answers2

2

AS3 has no way to duplicate existing objects, the only way to do what you're talking about is to make new instances of whatever clip you want to fall. However, note that you need not keep making them forever - once they start falling off the bottom of the screen, instead of deleting the old ones and making more, you can just move them back up to the top and re-randomize the x coord.

You don't have to make any classes, by the way. If you make a movieclip in your FLA, and open the properties and give it the class name MyParticle (or whatever), if Flash doesn't find any MyParticle class it will just automatically make an empty class for you (you should see a warning about this when you assign the class name). Then in your frame scripts you can make copies of this clip with

var mc:MovieClip = new MyParticle();
fenomas
  • 11,131
  • 2
  • 33
  • 57
0

Yes, the standard way is to make multiple instances.

davr
  • 18,877
  • 17
  • 76
  • 99