---------------------------------------------------------------------
--   Author: Xavier Richter
--   Copyright (c) GIMAGIN 2009, All Rights Reserved.
---------------------------------------------------------------------

-- Set the particle texture
pAge = Allocate(1);
pDirection = Allocate(1);

SetTexture("fx/images/etincelle");
SetBlendMode(kBlendNormal);

SetNumParticles(3);    -- Create some particles

pPosition:Init( fRange( Vec2(-40,-10), Vec2(40,40) ) + dLocus);
pColor:Init( Color(1,1,1,1) );
pScale:Init( fRange(0.1,0.25) );
pAge:Init(0);
pDirection:Init(fRange(-5,5));

-- Move the particles
pAge:Anim(pAge + fAge());
pPosition:Anim( pPosition + fTimeScale( Vec2(pDirection,3) ))  ;


pColor:Anim(fFade(pAge,Color(1,1,1,0),300,fPick(Color(1,1,1,1),Color(1,1,1,0.4)),3450,Color(1,1,1,1),250,Color(1,1,1,0))    );

-- Expire particles lower than 300
Anim( fExpire( fGreater(pAge,4000) ) );

function Update(seconds)
   -- Create 10 particles per second
   CreateParticles( seconds * 1);
end

