Set Display Mode 1280,960,32
Hide Mouse
Color Backdrop 0
Set Ambient light 20
Set Point Light 0,0,0,0
Position Light 0,2000,90,90
Color Light 0,RGB(255,204,204)
Set Light Range 0,10000
sync on : sync rate 60 : Color Backdrop rgb(0,0,0)
set camera range 0,.5,7000
Position Camera 0,0,0,0
Autocam off
Set Image Colorkey 0,0,0
Randomize Timer()
 
Text$="Please wait... Creating world for PLANET STORM!"
Create Bitmap 1,Text Width(Text$)+5,Text Height(Text$)+5
Set Cursor 0,0
Ink RGB(231,223,84),0
Print Text$
Get Image 100,0,0,BitMap Width(),BitMap Height()
Delete Bitmap 1
Set Current Bitmap 0
Sprite 1,25,25,100
Sync
Sleep 5000
Delete Sprite 1
 
CreateStarField()
CreatePlanet()
CreateClouds()
 
Make Object Sphere 4,1000,50,50
Texture Object 4,4
Make Object Sphere 5,1050,50,50
Texture Object 5,5
Ghost Object On 5
Fade Object 5,80
Position Object 4,-300,-80,3000
Position Object 5,-300,-80,3000
Make Object Sphere 6,1010,50,50
Texture Object 6,5
Ghost Object On 6
Fade Object 6,70
Position Object 6,-300,-80,3000
 
Turn Object Right 4,60
Pitch Object Down 4,20
Turn Object Right 5,62
Pitch Object Down 5,22
Turn Object Right 6,58
Pitch Object Down 6,18
Turn Object Right 6,170
 
 
Do
   Turn Object Right 4,.05
   Turn Object Right 5,.04
   Turn Object Right 6,.05
   If Rnd(200)=1 and Lightening<1
      Lightening=20
      Make Light 1
      Set Point Light 1,rnd(800)-700,Rnd(500)-220,2600
      Point Light 1,-300,-80,3000
   Endif
   If Lightening>0
      Color Light 1,Rgb(Rnd(255),Rnd(255),Rnd(255))
      Lightening=Lightening-1
      If Lightening<1
         Color Light 1,0
         Delete Light 1
      Endif
   Endif
   Sync
Loop
 
Function CreateClouds()
Create Bitmap 1,640,480
 
Ink rgb(rnd(100)+50,rnd(100)+50,rnd(100)+50),0
 
For j = 1 to rnd(80)+50
Ink rgb(rnd(55)+200,rnd(55)+200,rnd(55)+200),0
Radius1 = Rnd(30)+20
Radius2 = Rnd(30)+20
cx=rnd(640)-1
cy=rnd(480)-1
For i = 0 to 360 Step 2
   Radius1=Radius1+(Rnd(4)-2)
   Radius2=Radius2+(Rnd(4)-2)
   If Radius1<1 Then Radius1=1
   If Radius2<1 Then Radius2=1
   x#=Cos(i)*(Radius2)+cx
   y#=Sin(i)*(Radius1)+cy
   Line cx,cy,x#,y#
   If x#>639
      x#=x#-639
      Line 0,cy,x#,y#
   Endif
   If x#<0
      x#=x#+639
      Line 639,cy,x#,y#
   Endif
Next i
Next j
 
 
For i = 1 to 5
Blur Bitmap 1,6
Next i
 
Get Image 5,1,1,639,479
Set Current Bitmap 0
Delete Bitmap 1
EndFunction
 
Function CreatePlanet()
create bitmap 1,640,480
Ink rgb(10,10,240),1
 
For i = 0 to 480
   Line 0,i,640,i
Next i
 
For j = 1 to rnd(10)+7
Ink rgb(10,rnd(100)+50,10),1
Radius = Rnd(50)+25
cx=rnd(530)+55
cy=rnd(370)+55
For i = 0 to 720
   Radius=Radius+(Rnd(4)-2)
   x#=Cos(i/2)*(Radius)+cx
   y#=Sin(i/2)*(Radius)+cy
   Line cx,cy,x#,y#
   If x#>639
      x#=x#-639
      Line 0,cy,x#,y#
   Endif
   If x#<0
      x#=x#+639
      Line 639,cy,x#,y#
   Endif
Next i
Next j
For i = 1 to 5: Rem change back to 10
Blur Bitmap 1,6
Next i
Get Image 4,1,1,639,479
Set Current Bitmap 0
Delete Bitmap 1
EndFunction
 
Function CreateStarField()
create bitmap 1,1000,1000
For j = 1 to 3
For i = 1 to 1500
Ink rgb(200+rnd(55),200+rnd(55),200+rnd(55)),0
   Dot Rnd(1000),Rnd(1000)
Next i
Blur Bitmap 1,1
Next j
Get Image 16,0,0,999,950
Set Current Bitmap 0
Make Object Sphere 2, 10000
Texture Object 2,16
Scale Object Texture 2,8,8
Position Object 2,0,0,0
Set Object Light 2,0
Set Object Cull 2,0
Fade Object 2,1000
Delete Bitmap 1
Set Object Collision Off 2
CreateGas()
Get Image 2,1,1,639,479
Set Current Bitmap 0
Make Object Sphere 3,9000,50,50
Texture Object 3,2
Rem Scale Object Texture 3,.99,.99
Set Object Transparency 3,1
Set Object Cull 3,0
Ghost Object On 3
Set Object Light 3,0
Fade Object 3,20
Delete Bitmap 1
Set Object Collision Off 3
Rem Return Object 2 as Background Sphere (Starfield)
EndFunction
 
Function CreateGas()
Create Bitmap 1,640,480
 
Ink rgb(rnd(100)+50,rnd(100)+50,rnd(100)+50),0
 
For j = 1 to rnd(25)+25
Ink rgb(rnd(100)+50,rnd(100)+50,rnd(100)+50),0
Radius1 = Rnd(10)+10
Radius2 = Rnd(10)+10
cx=rnd(640)-1
cy=rnd(480)-1
For i = 0 to 360 Step 5
   Radius1=Radius1+(Rnd(2)-1)
   Radius2=Radius2+(Rnd(4)-2)
   If Radius1<1 Then Radius1=1
   If Radius2<1 Then Radius2=1
   x#=Cos(i)*(Radius2)+cx
   y#=Sin(i)*(Radius1)+cy
   Line cx,cy,x#,y#
   If x#>639
      x#=x#-639
      Line 0,cy,x#,y#
   Endif
   If x#<0
      x#=x#+639
      Line 639,cy,x#,y#
   Endif
Next i
Next j
 
 
For i = 1 to 3
Blur Bitmap 1,6
Next i
 
EndFunction