autocam off
Sync On
set camera range 1,10000
color backdrop rgb(100,100,250)
 
fog on
fog color rgb(100,100,250)
fog distance 450
 
numberofclouds=400
cloudseed=freeobject()
create_clouds(cloudseed,numberofclouds)
 
do
control camera using arrowkeys 0,0.1,1
 
move_clouds(cloudseed,numberofclouds)
text 0,0,str$(screen fps())
 
sync
loop
 
function create_clouds(cloudseed,numberofclouds)
 
create bitmap 1,50,50
ink rgb(255,255,200),0
for x=1 to 1000
   ang=rnd(360)
   rad=rnd(20)
   box 25+sin(ang)*rad,25+cos(ang)*rad,rnd(3)+25+sin(ang)*rad,rnd(3)+25+cos(ang)*rad
next x
blur bitmap 1,4
cloudimage = freeimage()
get image cloudimage, 0, 0, 50, 50
 
delete bitmap 1
 
 
for cloudnumber=cloudseed to cloudseed+numberofclouds
make object plain cloudnumber,rnd(50)+100,rnd(50)+100
position object cloudnumber,rnd(1000)-500,rnd(100)+10,rnd(1000)-500
xrotate object cloudnumber,90
texture object cloudnumber,cloudimage
`set object transparency cloudnumber,4
`set alpha mapping on cloudnumber,50
ghost object on cloudnumber,0
disable object zwrite cloudnumber
set object light cloudnumber,0
next n
 
endfunction
 
function move_clouds(cloudseed,numberofclouds)
 
for cloudnumber=cloudseed to cloudseed+numberofclouds
move object down cloudnumber,-.05
if object position z(cloudnumber)<-500 then position object cloudnumber,rnd(1000)-500,rnd(100)+10,500
next cloudnumber
 
endfunction
 
 
function freeobject()
   repeat
      inc n
   until object exist(n) = 0
endfunction n
 
function freeimage()
   repeat
      inc n
   until image exist(n) = 0
endfunction n