Tutorials Home
What's New
Top Rated
Submit
myTutes
Random!
Making snow
Author: Sergei A. Kornev
| Website: http://www.purehue.com/ |
Adding some actions.
Select SnowFlake on the stage ( just mouse left-click on MovieClip ) and press F9 to bring up it's actions.
Put this actions (if you want just paste this actions you should turn to Expert Mode before.)
onClipEvent (load) {
function Init() {
spdSnowFlake = 0.05+_root.spdSnowFlake*random(20)/10;
if (spdSnowFlake<0.2) {
spdSnowFlake = 0.3;
}
ampSnowFlake = 1+_root.ampSnowFlake*random(3);
rdxSnowFlake = spdSnowFlake/(1+random(10));
if (rdxSnowFlake>0.3) {
rdxSnowFlake = 0.14;
}
rotSnowFlake = 0.5+random(4);
this._x = random(_root.Height-10);
this._visible = true;
}
function Reset() {
this._visible = false;
this._y = _root.Top;
Init();
}
if (this._name<>"snowflake"){
Init();
}
}
onClipEvent (enterFrame) {
if (this._name<>"snowflake") {
// delta x of x coordinate
this.dx = this.dx+this.rdxSnowFlake;
if (this.dx>360) {
this.dx = this.dx-360;
}
this._rotation = this._rotation+rotSnowFlake;
// new snowflake x, y coordinates
this._x = this._x+this.ampSnowFlake*Math.sin(this.dx);
this._y = this._y+this.spdSnowFlake;
// if snowflake has fallen down then reset and init it's values.
if (this._y>_root.Bottom) {
this.Reset();
}
}
}
| » Level Intermediate |
|
|
Added: : 2003-12-28
Rating: 8.22 Votes: 65
Hits: 2072
|
| » Author |
|
Sergei A. Kornev web-designer from Saint-Petersburg, Russia.
More information available on site: www.puehue.com.
|
| » Download |
|
Download the files used in this tutorial.
|
|
Download (66 kb)
|
|
Get conversion and unzipping tools
for PC and Mac here!
|
| » Forums |
|
More help? Search our boards for quick answers!
|
|
Please rate this tutorial, 10 is the top rating, you can also click the
comments link to read/write a review.
|
|
|