I have a healthbar in my game designed by the a poster in the code snippets forum. I put it in, but it does not show on top of my 3D game. I call the function once per loop. I use the
Draw to Front command, but that hasnt helped. Here is my code:
Draw to Front
...
rem Minimum, Maximum, and Current HP
MinHP# = 0
MaxHP# = 200
CurHP# = 200
rem How many pixels long do we want the bar
pixlength = 500
pixheight = 10
rem XY location of bar on the display
x = 275
y = 30
...
do
rem Update input data
UpdateKeyHold()
rem Display screen data
set text size 22
text 0, 0, "FPS: "+str$(screen FPS())
text 0, 30, "Enemies Killed: "+str$(enemys_killed)
UpdateFollowCamera()
UpdatePlayer()
healthbar(x,y,MinHP#,MaxHP#,CurHP#,pixlength,pixheight)
UpdateEnemyAI()
UpdateElevator()
RunCollisionPRO()
CheckExit()
sync
loop
...
function healthbar(x as integer, y as integer, MinHP# as float, MaxHP# as float, CurHP# as float, pixlength as integer, pixheight as integer )
rem The Math
rem some conditions so that you don't go negative on certain values
if CurHP# < MinHP# then CurHP# = MinHP#
if CurHP# > MaxHP# then CurHP# = MaxHP#
if pixlength < 1 then pixlength = 1
if pixheight < 1 then pixheight = 1
rem Change our values from Integers to a percent so that we can see how much of the bar needs to be filled
pBar# = CurHP# / MaxHP#
rem Get the percentage of the bar to be filled
thebar = int(pixlength * pBar#)
rem Draw the bar
box x,y, x + thebar, y + pixheight
line x + pixlength, y, x + pixlength, y + pixheight
line x,y, x, y + pixheight
endfunction CurHP#
Please help me get the healthbar to show on top of my 3d action.
thanks
ph
Purple Heart - The Ultimate WWI FPS on DBPro
http://www.geocities.com/andrewdewitt55