include "sdl.inc"

SEtDisplay 1024,768,1
SetCaption "VULCAN PARTICLES"

Dim x(1000)  as sys 
Dim y(1000)  as sys 
Dim Xv(1000) as single
Dim Yv(1000) as single
Dim LifeSpan(1000) as sys 
sys Xstart,Ystart,i,bild

Sub ParticleInit()
Xstart = Width  /15
Ystart = Height /15
For i=0 To 1000
    LifeSpan(i) = Rand(1,600)
    X(i)  = Xstart
    Y(i)  = Ystart
    Yv(i) = Rand(1,4)
    Xv(i) = Rand(1,8) 
Next 
End Sub

ParticleInit
While Key(27)=0
ClsColor 5,5,5
For i=0 To 1000
Ellipse x(i),y(i),16,16, Rand(64,128),rand(128,255),255
Ellipse x(i)+300,y(i),16,16,Rand(64,128),rand(128,255),255
'Setpixel x(i),y(i), Rand(64,128),rand(128,255),255
'SetPixel x(i)+300,y(i),Rand(64,128),rand(128,255),255

x(i)  = x(i) + Xv(i)
y(i)  = y(i) + Yv(i)
Yv(i) = Yv(i) + .2
If y(i) >= Height  
   Yv(i) = Yv(i)-Yv(i) * Rand(2,16) /8   
   y(i)  = Height
End iF
LifeSpan(i) = LifeSpan(i) -1
If LifeSpan(i) <=0 
   LifeSpan(i) = Rand(1,600)
   x(i)  = Xstart
   y(i)  = Ystart
   Yv(i) = Rand(1,4)
   Xv(i) = Rand(1,8) 
End iF
Next 
'Text font,800,16,"Mathematics is fun!",ARGB(255,20,200,248)
Flip
SetFps 60
Wend
Ends 