pAge = Allocate(1) ; -- Allocate a parameter representing age.
-- Set the particle texture
SetTexture("star.png");
SetBlendMode(kBlendAdditiveAlpha);

SetNumParticles(20);    -- Create some particles
-- pVelocity:Init( f2dRadius( 40) * fRange( 0.6,0.6));
if not dPos then
  dPos = Vec2( 1, 1)
end
pPosition:Init(  dPos + f2dRadius( 1 ) * fRange( 0,50)  );
pColor:Init( Color(1,1,1,1) );
pScale:Init( fRange( 0.25, 0.5) );
pAge:Init( 0 ) ;

-- Fade the particles.

pAge:Anim( pAge+fAge() );
pColor:Anim( fFade( pAge, Color(1,1,1,1), 300, Color(0,0,0,0) ) );
pPosition:Anim( pPosition  );
-- Expire particles wich faded out completelly.

Anim(  fExpire(  fGreater( pAge, 300 )  )  ) ;

-- A function to run as we're executing
-- seconds - how many seconds have elapsed
gActive =false;
function Update(seconds)
   -- Create 20 particle per second
   if gActive then
      CreateParticles( seconds * 10 );
   end
end

