two boxes
tothealth=200 : `your maximum health
health=200 : `your health
damage=50 :`enemydamage
do
cls
`total health
ink rgb(200,0,0),1
box 0,0,tothealth,20
`remaining health
ink rgb(255,255,0),1
box 0,0,health,20
set cursor 0,20
print "Health: ",health
print "Press Any Key"
wait key
health=health-damage
Print "Enemy inflicts: ",damage
if health=<0 then goto endgame
wait key
loop
endgame:
Print "You have been defeated"
wait key
i hope this helps you, unless you meant reducing by percentage based on your remaining health, try something like this
tothealth=200 : `your maximum health
health=200 : `your health
do
cls
`total health
ink rgb(200,0,0),1
box 0,0,tothealth,20
`remaining health
ink rgb(255,255,0),1
box 0,0,health,20
set cursor 0,20
print "Health: ",health
print "Press Any Key"
wait key
damage=health/4
health=health-damage
Print "Enemy inflicts: ",damage
if health=<0 then goto endgame
wait key
loop
endgame:
Print "You have been defeated"
wait key
hope this helps you, good luck in your game
Formely Blank as a plank