This commit is contained in:
Kimapr 2023-03-29 15:01:07 +05:00
parent 3d47fae141
commit ea4071c6e1
2 changed files with 37 additions and 11 deletions

View file

@ -1,4 +1,6 @@
function love.conf(t) function love.conf(t)
t.width=400 --[[ t.window.width=420
t.height=400 t.window.height=700]]
t.window.fullscreen=true
t.window.resizable=true
end end

View file

@ -519,11 +519,6 @@ local function dropall(off,die)
end end
local function fillboard() local function fillboard()
cc=3
score=0
bat=1
gemrng=love.math.newRandomGenerator(991)
tochar=bw*bh+gemrng:random(bw)
for x=1,bw do for x=1,bw do
board[x]={} board[x]={}
for y=1,bh do for y=1,bh do
@ -548,11 +543,19 @@ local function fillboard()
end end
dropall(-bh) dropall(-bh)
end end
local function resboard()
cc=3
score=0
bat=1
gemrng=love.math.newRandomGenerator(991)
tochar=bw*bh+gemrng:random(bw)
fillboard()
end
local dbg=false local dbg=false
local playdbg=false local playdbg=false
function love.load() function love.load()
fillboard() resboard()
end end
local grabbed=nil local grabbed=nil
@ -655,6 +658,8 @@ local slow=1
local accumdt=0 local accumdt=0
local tps=120 local tps=120
local speeds={1,0.05,10} local speeds={1,0.05,10}
local plchint=1
local toplchi=plchint
function love.update(dt) function love.update(dt)
dt=math.min(dt,0.2)*(speeds[slow]) dt=math.min(dt,0.2)*(speeds[slow])
@ -688,8 +693,6 @@ function love.update(dt)
end end
if running then if running then
bat=math.max(0,bat-dt*0.015*(math.max(bat,0.0625)^0.5)) bat=math.max(0,bat-dt*0.015*(math.max(bat,0.0625)^0.5))
end
if running then
batd=interp(batd,bat,dt) batd=interp(batd,bat,dt)
scored=interp(scored,score,dt) scored=interp(scored,score,dt)
end end
@ -790,7 +793,28 @@ function love.update(dt)
if entc==0 and dying then if entc==0 and dying then
dying=false dying=false
running=false running=false
fillboard() resboard()
elseif entc==0 then
toplchi=toplchi-dt
if toplchi<0 then
toplchi=toplchi+plchint
local good=false
for ix=1,bw do
for iy=1,bh do
for _,a in pairs{{1,0},{-1,0},{0,1},{0,-1}} do
local px,py=ix+a[1],iy+a[2]
if px>=1 and py>=1 and px<=bw and py<=bh then
board[ix][iy],board[px][py]=
board[px][py],board[ix][iy]
good=good or check(ix,iy,check(px,py))
board[ix][iy],board[px][py]=
board[px][py],board[ix][iy]
end
end end end
if not good then dropall(0,true)fillboard() end
end
else
toplchi=plchint
end end
local oam,obm,rm={},{},{} local oam,obm,rm={},{},{}
for k,v in pairs(tk) do for k,v in pairs(tk) do