`Fractal Tree Basics by Tinkergirl - feel free to learn from and rip apart.
 
Randomize Timer()
 
backdrop on: color backdrop rgb(128,128,255)
autocam off
 
`Randomise some angles for rotation later.  As we have two branches per layer, we need 2 sets of angles.
angle1x# = rnd(45)
angle1y# = rnd(45)
angle1z# = rnd(45)
angle2x# = rnd(45)-90
angle2y# = rnd(45)
angle2z# = rnd(45)
 
make object plain 1,200,200
color object 1,rgb(0,128,0)
rotate object 1,-90,0,0
position camera 0,0,10,0
 
`Make the little helper mesh object.  (This could be hidden)  Acts as a remote pivot for limbs.
Helper = 1
make object cube 100,0.5
make mesh from object Helper,100
delete object 100
 
`Make a limb mesh.
LimbMesh = 2
make object box 101,1.5,10,1.5
make mesh from object LimbMesh,101
delete object 101
 
`Make the tree object that we will attach our limbs to.
Global Tree = 200
make object box Tree,2,20,2
position object Tree,10,10,60
color object Tree,rgb(255,128,0)
 
`Where all the limbs are added, see below for the ordering of the limbs.
`DB likes to have the limbs added in a very particular order.
 
`We add a helper limb for each branch and offset it to the top of the parent limb (half the limb height)
add limb Tree,1,Helper
link limb Tree,0,1
offset limb Tree,1,0,10,0
 
`We then add the tree branch to the helper limb.  This makes rotating the limbs a cinch.  (Thanks to Nicholas)
add limb Tree,2,LimbMesh
link limb Tree,1,2
offset limb Tree,2,0,5,0
color limb Tree,2,rgb(255,128,0)
 
`Rotate the limb, depening on whether it's a '2' style or a '1' style limb.
rotate limb Tree,1,angle1x#,angle1y#,angle1z#
 
add limb Tree,3,Helper
link limb Tree,2,3
offset limb Tree,3,0,5,0
 
add limb Tree,4,Limbmesh
scale limb Tree,4,75,75,75
link limb Tree,3,4
offset limb Tree,4,0,(5*0.75),0
color limb Tree,4,rgb(255,128,0)
 
rotate limb Tree,3,angle1x#,angle1y#,angle1z#
 
add limb Tree,5,Helper
link limb Tree,2,5
offset limb Tree,5,0,5,0
 
add limb Tree,6,Limbmesh
scale limb Tree,6,75,75,75
link limb Tree,5,6
offset limb Tree,6,0,(5*0.75),0
color limb Tree,6,rgb(255,128,0)
 
rotate limb Tree,3,angle2x#,angle2y#,angle2z#
 
add limb Tree,7,Helper
link limb Tree,0,7
offset limb Tree,7,0,10,0
 
add limb Tree,8,LimbMesh
link limb Tree,7,8
offset limb Tree,8,0,5,0
color limb Tree,8,rgb(255,128,0)
 
rotate limb Tree,7,angle2x#,angle2y#,angle2z#
 
add limb Tree,9,Helper
link limb Tree,8,9
offset limb Tree,9,0,5,0
color limb Tree,9,rgb(255,255,0)
 
add limb Tree,10,Limbmesh
scale limb Tree,10,75,75,75
link limb Tree,9,10
offset limb Tree,10,0,(5*0.75),0
color limb Tree,10,rgb(255,128,0)
 
rotate limb Tree,9,angle1x#,angle1y#,angle1z#
 
add limb Tree,11,Helper
link limb Tree,8,11
offset limb Tree,11,0,5,0
 
add limb Tree,12,Limbmesh
scale limb Tree,12,75,75,75
link limb Tree,11,12
offset limb Tree,12,0,(5*0.75),0
color limb Tree,12,rgb(255,128,0)
 
rotate limb Tree,11,angle2x#,angle2y#,angle2z#
 
 
sync on
sync rate 60
 
 
`**********************************
do
 
control camera using arrowkeys 0,0.25,0.75
 
 
turn object left Tree,0.1
sync
loop
`**********************************
 
 
remstart
 
     6     10
    /       \
-4-35       911-12-
    \       /
     2     8
      \   /
       1_7
        
        
       0
        
 
remend