time left

This commit is contained in:
James Turk 2023-04-08 23:13:24 -05:00
parent fc209f724e
commit 5cc1cbc66a

View File

@ -171,6 +171,7 @@ levels = {
}, },
} }
lvl = levels[1] lvl = levels[1]
lvl_start_time = 1
horizon = 64 horizon = 64
items = { items = {
{x=0, y=0, n=0}, {x=0, y=0, n=0},
@ -219,7 +220,6 @@ function level_draw()
-- hud -- hud
local size = max(flr(pieces/MAX_PIECES*100), 1) local size = max(flr(pieces/MAX_PIECES*100), 1)
local time_left = 10
local streak_str = streak2mult() local streak_str = streak2mult()
if streak_str == 1 then if streak_str == 1 then
streak_str = "" streak_str = ""
@ -227,11 +227,15 @@ function level_draw()
streak_str = streak_str.."X" streak_str = streak_str.."X"
end end
rectfill(0, 0, 128, 8, 2) rectfill(0, 0, 128, 8, 2)
print("size "..size..lvl.unit.." "..streak_str.." ", 1, 1, 9) print("SIZE "..size..lvl.unit.." "..streak_str.." ", 1, 1, 9)
print(time_left.."S", 70, 1, 9) print(time_left().."S", 60, 1, 9)
print("GOAL 100"..lvl.unit, 88, 1, 9) print("GOAL 100"..lvl.unit, 88, 1, 9)
end end
function time_left()
return flr(max(0, (90+lvl_start_time)-time()))
end
function streak2mult() function streak2mult()
if streak > 20 then if streak > 20 then
return 5 return 5