From 134d1f426ed36e94529f66ee5113c1bd8c7a8db7 Mon Sep 17 00:00:00 2001 From: James Turk Date: Sat, 8 Apr 2023 23:29:56 -0500 Subject: [PATCH] intro restored --- toomgis.p8 | 83 ++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 55 insertions(+), 28 deletions(-) diff --git a/toomgis.p8 b/toomgis.p8 index 15a533a..9a91bd9 100644 --- a/toomgis.p8 +++ b/toomgis.p8 @@ -2,17 +2,33 @@ pico-8 cartridge // http://www.pico-8.com version 41 __lua__ +state = "ampm" + function _draw() cls() - --ampm_draw() - level_draw() + if state == "ampm" then + ampm_draw() + elseif state == "level" then + level_draw() + elseif state == "gameover" then + gameover_draw() + end end function _update() - --ampm_upd() - toomgis_upd() - --level_draw() - level_upd() + if state == "ampm" then + ampm_upd() + toomgis_upd() + elseif state == "level" then + toomgis_upd() + level_upd() + elseif state == "gameover" then + gameover_upd() + end +end + +function _init() + ampm_init() end function sprm(n, x, y, w, h) @@ -25,6 +41,15 @@ end ampm_t = 0 +function ampm_init() + for i=2, 14 do + add2body(i) + add2body(i) + add2body(i) + add2body(i) + end +end + function ampm_draw() local tx = 1000 local fx = 78 @@ -62,16 +87,16 @@ function ampm_draw() fx, 90, 12) print("toomgis", fx, 100, 12) end - - end function ampm_upd() ampm_t += 1 if ampm_t > 500 then + start_level(1) ampm_t = 0 end + tangle -= 0.02 end -->8 @@ -108,15 +133,6 @@ function hitbody() end end -function full() - for i=2, 14 do - add2body(i) - add2body(i) - add2body(i) - end -end - - function toomgis_draw(x, y) --printh(x..","..y) for i=1,#tbody do @@ -170,20 +186,31 @@ levels = { unit="M", }, } -lvl = levels[1] -lvl_start_time = 1 horizon = 64 -items = { - {x=0, y=0, n=0}, - {x=0, y=0, n=0}, - {x=0, y=0, n=0}, - {x=0, y=0, n=0}, - {x=0, y=0, n=0}, - {x=0, y=0, n=0}, - {x=0, y=0, n=0}, -} +function start_level(n) + state = "level" + -- toomgis reset + tbody = {} + pieces = 1 + -- level reset + lvl = levels[n] + lvl_start_time = time() + items = { + {x=0, y=0, n=0}, + {x=0, y=0, n=0}, + {x=0, y=0, n=0}, + {x=0, y=0, n=0}, + {x=0, y=0, n=0}, + {x=0, y=0, n=0}, + {x=0, y=0, n=0}, + {x=0, y=0, n=0}, + {x=0, y=0, n=0}, + {x=0, y=0, n=0}, + } +end + function level_draw() -- background