clean up, run at 60 fps
now the bounce animation feels like it takes too long, trying to fix it
This commit is contained in:
parent
e1a70cc6fc
commit
e0b784ce7d
@ -54,18 +54,11 @@ end
|
|||||||
function _draw()
|
function _draw()
|
||||||
cls()
|
cls()
|
||||||
draw_hud_placeholder()
|
draw_hud_placeholder()
|
||||||
-- draw_static()
|
|
||||||
left_pane:draw()
|
left_pane:draw()
|
||||||
right_pane:draw()
|
right_pane:draw()
|
||||||
rearm_pane_instance:draw()
|
rearm_pane_instance:draw()
|
||||||
end
|
end
|
||||||
|
|
||||||
function draw_static()
|
|
||||||
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_rearm(frame_col(item<0))
|
|
||||||
end
|
|
||||||
|
|
||||||
function _init()
|
function _init()
|
||||||
item=1
|
item=1
|
||||||
bfm=1
|
bfm=1
|
||||||
@ -80,8 +73,8 @@ function _init()
|
|||||||
rearm_pane_instance = rearm_pane.new{hot=function() return item < 0 end}
|
rearm_pane_instance = rearm_pane.new{hot=function() return item < 0 end}
|
||||||
end
|
end
|
||||||
|
|
||||||
function _update()
|
function _update60()
|
||||||
crt_frm += 0.5
|
crt_frm += 0.25
|
||||||
if (crt_frm >= 9) crt_frm = 1
|
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
|
||||||
@ -122,10 +115,10 @@ end
|
|||||||
crt={-91,-166,-2641,-1441,-23041,23295,-20491,24570}
|
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])
|
for i,v in ipairs{c[1],c[2],c[1],0} do
|
||||||
rect(x0+1, y0+1, x1-1, y1-1, c[2])
|
i -= 1
|
||||||
rect(x0+2, y0+2, x1-2, y1-2, c[1])
|
rect(x0+i,y0+i,x1-i,y1-i,v)
|
||||||
rect(x0+3, y0+3, x1-3, y1-3, 0)
|
end
|
||||||
fillp(crt[crt_frm&0xff])
|
fillp(crt[crt_frm&0xff])
|
||||||
rectfill(x0+4, y0+4, x1-4, y1-4, cf)
|
rectfill(x0+4, y0+4, x1-4, y1-4, cf)
|
||||||
fillp()
|
fillp()
|
||||||
@ -156,7 +149,7 @@ end
|
|||||||
-- 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 in, 8 frames out
|
-- runs for 32 frames in, 16 frames out
|
||||||
}
|
}
|
||||||
|
|
||||||
function easing_pane:frac()
|
function easing_pane:frac()
|
||||||
@ -170,10 +163,9 @@ 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
|
||||||
-- increment is 0x0.1 -- 1/16th of pos
|
if (pos < 0) pos = min(pos + 0x0.05, 0)
|
||||||
if (pos < 0) pos = min(pos + 0x0.1, 0)
|
|
||||||
if pos > 0 then
|
if pos > 0 then
|
||||||
pos -= 0x0.2
|
pos -= 0x0.1
|
||||||
if (pos <= 0) pos = nil
|
if (pos <= 0) pos = nil
|
||||||
end
|
end
|
||||||
self.pos = pos
|
self.pos = pos
|
||||||
|
Loading…
x
Reference in New Issue
Block a user