PDA

View Full Version : newbie question / random movie clips



ScottSonnenberg
March 16th, 2004, 10:20 PM
What is the script to make Flash randomly play three or four movie clips.

I am making a basic shooting game.

flash4food
March 17th, 2004, 12:31 AM
give a wider explanation

are these clips already on stage? or u want to duplicate/attach them?

Amax2
March 17th, 2004, 03:55 AM
Try this.

on (press) {
count = 1;
while (count<10) {
_root.box.duplicateMovieClip("boxx"+count, count);
_root["boxx"+count]._x = random(550);
_root["boxx"+count]._y = random(150);
_root["boxx"+count]._xscale = random(150);
_root["boxx"+count]._yscale = random(150);
_root["boxx"+count]._alpha = random(100);
count += 1;
}
}


But since its not all AS meaning that you cant just copy and past it into a frame for it to work. So you can dl my fla.


or


You can create a MC and name it box (or whatever you want so long as it matches the names of the AS). Then copy and past this into the movieC that you created. Now add a blank key frame in frame 2 and give it the action of
goToAndPlay(1)
this makes it loop back to frame 1 and play over.

Now just click the box or whatever you made you MC out to be and it will creat 10 movie clips of that same MC. it will also randomize the scale and alphas of the MC.

ScottSonnenberg
March 17th, 2004, 10:25 AM
Thank you for the replies so far.

What I need is for different targets to jump out from behind objects or from out of frame. So there would be 3 different places that targets could come from.

There would be 3 places where I would place movie clips. In these three places the movie clip would have to randomly not play, play a target you can shoot at, or play a target that is negative points if shot.

I have already done the "keep score" tutorial on this site and have come up with a basic game using movie clips, but I want to randomize the game play.

Thank you

tommythewolfboy
March 17th, 2004, 02:38 PM
This should get you started though from an a/s perspective...
http://www.sitepoint.com/article/shoot-em-up-game-flash-mx

I did something similar a while back (it's on my website), although no randomisation of which of good/bad targets.

ScottSonnenberg
March 18th, 2004, 12:18 PM
Thank you for your help!