FiqStudios's Banner

FiqStudios

Reviews News Main
FiqStudios

Age/Gender: n/a, Male
Location: New Mexico
Job: Student

Rusty Air.

Contact Info

Newgrounds Stats

Sign-Up Date:
12/23/07

Level: 8
Aura: Dark

Rank: Scout
Blams: 56
Saves: 154
Rank #: 36,853

Whistle Status: Garbage

Exp. Points: 590 / 710
Exp. Rank #: 64,712
Voting Pow.: 5.00 votes

BBS Posts: 671 (0.92 per day)
Flash Reviews: 2
Music Reviews: 0
Trophies: 0
Stickers: 0

Entry #6

Jump to Entry: [ 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 ]


FiqStudios

Snow.

Posted by FiqStudios Jan. 31, 2008 @ 10:31 PM EST

Pretty strait-forward. I made snow; complete with glowing.

Snow.
Source.

____________________

Script:


In the main frame panel:

var pressing:Boolean = true;
var timer:Number = 0;
var gf:Number = .25;
var fr:Number = .8;
function onEnterFrame():Void {
timer++;
if (timer%15 == 0) {
var dot:MovieClip = attachMovie("dot", "dot"+_root.getNextHighestDepth(), _root.getNextHighestDepth());
dot._x = Math.random()*Stage.width;
}
}
function onMouseDown():Void {
pressing = !pressing;
}

In the "white dot" MovieClip :

import flash.filters.GlowFilter;
var vx:Number = 0;
var vy:Number = 0;
function onEnterFrame():Void {
var glow:GlowFilter = new GlowFilter(0xFFFFFF, 1, Math.sqrt((_x-_root._xmouse)*(_x-_root ._xmouse)+(_y-_root._ymouse)*(_y-_root ._ymouse))/50+2, Math.sqrt((_x-_root._xmouse)*(_x-_root ._xmouse)+(_y-_root._ymouse)*(_y-_root ._ymouse))/50+2, 3, 3, false, _root.pressing);
this.filters = [glow];
vy += _root.gf;
vx *= _root.fr;
vy *= _root.fr;
_x += vx;
_y += vy;
if (_y>Stage.height) {
removeMovieClip(this);
}
}

____________________


Explanation:


var pressing:Boolean = true;
var timer:Number = 0;

Initiatives.

var gf:Number = .25;
var fr:Number = .8;

Physics control. I used a single, _root variable instead of one in every "snowflake" to reduce lag.

function onEnterFrame():Void {
timer++;
if (timer%15 == 0) {
var dot:MovieClip = attachMovie("dot", "dot"+_root.getNextHighestDepth(), _root.getNextHighestDepth());
dot._x = Math.random()*Stage.width;
}
}

Creates a "snowflake" every 15 frames.

function onMouseDown():Void {
pressing = !pressing;
}

Determines if you have clicked.

import flash.filters.GlowFilter;

Sets up glow effect.

var vx:Number = 0;
var vy:Number = 0;

Init.

function onEnterFrame():Void {
var glow:GlowFilter = new GlowFilter(0xFFFFFF, 1, Math.sqrt((_x-_root._xmouse)*(_x-_root ._xmouse)+(_y-_root._ymouse)*(_y-_root ._ymouse))/50+2, Math.sqrt((_x-_root._xmouse)*(_x-_root ._xmouse)+(_y-_root._ymouse)*(_y-_root ._ymouse))/50+2, 3, 3, false, _root.pressing);
this.filters = [glow];

Adds the glow and sets the glow amount based on how far the mouse is from the "flake".

vy += _root.gf;
vx *= _root.fr;
vy *= _root.fr;

Gravity and friction.

_x += vx;
_y += vy;

Moving the MovieClip.

if (_y>Stage.height) {
removeMovieClip(this);
}

Deletes the MovieClip if it is below the screen.

}

Copyright 2008 Ryan Keathley.

Updated: 01/31/08 10:53 PM Log in to comment! | Share this!

The People Have Spoken

2 Comments

Feb. 5, 2008 | 8:14 PM SupraAddict says:

awesome AS, too bad Iv'e gotz Flash 6, or Mx, as ppl call itz.

COPYRIGHT!!??!?!?!?!
but, but, why?
who would steal action script........ >__>

P.S.
I hate teh KK!!!!

I STRIX AGAIN!!!!!

Feb. 6, 2008 | 12:08 AM FiqStudios responds:

Thanks, but people steal script all the time. >:U


Feb. 11, 2008 | 4:08 PM DEFF says:

well, i thought it was pretty neat

Jump to Entry: [ 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 ]