From fc209f724e98f8e970184e568121d752ea78342b Mon Sep 17 00:00:00 2001 From: James Turk Date: Sat, 8 Apr 2023 23:04:25 -0500 Subject: [PATCH] explode out --- toomgis.p8 | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/toomgis.p8 b/toomgis.p8 index 8c346d3..4c47985 100644 --- a/toomgis.p8 +++ b/toomgis.p8 @@ -79,7 +79,7 @@ end tangle = 0 tbody = { -} +} -- array of items in body pieces = 1 MAX_PIECES = 200 px = 0 @@ -96,18 +96,15 @@ end function add2body(n) if pieces < MAX_PIECES then pieces += 1 - add(tbody, {n=n, r=toomgis_radius() + rnd(9), off=rnd(4)}) + add(tbody, {n=n, r=toomgis_radius() + rnd(9), off=rnd(4), ejecting=false}) end end function hitbody() - to_remove = max(rnd(pieces * 0.5), 1) - for i=0,to_remove do - if pieces == 1 then - break + for piece in all(tbody) do + if rnd() < 0.2 then + piece.ejecting = true end - pieces -= 1 - deli(tbody) end end @@ -138,6 +135,19 @@ function toomgis_upd() px += vx py = max(0, py+vy) vy += yacc + + local to_remove = {} + for idx, piece in pairs(tbody) do + if piece.ejecting then + piece.r += 5 + if piece.r > 90 then + add(to_remove, idx) + end + end + end + for idx in all(to_remove) do + deli(tbody, idx) + end end -->8 -- level @@ -148,7 +158,7 @@ levels = { sky=7, gnd=5, mapy=2, - bad_item_ratio=0.1, + bad_item_ratio=0.2, unit="CM", }, { @@ -282,7 +292,7 @@ function level_upd() streak = 0 else sfx(6) - for i=0,streak2mult() do + for i=1,streak2mult() do add2body(item.n) end streak += 1