Snow tutorial

Hey, I’m trying to edit the snow tutorial that is on Kirupa because I want to make a bubble like effect. I’m not so strong when it comes to the .math section of actoinscript. So if someone could just tell me what I have to edit to make the bubbles go up instead of down it would help :slight_smile:

this is my action script i have on my movie clip called snow. I currently have it flowing upwards like bubbles but they spawn to high in the movie? Any ideas?

onClipEvent (load) {
// specifies the size of the movie stage
movieWidth = 140;
movieHeight = 244;
// variables that will modify the falling snow
i = 1+Math.random()*2;
k = -Math.PI+Math.random()*Math.PI;
// giving each snowflake unique characteristics
this._xscale = this._yscale=50+Math.random()*50;
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;

I hope you already figured it out, but just in case…

Attached is the source file from the tutorial with the corresponding modifications. :wink:
And you might want to take a look at this thread too… :slight_smile:

thanks a bunch Kax…you da actionscript masta

Originally posted by sanman918
thanks a bunch Kax

No problem. =)

Originally posted by sanman918
you da actionscript masta

Yeah, sure… :stuck_out_tongue:

i got a couple more questions. 1 can i have it so all the bubbles spawn down at the bottom. 2. I’m loading bubbles.swf onto a movie and the frame speed is 12 fps but the one for the bubbles needs to be about 25 so what do I do? and 3rd. I want to load 2 copies of bubbles.swf one on the left and one on the right…how would I do that? Thanks

Ok, if I understood your questions… :stuck_out_tongue:

  1. Change the depth of the bubbles or the movieclip holding the bubbles to a lower depth. :slight_smile:

  2. You could change the enterFrame event handler with a function, then use setInterval so it’s executed faster than the fps. :wink:

  3. Just create two movieclips and place one on the left and one on the right? :stuck_out_tongue:

Is that what you asked? :-\

  1. Most of the bubbles spawn at the bottom of the movie but some spawn all the way up top.
  2. Need a little more explaination if you don’t mind :slight_smile:
  3. I try that but everytime I load through an empty movie clip it messes up for some reason. I can try again though.
  1. It makes no sense at all… if there is any symbol in the same depth than any of the duplicated bubbles, it would be replaced by the bubble. :-
    I’d like to see the FLA if you don’t mind… :wink:

  2. Ok… I’ll attach a FLA later, just give me some time, i’m really busy right now. :-\

  3. Again, I can’t tell what’s wrong without taking a look at your FLA.

well im using the bubble .fla you gave me. And this isn’t just once with the load through an empty movie clip command it screws up. I’m loading it just fine and the action script is just perfect. Like I have a clock I made for a counter that is 3 seperate text fields that are dynamic. I view .swf by its self and its perfect. It reads 0:00 and its starts to count 0:01 but when I load it though a movieclip is gets all messed up like 0:0101 and you can scroll over the text and it only counts to 0:09 and then goes back to 0:00 instead of 0:10. But the .swf is perfect on its on and is just find when I load it right into the root level. But when I load through emptymovieclip its messed.

Ehmm… surely there’s an addressing issue. :-\

Can you post your script? :slight_smile:

well the thing that is most important to his scene is the bubbles. So could you please go into more detail how to make the frame rate different for a .swf I have loaded into my scene?

Sorry… I’ve been really busy. :-\

onClipEvent (load) {
	movieWidth = 300;
	movieHeight = 200;
	i = 1+Math.random()*2;
	k = -Math.PI+Math.random()*Math.PI;
	this._xscale = this._yscale=50+Math.random()*100;
	this._alpha = 75+Math.random()*100;
	this._x = -10+Math.random()*movieWidth;
	this._y = movieHeight-this._height;
	move = function () {
		rad += (k/180)*Math.PI;
		_x -= Math.cos(rad);
		_y -= i;
		if (_y<=-_height) {
			_y = movieHeight-_height;
		if (_x>=movieWidth || _x<=0) {
			_x = -10+Math.random()*movieWidth;
			_y = -5;
	setInterval(move, 1000/25);