messed up entry animation but it's a start

* wrong Y positions for everything
* both directions are "enter"
This commit is contained in:
Kistaro Windrider 2024-12-26 16:19:52 -08:00
parent c15ec61494
commit 25f58d5cce
Signed by: kistaro
SSH Key Fingerprint: SHA256:TBE2ynfmJqsAf0CP6gsflA0q5X5wD5fVKWPsZ7eVUg8

View File

@ -54,6 +54,13 @@ end
function _draw()
cls()
draw_hud_placeholder()
-- draw_static()
left_pane:draw()
right_pane:draw()
rearm_pane_instance:draw()
end
function draw_static()
draw_weap_opt(0,0,frame_col(item==1),1,"hull","\n +1\n max\nhealth")
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))
@ -62,6 +69,16 @@ end
function _init()
item=1
bfm=1
left_pane = weapon_pane.new{
}
right_pane = weapon_pane.new{
is_left=false,
s = 2,
hdr = "vulc",
body = " rate\n\n faster\n firing\n rate",
hot = function() return item == 2 end}
rearm_pane_instance = rearm_pane.new{hot=function() return item < 0 end}
end
function _update()
@ -73,6 +90,22 @@ function _update()
else
bfm += 1
end
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
right_pane.pos = -1
rearm_pane_instance.pos = -1
end
left_pane:update()
right_pane:update()
rearm_pane_instance:update()
end
function draw_hud_placeholder()
@ -121,10 +154,18 @@ end
-->8
-- rearm pane objects
easing_pane = mknew{
-- to enter: pos = 1; to exit: pos = -1
-- to enter: pos = -1; to exit: pos = 1
-- runs for 16 frames
}
function easing_pane:frac()
local pos = self.pos
if (not pos) return
if (pos < 0) return easeoutbounce(1+pos)
if (pos > 0) return easeoutbounce(1-pos)
return 1
end
function easing_pane:update()
local pos = self.pos
if (not pos or pos == 0) return
@ -146,14 +187,12 @@ weapon_pane = mknew(easing_pane.new{
})
function weapon_pane:draw()
local pos, frac, is_left = self.pos, 1, self.is_left
if (not pos) return
if (pos < 0) frac = easeoutbounce(1+pos)
if (pos > 0) frac = easeoutbounce(1-pos)
local frac, is_left = self:frac(), self.is_left
if (not frac) return
camera(
frac * (is_left and 55 or 0) + (1-frac) * (is_left and 0 or -56),
frac * 55)
glow_box(0,0,55,100,c,1)
glow_box(0,0,55,100,frame_col(self:hot()),1)
spr(self.s,5, 5)
print(self.hdr, 13, 8, 7)
print(self.body, 5, 15, 6)
@ -162,6 +201,15 @@ end
rearm_pane = mknew(easing_pane.new{})
function rearm_pane:draw()
local frac = self:frac()
if (not frac) return
camera(0, 28 * frac-1)
glow_box(0,101,111,127,frame_col(self:hot()),1)
spr(5,15,107,4,2)
print("full ammo\nfull shield\n+50% health",54, 106, 6)
camera()
end
__gfx__
000000000b00000000000a0007700770000aa0000444440004444444000000000000000000000000000000000000000000000000000000000000000000000000