mEmitSpeed = GUI_Slider(
   12.00,
      "Emitter Speed",
      0,200);

mScale = GUI_Slider(
   0.36,
      "Initial Scale",
      0,3.0);

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

mMaxParticles = GUI_Slider(
   30.00,
      "Max Particles",
      0,100);

-- ------------------------------------------------------------
-- Define our particle characteristics
pVelocity = Allocate(2) ; 
pAge = Allocate(1) ; 
pSpin = Allocate(1); 
pSpinSpeed = Allocate(1); 
pLifeTime = Allocate(1);

SetTexture("highlight");
SetBlendMode(mBlendMode);
SetNumParticles(mMaxParticles);

 -- ------------------------------------------------------------
 -- Initialization rules.
pPosition:Init(fRange(Vec2(-20, -20), Vec2(20, 20)));
pVelocity:Init(fRange(Vec2(-5, -5), Vec2(5, 5)));
pScale:Init(mScale);
pAge:Init(0);
pSpin:Init(fRange(0, 2 * 3.1415927));
pSpinSpeed:Init(fRange(-1.5, 1.5));
pLifeTime:Init(fRange(1500, 4000));

-- ------------------------------------------------------------
-- Particle Parameter Animation Functions
pPosition:Anim(pPosition + fTimeScale(pVelocity));
pScale:Anim(pScale + fTimeScale(0.11));
pColor:Anim(fFade(pAge, Color(1, 0, .5, 0), pLifeTime * 0.30,
                  Color(0, 0, 0, 0.8), pLifeTime * 0.30, 
                   Color(1, 1, 1, 0.8), pLifeTime * 0.30, 

               Color(0, 1, .5, 0)));

pSpin:Anim(pSpin + fTimeScale(pSpinSpeed));
pUp:Anim(f2dRotation(pSpin));

pAge:Anim(pAge + fAge());
Anim(fExpire(fGreater(pAge, pLifeTime)));

-- ------------------------------------------------------------
gActive = true

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