# Falling Snow Tutorial - Reverse Snowfall?

**URL:** <https://forum.kirupa.com/t/falling-snow-tutorial-reverse-snowfall/24960>\
**Category:** flash\
**Created:** [July 7, 2003, 6:38pm UTC](https://forum.kirupa.com/t/falling-snow-tutorial-reverse-snowfall/24960 "2003-07-07T18:38:41Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![mecha](https://avatars.discourse-cdn.com/v4/letter/m/b77776/32.png) [@mecha](https://forum.kirupa.com/u/mecha)\
**Post date:** [July 7, 2003, 6:38pm UTC](https://forum.kirupa.com/t/falling-snow-tutorial-reverse-snowfall/24960/1 "2003-07-07T18:38:41Z")

</div>

Hey All,

How would I reverse the Snowfall direction in the “Falling Snow” tutorial found at [http://www.kirupa.com/developer/mx/snow.htm](http://www.kirupa.com/developer/mx/snow.htm)

And also, how could I limit the spawn point to a certain location. In other words, how can I make all the snowflakes start at the same place.

This is probably easy, but I am learning Actionscript as I go along…:thumb:

thanks

mecha

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 7, 2003, 10:40pm UTC](https://forum.kirupa.com/t/falling-snow-tutorial-reverse-snowfall/24960/2 "2003-07-07T22:40:59Z")

</div>

there are many threads going over exactly this 😉

take some time on the search button up there (between online and home) and search on things like “snow” and “bubbles” (which is what everyone wants from upside-down snow) and you’ll find a lot!

:beam:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 7, 2003, 10:46pm UTC](https://forum.kirupa.com/t/falling-snow-tutorial-reverse-snowfall/24960/3 "2003-07-07T22:46:52Z")

</div>

Make it like this:

```auto
onClipEvent (load) {
	//specifies the size of the movie stage
	movieWidth = 300;
	movieHeight = 200;
	
	//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()*100;
	this._alpha = 75+Math.random()*100;
/*->*/	this._x = /// where you want it to spawn
/*->*/	this._y = /// where you want it to spawn
}
onClipEvent (enterFrame) {
	//putting it all together
	rad += (k/180)*Math.PI;
	this._x -= Math.cos(rad);
	this._y += i;
/*->*/	// changed to "<" and "+5"
	if (this._y<=movieHeight) {
		this._y = +5;
	}
/*->*/	// changed to "+5"
	if ((this._x>=movieWidth) || (this._x<=0)) {
		this._x = -10+Math.random()*movieWidth;
		this._y = +5;
	}
}

```

I may have made some mistakes in there, but basically you just want to change the “random spawning point” (which should be easy for you to see) and the y movement to positive instead of negative.

Why do you want snow moving up?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 7, 2003, 10:47pm UTC](https://forum.kirupa.com/t/falling-snow-tutorial-reverse-snowfall/24960/4 "2003-07-07T22:47:37Z")

</div>

Hey, yeah, what sen said 😉

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 7, 2003, 10:52pm UTC](https://forum.kirupa.com/t/falling-snow-tutorial-reverse-snowfall/24960/5 "2003-07-07T22:52:17Z")

</div>

just fyi, the easiest is to put it in a movieclip and turn the movieclip upside-down. Theres a post out there on how to do that 😉 - I know I still have the swf laying around out there uploaded  
[http://userpages.umbc.edu/~tmccau1/flash/snowtobubbles.swf](http://userpages.umbc.edu/~tmccau1/flash/snowtobubbles.swf)

the only problem might be you may need to change any \_root’s to this’s (this SHOULD work, though maybe not - basically its keeping all values and methods in THAT movieclip, and not \_root since the movieclip is whats going to be turned upsidedown 😉

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 8, 2003, 9:47am UTC](https://forum.kirupa.com/t/falling-snow-tutorial-reverse-snowfall/24960/6 "2003-07-08T09:47:26Z")

</div>

Hey,

Thanks for the replies:

jingman - I need snow going up so I can create a kind of Final Fantasy style twinkle / fairy kind of effect behind a logo for a website I am working on. Imaging the snowflakes replaced by white to transparent circles floating up from behind a 3D company logo. Thats the idea anyway!

I will try the code you supplied, thanks again!

senocular - Thanks for the upside down movieclip solution. I tried that but it didnt want to work. I will try it again but thoroughly checking the script for “\_root”!

Thanks again guys!

If I make any progress I will let ya know.

mecha

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 8, 2003, 11:17am UTC](https://forum.kirupa.com/t/falling-snow-tutorial-reverse-snowfall/24960/7 "2003-07-08T11:17:21Z")

</div>

Hey guys,

figured it out and it works great. Here is the revised code:

onClipEvent (load) {  
//specifies the size of the movie stage  
movieWidth = 300;  
movieHeight = 200;  
//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()\*100;  
this.\_alpha = 75+Math.random()\*100;  
//EDIT 1 - THIS IS WHERE I SAY WHERE TO SPAWN  
this.\_x = 100;  
this.\_y = 100;  
}  
onClipEvent (enterFrame) {  
//putting it all together  
rad += (k/180)\*Math.PI;  
this.\_x -= Math.cos(rad);  
//EDIT 3 - CHANGING “this.\_y += i;” to “this.\_y -= i;” reverses the direction  
this.\_y -= i;  
if (this.\_y\<=-this.\_height) {  
//EDIT 4 - RECONFIGURE THIS SPAWN POINT  
this.\_y = 100;  
this.\_x = 100;  
}  
if ((this.\_x\>=movieWidth) || (this.\_x\<=0)) {  
//EDIT 5 - RECONFIGURE THIS SPAWN POINT  
this.\_x = -5;  
this.\_y = -5;  
}  
}

Basicaly, after reversing the snowfall direction the only thing left to do was eliminate the random respawn points which is done in EDITS 4 & 5.

Thanks for your help guys!

mecha

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 5, 2003, 9:51am UTC](https://forum.kirupa.com/t/falling-snow-tutorial-reverse-snowfall/24960/8 "2003-08-05T09:51:45Z")

</div>

tried changing the value’s on the spawn points but the mc just freezes if i do :S
