simple clouds (Image heavy)

Miscellaneous Forums/Graphics Showcase/simple clouds (Image heavy)







cloudtexture(4)=LoadTexture("skins\cloud4.png",2)
Global cloudcount=200
Global cloudHeight=200
Global cloudcos#
Global cloudCOSDIR=1
PositionEntity cloudpivot,0,Cloudheight,0
PositionEntity cloudpivot2,0,cloudheight,0

Type cloud
 Field ent
 End Type

Function initclouds()
For I=1 To cloudcount
 cloud.cloud=New cloud
 tp=Rand(1,2)
 If tp=1 Then 
 cloud\ent=CreateSprite(cloudpivot)
 cn=Rand(1,5)
 Else
 cloud\ent=CreateSprite(cloudpivot2)
 EndIf
 EntityTexture cloud\ent,cloudtexture(Rand(1,4))
 EntityBlend cloud\ent,0
 sc#=Rnd(50,130)

 ScaleSprite cloud\ent,sc,sc 
 cr=Rand(190,250)
 EntityColor cloud\ent,cr,cr,cr
 PositionEntity cloud\ent,Rand(-600,600),Rand(cloudheight-80,cloudheight+80),Rand(-600,600)
 EntityAutoFade cloud\ENT,0,900
 Next
End Function

Function updateclouds()
 cloudCOS#=cloudCOS#+Rnd(1,2)
 TurnEntity cloudPIVOT,0,.012,0
 TurnEntity cloudPIVOT2,0,-.01,0
End Function

Function setstormy()
AmbientLight 150,150,225
For cloud.cloud=Each cloud
 sc#=Rnd(10,70)
 cr=Rand(100,200)
 cg=Rand(100,200)
 cb=Rand(200,255)
 EntityColor cloud\ent,cr,cg,cb
 Next
End Function

Function SetClear()
AmbientLight 255,255,255
For cloud.cloud=Each cloud
 sc#=Rnd(10,70)
 cr=Rand(200,250)
 EntityColor cloud\ent,cr,cr,cr
 Next
End Function

Function freeclouds()
 For cl.cloud=Each cloud
   FreeEntity cl\ent
   Delete cl
   Next
End Function

The simple cloud setup plops clouds at a given height above your scene at a given range, and given density., and with a call to update them. they move about gently. simple calls can change the color as well to represent stormy ect.