well I've got the health to update it self, but as for keeping object one facing the camera as to move around, I can't remember what to done.
Rem ***** Main Source File *****
Rem Project: sprite
Rem Created: Sunday, August 01, 2010
Rem ***** Main Source File *****
sync on : sync rate 60
autocam off
global health#
health#=100.0
make object cube 2,1
`SPRITE IMAGE
CREATE BITMAP 1,100,10
SET CURRENT BITMAP 0
`DELETE BITMAP 1
`
Make Object Plain 1,1.25,.1
texture object 1,1
set object transparency 1,1
fix object pivot 1
position object 1,0,0,5
HealthBar(0,0,100,10,health#)
`THE MAIN LOOP
DO
inc ang#,1
if ang#>360 then ang#=0
if ang#<-360 then ang#=0
yrotate object 2,(ang#)
position object 1,object position x(2),object size y(2)/2+1,object position z(2)
rotate object 1,camera angle x(),object angle y(1),0
move camera (keystate(17)-keystate(31))*1
turn camera left (keystate(30)-keystate(32))*1
`if keystate(44)
`dec health,1
`HealthBar(0,0,100,10,)
`endif
if keystate(52)
dec health#,1
endif
if keystate(51)
inc health#,1
endif
HealthBar(0,0,100,10,health#)
SYNC
LOOP
function HealthBar(x, y, width, height, P#)
set current bitmap 1
P# = P#/100.0
if P#<0.0 then P#=0.0
rem gradient bar
seg = width / 3
box x, y, x+seg, y+height, rgb(255,0,0),rgb(255,0,0),rgb(170,85,0),rgb(170,85,0)
box x+seg, y, x+seg+seg, y+height, rgb(170,85,0),rgb(170,85,0),rgb(85,170,0),rgb(85,170,0)
box x+seg+seg, y, x+width, y+height, rgb(85,170,0),rgb(85,170,0),rgb(0,255,0),rgb(0,255,0)
rem empty bit
ink rgb(92,92,92),0
box x+width*P#, y, x+width, y+height
rem highlight
c1 = 0xCCFFFFFF
c2 = 0x33FFFFFF
box x, y, x+width, y+height*0.5, c2,c1,c2,c1
GET IMAGE 1,0,0,100,10
set current bitmap 0
texture object 1,1
endfunction
edit
this let you now keep the bar facing the camera.
uses
SET OBJECT TO CAMERA ORIENTATION 1
Rem ***** Main Source File *****
Rem Project: sprite
Rem Created: Sunday, August 01, 2010
Rem ***** Main Source File *****
sync on : sync rate 60
autocam off
global health#
health#=100.0
make object cube 2,1
`SPRITE IMAGE
CREATE BITMAP 1,100,10
SET CURRENT BITMAP 0
`DELETE BITMAP 1
`
Make Object Plain 1,1.25,.1
texture object 1,1
set object transparency 1,1
fix object pivot 1
position object 1,0,0,5
HealthBar(0,0,100,10,health#)
`THE MAIN LOOP
DO
inc ang#,1
if ang#>360 then ang#=0
if ang#<-360 then ang#=0
yrotate object 2,(ang#)
position object 1,object position x(2),object size y(2)/2+1,object position z(2)
SET OBJECT TO CAMERA ORIENTATION 1
`otate object 1,camera angle x(),object angle y(1),0
move camera (keystate(17)-keystate(31))*1
turn camera left (keystate(30)-keystate(32))*1
`if keystate(44)
`dec health,1
`HealthBar(0,0,100,10,)
`endif
if keystate(51)
dec health#,1
endif
if keystate(52)
inc health#,1
endif
HealthBar(0,0,100,10,health#)
SYNC
LOOP
function HealthBar(x, y, width, height, P#)
set current bitmap 1
P# = P#/100.0
if P#<0.0 then P#=0.0
rem gradient bar
seg = width / 3
box x, y, x+seg, y+height, rgb(255,0,0),rgb(255,0,0),rgb(170,85,0),rgb(170,85,0)
box x+seg, y, x+seg+seg, y+height, rgb(170,85,0),rgb(170,85,0),rgb(85,170,0),rgb(85,170,0)
box x+seg+seg, y, x+width, y+height, rgb(85,170,0),rgb(85,170,0),rgb(0,255,0),rgb(0,255,0)
rem empty bit
ink rgb(92,92,92),0
box x+width*P#, y, x+width, y+height
rem highlight
c1 = 0xCCFFFFFF
c2 = 0x33FFFFFF
box x, y, x+width, y+height*0.5, c2,c1,c2,c1
GET IMAGE 1,0,0,100,10
set current bitmap 0
texture object 1,1
endfunction
Dark Physics makes any hot drink go cold.