-
Hi, I'm making a page and in the background I want it to look like it's raining I created a raindrop and converted to a movieclip. I added this script for a random start and reset. How can I get it to fall down the screen and get duplicate it a few times?
onClipEvent (load) {
function reset () {
this._x = random(450)+10;
this._y = 100;
rainSpeed = random(20)-1;
}
reset();
thanx for the help in advance
-
Ok... Put that code in frame 1...
In frame 2, put this code:
_y = _y + rainSpeed;
if ( _y > GROUND_Y ) {
reset();
}
Kinda obvious what "GROUND_Y" is, right?
In frame 3, just put:
gotoAndPlay(2);
So basically, it'll start out in 1, initialize to a random location, then loop between frames 2 and 3... Frame 2 will keep moving it down until it reaches the bottom, then reset it again... Try it
-
All that has you movie nicely "raining" down the screen and then jumping to a new position to do it again.
To create lots of raindrops without having to put them onstage, drop one onstage and add this to it for 20 drops, just change the number for more or less
onClipEvent (load) {
var CopyCount;
if (CopyCount <= 20) {
CopyCount = Number(CopyCount)+1;
duplicateMovieClip (Raindrop, "Raindrop" add CopyCount, CopyCount);
}
}
mark
-
call me fool but I need your help
Hey Guys!
I'm new at flash scripting but I was looking to do something like this, as mentioned above. I tried this but it didn;t work. It would be great if any of you could please fwd. me the souce file?
Many thanks
-
I have to apologise
It doesnt work, the duplicate script being in the onClipEvent means all the mc's try to duplicate themselves 2o times and then those do on and on NOT GOOD!!
I have built a movie that works, let me know where to send it.
mark
-
Thanks Mark.
Can you please email me the source file at lostinsydney@hotmail.com.
Thanks again )
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|