messed up entry animation but it's a start
* wrong Y positions for everything * both directions are "enter"
This commit is contained in:
parent
c15ec61494
commit
25f58d5cce
@ -54,6 +54,13 @@ end
|
|||||||
function _draw()
|
function _draw()
|
||||||
cls()
|
cls()
|
||||||
draw_hud_placeholder()
|
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(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_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))
|
||||||
@ -62,6 +69,16 @@ end
|
|||||||
function _init()
|
function _init()
|
||||||
item=1
|
item=1
|
||||||
bfm=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
|
end
|
||||||
|
|
||||||
function _update()
|
function _update()
|
||||||
@ -73,6 +90,22 @@ function _update()
|
|||||||
else
|
else
|
||||||
bfm += 1
|
bfm += 1
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
function draw_hud_placeholder()
|
function draw_hud_placeholder()
|
||||||
@ -121,10 +154,18 @@ end
|
|||||||
-->8
|
-->8
|
||||||
-- rearm pane objects
|
-- rearm pane objects
|
||||||
easing_pane = mknew{
|
easing_pane = mknew{
|
||||||
-- to enter: pos = 1; to exit: pos = -1
|
-- to enter: pos = -1; to exit: pos = 1
|
||||||
-- runs for 16 frames
|
-- 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()
|
function easing_pane:update()
|
||||||
local pos = self.pos
|
local pos = self.pos
|
||||||
if (not pos or pos == 0) return
|
if (not pos or pos == 0) return
|
||||||
@ -146,14 +187,12 @@ weapon_pane = mknew(easing_pane.new{
|
|||||||
})
|
})
|
||||||
|
|
||||||
function weapon_pane:draw()
|
function weapon_pane:draw()
|
||||||
local pos, frac, is_left = self.pos, 1, self.is_left
|
local frac, is_left = self:frac(), self.is_left
|
||||||
if (not pos) return
|
if (not frac) return
|
||||||
if (pos < 0) frac = easeoutbounce(1+pos)
|
|
||||||
if (pos > 0) frac = easeoutbounce(1-pos)
|
|
||||||
camera(
|
camera(
|
||||||
frac * (is_left and 55 or 0) + (1-frac) * (is_left and 0 or -56),
|
frac * (is_left and 55 or 0) + (1-frac) * (is_left and 0 or -56),
|
||||||
frac * 55)
|
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)
|
spr(self.s,5, 5)
|
||||||
print(self.hdr, 13, 8, 7)
|
print(self.hdr, 13, 8, 7)
|
||||||
print(self.body, 5, 15, 6)
|
print(self.body, 5, 15, 6)
|
||||||
@ -162,6 +201,15 @@ end
|
|||||||
|
|
||||||
rearm_pane = mknew(easing_pane.new{})
|
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__
|
__gfx__
|
||||||
000000000b00000000000a0007700770000aa0000444440004444444000000000000000000000000000000000000000000000000000000000000000000000000
|
000000000b00000000000a0007700770000aa0000444440004444444000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
Loading…
x
Reference in New Issue
Block a user