Ahh, seems that turning an object left or right can mess the returned angle up. Works now, added some globals, and right click to rotate the camera.
Rem Project: MyFPS
Rem Created: Saturday, March 12, 2011
Rem ***** Main Source File *****
set dir "media" : hide mouse : sync rate 60 : set camera fov 70
SET DISPLAY MODE 1280, 1024, 32
set window off
rem ***** Variabili globali *****
global player = 1
global healt = 100
global ammo = 100
global camAX# camAY# camTAX# camTAY#
global player_ang#
initialize_player()
load_level()
set global collision on
do
player_control()
text 0,10,"FPS = "+str$(screen fps())
text 0,25,"Gioco creato interamente da OmegaGT"
text 0,40,"CamXY Angle:"+str$(camAX#)+","+str$(camAY#)
LOOP
Function player_control()
X_PLAYER = object position x(1)
Y_PLAYER = object position y(1)
Z_PLAYER = object position z(1)
mb=mouseclick()
camTAX#=30.0
camTAY#=wrapvalue(player_ang#)
`No right click, so reset camera
if mb<>2
camAX#=curveangle(camTAX#,camAX#,10.0)
camAY#=curveangle(camTAY#,camAY#,10.0)
endif
Rotate camera camAX#,camAY#,0.0
Position camera object position x(player),object position y(player)+100.0,object position z(player)
`Right click then rotate camera
if mb=2
inc camAX#,mousemovey()
inc camAY#,mousemovex()
endif
Move camera -200
rotate object player,0,player_ang#,0
mov_speed= 5
if upkey() and leftkey() then mov_speed=4
if upkey() and rightkey() then mov_speed=4
if upkey() then move object 1,mov_speed
if downkey() then move object 1,-mov_speed
if leftkey() then dec player_ang#,5
if rightkey() then inc player_ang#,5
EndFunction
function load_level()
load object "level1/level.x", 2
make object plane 3,3000,3000
xrotate object 3, 90
position object 3,0,-150,0
load image "water.jpg",2
texture object 3,2
set ambient light 100
ENDFUNCTION
Function initialize_player()
load object "player.x",player
load image "tommy_6_D2.dds",1,1
texture object player,1
position object player,800,70,0
rotate object player,0,180,0
fix object pivot player
scale object player,200,200,200
EndFunction
Function MouseLook(xTarget, yTarget, zTarget, hDist#, vDist#, Speed#)
`Continue from where we last were
hAngle# = hAngle# + Speed#
vAngle# = vAngle# + vDist#
`Tricky part: Make a 'circular' camera movement
xPos# = xTarget + cos(hAngle#) * hDist#
yPos# = yTarget + vAngle#
zPos# = zTarget + sin(hAngle#) * hDist#
`Position Camera in it's new place and point it at our main character
Position Camera xPos#, yPos#, zPos#
Point Camera xTarget, yTarget, zTarget
`Usually you'll want the camera just a tad higher then the char, so do that now
Position Camera xPos#, yPos# + 200, zPos#
`Point our Main Character in the same direction as our camera
Rotate Object 1, Object Angle X(1), Camera Angle Y(), Object Angle Z(1)
EndFunction

Health, Ammo, and bacon and eggs!
