
-- Rain parameters
kPPS = 600;               -- Number of particles generated per second
kGravity = 700 ;            -- Gravity in pixels/second/second

-- kBlendNormal
-- kBlendOpaque
-- kBlendAdditive
-- kBlendAdditiveAlpha
-- kBlendSubtractive
-- kBlendLit

function Init()
  SetTexture("flash");
  SetBlendMode(kBlendNormal);
  SetNumParticles(1);
end

floor = math.floor

ParticlesPerSecond = NewParticleGenerator();

StopSpouting = NewTimeout(5);
TestDone = NewTimeout(500);

function Update(ms)
  if (TestDone(ms)) then
    SetDone();
    return ;
  end
  local newParticles = ParticlesPerSecond( kPPS,ms );

  if (not StopSpouting(ms)) then
   InitPosition( "vRange", Vec3(1,0,0), Vec3(0,0,0) );
  -- InitVelocity( "vRange", Vec3(-100,-200,0), Vec3(100, -400, 0));
   InitScale( "fRange", .5, 5 );
   InitAge("iRange", 0, 8);
   InitExtra1("fRange",0,1);
   CreateParticles(1);
  end

--  Gravity(kGravity);

   Do("move");
   DoAge("iAge");
   DoScale("fScale",
      .1, 90, 
      2, 35
      );
   DoColor(
   "cFade",
   Color(1,1,1,1),40,
   Color(1,1,1,0.5),10);

   Do("expire", 175)

   --onDoUp( "vRotate", -.6, .6 );


end

