Here is a better working way to do this.
Hope this works for you.
Plz dont question my box meathod ( IT JUST WORKS.)
it may seem confusing i know, but once u get it its really easy to use.
It works great.
Any suggestions would be helpful.
sync on
black=rgb(0,0,0)
red=rgb(255,0,0)
yellow=rgb(255,255,0)
white=rgb(255,255,255)
green=rgb(0,255,0)
blue=rgb(0,0,255)
hp1# = 50
mp1# = 50
Do
cls
randomize timer()
gosub Control
hp2#=100
hpper#=hp1#/hp2#
hpper=percent(hpper#)
hp1$=str$(hp1#)
hp2$=str$(hp2#)
hp12$=hp1$+"/"+hp2$
mp2#=100
mpper#=mp1#/mp2#
mpper=percent(mpper#)
mp1$=str$(mp1#)
mp2$=str$(mp2#)
mp12$=mp1$+"/"+mp2$
gosub catching
gosub stats
ink white,black
liney(30,30)
liney(50,50)
linex(30,50)
ink red,black
box (screen width()/2)-50,35,((screen width()/2)-50)+hpper,45
ink white,black
liney(60,60)
liney(80,80)
linex(60,80)
ink blue,black
box (screen width()/2)-50,65,((screen width()/2)-50)+mpper,75
sync
Loop
end
catching:
if hp1# >= hp2# then hpper = hp2#
if (hp1#*2)= hp2# then hpper = 50
if hp1# <= 0 then hp1# = 0
if mp1# >= mp2# then mpper = mp2#
if (mp1#*2)= mp2# then mpper = 50
if mp1# <= 0 then mp1# = 0
return
stats:
if hpper = 0 then ink white,black : Print "DEAD!"
if hpper >=90
ink green,black
endif
if hpper<=30 and hpper>5
ink yellow,black
endif
if hpper<90 and hpper>30
ink white,black
endif
if hpper<=5
ink red,black
endif
if hpper = 100 then ink green,black
center text screen width() /2,2,hp12$
if mpper >=90
ink green,black
endif
if mpper<=30 and mpper>5
ink yellow,black
endif
if mpper<90 and mpper>30
ink white,black
endif
if mpper<=5
ink red,black
endif
center text screen width()/2,100,mp12$
if mpper = 100 then ink green,black
return
Control:
if upkey() > 0: hp1#=hp1#+1: endif: if downkey() > 0: hp1# = hp1# - 1: endif: if rightkey() = 1: mp1#=mp1# +1: endif: if leftkey() = 1: mp1#=mp1#-1: endif
return
function percent(a#)
a$=str$(a#): b$=mid$(a$,1): b=val(b$): if b<1: a=len(a$): a$=right$(a$,a-2): b$=mid$(a$,1): if b$="0": b$=mid$(a$,2)
b=val(b$): if b>4 then goto notzero: b$=mid$(a$,3): b=val(b$): if b>4 then goto notzero: perval=0: goto funcend
endif
notzero:
b$=mid$(a$,3): a$=left$(a$,2): a=val(a$): b=val(b$): if b>4: a=a+1: endif: b$=mid$(a$,4): b=val(b$): if b>4
a=a+1: endif: a$=str$(a): perval=val(a$): goto funcend: endif
if b>1 or b=1: hund$=str$(b): a=len(a$): a$=right$(a$,a-2): b$=mid$(a$,3): a$=left$(a$,2): a=val(a$): b=val(b$)
if b>4: a=a+1: endif: b$=mid$(a$,4): b=val(b$): if b>4: a=a+1: endif: a$=str$(a): a$=hund$+a$: perval=val(a$)
endif
funcend:
endfunction perval
function liney(y1#,y2#)
line (screen width()/2)+55,y1#,(screen width()/2)-55,y2#
endfunction
function linex(y1#,y2#)
line (screen width()/2)+55,y1#,(screen width()/2)+55,y2#: line (screen width()/2)-55,y1#,(screen width()/2)-55,y2#
endfunction
Yes i know this is quite long for a silly little program.
If at first you dont succeed, LOWER YOUR STANDARDS.