Ok here's my mousecode I use. Hit the "=" key change from Flip True to Flip False.
EDIT: Added in a sniper scope. Press RMB to toggle between 1x and 3x power.
EDIT: Added in a sniper scope. Press RMB to toggle between 1x and 3x power.
;MouseLook Code ;by Chroma Global sw = 1024, sh = 768 Graphics3D sw,sh,0,2 SetBuffer BackBuffer() ;delta time vars Global dt#,NewTime%,OldTime%,TotalTime% NewTime = MilliSecs() OldTime = NewTime ;fps calc Global framecounter_counter Global framecounter_time Global framecounter_framerate Global FPS$ Function FPS$() Framecounter_counter=Framecounter_counter+1 If Framecounter_time=0 Then Framecounter_time=MilliSecs() If Framecounter_time+1001<MilliSecs() Then Framecounter_framerate=Framecounter_counter Framecounter_counter=0 Framecounter_time=MilliSecs() EndIf zsemi$="FPS: "+Framecounter_framerate Return zsemi$ End Function Global cam_piv = CreatePivot() Global cam = CreateCamera(cam_piv) CameraRange cam,0.2,10000 PositionEntity cam,0,1.6,0 ; mouse sensitivity Local mlook_spd# = 12.0 ;speed Local mlook_dmp# = 20.0 ;damper ;Make some cubes to look at Dim cube(200) For n=1 To 200 cube(n) = CreateCube() ScaleEntity cube(n), Rand(1,50),Rand(1,50),Rand(1,50) PositionEntity cube(n), Rand(-1000,1000),Rand(-1000,1000),Rand(-1000,1000) Next Local flp = True Local cam_zoom = 1 ; Reset Mouse HidePointer MoveMouse sw/2,sh/2 While Not KeyHit(1) Cls Delta_Time() If MouseHit(2) zoom = 1 - zoom Select zoom Case 0 cam_zoom = 1 mlook_spd = 12.0 Case 1 cam_zoom = 3 mlook_spd = 12.0 * 5 End Select CameraZoom cam,cam_zoom EndIf ;Hit the "=" key to toggle Flip True/False If KeyHit(13) Then flp = 1 - flp ; ---FPS Code--- ;mouselook mxspd# = MouseXSpeed() / mlook_spd myspd# = MouseYSpeed() / mlook_spd If mxspd <> 0 Or myspd <> 0 Then MoveMouse sw/2,sh/2 mlook_yaw# = mlook_yaw - mxspd mlook_pitch# = mlook_pitch + myspd If mlook_pitch => 89 Then mlook_pitch = 89 If mlook_pitch =< -89 Then mlook_pitch = -89 mlook_yaw2# = mlook_yaw2# + ((mlook_yaw# - mlook_yaw2#) * mlook_dmp#) * dt mlook_pitch2# = mlook_pitch2# + ((mlook_pitch# - mlook_pitch2#) * mlook_dmp#) * dt RotateEntity cam,mlook_pitch2,mlook_yaw2,0 UpdateWorld RenderWorld Text 5,5,"Press '=' to toggle Flip state." Text 5,25,FPS() Text 5,65,"RMB to toggle sniper scope." Text 5,85,"Magnification: "+cam_zoom+"x" ;2D Crosshair Color 0,255,0 Line sw/2-5,sh/2,sw/2-9,sh/2 Line sw/2+5,sh/2,sw/2+9,sh/2 Line sw/2,sh/2-5,sw/2,sh/2-9 Line sw/2,sh/2+5,sw/2,sh/2+9 Color 255,255,255 Flip flp Wend End Function Delta_Time() NewTime = MilliSecs() dt = Float (NewTime - OldTime)/1000 OldTime = NewTime TotalTime = TotalTime + dt End Function