REM Project: knick-knack
REM Created: 11/7/2007 7:39:47 PM
REM
REM ***** Main Source File *****
REM
sync on:sync rate 60:sync
 
#constant MaxSwing = 45
#constant SwingSpeed = 3
 
make camera 1
 
move camera 1,-10
 
make object cylinder 1,1 `Makes center shaft
make mesh from object 2,1 `Makes a mesh of a cylinder for later limb use
scale limb 1,0,5,500,5   `Scales the shaft to make it long
 
`Makes a sphere mesh
make object sphere 2,.5
make mesh from object 1,2
delete object 2
 
`Makes a cylinder with two balls
add limb 1,1,1
add limb 1,2,1
 
scale limb 1,2,150,150,150 `Makes the bottom ball bigger
 
`Puts the balls at either end
offset limb 1,1,0,2.5,0
offset limb 1,2,0,-2.5,0
 
`Makes the first horizontal cross shaft
add limb 1,3,2
scale limb 1,3,10,250,10
rotate limb 1,3,0,0,90
 
`Makes the first sticking out shaft
add limb 1,4,2
scale limb 1,4,10,150,10
rotate limb 1,4,90,0,0
offset limb 1,4,-.75,0,-.75
 
`Makes the second sticking out shaft
add limb 1,5,2
scale limb 1,5,10,150,10
rotate limb 1,5,90,0,0
offset limb 1,5,.75,0,.75
 
`Makes annother shaft
add limb 1,6,2
scale limb 1,6,10,75,10
rotate limb 1,6,0,0,90
offset limb 1,6,-.375,0,-1.5
 
`Makes the shaft opposite the above shaft
add limb 1,7,2
scale limb 1,7,10,75,10
rotate limb 1,7,0,0,90
offset limb 1,7,.375,0,1.5
 
`Makes annother shaft
add limb 1,8,2
scale limb 1,8,10,100,10
rotate limb 1,8,90,0,0
offset limb 1,8,0,0,1.5
 
`Makes the one of the four final balls
add limb 1,9,1
 
`Makes the oposite ball
add limb 1,10,1
 
link limb 1,8,9
scale limb 1,9,1000,100,1000
offset limb 1,9,0,.5,0
 
link limb 1,8,10
scale limb 1,10,1000,100,1000
offset limb 1,10,0,-.5,0
 
`Makes the shaft opposite the above shaft
add limb 1,11,2
scale limb 1,11,10,100,10
rotate limb 1,11,90,0,0
offset limb 1,11,0,0,-1.5
 
`Makes the second to last ball
add limb 1,12,1
 
`Makes the final ball
add limb 1,13,1
 
link limb 1,11,12
scale limb 1,12,1000,100,1000
offset limb 1,12,0,-.5,0
 
link limb 1,11,13
scale limb 1,13,1000,100,1000
offset limb 1,13,0,.5,0
 
make object box 5,3,.2,5
 
move object down 5,3
 
make object cylinder 6,1
scale object 6,25,300,25
position object 6,-1.25,-1.5,0
make object cylinder 7,1
scale object 7,25,300,25
position object 7,1.25,-1.5,0
 
 
 
 
swing = 1
 
d1 = 1
d2 = 1
 
do
   sync
 
   angx = object angle x(1)
 
   if angx > MaxSwing or angx < -MaxSwing
      swing = -1*swing
   endif
 
   xrotate object 1,angx+SwingSpeed*swing
 
 
 
   rotate limb 1,8,limb angle x(1,8)+SwingSpeed*d1,0,0
   rotate limb 1,11,limb angle x(1,11)+SwingSpeed*d2,0,0
 
   wrap = wrapvalue(limb angle x(1,8))
 
   if wrap=90 or wrap = 270
      d1 = rnd(1)
      if d1 = 0
         d1 = -1
      endif
   endif
 
   wrap = wrapvalue(limb angle x(1,11))
 
   if wrap=90 or wrap = 270
      d2 = rnd(1)
      if d2 = 0
         d2 = -1
      endif
   endif
 
   if rightkey()
      turn camera left 1,90
      move camera 1,-1
      turn camera right 1,84.3
   endif
   if leftkey()
      turn camera right 1,90
      move camera 1,-1
      turn camera left 1,84.3
   endif
loop