Compare commits

...

5 Commits

Author SHA1 Message Date
cc3ed20f76
fix overshield 2024-08-18 01:29:27 -07:00
fa0cff1ffc
one hit mode, fix vertmeter
full height meters overflowed p8num range
2024-08-18 01:28:12 -07:00
4f8b861cdb
okay I special cased it 2024-08-18 01:14:05 -07:00
5dc259c094
the Secret Hit Point: you have 1hp when the meter is empty
this won't work if your maxhp is 1, will need to special case that
2024-08-18 01:13:25 -07:00
51629376f2
adjust HUD
Health and shields now share one bar. one hit point is (about) the same
size in each. There is an indicator splitting the two categories of HP.
2024-08-18 01:10:20 -07:00

View File

@ -328,20 +328,26 @@ function drawhud()
line(113,127) line(113,127)
draw_gun_info("❎",1,116,3,primary_ship.main_gun) draw_gun_info("❎",1,116,3,primary_ship.main_gun)
draw_gun_info("🅾️",2,116,31,primary_ship.special_gun) draw_gun_info("🅾️",1,116,31,primary_ship.special_gun)
dropshadow("pwr",114,59,1) dropshadow("p h",114,59,1)
inset(114,66,119,125) inset(114,66,119,125)
fillp(0x5a5a) fillp(0x5a5a)
vertmeter(115,67,118,124,primary_ship.power, primary_ship.max_power, powcols) vertmeter(115,67,118,124,primary_ship.power, primary_ship.max_power, powcols)
inset(120,66,125,125) inset(120,66,125,125)
line(120,96,125,96,119) -- 57 px vertically
line(120,97,125,97,85) local mxs, mxh = primary_ship.maxshield, primary_ship.maxhp
pset(120, 125, 119) if mxs + mxh > 1 then
vertmeter(121,67,124,95,primary_ship.shield, primary_ship.maxshield,{204,220,221}) local split = 57 * (mxs / (mxs + mxh-1)) \ 1 + 66
vertmeter(121,98,124,124,primary_ship.hp, primary_ship.maxhp, hpcols) line(121, split, 124, split, 0xba)
fillp(0) 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)
else
print("!", 122, 94, 9)
print("!", 121, 93, 8)
end
fillp(0)
end end
function draw_gun_info(lbl,fgc,x,y,gun) function draw_gun_info(lbl,fgc,x,y,gun)
@ -367,9 +373,9 @@ function draw_gun_info(lbl,fgc,x,y,gun)
end end
function vertmeter(x0,y0,x1,y1,val,maxval,cols) function vertmeter(x0,y0,x1,y1,val,maxval,cols)
if (val <= 0) return if ((val <= 0) or (maxval <= 0)) return
local h = y1-y0 local h = y1-y0
local px = -flr(-(h*val)\maxval) local px = val/maxval * h \ 1
local ncols = #cols local ncols = #cols
local firstcol = ((h-px)*ncols\h)+1 local firstcol = ((h-px)*ncols\h)+1
local lastbottom = y0+(h*firstcol\ncols) local lastbottom = y0+(h*firstcol\ncols)
@ -562,6 +568,7 @@ function ship_m:refresh_shield()
if (lframe < self.shield_refresh_ready) return if (lframe < self.shield_refresh_ready) return
if (self.power < self.shieldcost) return if (self.power < self.shieldcost) return
self.shield += 1 self.shield += 1
self.shield = min(self.shield, self.maxshield)
self.power -= self.shieldcost self.power -= self.shieldcost
self.shield_refresh_ready = lframe + self.shieldcooldown self.shield_refresh_ready = lframe + self.shieldcooldown
end end
@ -905,6 +912,11 @@ player = ship_m.new{
mknew(player, mknew(player,
function(p) function(p)
p.main_gun = zap_gun.new() p.main_gun = zap_gun.new()
-- ONE HIT MODE
-- p.hp = 1
-- p.maxhp = 1
-- p.shield = 0
-- p.maxshield = 0
end end
) )