The code is mine, and I'm very happy that Kelz didn't post my code without permission.
Basically I've assigned an increment to the up and down arrows respectively, so when you press up health goes up, this is to test it.
When I was testing it I found out that the mp bar, when being increased, goes further than it should, i.e the percentage made for the bar goes above 100%. But the actaul percentage number is accurate.
This is my code:
rem this is the battle sequence in the main loop
rem let zee battle commences
loop object 2,(frames(1)+1),frames(2)
do
rem char 1
ink rgb(0,0,0),1 : text 42,752,name$ : text 216,752,"HP:" : text 416,752,"MP:"
ink rgb(255,255,255),1 : text 40,750,name$ : text 214,750,"HP:" : text 414,750,"MP:"
ink rgb(255,255,255),1 : line 239,749,340,749 : line 239,765,340,765 : line 239,749,239,765 : line 340,749,340,765
line 439,749,540,749 : line 439,765,540,765 : line 439,749,439,765 : line 540,749,540,765
if data#(1,1)<>oldhp# or data#(1,3)<>oldmp# then RE_MAKE_BARS()
ink rgb(0,0,0),1 : text 350,752,str$(int((data#(1,1)/data#(1,2))*100))+"%" : : text 550,752,str$(int((data#(1,3)/data#(1,4))*100))+"%"
ink rgb(255,255,255),1 : text 348,750,str$(int((data#(1,1)/data#(1,2))*100))+"%" : text 548,750,str$(int((data#(1,3)/data#(1,4))*100))+"%"
oldhp#=data#(1,1) : oldmp#=data#(1,3)
if upkey()=1 then data#(1,1)=data#(1,1)+1 : data#(1,3)=data#(1,3)+1
if downkey()=1 then data#(1,1)=data#(1,1)-1 : data#(1,3)=data#(1,3)-1
sprite 1,240,750,3 : sprite 2,440,750,4
if escapekey()=1 then end
sync : loop
This is the function
function RE_MAKE_BARS()
if data#(1,1)<0 then data#(1,1)=0
if data#(1,1)>data#(1,2) then data#(1,1)=data#(1,2)
if data#(1,3)<0 then data#(1,3)=0
if data#(1,3)>data#(1,4) then data#(1,3)=data#(1,4)
gethp=int((data#(1,1)/data#(1,2))*100) : if gethp<1 then gethp=1
getmp=int((data#(1,3)/data#(1,4))*100) : if getmp<1 then getmp=1
load bitmap "Media/Bitmaps/HP.bmp",1 : set current bitmap 1 : get image 3,0,0,gethp,15 : delete bitmap 1
load bitmap "Media/Bitmaps/MP.bmp",1 : set current bitmap 1 : get image 4,0,0,getmp,15 : delete bitmap 1
endfunction
:: 'Xzi' is pronounced 'Zee' due to the wonders of the English Language ::