From 78fe254e9650d9929b0debf59f3e0ec06c7b73b5 Mon Sep 17 00:00:00 2001 From: Kistaro Windrider Date: Mon, 4 Sep 2023 00:39:55 -0700 Subject: [PATCH] shuffle some panel stuff around, remove unreasonable source logic --- panel_extreme.p8 | 68 ++++++++++++------------------------------------ 1 file changed, 17 insertions(+), 51 deletions(-) diff --git a/panel_extreme.p8 b/panel_extreme.p8 index 7f69dc8..77bdefa 100644 --- a/panel_extreme.p8 +++ b/panel_extreme.p8 @@ -294,6 +294,7 @@ panel = { -- negative == mid-fall -- positive == bounce -- frames left + state="idle" } mknew(panel) @@ -313,6 +314,7 @@ prpblkp = {14,13,2,7} newblock = { function() return panel.new{ + id=1, plt=redblkp, sx=83,sy=1, ey=2, as=0, @@ -320,6 +322,7 @@ newblock = { end, function() return panel.new{ + id=2, plt=ylwblkp, sx=83,sy=11, ey=2,as=0, @@ -327,6 +330,7 @@ newblock = { end, function() return panel.new{ + id=3, plt=grnblkp, sx=78,sy=11, ey=2,as=0, @@ -334,6 +338,7 @@ newblock = { end, function() return panel.new{ + id=4, plt=blublkp, sx=83,sy=6, ey=2,as=0, @@ -341,6 +346,7 @@ newblock = { end, function() return panel.new{ + id=5, plt=prpblkp, sx=73,sy=11, ey=2,as=0, @@ -427,15 +433,15 @@ end -- gameplay logic game={ - incoming_frac = 0 - speed = 0 - gravity_lag = 30 - pop_lag = 20 + incoming_frac = 0, + speed = 0, + gravity_lag = 30, + pop_lag = 20, - stop_frames = 0 - stop_max = 1 - life = 180 - life_max = 180 + stop_frames = 0, + stop_max = 1, + life = 180, + life_max = 180, } mknew(game, function(ret) @@ -443,13 +449,13 @@ mknew(game, function(ret) for i=1,12 do board[i] = { nopanel, nopanel, nopanel, nopanel, nopanel, nopanel, - } + } + end ret.board = board ret.garbage_queue = {} ret.garbage_source = source.new() ret.floor_source = source.new() - end -end) + end) function game:update() end @@ -457,46 +463,6 @@ end function game:draw() end -function shuffle(tbl) - local n = #tbl - for i=1,n-1 do - local idx = (rnd(n-i+1)&-1)+i - if (idx != i) tbl[idx], tbl[i] = tbl[i], tbl[idx] - end -end - -source={ - lumps = 3 - metalumps = 3 - metalumpiness = 2 -} -mknew(source, function(ret) - ret.bucket = {} - ret.lumpqueue = {} - ret.rejects = {} -end) - -function source:pick() - local lq, b := self.lumpqueue, bucket - for i=#lq/self.metalumpiness,self.metalumps do - local p := rnd(newblock) - for i=1,self.metalumpiness do - add(lq, p) - end - -- todo: draw individual panels - -- note: individual panels - -- must derive from the prototypes. - -- still not sure what the best - -- bag algorithm is; I think this - -- algorithm fills too much. - -- todo: rewrite to only redraw - -- when only one bag remains. - - -- todo: actual pick algorithm - -- todo: rejection and redraw algorithm - end -end - __gfx__ 0000000000111000011011000000000009999900066666000eeeee00077777000aaaaa0001111111000000000000000000000000000000000000000000000000