REM Project: Spider REM Created: 11/20/2007 4:56:10 AM REM REM ***** Main Source File ***** REM Global camera_x# : Global camera_y# Global shift$ = "In Progress..." Global stage1$ = "In Progress..." Global stage2$ = "In Progress..." Global root_obj Global _time Global exec Global exec2 _time = Timer() ` For Timing Stages display_mode() create_objects() position camera 0,7,-20 do transform() rotate_camera() the_timer() Sync loop Function create_objects() Global _abdomen Global _fovea Global l_abdomen _fovea = free_object() make object sphere _fovea,1.5 : scale object _fovea,150,100,100 Make Mesh From Object 1000,_fovea Delete Object _fovea Make Object _fovea,1000,0 Delete Mesh 1000 position object _fovea,3,0,0 : color object _fovea,rgb(255,255,0) _abdomen = free_object() make object sphere _abdomen,5,20,20 scale object _abdomen,100,75,80 Make Mesh From Object 1000,_abdomen Delete Object _abdomen root_obj = _fovea l_abdomen = free_limb(root_obj) Add Limb _fovea,l_abdomen,1000 Delete Mesh 1000 Color Limb _fovea,l_abdomen,rgb(255,225,0) Offset Limb _fovea,l_abdomen,-1.5,0,0 Make Object Sphere 1000,0.35 Make Mesh From Object 1000,1000 Delete Object 1000 Make Object Cylinder 1000,0.3 Scale Object 1000,100,900,100 Make Mesh from Object 1001,1000 `Mesh 1000 will be our first segmented legs Delete Object 1000 dim _joint(9) ` Create first set of joints dim s1_leg(9) dim _joint2(9) dim s2_leg(9) for i = 1 to 8 _joint(i) = free_limb(root_obj) Add Limb _fovea,_joint(i),1000 : color limb _fovea,_joint(i),RGB(255,225,0) offset limb _fovea,_joint(i),0,(i*0.5) + 2,0 s1_leg(i) = free_limb(root_obj) Add Limb _fovea,s1_leg(i),1001 Link Limb _fovea,_joint(i),s1_leg(i) offset limb _fovea,s1_leg(i),0,1.4,0 color limb _fovea,s1_leg(i),RGB(255,225,0) _joint2(i) = free_limb(root_obj) Add Limb _fovea,_joint2(i),1000 : color limb _fovea,_joint2(i),RGB(255,225,0) Link limb _fovea,s1_leg(i),_joint2(i) : offset limb _fovea,_joint2(i),0,1.3,0 s2_leg(i) = free_limb(root_obj) Add Limb _fovea,s2_leg(i),1001 Link Limb _fovea,_joint2(i),s2_leg(i) scale limb _fovea,s2_leg(i),100,150,100 offset limb _fovea,s2_leg(i),0,2.1,0 color limb _fovea,s2_leg(i),RGB(255,225,0) next i Delete Mesh 1000 offset limb _fovea,_joint(1),-0.50,0,-0.6 ` Right Side Joints offset limb _fovea,_joint(2),-0.25,0,-0.65 offset limb _fovea,_joint(3),0,0,-0.7 offset limb _fovea,_joint(4),0.25,0,-0.65 offset limb _fovea,_joint(5),-0.50,0,0.6 ` Left Side Joints offset limb _fovea,_joint(6),-0.25,0,0.65 offset limb _fovea,_joint(7),0,0,0.7 offset limb _fovea,_joint(8),0.25,0,0.65 REM ------------------- LEGS DEFAULT ------------------------------- Rotate Limb _fovea,_joint(1),-92,91,0 ` Legs Default Rotate Limb _fovea,_joint(2),-96,79,0 Rotate Limb _fovea,_joint(3),49,-66,0 Rotate Limb _fovea,_joint(4),-48.5,90.5,0 Rotate Limb _fovea,_joint(5),-100,104,0 Rotate Limb _fovea,_joint(6),-69,108,0 Rotate Limb _fovea,_joint(7),51,-93,0 Rotate Limb _fovea,_joint(8),62.5,-97,0 Rotate Limb _fovea,_joint2(1),-172.5,67.5,0 Rotate Limb _fovea,_joint2(2),-170.5,82,0 Rotate Limb _fovea,_joint2(3),-79.5,154.5,0 Rotate Limb _fovea,_joint2(4),-78,0,0 Rotate Limb _fovea,_joint2(5),-180,19.5.5,0 Rotate Limb _fovea,_joint2(6),171.5,52,0 Rotate Limb _fovea,_joint2(7),87,0,0 Rotate Limb _fovea,_joint2(8),74,9.5,0 for i = 1 to 8 Hide Limb _fovea,s2_leg(i) : Hide Limb _fovea,_joint2(i) : Hide Limb _fovea,s1_leg(i) next i REM ---------------------------------------------------------------- REM ------------------- LEGS FLARED ------------------------------- RemStart Rotate Limb _fovea,_joint(1),-63.5,23.5,0 ` Legs Flared Rotate Limb _fovea,_joint(2),-66.5,-2.5,0 Rotate Limb _fovea,_joint(3),-69,-34,0 Rotate Limb _fovea,_joint(4),-83.5,-80.5,0 Rotate Limb _fovea,_joint(5),63.5,-23.5,0 Rotate Limb _fovea,_joint(6),66.5,2.5,0 Rotate Limb _fovea,_joint(7),69,34,0 Rotate Limb _fovea,_joint(8),83.5,80.5,0 Rotate Limb _fovea,_joint2(1),-78.5,27.5,0 Rotate Limb _fovea,_joint2(2),-66.5,-2.5,0 Rotate Limb _fovea,_joint2(3),-69,-34,0 Rotate Limb _fovea,_joint2(4),-36.5,-5,0 Rotate Limb _fovea,_joint2(5),78.5,-27.5,0 Rotate Limb _fovea,_joint2(6),66.5,2.5,0 Rotate Limb _fovea,_joint2(7),69,34,0 Rotate Limb _fovea,_joint2(8),36.5,5,0 RemEnd REM ---------------------------------------------------------------- endfunction Function free_image() repeat inc n until image exist(n) = 0 endfunction n Function free_object() repeat inc n until object exist(n) = 0 endfunction n Function free_limb(root_obj) repeat inc n until limb exist(root_obj,n) = 0 endfunction n Function display_mode() Set Display Mode 1024,768,32 Hide Mouse Autocam off Sync Rate 70 Color Backdrop 0 Sync On make light 1 position light 1,30,10,-10 set light range 1,100 endfunction function rotate_camera() camradius#=20 if 0 global camangle# endif inc camangle#,0.1 camx#=camradius#*cos(camangle#) camz#=camradius#*sin(camangle#) camy#=35 position camera camx#,camy#,camz# point camera 0,0,0 endfunction function transform() transform_elapsed = the_timer() if shift$ <> "Complete" And transform_elapsed >= 5 Then color_shift() if shift$ = "Complete" And stage1$ <> "Complete" then stage_one() if stage1$ = "Complete" then stage_two() endfunction function stage_one() ` Moves the abdomen to form the basic shape of the spider If 0 Then Global l_abdomen_x# if 0 Then Global l_abdomen_y# dec l_abdomen_x#,0.02 if l_abdomen_y# <= 0.5 Then inc l_abdomen_y#,0.01 Offset Limb _fovea,l_abdomen,l_abdomen_x#,l_abdomen_y#,0 if l_abdomen_x# <= -2.8 Then stage1$ = "Complete" endfunction function stage_two() for i = 1 to 8 Show Limb _fovea,s2_leg(i) Show Limb _fovea,_joint2(i) Show Limb _fovea,s1_leg(i) next i Dim _joint_x#(9) Dim _joint_y#(9) Dim _joint2_x#(9) Dim _joint2_y#(9) if exec2 = 0 for i = 1 to 8 _joint_x#(i) = Limb Angle X(_fovea,_joint(i)) _joint_y#(i) = Limb Angle Y(_fovea,_joint(i)) _joint2_x#(i) = Limb Angle X(_fovea,_joint2(i)) _joint2_y#(i) = Limb Angle Y(_fovea,_joint2(i)) next i exec2 = 1 endif if Limb Angle X (_fovea,_joint(1)) <= -63.5 Then Inc _joint_x#(1),0.2 if Limb Angle Y (_fovea,_joint(1)) >= 23.5 Then Dec _joint_y#(1),0.2 if Limb Angle X (_fovea,_joint(2)) <= -66.5 Then Inc _joint_x#(2),0.2 if Limb Angle Y (_fovea,_joint(2)) >= -2.5 Then Dec _joint_y#(2),0.2 if Limb Angle X (_fovea,_joint(3)) >= -69 Then Dec _joint_x#(3),0.2 if Limb Angle Y (_fovea,_joint(3)) <= -34 Then Inc _joint_y#(3),0.2 if Limb Angle X (_fovea,_joint(4)) >= -83.5 Then Dec _joint_x#(4),0.2 if Limb Angle Y (_fovea,_joint(4)) >= -80.5 Then Dec _joint_y#(4),0.2 if Limb Angle X (_fovea,_joint(5)) <= 63.5 Then Inc _joint_x#(5),0.2 if Limb Angle Y (_fovea,_joint(5)) >= -23.5 Then Dec _joint_y#(5),0.2 if Limb Angle X (_fovea,_joint(6)) <= 66.5 Then Inc _joint_x#(6),0.2 if Limb Angle Y (_fovea,_joint(6)) >= 2.5 Then Dec _joint_y#(6),0.2 if Limb Angle X (_fovea,_joint(7)) <= 69 Then Inc _joint_x#(7),0.2 if Limb Angle Y (_fovea,_joint(7)) <= 34 Then Inc _joint_y#(7),0.2 if Limb Angle X (_fovea,_joint(8)) <= 83.5 Then Inc _joint_x#(8),0.2 if Limb Angle Y (_fovea,_joint(8)) <= 80.5 Then Inc _joint_y#(8),0.2 if Limb Angle X (_fovea,_joint2(1)) <= -78.5 Then Inc _joint2_x#(1),0.2 if Limb Angle Y (_fovea,_joint2(1)) >= 27.5 Then Dec _joint2_y#(1),0.2 if Limb Angle X (_fovea,_joint2(2)) <= -66.5 Then Inc _joint2_x#(2),0.2 if Limb Angle Y (_fovea,_joint2(2)) >= -2.5 Then Dec _joint2_y#(2),0.2 if Limb Angle X (_fovea,_joint2(3)) <= -69 Then Inc _joint2_x#(3),0.2 if Limb Angle Y (_fovea,_joint2(3)) >= -34 Then Dec _joint2_y#(3),0.2 if Limb Angle X (_fovea,_joint2(4)) <= -36.5 Then Inc _joint2_x#(4),0.2 if Limb Angle Y (_fovea,_joint2(4)) >= -5 Then Dec _joint2_y#(4),0.2 if Limb Angle X (_fovea,_joint2(5)) <= 78.5 Then Inc _joint2_x#(5),0.2 if Limb Angle Y (_fovea,_joint2(5)) >= -27.5 Then Dec _joint2_y#(5),0.2 if Limb Angle X (_fovea,_joint2(6)) >= 66.5 Then Dec _joint2_x#(6),0.2 if Limb Angle Y (_fovea,_joint2(6)) >= 2.5 Then Dec _joint2_y#(6),0.2 if Limb Angle X (_fovea,_joint2(7)) >= 69 Then Dec _joint2_x#(7),0.2 if Limb Angle Y (_fovea,_joint2(7)) <= 34 Then Inc _joint2_y#(7),0.2 if Limb Angle X (_fovea,_joint2(8)) >= 36.5 Then Dec _joint2_x#(8),0.2 if Limb Angle Y (_fovea,_joint2(8)) >= 5 Then Dec _joint2_y#(8),0.2 for i = 1 to 8 rotate limb _fovea,_joint(i),_joint_x#(i),_joint_y#(i),0 rotate limb _fovea,_joint2(i),_joint2_x#(i),_joint2_y#(i),0 next i endfunction function color_shift() if 0 Global rr# Global gg# Global bb# Global r2# Global g2# Global b2# endif if exec = 0 rr# = 255 : gg# = 225 : bb# = 0 r2# = 255 : g2# = 225 : b2# = 0 exec = 1 endif color object l_abdomen,rgb(rr#,gg#,bb#) : color object _fovea,rgb(r2#,g2#,b2#) if rr# >= 141 Then dec rr#,0.2 if gg# >= 54 Then dec gg#,0.3 if r2# >= 141 then dec r2#,0.2 if g2# >= 54 then dec g2#,0.3 if g2# <= 54 Then shift$ = "Complete" endfunction shift$ function the_timer() if 0 Then Global _elapsed _elapsed = (Timer()-_time)/1000 endfunction _elapsed