TGC Codebase Backup



limps by Zack V11

29th Sep 2008 1:15
Summary

sync on rem make an object make object box 1,100,100,100 rem make a cylinder shaped object to get the mesh for the limb from rem (note that the mesh number comes before the object



Description

sync on



rem make an object
make object box 1,100,100,100




rem make a cylinder shaped object to get the mesh for the limb from
rem (note that the mesh number comes before the object number on the make mesh from object command)
make object cylinder 2,100
make mesh from object 1,2
delete object 2

rem add a limb to the box object using the mesh from the cylinder (obj number, limb number, mesh number)
rem limbs must be created in sequence, 1,2,3,4 etc
add limb 1,1,1


rem rotate the limb
rotate limb 1,1,45,45,0

rem resize the limb
scale limb 1,1,50,150,50

rem adjust the position of the limb
offset limb 1,1,0,100,0






rem (set the object)
set object 1,1,1,0,1,1,1,1


rem (setup camera)
position camera 250,100,-500






rem loop
do

set text font "arial"
ink rgb(500,500,500),0
center text 320,10,"use left and right arrow keys to rotate the cylinder limb"
center text 320,460,"press escape to exit"

rem rotate object
yrotate object 1,wrapvalue(object angle y(1)+0.5)

rem move object
move object 1,2.5

rem rotate limb (limb angle x(obj number,limb number)
if leftkey()=1 then rotate limb 1,1,wrapvalue(limb angle x(1,1)-1),45,0
if rightkey()=1 then rotate limb 1,1,wrapvalue(limb angle x(1,1)+1),45,0

sync
loop



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    sync on



rem make an object
make object box 1,100,100,100




rem make a cylinder shaped object to get the mesh for the limb from
rem (note that the mesh number comes before the object number on the make mesh from object command)
make object cylinder 2,100
make mesh from object 1,2
delete object 2

rem add a limb to the box object using the mesh from the cylinder (obj number, limb number, mesh number)
rem limbs must be created in sequence, 1,2,3,4 etc
add limb 1,1,1


rem rotate the limb
rotate limb 1,1,45,45,0

rem resize the limb
scale limb 1,1,50,150,50

rem adjust the position of the limb
offset limb 1,1,0,100,0






rem (set the object)
set object 1,1,1,0,1,1,1,1


rem (setup camera)
position camera 250,100,-500






rem loop
do

   set text font "arial"
   ink rgb(500,500,500),0
   center text 320,10,"use left and right arrow keys to rotate the cylinder limb"
   center text 320,460,"press escape to exit"

   rem rotate object
   yrotate object 1,wrapvalue(object angle y(1)+0.5)

   rem move object
   move object 1,2.5

   rem rotate limb (limb angle x(obj number,limb number)
   if leftkey()=1 then rotate limb 1,1,wrapvalue(limb angle x(1,1)-1),45,0
   if rightkey()=1 then rotate limb 1,1,wrapvalue(limb angle x(1,1)+1),45,0

sync
loop