i just locked it on screen but if you wanna get ur hands dirty and a free sneak peek, have at it. i didnt delete te old code, i just put rem next to it. if you could fix it without using the lock on screen i would greatly appreciate it. media is attached in folder.
sync on
rem make object plane 1,25,.5
rem position object 1,0,0,0
rem make object cylinder 2,3
rem position object 2,0,1,5
load image "media\f_z_01_d2.dds" ,1
load object "media\HUD.dbo" ,99
make object cube 3, 5
scale object 3, 1000,1,1000
position object 3, 0,-3,0
texture object 3,1
scale object texture 3,10,10
rotate object 99,0,180,0
scale object 99,10,10,10
load mesh "media\HUD.x" ,1
hide mouse
load sound "media\Automatic loop.wav" ,1
make object sphere 50,.5
hide object 50
set object speed 99,15
hide light 0
make light 1
position light 1, 0,15,0
set light range 1,15
load sound "media\dryfire.wav" ,2
set ambient light 80
color backdrop rgb(230,230,255)
ammo#=30
fire#=1
reload#=0
idle#=1
_LAST_SHOT = TIMER()
_BULLET_DELAY=150
do
if reload#=0 and idle#=1 then loop OBJECT 99, 29,55
if keystate(17) =1 and reload#=0 then loop object 99,56,71
if keystate(30) =1 and reload#=0 then loop object 99,56,71
if keystate(32) =1 and reload#=0 then loop object 99,56,71
if keystate(32) =1 and reload#=0 then loop object 99,56,71
if keystate(31) =1 then idle#=0 else idle#=1
if keystate(30) =1 then idle#=0 else idle#=1
if keystate(32) =1 then idle#=0 else idle#=1
if keystate(17) =1 then idle#=0 else idle#=1
if keystate(19) = 1 and ammo# =<0 then reload#=1
if reload#=1 then fire#=0
if keystate(19) =1 and reload#=1 then play object 99, 90,202
if reload#=1 then ammo#=30
if reload#=1 and ammo#=30 then reload#=0
remstart camx# = camera position x()
camy# = camera position y ()
camz# = camera position z ()
camAx# = camera angle x () + 10
camAy# = camera angle y () + 180
remend camAz# = camera angle z ()
lock object on 99
offset limb 99,0,0,-3.6,10.5
ControlCamera( 0.05 )
rem position object 99, camx#,camy#,camz#
rem rotate object 99, camAx#, camAy#, camAz#
if sound playing(1) =0 then fire#=1 else fire#=0
if mouseclick () =1 and fire#=1 and ammo# =>1 then play sound 1
if mouseclick () =1 and ammo# =<0 then play sound 2
_SOUND_PLAYING = sound playing(1)
if _SOUND_PLAYING=1 then loop OBJECT 99,78,84 rem then play object 99,85,89
if _SOUND_PLAYING=1 and (TIMER() - _LAST_SHOT)>= _BULLET_DELAY
dec ammo#,1
_LAST_SHOT = TIMER()
endif
_SOUND_PLAYING = sound playing(1)
if _SOUND_PLAYING=2 then loop OBJECT 99,29,55
if _SOUND_PLAYING=2 and (TIMER() - _LAST_SHOT)>= _BULLET_DELAY
_LAST_SHOT = TIMER()
endif
print ammo#
sync
loop
function ControlCamera( velocity# as float )
camXSpd# = keystate(17) - keystate(31) : camXSpd# = camXSpd# * velocity#
camZSpd# = keystate(30) - keystate(32) : camZSpd# = camZSpd# * velocity#
camYSpd# = keystate(16) - keystate(18) : camYSpd# = camYSpd# * velocity#
x# = camera position x() : y# = camera position y() : z# = camera position z()
yrotate camera wrapvalue( camera angle y() + mousemovex() / 2.0 )
`90 and 270 are the boundaries for the camera rotation in this case
`If the camera rotates out of those boundaries, the program sets it to the closest boundary
temp= wrapvalue( camera angle x() + mousemovey() / 2.0 )
if temp > 270
xrotate camera temp
else
if temp >= 180 then xrotate camera 270
endif
if temp < 90
xrotate camera temp
else
if temp < 180 then xrotate camera 90
endif
ny# = y# - camYSpd#
nx# = x# + camXSpd# * sin( camera angle y() ) + camZSpd# * sin( camera angle Y() - 90.0 )
nz# = z# + camXSpd# * cos( camera angle y() ) + camZSpd# * cos( camera angle Y() - 90.0 )
position camera (nx#), (ny#), (nz#)
endfunction
