Sync On: Sync Rate 60:Autocam Off
Tree(1)
Set Object Emissive 1,Rgb(50,100,50)
 
Position Object 1,0,-1.8,8
Do
   Turn Object Right 1,.2
   Sync
Loop
 
 
 
 
 
Function Branch()
   Ink 0,0
   Box 0,0,50,200
   Ink Rgb(100,80,0),0
   For i = 23 to 27
      Line 25,5,i,200
   Next i
   n=rnd(20)+rnd(20)+rnd(20)+rnd(20)+200
   For i = 1 to n
      Ink Rgb(0,Rnd(100)+100,0),0
      h=rnd(170)+25
      w=((h/3.5)-rnd(h/3.5))*(rnd(1)*2-1)
      Line 25,h,25+w,h-abs(w)
      `Line 25,h+1,25+w,h-abs(w)+1
   Next i
   Get Image 3,0,0,50,200,0
   cls
Endfunction
 
Function Tree(Obj)
   If Image Exist(4)=0
      Ink Rgb(150,80,0),0
      Box 0,0,40,200
      Get Image 4,0,0,40,200
   Endif
   If Image Exist(3)=0
      Branch()
   Endif
   Make Object Triangle Obj,-.3,-3,0,0,4.5,0,.3,-3,0
   Make Mesh From Object 1,Obj
   Add Limb Obj,1,1
   Rotate Limb Obj,1,0,90,0
   Make Mesh from Object 1,Obj
   Delete Object Obj
   Make Object Plain Obj,.2,1
   Offset Limb Obj,0,0,.45,0
   Pitch Object Down Obj,125
   Fix Object Pivot Obj
   Make Mesh From Object 2,Obj
   Delete Object Obj
   Make Object Obj,1,4
   branches=rnd(20)+rnd(20)+rnd(20)+rnd(20)+150
   For i=1 to branches
      Add Limb Obj,i,2
      Texture Limb Obj,i,3
      h#=rnd(400.0)/100.0+.5
      Scale Limb Obj,i,h#*80.0,h#*80.0,h#*80.0
      Offset Limb Obj,i,0,5.0-h#,0
      Rotate Limb Obj,i,Rnd(4)-2,Rnd(360),Rnd(4)-2
   Next i
   b=Free_Obj()
   Make Object Sphere b,.12,6,6
   Make Mesh from Object 3,b
   Delete Object b
   Color_Texture(11,Rgb(255,0,0))
   Color_Texture(12,Rgb(0,255,0))
   Color_Texture(13,Rgb(0,0,255))
   Color_Texture(14,Rgb(255,255,255))
   For i = 1 to rnd(20)+40
      Add Limb Obj,branches+i,3
      Texture Limb obj,branches+i,11+Rnd(3)
      h#=rnd(500.0)/100.0-.8
      Do
         if h#>rnd(500.0)/100.0-.8
            h#=h#-.05
         Else
            Exit
         Endif
      Loop
      m#=(4.8-h#)*.35
      i#=i
      a#=rnd(200.0)/10.0+i#*10.0
      Offset Limb obj,branches+i,Sin(a#)*m#,h#,Cos(a#)*m#
   Next i
   s=Free_Obj()
   Star(s)
   Make Mesh from Object 3,s
   Delete Object s
   Add Limb obj,branches+i,3
   Offset Limb obj,branches+i,0,4.7,0
   Color_Texture(15,Rgb(200,200,255))
   Texture Limb obj,branches+i,15
   Set Object Transparency Obj,branches+i
   Set Object Cull Obj,0
   Set object Emissive Obj,Rgb(150,150,150)
   Make Light 1
   Set Light Range 1,2
   Color Light 1,255,255,255
   Position Light 1,Limb Position X(obj,branches+i),Limb Position Y(obj,branches+i),Limb Position Z(obj,branches+i)-.5
Endfunction
 
Function Free_Obj()
   Do
      i=rnd(60000)
      if Object Exist(i)=0 Then Exit
   Loop
Endfunction i
 
Function Color_Texture(image,color as dword)
   Ink color,0
   Box 0,0,10,10
   Get Image image,0,0,10,10
Endfunction
 
Function Star(obj)
   Make Object Cone obj,.2
   Offset Limb obj,0,0,.1,0
   Scale Object obj,100,200,100
   Make Mesh from Object obj,obj
   Delete Object obj
   Make Object obj,obj,0
   Add Limb obj,1,obj
   Rotate Limb obj,1,180,0,0
   Add Limb obj,2,obj
   Rotate Limb obj,2,90,0,0
   Add Limb obj,3,obj
   Rotate Limb obj,3,-90,0,0
   Add Limb obj,4,obj
   Rotate Limb obj,4,0,0,90
   Add Limb obj,5,obj
   Rotate Limb obj,5,0,0,-90
Endfunction