Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to do this...? 3

Status
Not open for further replies.

funkymonk

Technical User
Dec 18, 2000
588
GB
Hi all,

I have been trying to get this FX, the snow falling, [] for the background to a simple game I am creating for my companies website this Christmas. Problem is, I just can't get it smooth enough! It just twists and turns all over the place.

I have been away from flash for a couple of month’s now so there’s probably something I'm missing. The way I have been trying to do it is by using the 'Flip Horizontal' command to try and get the turn into it.

Any ideas....?

Cheers

Rod



funkymonk B-)
rod@sameplanet.co.uk
 
Hi Rod!

Probably a combination of alpha and scaling (compressing the flake to a simple line and then expanding it again, giving it a rotation look!) within a motion tween.

Then maybe add a few of them with attachMovieClip!

Regards,
wink4.gif
ldnewbie
 
attachMovieClip? Lost me there.....

I have just tried the scaling fx but to no joy I'm afraid. i didn't try alpha with it though. I have just been on the site again, trying to analyse it and think you are right, just gonna need a bit of time and skill to get it right I think.

Thanx for the reply

If you could enlighten me on the above command (attachMovieClip), that would be very nice of you...

funkymonk B-)
rod@sameplanet.co.uk

 
Actually ment duplicatemovieclip (somewhat the same!)...

Once you get a one flake movie clip going, you can duplicate it.
Check this:

As for the (faked)rotating flake, check this to see what I ment. Rather than spinning text, you would simply spin your symbol flake!


Regards,
wink4.gif
ldnewbie
 
Cheers Old, I shall have a look at that in a bit - just been given something else to doX-) so will work on it tomorrow.....

Again, cheers mate.... funkymonk B-)
rod@sameplanet.co.uk

 
Get the feeling that snow effects are going to be the most common topic between now and Christmas? :)

Here's my version which you're welcome to grab, makes use of the duplicateMovieClip that Old mentioned...


It's all script so it's really easy to set up -

Make yourself a snowball, convert it to a movieClip, have two instances of it on the stage. Name one of them "flake", select the other one and attach these clipEvents:

onClipEvent (load) {
function radians (theta) {
return (theta/180*Math.PI);
}
function rand (value) {
return Math.floor(Math.random()*value)+1;
}
function init (mc) {
mc._x = rand(stageSize);
mc._y = rand(100)-100;
mc._xscale = mc._yscale=rand(30)+20;
mc.speed = rand(3);
mc.drift = rand(180)+90;
}
driftInc = 1;
stageSize = 550;
maxFlakes =25;
for (i=1; i<maxFlakes; i++) {
duplicateMovieClip (_root.flake, &quot;snow&quot;+i, i);
clip = _root[&quot;snow&quot;+i];
init(clip);
}
}
onClipEvent (enterFrame) {

for (i=1; i<maxFlakes; i++) {
clip = _root[&quot;snow&quot;+i];
if (clip.drift<270 && clip.drift>90) {
sweep = radians(clip.drift);
clip._x += Math.floor(1.2*Math.cos(sweep))+1;

} else {
driftInc *= -1;
}
clip.drift += driftInc;
clip._y += clip.speed;
if (clip._y>400) {
init(clip);
}
}
}


Every flake is unique (or close enough ;-)...). Depending on the speed of your computer you can increase and decrease &quot;maxFlakes&quot; to get the amount of snow you're after. There are 25 flakes on the demo but my PC was reasonably happy to do 80-90 flakes as a rough guide...
 
This is a very &quot;romantic&quot; view of snow, compared to the 5 inches of the actual damn thing we got this morning, which BTW has just turned into pooring freezing rain... Might not even be able to finish this post before the power is down!
I watched your snow fall for at least 5 minutes, but curiously it doesn't seem to accumulate on the ground, as it's doing here in Montréal! LOL
Must be UK snow!

Regards,
wink4.gif
ldnewbie
 
wangbar, another wiked script, you da man Regards

Big Dave

davidbyng@hotmail.com


** If I am wrong I am sorry, but i'm only trying to help!! **

 
Nice! I'll turn it into a screensaver!

This is not just a wipe! What's the modifying accumulation code?

Regards,
wink4.gif
ldnewbie
 
The ground is an MC... I added this inside the enterFrame script...

_root.ground._yscale+=1;

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top