ok i menaged to get things working almost the way i want, but there is a problem when sprite is facing left and right correctly then up and down are incorrect and vice versa. run the code below but replace "DamageIndicator.tga" with anything code should work with any image.
@baxlash
can you explain to me how these two functions work?
sync on
sync rate 60
set display mode 640,480,32
autocam off
load image "DamageIndicator.tga",1
sprite 1,screen width()/2,screen height()/2,1
set sprite image 1,1
set sprite 1,0,1
offset sprite 1,sprite width(1)/2,sprite height(1)*2
`make object plane 1,256,64
`move object 1,-600
`lock object on 1
`set object light 1,0
`disable object zdepth 1
`texture object 1,1
`set object transparency 1,1
make object box 2,50,100,50
do
bearing1#=cam_bearing()
bearing2#=damage_bearing(2)
difference#=wrapvalue(bearing1#+180-bearing2#)-180
`zrotate object 1,0
`roll object right 1,difference#
rotate sprite 1,difference#
ang#=ang#+.1
position object 2,0,0,0
`yrotate object 2,ang#
move object 2,250
camang#=camang#+mousemovex()
yrotate camera camang#
dot screen width()/2,screen height()/2
sync
loop
end
function damage_bearing(shooter)
cx# = camera position x()
cy# = camera position z()
bx# = object position x(shooter)
by# = object position z(shooter)
a# = atanfull(bx#-cx#, by#-cy#)
endfunction a#
function cam_bearing()
cx# = camera position x()
cy# = camera position z()
move camera -100
bx# = camera position x()
by# = camera position z()
move camera 100
a# = atanfull(bx#-cx#, by#-cy#)
endfunction a#