Compare commits

...

2 Commits

Author SHA1 Message Date
6b8efe3438
fix HP-only mode
it was showing the bar intended as the warning that there's no HP
under the shield. but I tried it and that bar just makes it look like
there *is* a sliver of health, which there isn't. so it's better off
without that in either mode.
2024-08-18 14:49:44 -07:00
c2668cefea
handle 0 shield and 1 max HP cases 2024-08-18 14:40:11 -07:00

View File

@ -320,6 +320,7 @@ function drawgame()
end
powcols=split"170,154,153,148,68"
shlcols = split"204,220,221"
function drawhud()
-- 112-and-right is hud zone
rectfill(112, 0, 127, 127,0x56)
@ -337,12 +338,16 @@ function drawhud()
inset(120,66,125,125)
-- 57 px vertically
local mxs, mxh = primary_ship.maxshield, primary_ship.maxhp
if mxs + mxh > 1 then
local mxs, cs, mxh, ch = primary_ship.maxshield, primary_ship.shield, primary_ship.maxhp, primary_ship.hp
if (mxs > 0) and (mxh > 1) then
local split = 57 * (mxs / (mxs + mxh-1)) \ 1 + 66
line(121, split, 124, split, 0xba)
vertmeter(121,67,124,split-1,primary_ship.shield, mxs,{204,220,221})
vertmeter(121,split+1,124,124,primary_ship.hp-1, mxh-1, hpcols)
vertmeter(121,67,124,split-1,cs, mxs,shlcols)
vertmeter(121,split+1,124,124,ch-1, mxh-1, hpcols)
elseif mxs > 0 then
vertmeter(121,67,124,124,cs,mxs,shlcols)
elseif mxh > 1 then
vertmeter(121,67,124,124,ch-1,mxh-1,hpcols)
else
print("!", 122, 94, 9)
print("!", 121, 93, 8)