include "window.inc"
Window "",400,800,1
include "Fernsprite.inc"
CreateFern
ColorKey 0,0,0

int x[1000]
int y[1000]
int Xv[1000]
int Yv[1000]
int LifeSpan[1000]
int Xstart,Ystart,i,j,drop,bunt


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

Sub drop(sys x,y,ra,rb,r,g,b)       
int iBrush,iPen,c
c=b*0x10000+g*0x100+r
iBrush = CreateSolidBrush c
iPen=CreatePen -1,-1,c
SelectObject bHdc, iBrush
SelectObject bHdc, iPen
Ellipse bHdc,x,y,x+ra,y+rb
DeleteObject iBrush
DeleteObject iPen
End Sub

single pp=0.3
sys rx,ry,rb,rc,px,py,spla

ParticleInit()

while asckey=0 and WinExit=0

'SKY

for y=0 to 749
  line 0,y,399,y,0xffffffff,10,10,y*pp
next

'WATER

for y=750 to 799
  line 0,y,399,y,0xffffffff,0,200,200
next


For i=0 To 999
px=x[i]
py=y[i]
if py>750 then spla=1
rx=rand(14,16)
ry=rand(12,24)
'oval px,py,rx,ry,0,200,220
drop px,py,rx,ry,0,200,220
rb=rand(6,12)
rc=rand(6,12)
line px+rb,py+rb,px+rc,py+rc,0xffffffff,0xff,0xee,0xaa
line px+rb,py+rc,px+rc,py+rb,0xffffffff,0xff,0xee,0xaa
x(i) = x(i) + Xv(i)
y(i) = y(i) + Yv(i)
Yv(i) = Yv(i) + 0.96
iF y(i) >= Height Then  
   Yv(i) = Yv(i)-(Yv(i) * 0.46)
   y(i)  = Height
End iF
LifeSpan(i) = LifeSpan(i) -1
iF LifeSpan(i) <=0 Then
   LifeSpan(i) = Rand(1,500)
   x(i) = Xstart
   y(i) = Ystart
   Yv(i) = Rand(1,4)
   Xv(i) = Rand(1,8) 
End iF
Next

if spla then
  for j=0 to 80 step 5
    py=745
    px=j*5+rand(0,20)
    drop px,py,32,12,0,200,220
  next
end if

  FernCopy -100,300,300,470,420,470
  FernCopy 0,400,300,470,420,470
  FernCopy 100,350,300,470,420,470
Events
FlipBuffer
WaitFPS 60
Wend
DeleteFern
WinEnd

