I made a code snippet for views a while back, then when I went on IRC someone asked for this so I decided to make it into a function (Dead...something). So, here it is:
FUNCTION Third_Person_View(Object#,X#,Y#,Z#)
IF CREATED#=0
MAKE OBJECT SPHERE 9999,1
MAKE MESH FROM OBJECT 1,9999
DELETE OBJECT 9999
PERFORM CHECKLIST FOR OBJECT LIMBS Object#
Limb#=CHECKLIST QUANTITY()
ADD LIMB Object#,Limb#,1
OFFSET LIMB Object#,Limb#,X#,Y#,Z#
DELETE MESH 1
HIDE LIMB Object#,Limb#
CREATED#=1
ENDIF
POSITION CAMERA LIMB POSITION X(Object#,Limb#),LIMB POSITION Y(Object#,Limb#),LIMB POSITION Z(Object#,Limb#)
POINT CAMERA OBJECT POSITION X(Object#),OBJECT POSITION Y(Object#),OBJECT POSITION Z(Object#)
ENDFUNCTION
Just put that code below the loop, then in the beginning of the loop call the function. And before the loop define Limb# as a global, by simply typing:
Ok heres how you define the function:
Object# is the object you want the camera to follow
X# is the X# Offset for the limb
Y# is the Y# Offset for the limb
Z# is the Z# Offset for the limb
Here's a quick way of using the function:
SYNC ON:SYNC RATE 0:AUTOCAM OFF
MAKE OBJECT BOX 1,20,20,20
MAKE OBJECT SPHERE 2,40:POSITION OBJECT 2,0,0,60
GLOBAL Limb#
DO
Third_Person_View(1,0,100,-200
IF UPKEY()=1 THEN MOVE OBJECT 1,.4
IF DOWNKEY()=1 THEN MOVE OBJECT 1,-.4
IF RIGHTKEY()=1 THEN TURN OBJECT RIGHT 1,.2
IF LEFTKEY()=1 THEN TURN OBJECT LEFT 1,.2
SYNC
LOOP
FUNCTION Third_Person_View(Object#,X#,Y#,Z#)
IF CREATED#=0
MAKE OBJECT SPHERE 9999,1
MAKE MESH FROM OBJECT 1,9999
DELETE OBJECT 9999
PERFORM CHECKLIST FOR OBJECT LIMBS Object#
Limb#=CHECKLIST QUANTITY()
ADD LIMB Object#,Limb#,1
OFFSET LIMB Object#,Limb#,X#,Y#,Z#
DELETE MESH 1
HIDE LIMB Object#,Limb#
CREATED#=1
ENDIF
POSITION CAMERA LIMB POSITION X(Object#,Limb#),LIMB POSITION Y(Object#,Limb#),LIMB POSITION Z(Object#,Limb#)
POINT CAMERA OBJECT POSITION X(Object#),OBJECT POSITION Y(Object#),OBJECT POSITION Z(Object#)
ENDFUNCTION
I couldnt reconnect to IRC to tell Dead that I finished it so...Dead, if you see this then hope it helps. Sorry devhat got screwy with me again
Current Projects: SHADE - Game Maker | Mecho - TGC Puzzle Entry | Halo Physics Engine | COLD - Polygonal Collision Detection