|
-
theSWEEN
[RESOLVED] Rising rain
Hello, can anyone help me modify the following code (the code to make it rain), so instead of the movieclip duplicating and falling, it duplicates and rises...
This code is in the movieclip:
onClipEvent (load) {
//put the size of the movie stage here
movieWidth = 550;
movieHeight = 300;
//variables that will modify the falling snow
//this is for the speed of the falling rain
i = 20+Math.random()*100;
k = -Math.PI+Math.random()*Math.PI;
//giving each snowflake unique characteristics
this._xscale = this._yscale=50+Math.random()*100;
this._alpha = 75+Math.random()*100;
this._x = -10+Math.random()*movieWidth;
this._y = -10+Math.random()*movieHeight;
}
onClipEvent (enterFrame) {
//putting it all together
rad += (k/180)*Math.PI;
this._x -= Math.cos(rad);
this._y += i;
if (this._y>=movieHeight) {
this._y = -5;
}
if ((this._x>=movieWidth) || (this._x<=0)) {
this._x = -10+Math.random()*movieWidth;
this._y = -5;
}
}
This code is in the frame:
for (k=0; k<25; k++) {
duplicateMovieClip(_root.rain, "rain"+k, k);
}
Also, I can see this wont work if you import the .swf into anther movie, does anyone know why?
Thanks in advance..
Steve
Last edited by thesween; 09-29-2007 at 09:15 PM.
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
|