diff --git a/toomgis.p8 b/toomgis.p8 index 4ffcea1..0569dd5 100644 --- a/toomgis.p8 +++ b/toomgis.p8 @@ -10,25 +10,11 @@ end function _update() --ampm_upd() - --toomgis_upd() + toomgis_upd() --level_draw() level_upd() end -function test_draw() - cls() - sprm(0, 20, 20, 1, 2) - sprm(32, 20, 32, 1, 2) - - sprm(44, 80, 80, 1, 2) - - sprm(0, 50, 100, 1, 2) - sprm(32, 50, 112, 1, 2) - spr(35, 50, 112, 2, 2) - - sprm(15, 100, 10, 1, 4) -end - function sprm(n, x, y, w, h) -- mirrored sprite draw spr(n, x, y, w, h) @@ -91,14 +77,25 @@ end -->8 -- toomgis -tspeed = -0.01 tangle = 0 tbody = { } +pieces = 1 +MAX_PIECES = 200 +px = 0 +py = 0 +vx = 0 +vy = 0 +yacc = 0 + function add2body(n) - add(tbody, {n=n, r=rnd(20)+5, - off=rnd(4)}) + if pieces < MAX_PIECES then + pieces += 1 + -- center hole + variance + grow outwards + local r = 5 + rnd(5) + (pieces / MAX_PIECES) * 25 + add(tbody, {n=n, r=r, off=rnd(4)}) + end end function full() @@ -124,7 +121,11 @@ function toomgis_draw(x, y) end function toomgis_upd() - tangle += tspeed + tangle += vx * 0.01 + px += vx + py = max(0, py+vy) + vy += yacc + printh("vy="..vy.." yacc="..yacc) end -->8 -- level @@ -142,14 +143,7 @@ levels = { } } lvl = levels[1] -zoom = 16 horizon = 64 -px = 0 -py = 0 -vx = 0 -vy = 0 -yacc = 0 - function level_draw() @@ -159,16 +153,16 @@ function level_draw() --map(0, lvl.y, 0, 32, 16, 8) -- each level is 3tl/24px + cls(lvl.sky) + --- zoom should go from 16 to 2 w/ growth + local zoom = 16 - (14 * (pieces / MAX_PIECES)) local h=24 * zoom for y=0,h do tline(0, 128-h+y, 128, 128-h+y, - 0, 2+y/(8*zoom), 1/(8*zoom), 0) + (px-20)/(8*zoom), 2+y/(8*zoom), 1/(8*zoom), 0) end - toomgis_draw(10, 96-py) - - -- debug - print(px..", "..py, 0, 0, 12) + toomgis_draw(20, 96-py) end function level_upd() @@ -179,28 +173,22 @@ function level_upd() vx -= 0.05 end if vx < 0 then - vx = 0 - elseif vx > 5 then - vx = 5 + vx = 0 + elseif vx > 3 then + vx = 3 end - if btn(❎) and py==0 then - yacc = 3 + if btnp(❎) and py == 0 then + yacc = 10 + elseif py > 0 then + yacc = -3 + elseif py == 0 and yacc < 0 then + -- on ground + yacc = 0 + vy = 0 end - - px += vx - py = max(0, py+vy) - vy += yacc - yacc -= 0.3 - - -- debug, zoom ctls - if btn(⬆️) then - zoom += 0.1 - elseif btn(⬇️) then - zoom -= 0.1 - end - if zoom < .5 then - zoom = .5 - end + + -- make toomgis bigger as he rolls + add2body(flr(rnd(14)+2)) end __gfx__ 000022220000000000444400000ee000aaaaaaaa0000000000555500045454000099990000087000000000000cccccc00077700000000a0000ffff0000005555