-- Define our particle characteristics
pVelocity = Allocate(2) ; -- Allocate a Vec2 velocity member
pAge = Allocate(1) ; -- Allocate a TReal age member
pSpin = Allocate(1); -- Allocate a TReal spin member
pSpinSpeed = Allocate(1); -- Allocate a TReal spin member
pDead = Allocate(1);

-- Set the particle texture
SetTexture("etincelle");
SetBlendMode(kBlendNormal);

SetNumParticles(3600);    -- Create some particles

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

pPosition:Init(  Vec2(65,65) );
pVelocity:Init( fRange( Vec2(-200,-500), Vec2(200,-120) ) );
pColor:Init( Color(1,1,1,1) );
pScale:Init( 0.3 );
pAge:Init(0);
pSpin:Init( fRange( 0, 2*3.1415927 ) );
pSpinSpeed:Init( fRange( -10, 10 ) );
pDead:Init(1000); 
-- Explosion time is defined into TIMEEXPLOSION in FxInScore.h


pPosition:Anim( pPosition + fTimeScale(pVelocity) );
pPosition:Anim( pPosition );
pScale:Anim( pScale + fTimeScale(0.4) );
pVelocity:Anim( pVelocity + fTimeScale(Vec2(0,800)) );
pColor:Anim( fFade( pAge,Color(1,1,1,1),1000, Color(1,1,1,0) ) );
pSpin:Anim( pSpin + fTimeScale( pSpinSpeed ) );
pUp:Anim( f2dRotation( pSpin ) );
-- Add time to the age
pAge:Anim( pAge+fAge() );

Anim( fInScore());


-- Expire particles over 1500 ms old
Anim( fExpire( fGreater(pAge, pDead) ) );

-- Create an initial particle
CreateParticles( 0 );

gActive = 1  ;


-- A function to run as we're executing
-- seconds - how many seconds have elapsed
function Update(seconds)
   -- Create 10 particles per second
   if gActive > 0 then
		CreateParticles( 10 );
	else
		CreateParticles( 0 );
	end
end

