I made a small test program for particles. But is doesn't work properly. The particles disappear behind the background/
The problem I have is somewhat simular to this:
http://code.google.com/p/agk/issues/detail?id=400
I narrowed it down to these 2 instructions:
SetSpriteDepth(sID, 0)
SetSpriteColor( sID, 255, 255, 255, 40)
Which is not what I want as the background picture alpha is too low for me.
I would expect that SetSpriteDepth(sID, 10000) would solve my problem but it doesn't.
If I don't use a background picture then everything works fine.
Advice anyone?
SetVirtualResolution ( 320, 480 )
iID = LoadImage( "background1.jpg" )
sID = CreateSprite( iID )
SetSpriteSize( sID, 320, 480 )
// SetSpriteDepth partly determines if particles are visible
// 10 and higher only give flashes on screen
SetSpriteDepth(sID, 0)
// alpha of SetSpriteColor must be lower than 255,
// otherwise picture covers(?) particles
SetSpriteColor( sID, 255, 255, 255, 40)
iID = LoadImage ( "ball1.png" )
x = 150
y = 50
pID = CreateParticles ( x, y )
SetParticlesImage ( pID, iID )
SetParticlesSize ( pID, 8 )
SetParticlesFrequency ( pID, 500 )
SetParticlesLife ( pID, 5.5 )
SetParticlesStartZone ( pID, -20, 0, 0, 20 )
SetParticlesDirection ( pID, 30, -20 )
SetParticlesAngle ( pID, 360 )
AddParticlesForce ( pID, 2.0, 3, 0, 200 )
AddParticlesColorKeyFrame ( pID, 0.0, 255, 255, 255, 128 )
AddParticlesColorKeyFrame ( pID, 1.0, 255, 0, 0, 128 )
AddParticlesColorKeyFrame ( pID, 2, 255, 0, 255, 0 )
SetParticlesMax ( pID, 450)
do
printc( " pID=" + str(pID) )
if GetParticlesExists( pID ) = 0
print (" GONE")
else
reached = GetParticlesMaxReached(pID)
printc( " reached=" + str(reached) )
print (". Still alive")
if reached = 1
DeleteParticles(pID)
endif
endif
sync ( )
loop