This commit is contained in:
Kistaro Windrider 2024-12-26 16:59:43 -08:00
parent 25f58d5cce
commit caaf848722
Signed by: kistaro
SSH Key Fingerprint: SHA256:TBE2ynfmJqsAf0CP6gsflA0q5X5wD5fVKWPsZ7eVUg8

View File

@ -61,7 +61,7 @@ function _draw()
end end
function draw_static() function draw_static()
draw_weap_opt(0,0,frame_col(item==1),1,"hull","\n +1\n max\nhealth") draw_weap_opt(0,0,frame_col(item==1),1,"hull","\n +1\n max\n health")
draw_weap_opt(56,0,frame_col(item==2),2,"vulc"," rate\n\n faster\n firing\n rate") draw_weap_opt(56,0,frame_col(item==2),2,"vulc"," rate\n\n faster\n firing\n rate")
draw_rearm(frame_col(item<0)) draw_rearm(frame_col(item<0))
end end
@ -69,9 +69,8 @@ end
function _init() function _init()
item=1 item=1
bfm=1 bfm=1
left_pane = weapon_pane.new{ crt_frm = 1
left_pane = weapon_pane.new{}
}
right_pane = weapon_pane.new{ right_pane = weapon_pane.new{
is_left=false, is_left=false,
s = 2, s = 2,
@ -82,6 +81,8 @@ function _init()
end end
function _update() function _update()
crt_frm += 0.5
if (crt_frm >= 9) crt_frm = 1
if (btn(3) and item > 0 or btn(2) and item < 0) item = -item if (btn(3) and item > 0 or btn(2) and item < 0) item = -item
if (btn(0)) item = 1 if (btn(0)) item = 1
if (btn(1)) item = 2 if (btn(1)) item = 2
@ -92,17 +93,17 @@ function _update()
end end
if btnp(4) then if btnp(4) then
left_pane.pos = 1
right_pane.pos = 1
rearm_pane_instance.pos = 1
end
if btnp(5) then
left_pane.pos = -1 left_pane.pos = -1
right_pane.pos = -1 right_pane.pos = -1
rearm_pane_instance.pos = -1 rearm_pane_instance.pos = -1
end end
if btnp(5) then
left_pane.pos = 1
right_pane.pos = 1
rearm_pane_instance.pos = 1
end
left_pane:update() left_pane:update()
right_pane:update() right_pane:update()
rearm_pane_instance:update() rearm_pane_instance:update()
@ -118,16 +119,16 @@ end
-->8 -->8
-- rearm pane drawing -- rearm pane drawing
crt={-91,-166,-2641,-1441,-23041,23295,-20491,24570}
function glow_box(x0, y0, x1, y1, c, cf) function glow_box(x0, y0, x1, y1, c, cf)
rect(x0, y0, x1, y1, c[1]) rect(x0, y0, x1, y1, c[1])
rect(x0+1, y0+1, x1-1, y1-1, c[2]) rect(x0+1, y0+1, x1-1, y1-1, c[2])
rect(x0+2, y0+2, x1-2, y1-2, c[1]) rect(x0+2, y0+2, x1-2, y1-2, c[1])
if cf then rect(x0+3, y0+3, x1-3, y1-3, 0)
-- todo: animate "dot crawl" background fillp(crt[crt_frm&0xff])
fillp(…) rectfill(x0+4, y0+4, x1-4, y1-4, cf)
rectfill(x0+3, y0+3, x1-3, y1-3, cf)
fillp() fillp()
end
end end
function frame_col(hot) function frame_col(hot)
@ -161,9 +162,9 @@ easing_pane = mknew{
function easing_pane:frac() function easing_pane:frac()
local pos = self.pos local pos = self.pos
if (not pos) return if (not pos) return
if (pos < 0) return easeoutbounce(1+pos) if (pos < 0) return 1-easeoutbounce(1+pos)
if (pos > 0) return easeoutbounce(1-pos) if (pos > 0) return easeoutbounce(1-pos)
return 1 return 0
end end
function easing_pane:update() function easing_pane:update()
@ -182,7 +183,7 @@ weapon_pane = mknew(easing_pane.new{
is_left = true, is_left = true,
s = 1, s = 1,
hdr = "hull", hdr = "hull",
body = "\n +1\n max\nhealth", body = "\n +1\n max\n health",
hot = function() return item == 1 end, hot = function() return item == 1 end,
}) })
@ -190,8 +191,8 @@ function weapon_pane:draw()
local frac, is_left = self:frac(), self.is_left local frac, is_left = self:frac(), self.is_left
if (not frac) return if (not frac) return
camera( camera(
frac * (is_left and 55 or 0) + (1-frac) * (is_left and 0 or -56), frac * (is_left and 55 or -128) + (1-frac) * (is_left and 0 or -56),
frac * 55) 0)
glow_box(0,0,55,100,frame_col(self:hot()),1) glow_box(0,0,55,100,frame_col(self:hot()),1)
spr(self.s,5, 5) spr(self.s,5, 5)
print(self.hdr, 13, 8, 7) print(self.hdr, 13, 8, 7)
@ -204,8 +205,8 @@ rearm_pane = mknew(easing_pane.new{})
function rearm_pane:draw() function rearm_pane:draw()
local frac = self:frac() local frac = self:frac()
if (not frac) return if (not frac) return
camera(0, 28 * frac-1) camera(0, -28 * frac)
glow_box(0,101,111,127,frame_col(self:hot()),1) glow_box(0,101,111,127,frame_col(self:hot()),5)
spr(5,15,107,4,2) spr(5,15,107,4,2)
print("full ammo\nfull shield\n+50% health",54, 106, 6) print("full ammo\nfull shield\n+50% health",54, 106, 6)
camera() camera()
@ -220,9 +221,9 @@ __gfx__
00700700008888200000800008800880a000000a47a4477a047a4440000000000000000000000000000000000000000000000000000000000000000000000000 00700700008888200000800008800880a000000a47a4477a047a4440000000000000000000000000000000000000000000000000000000000000000000000000
000000000008820000a0000008800880080aa080477777a00477777a000000000000000000000000000000000000000000000000000000000000000000000000 000000000008820000a0000008800880080aa080477777a00477777a000000000000000000000000000000000000000000000000000000000000000000000000
0000000000002000008000000880088000088000477770000422aaaa222200020000020000000000000000000000000000000000000000000000000000000000 0000000000002000008000000880088000088000477770000422aaaa222200020000020000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000047a77700022ee0002eeee002e00022e000000000000000000000000000000000000000000000000000000000 0d5000000000000000000000000000000000000047a77700022ee0002eeee002e00022e000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000047a4777002ea2e002e002e02ee022ee000000000000000000000000000000000000000000000000000000000 d00000000000000000000000000000000000000047a4777002ea2e002e002e02ee022ee000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000047a0477a22ea2e002e002e02e2e2e2e000000000000000000000000000000000000000000000000000000000 500000000000000000000000000000000000000047a0477a22ea2e002e002e02e2e2e2e000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000047a0047a2e2222e02e222e02e02e02e000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000047a0047a2e2222e02e222e02e02e02e000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000047a0047a2eeeeeea2eeee002e02e02e000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000047a0047a2eeeeeea2eeee002e02e02e000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000aa000aa2e7aa2ea2e00e002e02e02e000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000aa000aa2e7aa2ea2e00e002e02e02e000000000000000000000000000000000000000000000000000000000