mEmitSpeed = GUI_Slider(
	0.20,
      "Emitter Speed",
      0,100);

mRadius = GUI_Slider(
	512.00,
      "Radius",
      0,600);

mStartSpeed = GUI_Slider(
	50.00,
      "Start Speed",
      0,500);

mGravity = GUI_Slider(
	500.00,
      "Gravity",
      0,500);

mScale = GUI_Slider(
   0.90,
   "Scale",
   0,3);

mTextureName = GUI_PickTexture("fx/world5/falling_drop","Particle Texture");

mBlendMode = GUI_Select(
   kBlendNormal,
      "Blend Mode",
      {
         { description="Normal", value=kBlendNormal},
         { description="Additive", value=kBlendAdditiveAlpha}
      }
);

-- ------------------------------------------------------------
-- Globals

gActive = true;

-- ------------------------------------------------------------
-- Define our particle characteristics
pVelocity = Allocate(2);
pFadeStart = Allocate(1);

SetTexture(mTextureName);
SetBlendMode(mBlendMode);

SetNumParticles(64);

-- ------------------------------------------------------------
-- Initialization rules.
-- 
-- The following rules define how particles are created.

if not dLocus then
   dLocus= Vec2(0,0) ; 
end

pPosition:Init(Vec2(fRange(-mRadius,mRadius), 0) + dLocus);
pVelocity:Init(Vec2(0, mStartSpeed));
pScale:Init(mScale);
pColor:Init(Color(1, 1, 1, 1));
pFadeStart:Init(fPick(200, 250));

-- ------------------------------------------------------------
-- Particle Parameter Animation Functions
--
-- The following rules define how particles animate.
-- Each rule is applied on each frame of animation.
pPosition:Anim(pPosition + fTimeScale(pVelocity));
pVelocity:Anim(pVelocity + Vec2(0, fTimeScale(mGravity)))
pColor:Anim( 
   fFade( pPosition[2],
      Color(1,1,1,1), pFadeStart,
      Color(1,1,1,1), 50,
      Color(1,1,1,0) )
   );

-- General Anim functions
Anim( fExpire( fGreater(pPosition[2], 300) ) );

-- ------------------------------------------------------------

-- A function to run as we're executing
-- seconds - how many seconds have elapsed

function Update(seconds)
   if gActive then
     CreateParticles(seconds * mEmitSpeed);
   end -- gActive
end

