Limbs. Basically I make an object that is hidden and positioned where the camera is. This has a limb (which is an object attached to it like an arm, so wherever it is and however it is rotated it still remains in the same place relative to its parent object). I then glue an object to the limb, the gun. You can unglue it and glue a different one whenever.
`Setup
sync on
sync rate 60
autocam off
`Make character object
make object cube 1,10
`Make a mesh from it
make mesh from object 1,1
`Create a limb on the object (imagine it as an arm)
add limb 1,1,1 :`Syntax = add limb objNum,limbNum,meshNum
`Offset the limb to the side
offset limb 1,1,3,-3,7
`Delete the mesh and hide the character object
delete mesh 1
hide object 1
`Make a gun
make object box 2,1,1,10
`Attach the gun to the 'arm' limb
glue object to limb 2,1,1 :`Syntax = glue object to limb objectToBeGlued,objectToGlueOnto,limbNum
`Create a matrix to walk on
make matrix 1,1000,1000,100,100
position matrix 1,0,-10,0
do
`Movement
xPos#=xPos#+sin(ang#)*(upkey()-downkey())
zPos#=zPos#+cos(ang#)*(upkey()-downkey())
ang#=wrapvalue(ang#+(rightkey()-leftkey()))
`Position character object
position object 1,xPos#,0,zPos#
rotate object 1,0,ang#,0
`Position the camera
position camera xPos#,0,zPos#
rotate camera 0,ang#,0
sync
loop
Do you bite your thumb at me sir?
Athelon XP 1600 Plus - Nvidia Geforce MX400 - 256mb RAM