function energy(value)
Displays health, life or energy top left as bar bitmap & image no 31 are created and then displayed with a bar length according to the value 'v' passed to the function. The code is a sample how to use the function.
remstart
function energy example
-----------------------
(c) 2008 Attila
Display health, life or energy to left as bar
remend
cls
sync on
while inkey$() = ""
for h=10 to 100
cls
energy(h)
sync
next h
for h=100 to 10 step -1
cls
energy(h)
sync
next h
endwhile
end
function energy(v)
remstart
-----------------------------------------------------------
function energy(v)
-----------------------
(c) 2008 Attila
Displays health, life or energy top left as bar
bitmap/image no 31 is created and then displayed
with a bar lenght acording to the value 'v' passed
to the function.
-----------------------------------------------------------
remend
if bitmap exist(31) = 0
create bitmap 31,128,128
set current bitmap 31
ink rgb(255,0,0),0
box 1,1,127,127
ink rgb(255,32,0),0
for h=8 to 32
line 1,h,96,h
next h
ink rgb(255,128,0),0
for h=28 to 64
line 1,h,127,h
next h
ink rgb(255,255,0),0
for h=40 to 52
line 1,h,127,h
next h
get image 31,1,1,127,127
set current bitmap 0
endif
if v < 1 then v=1
wi = (128/100)*v
sprite 31,0,0,31
size sprite 31,wi,10
endfunction