I think this is what you are looking for:
` four objects rotating around a single object
` LBFN 10/16/2009
sync on : sync rate 60
autocam off : hide mouse
global main as integer : main = 1 : global TotalObjects as integer : TotalObjects = 5
go = 0
dim ObjAngle#(TotalObjects)
CreateObjects()
` get main object's position, move the camera back and point the camera at it
x# = object position x(main) : y# = object position y(main) : z# = object position z(main)
position camera x#,y# + 100,z# - 400.0
point camera x#,y#,z#
repeat
if keystate(34) = 1 then go = 1 : ` G key
if keystate(31) = 1 then go = 0 : ` S key
if go = 1 then RotateAround()
control camera using arrowkeys 0,5.0,1.0 : ` allow user to move the camera around
debug() : ` show FPS
sync
until spacekey() = 1 : ` keep running loop until the spacebar is pressed
DeleteAll() : ` get rid of all objects
show mouse
end
function CreateObjects()
for i = 1 to TotalObjects
if i = main
make object sphere i,20
color object i,rgb(0,255,0)
else
make object cube i,20
if i = 2 then set object ambience i,rgb(255,0,0)
if i = 3 then set object ambience i,rgb(255,255,0)
if i = 4 then set object ambience i,rgb(0,0,255)
if i = 5 then set object ambience i,rgb(255,0,255)
` place the objects at 90 degree angles from the main object
oy# = (i - 2) * 90
ObjAngle#(i) = oy#
z# = sin(oy#) * 150.0 : ` you can lower the 150 to make them closer to the
x# = cos(oy#) * 150.0 : ` main object
position object i,x#,0.0,z#
endif
next i
endfunction
function RotateAround()
for i = 2 to TotalObjects
oy# = ObjAngle#(i)
oy# = wrapvalue(oy# + 5.0)
ObjAngle#(i) = oy#
z# = sin(oy#) * 150.0
x# = cos(oy#) * 150.0
position object i,x#,0.0,z#
next i
endfunction
function Debug()
text 10,10,"FPS: " + str$(screen fps())
endfunction
function DeleteAll()
for i = 1 to TotalObjects
if object exist(i) = 1
delete object i
endif
next i
endfunction
Press 'G' to rotate them. Press 'S' to stop them from rotating. Press the Spacebar to exit.
Hope this helps,
LB
So many games to code......so little time.