whoosh animation when level up pending

This commit is contained in:
Kistaro Windrider 2024-12-28 19:56:42 -08:00
parent 2c1ad0a0b3
commit c55ea000fd
Signed by: kistaro
SSH Key Fingerprint: SHA256:TBE2ynfmJqsAf0CP6gsflA0q5X5wD5fVKWPsZ7eVUg8

View File

@ -157,6 +157,7 @@ function init_hpcols()
end end
function wipe_level() function wipe_level()
xpwhoosh = nil
primary_ship = player.new() primary_ship = player.new()
init_hpcols() init_hpcols()
pships = linked_list.new() pships = linked_list.new()
@ -251,6 +252,17 @@ function updategame()
state = win state = win
end end
if (not pships.next) state = lose if (not pships.next) state = lose
if primary_ship.xp >= primary_ship.xptarget then
if not xpwhoosh then
xpwhoosh = 0
else
xpwhoosh += 1
if (xpwhoosh > 60) xpwhoosh = 0
end
else
xpwhoosh = nil
end
end end
function _draw() function _draw()
@ -346,8 +358,18 @@ function drawhud()
print("XP",119,55,1) print("XP",119,55,1)
print("HP",114,122,1) print("HP",114,122,1)
fillp(0x5a5a) fillp(0x5a5a)
if xpwhoosh then
clip(115,58,4,60)
rectfill(115,58,118,117,0xaa)
local voff = 5*xpwhoosh+6
rectfill(115,118-voff,118,117-voff+10,0xbb)
rectfill(115,118-voff+11,118,117-voff+20,0xba)
clip()
else
vertmeter(115,58,118,117,primary_ship.xp, primary_ship.xptarget, powcols) vertmeter(115,58,118,117,primary_ship.xp, primary_ship.xptarget, powcols)
-- 59 px vertically end
-- 59 px vertically? or 60? off-by-1 error somewhere here or in vertmeter?
-- it's here. I think
local mxs, cs, mxh, ch = primary_ship.maxshield, primary_ship.shield, primary_ship.maxhp, primary_ship.hp local mxs, cs, mxh, ch = primary_ship.maxshield, primary_ship.shield, primary_ship.maxhp, primary_ship.hp
if (mxs > 0) and (mxh > 0) then if (mxs > 0) and (mxh > 0) then
local split = 59 * (mxs / (mxs + mxh)) \ 1 + 64 local split = 59 * (mxs / (mxs + mxh)) \ 1 + 64