incomplete start of piece gen
This commit is contained in:
parent
d4a67acc9b
commit
31fb5b83e9
@ -279,6 +279,9 @@ end
|
|||||||
-->8
|
-->8
|
||||||
-- panel drawing
|
-- panel drawing
|
||||||
|
|
||||||
|
-- empty panel placeholder
|
||||||
|
nopanel = {}
|
||||||
|
|
||||||
-- panel in ordinary state
|
-- panel in ordinary state
|
||||||
panel = {
|
panel = {
|
||||||
-- plt: palette as table
|
-- plt: palette as table
|
||||||
@ -419,6 +422,82 @@ function ants:draw()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-->8
|
||||||
|
-- gameplay logic
|
||||||
|
|
||||||
|
game={
|
||||||
|
incoming_frac = 0
|
||||||
|
speed = 0
|
||||||
|
gravity_lag = 30
|
||||||
|
pop_lag = 20
|
||||||
|
|
||||||
|
stop_frames = 0
|
||||||
|
stop_max = 1
|
||||||
|
life = 180
|
||||||
|
life_max = 180
|
||||||
|
}
|
||||||
|
|
||||||
|
mknew(game, function(ret)
|
||||||
|
local board = {}
|
||||||
|
for i=1,12 do
|
||||||
|
board[i] = {
|
||||||
|
nopanel, nopanel, nopanel, nopanel, nopanel, nopanel,
|
||||||
|
}
|
||||||
|
ret.board = board
|
||||||
|
ret.garbage_queue = {}
|
||||||
|
ret.garbage_source = source.new()
|
||||||
|
ret.floor_source = source.new()
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
function game:update()
|
||||||
|
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__
|
__gfx__
|
||||||
0000000000111000011011000000000009999900066666000eeeee00077777000aaaaa0001111111000000000000000000000000000000000000000000000000
|
0000000000111000011011000000000009999900066666000eeeee00077777000aaaaa0001111111000000000000000000000000000000000000000000000000
|
||||||
00000000012221001221221000000000988888206bbbbb30eddddd207cccccd0a999994012222222300040400000000000000000000000000000000000000000
|
00000000012221001221221000000000988888206bbbbb30eddddd207cccccd0a999994012222222300040400000000000000000000000000000000000000000
|
||||||
|
Loading…
Reference in New Issue
Block a user