Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Fine tuning Snow fall

Contributor ,
Dec 17, 2014 Dec 17, 2014

right now I have a particle engine that creates snow falling. It uses the whole stage (_root). I'm trying to get snow to fall in a specific movie clip so it only attaches, and removes the snowflake (particle) in a selected movieclip. I have a MC called widescreen_mc and inside that I have sky_mc. I would like the snow to fall in the sky_mc so you only see the snow in the screen. I've tried attaching it in the sky MC and then change the other stettings (width height) to adjust, but nothing I do works as expected. Here is the Prticle engine code i've been using. can anyone show/tell me the changes I need to make to get it to work (brief explanation of any code changes would be apprciated so I can see my mistkes.)

Merry Christmas

import mx.transitions.Tween;

import mx.transitions.easing.*;

timer = 0;

timermax = 10;

particleCount = 0;

gravity = .01;

changeOver = 100;

checker = true;

percipitation = function()

{

  //this._x += -5;

  this.yspeed += gravity;

  this._y += this.yspeed;

  if (this._y > (Stage.height))

  {

  this.removeMovieClip();

  }

}

onEnterFrame = function ()

{

  timer ++;

  if (timer == timermax)

  {

  //generate particle

  particle = _root.attachMovie("Snow","P_"+ particleCount, _root.getNextHighestDepth());

  ///needs to set random position across

  particle._x = Math.floor(Math.random()*(1+Stage.width+3)) -3;

  //particle._x = _xmouse;

  particle._y = -10;

  particle.xspeed = random (6) - 3;

  particle.yspeed = random (6) - 0;

  particle.thesize = random (100) + 10;

  particle.fade = Math.floor(Math.random()*(1+50-10))+10;

  particle._xscale = particle._yscale = particle.thesize

  particle._alpha = particle.fade

  particle.onEnterFrame = percipitation;

  timer =0;

  particleCount ++;

  //trace(particleCount);

  clock_mc.swapDepths(particle);

  change_mc.swapDepths(clock_mc);

  winter_mc.swapDepths(change_mc);

  protect_mc.swapDepths(winter_mc);

  holder_mc.swapDepths(protect_mc);

  }

  //}

}

TOPICS
ActionScript
740
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Dec 17, 2014 Dec 17, 2014

again, and then comment out those swapDepths() statements unless needed and change the _x,_y values of the particles so they start and stay (ie, edit precipitation) in your sky mc.

Translate
Community Expert ,
Dec 17, 2014 Dec 17, 2014

change this line:

  particle = _root.attachMovie("Snow","P_"+ particleCount, _root.getNextHighestDepth());

to

  particle = widescreen_mc.sky_mc.attachMovie("Snow","P_"+ particleCount, widescreen_mc.sky_mc.getNextHighestDepth());

and then comment out those swapDepths() statements unless needed and change the _x,_y values of the particles so they start and stay (ie, edit precipitation) in your sky mc.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Dec 17, 2014 Dec 17, 2014

Thanks Kglad

I had tried that, and the snowflakes are falling just as they did before, the entire stage, and not just in the widesceen movie clip?

they are being attached in the sky clip why would they be seen outside the wide

screen (the stage?)

I did put a trace for the size of the sky clip and the widescreen to see what the code was seeing for its height. they kept changing It shoud be static number

I'm more confused than I was before, Any suggestions on why its not working

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 17, 2014 Dec 17, 2014

again, and then comment out those swapDepths() statements unless needed and change the _x,_y values of the particles so they start and stay (ie, edit precipitation) in your sky mc.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Dec 17, 2014 Dec 17, 2014

Got it to work!

ThANKS!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 17, 2014 Dec 17, 2014
LATEST

you're welcome.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines