From 5cc1cbc66a1391e4da14a1eaf40e441f2a09e55d Mon Sep 17 00:00:00 2001 From: James Turk Date: Sat, 8 Apr 2023 23:13:24 -0500 Subject: [PATCH] time left --- toomgis.p8 | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/toomgis.p8 b/toomgis.p8 index 4c47985..15a533a 100644 --- a/toomgis.p8 +++ b/toomgis.p8 @@ -171,6 +171,7 @@ levels = { }, } lvl = levels[1] +lvl_start_time = 1 horizon = 64 items = { {x=0, y=0, n=0}, @@ -219,7 +220,6 @@ function level_draw() -- hud local size = max(flr(pieces/MAX_PIECES*100), 1) - local time_left = 10 local streak_str = streak2mult() if streak_str == 1 then streak_str = "" @@ -227,11 +227,15 @@ function level_draw() streak_str = streak_str.."X" end rectfill(0, 0, 128, 8, 2) - print("size "..size..lvl.unit.." "..streak_str.." ", 1, 1, 9) - print(time_left.."S", 70, 1, 9) + print("SIZE "..size..lvl.unit.." "..streak_str.." ", 1, 1, 9) + print(time_left().."S", 60, 1, 9) print("GOAL 100"..lvl.unit, 88, 1, 9) end +function time_left() + return flr(max(0, (90+lvl_start_time)-time())) +end + function streak2mult() if streak > 20 then return 5