Compare commits

...

1 Commits

Author SHA1 Message Date
MrZ_26
48b68a876b 0.7.27+α 2020-02-04 19:36:54 +08:00
20 changed files with 938 additions and 673 deletions

BIN
SFX/welcome.ogg Normal file

Binary file not shown.

2
ai.lua
View File

@@ -72,7 +72,7 @@ function CC_switch20G(P)
P.r,P.c=#P.cur.bk,#P.cur.bk[1]
P.curX,P.curY=blockPos[P.cur.id],21+ceil(P.fieldBeneath/30)-P.r+min(int(#P.field*.2),2)
P.freshNext()
P:freshNext()
BOT.addNext(P.AI_bot,CCblockID[P.next[P.AIdata.next].id])
collectgarbage()
end

View File

@@ -1,4 +1,4 @@
gameVersion="Alpha V0.7.25"
gameVersion="Alpha V0.7.27+"
function love.conf(t)
t.identity="Techmino"--Save directory name
t.version="11.1"
@@ -9,7 +9,7 @@ function love.conf(t)
t.audio.mixwithsystem=true--Switch on to keep sysBGM
local W=t.window
W.title="Techmino "..gameVersion
W.title=math.random()>.01 and "Techmino "..gameVersion or"MrZ NB!"
W.icon="/image/icon.png"
W.width,W.height=1280,720
W.minwidth,W.minheight=640,360

View File

@@ -1,11 +1,6 @@
local gc=love.graphics
local setFont=setFont
local int,rnd,max,min=math.floor,math.random,math.max,math.min
local format=string.format
local ins,rem=table.insert,table.remove
local function newNext(n)
P.next[#P.next+1]={bk=blocks[n][0],id=n,color=P.gameEnv.bone and 8 or n,name=n}
end
local PCbase={
{3,3,3,0,0,0,0,0,2,2},
{3,6,6,0,0,0,0,2,2,5},
@@ -16,7 +11,7 @@ local PCbase={
{5,5,2,2,0,0,0,6,6,4},
{5,2,2,0,0,0,0,4,4,4},
}
PClist={
local PClist={
{7,7,4,5},{7,7,6,4},{7,7,2,4},{7,7,1,3},{7,7,5,6},{7,7,5,2},{7,7,5,4},{7,7,5,3},
{7,4,1,2},{7,3,5,7},{7,5,4,3},{7,5,1,2},{7,1,4,2},{7,4,2,5},{7,6,4,5},{7,5,4,2},
{7,5,6,4},{7,5,3,6},{7,2,5,6},{7,2,6,4},{7,2,1,3},{7,5,2,7},{7,5,7,2},{7,5,2,3},
@@ -37,7 +32,6 @@ local death_fall={10,9,8,7,6}
local pc_drop={50,45,40,35,30,26,22,18,15,12}
local pc_lock={55,50,45,40,36,32,30}
local pc_fall={18,16,14,12,10,9,8,7,6}
local blockColor=blockColor
local function throwBadge(S,R)--Sender/Receiver
local x1,y1,x2,y2
if S.small then
@@ -58,7 +52,7 @@ local function AITemplate(type,speedLV,next,hold,node)
return{
type="CC",
next=next,
hold=true,--hold,-------------!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
hold=hold,--hold,-------------!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
delta=AISpeed[speedLV],
node=node,
}
@@ -90,7 +84,7 @@ loadmode={
if curMode.lv==2 then
pushSpeed=1
for i=1,5 do
garbageRise(10,1,rnd(10))
players[1]:garbageRise(10,1,rnd(10))
end
end
end,
@@ -99,35 +93,35 @@ loadmode={
if curMode.lv==1 then
newPlayer(2,965,360,.5,AITemplate("9S",3))
elseif curMode.lv==2 then
newPlayer(2,965,360,.5,AITemplate("CC",2,2,false,25000))
newPlayer(2,965,360,.5,AITemplate("CC",2,2,false,10000))
elseif curMode.lv==3 then
newPlayer(2,965,360,.5,AITemplate("9S",6))
elseif curMode.lv==4 then
newPlayer(2,965,360,.5,AITemplate("CC",5,2,true,35000))
newPlayer(2,965,360,.5,AITemplate("CC",5,2,true,20000))
elseif curMode.lv==5 then
newPlayer(2,965,360,.5,AITemplate("9S",9))
elseif curMode.lv==6 then
newPlayer(2,965,360,.5,AITemplate("CC",8,3,true,50000))
newPlayer(2,965,360,.5,AITemplate("CC",8,3,true,30000))
elseif curMode.lv==7 then
newPlayer(2,965,360,.5,AITemplate("9S",10))
elseif curMode.lv==8 then
newPlayer(2,965,360,.5,AITemplate("CC",9,3,true,100000))
newPlayer(2,965,360,.5,AITemplate("CC",9,3,true,40000))
elseif curMode.lv==9 then
newPlayer(2,965,360,.5,AITemplate("CC",10,4,true,200000))
newPlayer(2,965,360,.5,AITemplate("CC",10,4,true,80000))
end
end,
round=function()
newPlayer(1,340,15)
if curMode.lv==1 then
newPlayer(2,965,360,.5,AITemplate("9S",nil,10))
newPlayer(2,965,360,.5,AITemplate("9S",10))
elseif curMode.lv==2 then
newPlayer(2,965,360,.5,AITemplate("CC",10,2,false,20000))
newPlayer(2,965,360,.5,AITemplate("CC",10,2,false,10000))
elseif curMode.lv==3 then
newPlayer(2,965,360,.5,AITemplate("CC",10,3,true,50000))
newPlayer(2,965,360,.5,AITemplate("CC",10,3,true,30000))
elseif curMode.lv==4 then
newPlayer(2,965,360,.5,AITemplate("CC",10,4,true,100000))
newPlayer(2,965,360,.5,AITemplate("CC",10,4,true,60000))
elseif curMode.lv==5 then
newPlayer(2,965,360,.5,AITemplate("CC",10,6,true,1000000))
newPlayer(2,965,360,.5,AITemplate("CC",10,6,true,100000))
end
garbageSpeed=1e4
end,
@@ -198,7 +192,7 @@ loadmode={
if L[r]then L[r],t=false,t-1 end
end
local min,max
if LV==1 then min,max=3,5
if LV==1 then min,max=4,6
elseif LV==2 then min,max=4,8
elseif LV==3 then min,max=8,10
end
@@ -207,7 +201,7 @@ loadmode={
if L[n]then
newPlayer(n,78*i-54,115*j-98,.09,AITemplate("9S",rnd(min,max)))
else
newPlayer(n,78*i-54,115*j-98,.09,AITemplate("CC",rnd(min,max),LV+1,true,LV^2*3500))
newPlayer(n,78*i-54,115*j-98,.09,AITemplate("CC",rnd(min,max)-1,LV+1,true,LV*10000))
end
n=n+1
end end
@@ -215,7 +209,7 @@ loadmode={
if L[n]then
newPlayer(n,78*i+267,115*j-98,.09,AITemplate("9S",rnd(min,max)))
else
newPlayer(n,78*i+267,115*j-98,.09,AITemplate("CC",rnd(min,max),LV+1,true,LV^2*3500))
newPlayer(n,78*i+267,115*j-98,.09,AITemplate("CC",rnd(min,max)-1,LV+1,true,LV*10000))
end
n=n+1
end end
@@ -231,16 +225,16 @@ loadmode={
if L[r]then L[r],t=false,t-1 end
end
local min,max
if LV==1 then min,max=3,5
elseif LV==2 then min,max=4,9
elseif LV==3 then min,max=7,10
if LV==1 then min,max=4,6
elseif LV==2 then min,max=4,8
elseif LV==3 then min,max=8,10
end
local n=2
for i=1,7 do for j=1,7 do
if L[n]then
newPlayer(n,46*i-36,97*j-72,.068,AITemplate("9S",rnd(min,max)))
else
newPlayer(n,46*i-36,97*j-72,.068,AITemplate("CC",rnd(min,max),LV+1,true,LV^2*3000))
newPlayer(n,46*i-36,97*j-72,.068,AITemplate("CC",rnd(min,max)-1,LV+1,true,LV*10000))
end
n=n+1
end end
@@ -248,7 +242,7 @@ loadmode={
if L[n]then
newPlayer(n,46*i+264,97*j-72,.068,AITemplate("9S",rnd(min,max)))
else
newPlayer(n,46*i+264,97*j-72,.068,AITemplate("CC",rnd(min,max),LV+1,true,LV^2*3000))
newPlayer(n,46*i+264,97*j-72,.068,AITemplate("CC",rnd(min,max)-1,LV+1,true,LV*10000))
end
n=n+1
end end
@@ -288,7 +282,7 @@ loadmode={
if L<10 then
newPlayer(2,965,360,.5,AITemplate("9S",2*L))
else
newPlayer(2,965,360,.5,AITemplate("CC",L-6,2+int((L-11)*.5),true,15000+5000*(L-10)))
newPlayer(2,965,360,.5,AITemplate("CC",L-6,2+int((L-11)*.5),modeEnv.hold,15000+5000*(L-10)))
end
end
preField.h=20
@@ -315,199 +309,8 @@ loadmode={
modeEnv.bgm=customRange.bgm[customSel[13]]
end,
}
mesDisp={
--Default:font=35,white
sprint=function(P)
setFont(60)
local r=max(P.gameEnv.target-P.stat.row,0)
mStr(r,-82,265)
if r<21 and r>0 then
gc.setLineWidth(4)
gc.setColor(1,r>10 and 0 or rnd(),.5)
gc.line(0,600-30*r,300,600-30*r)
end
end,
marathon=function(P)
setFont(50)
mStr(P.stat.row,-82,320)
mStr(P.gameEnv.target,-82,370)
gc.rectangle("fill",-125,375,90,4)
end,
master=function(P)
setFont(50)
mStr(P.modeData.point,-82,320)
mStr((P.modeData.event+1)*100,-82,370)
gc.rectangle("fill",-125,375,90,4)
end,
classic=function(P)
setFont(80)
local r=P.gameEnv.target*.1
mStr(r<11 and 19+r or r==11 and"00"or r==12 and"0a"or format("%x",r*10-110),-82,210)
setFont(20)
mStr("speed level",-82,290)
setFont(50)
mStr(P.stat.row,-82,320)
mStr(P.gameEnv.target,-82,370)
gc.rectangle("fill",-125,375,90,4)
end,
zen=function(P)
setFont(75)
mStr(max(200-P.stat.row,0),-82,280)
end,
infinite=function(P)
setFont(50)
mStr(P.stat.atk,-82,310)
mStr(format("%.2f",P.stat.atk/P.stat.row),-82,420)
setFont(20)
mStr("Attack",-82,363)
mStr("Efficiency",-82,475)
end,
tsd=function(P)
setFont(35)
mStr("TSD",-82,407)
setFont(80)
mStr(P.modeData.event,-82,330)
end,
blind=function(P)
setFont(25)
mStr("Rows",-82,300)
mStr("Techrash",-82,420)
if curMode.lv==6 then
mStr("Point",-82,180)
setFont(60)
mStr(P.modeData.point*.1,-82,110)
end
setFont(80)
mStr(P.stat.row,-82,220)
mStr(P.stat.clear_4,-82,340)
end,
dig=function(P)
setFont(70)
mStr(P.modeData.event,-82,310)
setFont(30)
mStr("Wave",-82,375)
end,
survivor=function(P)
setFont(70)
mStr(P.modeData.event,-82,310)
setFont(30)
mStr("Wave",-82,375)
end,
defender=function(P)
setFont(60)
mStr(P.modeData.point,-82,315)
setFont(30)
mStr("RPM",-82,375)
end,
attacker=function(P)
setFont(60)
mStr(P.modeData.point,-82,315)
setFont(30)
mStr("RPM",-82,375)
end,
tech=function(P)
setFont(50)
mStr(P.stat.atk,-82,310)
mStr(format("%.2f",P.stat.atk/P.stat.row),-82,420)
setFont(20)
mStr("Attack",-82,363)
mStr("Efficiency",-82,475)
end,
c4wtrain=function(P)
setFont(50)
mStr(max(100-P.stat.row,0),-82,220)
mStr(P.combo,-82,310)
mStr(P.modeData.point,-82,400)
setFont(20)
mStr("combo",-82,358)
mStr("max combo",-82,450)
end,
pctrain=function(P)
setFont(22)
mStr("Perfect Clear",-82,412)
setFont(80)
mStr(P.stat.pc,-82,330)
end,
pcchallenge=function(P)
setFont(22)
mStr("Perfect Clear",-82,432)
setFont(80)
mStr(P.stat.pc,-82,350)
setFont(50)
mStr(max(100-P.stat.row,0),-82,250)
gc.setColor(.5,.5,.5)
if frame>179 then
local y=72*(7-(P.stat.piece+(P.hold.id>0 and 2 or 1))%7)-36
gc.line(320,y,442,y)
end
end,
techmino49=function(P)
setFont(40)
mStr(#players.alive.."/49",-82,175)
mStr(P.ko,-70,215)
setFont(25)
gc.print("KO",-127,225)
gc.setColor(1,.5,0,.6)
gc.print(P.badge,-47,227)
gc.setColor(1,1,1)
setFont(30)
gc.print(up0to4[P.strength],-132,290)
for i=1,P.strength do
gc.draw(badgeIcon,16*i-138,260)
end
end,
techmino99=function(P)
setFont(40)
mStr(#players.alive.."/99",-82,175)
mStr(P.ko,-70,215)
setFont(25)
gc.print("KO",-127,225)
gc.setColor(1,.5,0,.6)
gc.print(P.badge,-47,227)
gc.setColor(1,1,1)
setFont(30)
gc.print(up0to4[P.strength],-132,290)
for i=1,P.strength do
gc.draw(badgeIcon,16*i-138,260)
end
end,
drought=function(P)
setFont(75)
mStr(max(100-P.stat.row,0),-82,280)
end,
custom=function(P)
if P.gameEnv.puzzle or P.gameEnv.target>1e10 then
setFont(25)
mStr("Rows",-82,290)
setFont(60)
mStr(P.stat.row,-82,225)
else
setFont(60)
mStr(max(P.gameEnv.target-P.stat.row,0),-82,240)
end
if P.gameEnv.puzzle and P.modeData.event==0 then
gc.setLineWidth(3)
for y=1,preField.h do for x=1,10 do
local B=preField[y][x]
if B>7 then
gc.setColor(blockColor[B])
gc.rectangle("line",30*x-23,607-30*y,16,16)
elseif B>0 then
local c=blockColor[B]
gc.setColor(c[1],c[2],c[3],.6)
gc.rectangle("line",30*x-25,605-30*y,20,20)
gc.rectangle("line",30*x-20,610-30*y,10,10)
elseif B==-1 then
gc.setColor(1,1,1,.4)
gc.line(30*x-25,605-30*y,30*x-5,625-30*y)
gc.line(30*x-25,625-30*y,30*x-5,605-30*y)
end
end end
end
end
}
-------------------------<Events>-------------------------
Event={null=null}
Event={null=NULL}
function Event.reach_winCheck(P)
if P.stat.row>=P.gameEnv.target then
Event.win(P)
@@ -806,8 +609,13 @@ function Event.c4w_reach(P)
end
end
function Event.newPC(P)
if P.curY+P.r>5-P.stat.row%4+#P.clearing then
Event.lose(P)
local r=P.field;r=r[#r]
if r then
local c=0
for i=1,10 do if r[i]>0 then c=c+1 end end
if c<5 then
Event.lose(P)
end
end
if P.stat.piece%4==0 and #P.field==0 then
P.modeData.event=P.modeData.event==0 and 1 or 0
@@ -820,7 +628,7 @@ function Event.newPC(P)
elseif b<5 then b=7-b
end
end
P:newNext(b)
P.next[#P.next+1]={bk=blocks[b][0],id=b,color=b,name=b}--P:newNext(b)'s simple version!
end
P.counter=P.stat.piece==0 and 20 or 0
newTask(Event_task.PC,P)
@@ -906,7 +714,7 @@ function Event_task.dig_normal(P)
P.counter=P.counter+1
if P.counter>=max(90,180-P.modeData.event)then
P.counter=0
garbageRise(10,1,rnd(10))
P:garbageRise(10,1,rnd(10))
P.modeData.event=P.modeData.event+1
end
end
@@ -915,7 +723,7 @@ function Event_task.dig_lunatic(P)
P.counter=P.counter+1
if P.counter>=max(45,80-.3*P.modeData.event)then
P.counter=0
garbageRise(11+P.modeData.event%3,1,rnd(10))
P:garbageRise(11+P.modeData.event%3,1,rnd(10))
P.modeData.event=P.modeData.event+1
end
end
@@ -926,7 +734,7 @@ function Event_task.survivor_easy(P)
P.atkBuffer[#P.atkBuffer+1]={pos=rnd(10),amount=1,countdown=30,cd0=30,time=0,sent=false,lv=1}
P.atkBuffer.sum=P.atkBuffer.sum+1
P.stat.recv=P.stat.recv+1
if P.modeData.event==45 then showText(P,text.maxspeed,"appear",100,-140,.6)end
if P.modeData.event==45 then P:showText(text.maxspeed,"appear",100,-140,.6)end
P.counter=0
P.modeData.event=P.modeData.event+1
end
@@ -943,7 +751,7 @@ function Event_task.survivor_normal(P)
d%4==3 and{pos=rnd(10),amount=4,countdown=90,cd0=90,time=0,sent=false,lv=3}
P.atkBuffer.sum=P.atkBuffer.sum+d%4+1
P.stat.recv=P.stat.recv+d%4+1
if P.modeData.event==45 then showText(P,text.maxspeed,"appear",100,-140,.6)end
if P.modeData.event==45 then P:showText(text.maxspeed,"appear",100,-140,.6)end
P.counter=0
P.modeData.event=d
end
@@ -960,7 +768,7 @@ function Event_task.survivor_hard(P)
local R=(P.modeData.event%3<2 and 1 or 3)
P.atkBuffer.sum=P.atkBuffer.sum+R
P.stat.recv=P.stat.recv+R
if P.modeData.event==60 then showText(P,text.maxspeed,"appear",100,-140,.6)end
if P.modeData.event==60 then P:showText(text.maxspeed,"appear",100,-140,.6)end
P.counter=0
P.modeData.event=P.modeData.event+1
end
@@ -973,7 +781,7 @@ function Event_task.survivor_lunatic(P)
P.atkBuffer[#P.atkBuffer+1]={pos=rnd(10),amount=4,countdown=t,cd0=t,time=0,sent=false,lv=3}
P.atkBuffer.sum=P.atkBuffer.sum+4
P.stat.recv=P.stat.recv+4
if P.modeData.event==60 then showText(P,text.maxspeed,"appear",100,-140,.6)end
if P.modeData.event==60 then P:showText(text.maxspeed,"appear",100,-140,.6)end
P.counter=0
P.modeData.event=P.modeData.event+1
end
@@ -991,7 +799,7 @@ function Event_task.survivor_ultimate(P)
P.atkBuffer.sum=P.atkBuffer.sum+20
P.stat.recv=P.stat.recv+20
P.counter=0
if P.modeData.event==31 then showText(P,text.maxspeed,"appear",100,-140,.6)end
if P.modeData.event==31 then P:showText(text.maxspeed,"appear",100,-140,.6)end
P.modeData.event=P.modeData.event+1
end
end
@@ -1011,16 +819,16 @@ function Event_task.defender_normal(P)
D.event=D.event+1
D.point=int(108e3/(360-D.event*2))*.1
if D.event==25 then
showText(P,text.great,"appear",100,-140,.6)
P:showText(text.great,"appear",100,-140,.6)
pushSpeed=2
P.dropDelay,P.gameEnv.drop=20,20
elseif D.event==50 then
showText(P,text.awesome,"appear",100,-140,.6)
P:showText(text.awesome,"appear",100,-140,.6)
pushSpeed=3
P.dropDelay,P.gameEnv.drop=10,10
elseif D.event==90 then
P.dropDelay,P.gameEnv.drop=5,5
showText(P,text.maxspeed,"appear",100,-140,.6)
P:showText(text.maxspeed,"appear",100,-140,.6)
end
end
end
@@ -1041,15 +849,15 @@ function Event_task.defender_lunatic(P)
D.event=D.event+1
D.point=int(144e3/(240-2*D.event))*.1
if D.event==25 then
showText(P,text.great,"appear",100,-140,.6)
P:showText(text.great,"appear",100,-140,.6)
pushSpeed=3
P.dropDelay,P.gameEnv.drop=4,4
elseif D.event==50 then
showText(P,text.awesome,"appear",100,-140,.6)
P:showText(text.awesome,"appear",100,-140,.6)
pushSpeed=4
P.dropDelay,P.gameEnv.drop=3,3
elseif D.event==75 then
showText(P,text.maxspeed,"appear",100,-140,.6)
P:showText(text.maxspeed,"appear",100,-140,.6)
P.dropDelay,P.gameEnv.drop=2,2
end
end
@@ -1076,10 +884,10 @@ function Event_task.attacker_hard(P)
D.event=D.event+1
D.point=int(72e4/t)*.1
if D.event==20 then
showText(P,text.great,"appear",100,-140,.6)
P:showText(text.great,"appear",100,-140,.6)
pushSpeed=3
elseif D.event==50 then
showText(P,text.maxspeed,"appear",100,-140,.6)
P:showText(text.maxspeed,"appear",100,-140,.6)
end
end
end
@@ -1112,13 +920,13 @@ function Event_task.attacker_ultimate(P)
D.event=D.event+1
D.point=int(s*36e3/t)*.1
if D.event==10 then
showText(P,text.great,"appear",100,-140,.6)
P:showText(text.great,"appear",100,-140,.6)
pushSpeed=4
elseif D.event==20 then
showText(P,text.awesome,"appear",100,-140,.6)
P:showText(text.awesome,"appear",100,-140,.6)
pushSpeed=5
elseif D.event==30 then
showText(P,text.maxspeed,"appear",100,-140,.6)
P:showText(text.maxspeed,"appear",100,-140,.6)
end
end
end
@@ -1168,7 +976,7 @@ local Fkey_func={
end
P.keyPressing[9]=true
else
changeAtkMode(P.atkMode<3 and P.atkMode+2 or 5-P.atkMode)
P:changeAtkMode(P.atkMode<3 and P.atkMode+2 or 5-P.atkMode)
P.swappingAtkMode=30
end
end,

BIN
font.ttf

Binary file not shown.

View File

@@ -1,164 +0,0 @@
local gc=love.graphics
local int,rnd=math.floor,math.random
local rem=table.remove
function randomTarget(p)
if #players.alive>1 then
local r
::L::
r=players.alive[rnd(#players.alive)]
if r==p then goto L end
return r
end
end
function freshMostDangerous()
mostDangerous,secDangerous=nil
local m,m2=0,0
for i=1,#players.alive do
local h=#players.alive[i].field
if h>=m then
mostDangerous,secDangerous=players.alive[i],mostDangerous
m,m2=h,m
elseif h>=m2 then
secDangerous=players.alive[i]
m2=h
end
end
end
function freshMostBadge()
mostBadge,secBadge=nil
local m,m2=0,0
for i=1,#players.alive do
local h=players.alive[i].badge
if h>=m then
mostBadge,secBadge=players.alive[i],mostBadge
m,m2=h,m
elseif h>=m2 then
secBadge=players.alive[i]
m2=h
end
end
end
function royaleLevelup()
gameStage=gameStage+1
local spd
if(gameStage==3 or gameStage>4)and players[1].alive then
players[1]:showText(text.royale_remain(#players.alive),"beat",50,-100,.3)
end
if gameStage==2 then
spd=30
elseif gameStage==3 then
spd=15
garbageSpeed=.6
if players[1].alive then BGM("cruelty")end
elseif gameStage==4 then
spd=10
pushSpeed=3
elseif gameStage==5 then
spd=5
garbageSpeed=1
elseif gameStage==6 then
spd=3
if players[1].alive then BGM("final")end
end
for i=1,#players.alive do
players.alive[i].gameEnv.drop=spd
end
if curMode.lv==3 then
for i=1,#players.alive do
local P=players.alive[i]
P.gameEnv.drop=int(P.gameEnv.drop*.3)
if P.gameEnv.drop==0 then
P.curY=P.y_img
P.gameEnv._20G=true
if P.AI_mode=="CC"then CC_switch20G(P)end--little cheating,never mind
end
end
end
end
function loadGame(mode,level)
--rec={}
curMode={id=modeID[mode],lv=level}
drawableText.modeName:set(text.modeName[mode])
drawableText.levelName:set(modeLevel[modeID[mode]][level])
needResetGameData=true
gotoScene("play","deck")
end
function resetPartGameData()
frame=30
destroyPlayers()
loadmode[curMode.id]()
if modeEnv.task then
for i=1,#players do
newTask(Event_task[modeEnv.task],players[i])
end
end
if modeEnv.royaleMode then
for i=1,#players do
players[i]:changeAtk(randomTarget(players[i]))
end
end
for i=1,#virtualkey do
virtualkey[i].press=false
end
collectgarbage()
end
function resetGameData()
gamefinished=false
frame=0
garbageSpeed=1
pushSpeed=3
pauseTime=0--Time paused
pauseCount=0--Times paused
destroyPlayers()
local E=defaultModeEnv[curMode.id]
modeEnv=E[curMode.lv]or E[1]
loadmode[curMode.id]()--bg/bgm need redefine in custom,so up here
if modeEnv.task then
for i=1,#players do
newTask(Event_task[modeEnv.task],players[i])
end
end
curBG=modeEnv.bg
BGM(modeEnv.bgm)
FX_badge={}
FX_attack={}
for _,v in next,PTC.dust do
v:release()
end
for i=1,#players do
if not players[i].small then
PTC.dust[i]=PTC.dust0:clone()
PTC.dust[i]:start()
end
end
if modeEnv.royaleMode then
for i=1,#players do
players[i]:changeAtk(randomTarget(players[i]))
end
mostBadge,mostDangerous,secBadge,secDangerous=nil
gameStage=1
garbageSpeed=.3
pushSpeed=2
end
for i=1,#virtualkey do
virtualkey[i].press=false
end
stat.game=stat.game+1
local m,p=#freeRow,40*#players+1
while freeRow[p]do
m,freeRow[m]=m-1
end
freeRow.L=#freeRow
SFX("ready")
collectgarbage()
end
function gameStart()
SFX("start")
for P=1,#players do
P=players[P]
P:resetblock()
P.timing=true
P.control=true
end
end

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 30 KiB

View File

@@ -103,17 +103,15 @@ return{
load={"加载语音ing","加载音乐ing","加载音效ing","加载完成",},
tips={
"不是动画,真的在加载!",
"整个游戏都是MrZ完成的!",
"大满贯10连击消四全清!",
"<方块研究所>有一个Nspire-CX版本!",
"B2B2B???",
"B2B2B2B存在吗?",
"MEGACMB!",
"ALLSPIN!",
"O型回旋三清?",
"只用一个输入设备就可以游玩了",
"O spin triple!",
"Miya:喵!",
"225238922,哔哩哔哩 干杯~",
"225238922 哔哩哔哩 干杯~",
"适度游戏益脑,沉迷游戏伤身,合理安排时间,享受健康生活",
"合群了就会消失,但是消失不代表没有意义",
"学会使用两个旋转键,三个更好",
@@ -128,9 +126,10 @@ return{
"2.7182818284590452353",
"Let-The-Bass-Kick!",
"使用love2d引擎制作",
"哪里不舒服的话先看看设置有没有你想要",
"有疑问?先看设置有没有你想要的",
"有建议的话可以把信息反馈给作者~",
"本游戏不叫铁壳米诺",
"CLASSIC SEXY RUSSIAN BLOCKS",
"LrL,RlR LLr,RRl RRR/LLL F!!",--ZSLJTTI
},
stat={
"游戏运行次数:",
@@ -160,10 +159,18 @@ return{
"使用LOVE2D引擎",
"作者:MrZ 邮箱:1046101471@qq.com",
"程序:MrZ 美术:MrZ 音乐:MrZ 音效:MrZ 语音:Miya",
"使用工具:VScode,GFIE,Beepbox,Goldwave,Cold_Clear",
"特别感谢:Farter,Flyz,196,Teatube,T830,[所有测试人员]和 你!",
"错误或者建议请附带相关信息发送到作者邮箱~",
},
used=[[
使用工具:
Beepbox
GFIE
Goldwave
使用库:
Cold_Clear[MinusKelvin]
simple-love-lights[dylhunn]
]],
support="支持作者",
group="官方QQ群",
warning="禁 止 私 自 传 播",
@@ -244,6 +251,8 @@ return{
sdarrD="-",sdarrU="+",
quickR="快速重新开始",
swap="组合键切换攻击模式",
ctrl="控制设置",
touch="触屏设置",
back=BK,
},
setting_graphic={

View File

@@ -103,17 +103,15 @@ return{
load={"加载语音ing","加载音乐ing","加载音效ing","加载完成",},
tips={
"不是动画,真的在加载!",
"整个游戏都是MrZ完成的!",
"大满贯10连击消四全清!",
"<方块研究所>有一个Nspire-CX版本!",
"B2B2B???",
"B2B2B2B存在吗?",
"MEGACMB!",
"ALLSPIN!",
"O型回旋三清?",
"只用一个输入设备就可以游玩了",
"O型回旋三清!",
"Miya:喵!",
"225238922,哔哩哔哩 干杯~",
"225238922 哔哩哔哩 干杯~",
"适度游戏益脑,沉迷游戏伤身,合理安排时间,享受健康生活",
"合群了就会消失,但是消失不代表没有意义",
"学会使用两个旋转键,三个更好",
@@ -128,9 +126,10 @@ return{
"2.7182818284590452353",
"Let-The-Bass-Kick!",
"使用love2d引擎制作",
"哪里不舒服的话先看看设置有没有你想要",
"有疑问?先看设置有没有你想要的",
"有建议的话可以把信息反馈给作者~",
"郑重声明本游戏不叫[铁壳米诺]",
"CLASSIC SEXY RUSSIAN BLOCKS",
"LrL,RlR LLr,RRl RRR/LLL F!!",--ZSLJTTI
},
stat={
"游戏运行次数:",
@@ -160,10 +159,18 @@ return{
"使用LOVE2D引擎",
"作者:MrZ 邮箱:1046101471@qq.com",
"程序:MrZ 美术:MrZ 音乐:MrZ 音效:MrZ 语音:Miya",
"使用工具:VScode,GFIE,Beepbox,Goldwave,Cold_Clear",
"特别感谢:Farter,Flyz,196,Teatube,T830,[所有测试人员]和 你!",
"错误或者建议请附带相关信息发送到作者邮箱~",
},
used=[[
使用工具:
Beepbox
GFIE
Goldwave
使用库:
Cold_Clear[MinusKelvin]
simple-love-lights[dylhunn]
]],
support="支持作者",
group="官方QQ群",
warning="禁 止 私 自 传 播",
@@ -245,6 +252,8 @@ return{
sdarrD="-",sdarrU="+",
quickR="快速重新开始",
swap="组合键切换攻击模式",
ctrl="控制设置",
touch="触屏设置",
back=BK,
},
setting_graphic={

View File

@@ -103,17 +103,15 @@ return{
load={"Loading VOICE","Loading BGM","Loading SFX","Finished",},
tips={
"Not animation,real loading!",
"The WHOLE game is made by MrZ!",
"Back to Back 10 combo Techrash PC!",
"Techmino has a Nspire-CX edition!",
"B2B2B???",
"Is B2B2B2B possible?",
"MEGACMB!",
"ALLSPIN!",
"O spin triple?",
"You can play with any input device!",
"O spin triple!",
"Miya:Nya!",
"225238922,Bilibili cheers!",
"225238922 Bilibili cheers!",
"Playing too much = taking drugs",
"Disappearing doesn't mean useless",
"Try to use two rotate button,three better",
@@ -129,8 +127,10 @@ return{
"Let-The-Bass-Kick!",
"Powered by love2d",
"Find out what's in the setting!",
"Any suggestions to author!~",
"Any suggestions to author!",
"Techmino=Technique+tetromino",
"CLASSIC SEXY RUSSIAN BLOCKS",
"LrL,RlR LLr,RRl RRR/LLL F!!",--ZSLJTTI
},
stat={
"Games run:",
@@ -140,7 +140,7 @@ return{
"Rotate:",
"Hold:",
"Block used:",
"Rows cleared:",
"Lines cleared:",
"Attack:",
"Sent:",
"Receive:",
@@ -159,11 +159,19 @@ return{
"",
"Powered by LOVE2D",
"Author:MrZ E-mail:1046101471@qq.com",
"Programe:MrZ Art:MrZ Music:MrZ SFX:MrZ VOICE:Miya",
"Tool used:VScode,GFIE,Beepbox,Goldwave,Cold_Clear",
"Program:MrZ Art:MrZ Music:MrZ SFX:MrZ VOICE:Miya",
"Special thanks:Farter,Flyz,196,Teatube,T830,[all test staff] and YOU!",
"Any bugs/suggestions to my E-mail.",
},
used=[[
Tool used:
Beepbox
GFIE
Goldwave
Lib used:
Cold_Clear[MinusKelvin]
simple-love-lights[dylhunn]
]],
support="Support Author",
group="Official QQ Group",
warning="DO NOT DISTRIBUTE",
@@ -262,7 +270,7 @@ return{
shakeFX="Shake FX level",
atkFX="ATK FX level",
fullscreen="Fullscreen",
frame="drawFPS",
frame="draw FPS",
back=BK,
},
setting_sound={

80
light.lua Normal file
View File

@@ -0,0 +1,80 @@
--LIGHT MODULE(Optimized by MrZ,Original on github/love2d community/simple-love-lights)
--Heavily based on mattdesl's libGDX implementation:
--https://github.com/mattdesl/lwjgl-basics/wiki/2D-Pixel-Perfect-Shadows
local gc=love.graphics
local C=gc.clear
local shadowMapShader=gc.newShader("shadowMapShader.cs")--Shader for caculating the 1D shadow map.
local lightRenderShader=gc.newShader("lightRenderShader.cs")--Shader for rendering blurred lights and shadows.
Lights={}--Lightsource objects
local Lights=Lights
--Private--
local function move(L,x,y)
L.x,L.y=x,y
end
local function setPow(L,pow)
L.size=pow
end
local function destroy(L)
L.blackCanvas:release()
L.shadowCanvas:release()
L.renderCanvas:release()
end
local function draw(L)
local r,g,b,a=love.graphics.getColor()
gc.setCanvas(L.blackCanvas)C()
gc.setCanvas(L.shadowCanvas)C()
gc.setCanvas(L.renderCanvas)C()
lightRenderShader:send("xresolution",L.size);
shadowMapShader:send("yresolution",L.size);
--初始化数据
local X=L.x-L.size*.5
local Y=L.y-L.size*.5
--整束光的左上角
gc.translate(-X,-Y)
L.blackCanvas:renderTo(L.blackFn)
gc.translate(X,Y)
--渲染遮光物
gc.setShader(shadowMapShader)
gc.setCanvas(L.shadowCanvas)
gc.draw(L.blackCanvas)
--根据遮光物渲染阴影画布
gc.setShader(lightRenderShader)
gc.setCanvas(L.renderCanvas)
gc.draw(L.shadowCanvas,0,0,0,1,L.size)
--根据阴影画布渲染光画布
gc.setShader()gc.setCanvas()gc.setBlendMode("add")
--准备渲染
gc.setColor(r,g,b,a)
gc.draw(L.renderCanvas,X,Y+L.size,0,1,-1)
--渲染到屏幕
gc.setBlendMode("alpha")
--复位
end
--Public--
function drawLight()
for i=1,#Lights do
Lights[i]:draw()
end
end
function clearLight(L)
for i=1,#Lights do
Lights[i]:destroy()
Lights[i]=nil
end
end
function addLight(x,y,R,F)
local id=#Lights+1
Lights[id]={
id=id,
x=x,y=y,size=R,
blackCanvas=gc.newCanvas(R,R),--遮挡物画布
shadowCanvas=gc.newCanvas(R,1),--1D视深画布
renderCanvas=gc.newCanvas(R,R),--灯光画布
blackFn=F,--遮挡物绘图函数
--方法
move=move,
setPow=setPow,
draw=draw,
destroy=destroy,
}
end

30
lightRenderShader.cs Normal file
View File

@@ -0,0 +1,30 @@
#define PI 3.14
extern float xresolution;
//从1D距离map采样
float samp(vec2 coord,float r,Image u_texture){
return step(r,Texel(u_texture,coord).r);
}
vec4 effect(vec4 color,Image texture,vec2 texture_coords,vec2 screen_coords){
//直角转极坐标用于采样1D材质的y总是0
vec2 norm=texture_coords.st*2.-1.;
float r=length(norm);
vec2 tc=vec2((atan(norm.y,norm.x)+PI)/(2.*PI),0.);
//根据离光源距离放大模糊系数,模拟影子淡出
float blur=(1./xresolution)*smoothstep(0.,1.,r);
//简易高斯模糊
float sum=
samp(vec2(tc.x-4.*blur,tc.y),r,texture)*.5
+samp(vec2(tc.x-3.*blur,tc.y),r,texture)*.9
+samp(vec2(tc.x-2.*blur,tc.y),r,texture)*.12
+samp(vec2(tc.x-1.*blur,tc.y),r,texture)*.15
+samp(tc,r,texture)*.16//The center tex coord,which gives us hard shadows.
+samp(vec2(tc.x+1.*blur,tc.y),r,texture)*.15
+samp(vec2(tc.x+2.*blur,tc.y),r,texture)*.12
+samp(vec2(tc.x+3.*blur,tc.y),r,texture)*.9
+samp(vec2(tc.x+4.*blur,tc.y),r,texture)*.5;
//sum值为亮度(0~1)
//乘上距离得到逐渐变淡的光线
return vec4(vec3(1.),sum*smoothstep(1.,.1,r));
}

View File

@@ -1,7 +1,3 @@
local gc=love.graphics
local tc,kb=love.touch,love.keyboard
local sys=love.system
local fs=love.filesystem
local mobile=system=="Android"or system=="iOS"
actName={"moveLeft","moveRight","rotRight","rotLeft","rotFlip","hardDrop","softDrop","hold","func","restart","insLeft","insRight","insDown"}
@@ -53,6 +49,7 @@ blockColor={
color.darkGreen,
}
sfx={
"welcome",
"button","swipe",
"ready","start","win","fail","collect",
"move","rotate","rotatekick","hold",
@@ -178,7 +175,7 @@ modeLevel={
tsd={"NORMAL","HARD"},
blind={"EASY","HARD","HARD+","LUNATIC","ULTIMATE","GM"},
dig={"NORMAL","LUNATIC"},
survivor={"EASY","NORMAL","HARD","LUNATIC","ULTIMATE","EXTRA"},
survivor={"EASY","NORMAL","HARD","LUNATIC","ULTIMATE"},
defender={"NORMAL","LUNATIC"},
attacker={"HARD","ULTIMATE"},
tech={"NORMAL","NORMAL+","HARD","HARD+","LUNATIC","LUNATIC+",},
@@ -283,7 +280,7 @@ end
Widget={
load={},intro={},quit={},
main={
play= newButton(150,280,200,160,color.red, 70,function()gotoScene("mode")end, nil,"setting"),
play= newButton(150,280,200,160,color.red, 60,function()gotoScene("mode")end, nil,"setting"),
setting=newButton(370,280,200,160,color.lightBlue, 50,function()gotoScene("setting_game")end, nil,"music"),
music= newButton(590,280,200,160,color.lightPurple,37,function()gotoScene("music")end, nil,"help"),
help= newButton(150,460,200,160,color.yellow, 55,function()gotoScene("help")end, nil,"stat"),
@@ -403,7 +400,7 @@ Widget={
setting.fullscreen=not setting.fullscreen
love.window.setFullscreen(setting.fullscreen)
if not setting.fullscreen then
love.resize(gc.getWidth(),gc.getHeight())
love.resize(love.graphics.getWidth(),love.graphics.getHeight())
end
end,nil,"bg"),
bg= newSwitch(990,250,40,function()return setting.bg end,function()setting.bg=not setting.bg end, nil,"bgblock"),
@@ -411,7 +408,7 @@ Widget={
setting.bgblock=not setting.bgblock--if not setting.bgblock then for i=1,16 do FX_BGblock.list[i].v=3*FX_BGblock.list[i].v end end
end,nil,"skin"),
skin= newButton(860,470,120,60,color.white,40,function()
setting.skin=setting.skin%6+1
setting.skin=setting.skin%8+1
changeBlockSkin(setting.skin)
end,nil,"back"),
back= newButton(1160,600,160,160,color.white,55,back,nil,"sound"),
@@ -462,7 +459,7 @@ Widget={
},
help={
his= newButton(1050,520,230,60,color.white,40,function()gotoScene("history")end,nil,"back"),
qq= newButton(1050,600,230,60,color.white,40,function()sys.openURL("tencent://message/?uin=1046101471&Site=&Menu=yes")end, function()return mobile end,"his"),
qq= newButton(1050,600,230,60,color.white,40,function()love.system.openURL("tencent://message/?uin=1046101471&Site=&Menu=yes")end, function()return mobile end,"his"),
back= newButton(640, 600,180,60,color.white,40,back,nil,"qq"),
},
history={
@@ -471,7 +468,7 @@ Widget={
back= newButton(1155,600,180,90,color.white,40,back),
},
stat={
path= newButton(980,590,250,60,color.white,30,function()sys.openURL(fs.getSaveDirectory())end,function()return mobile end,"back"),
path= newButton(980,590,250,60,color.white,30,function()love.system.openURL(love.filesystem.getSaveDirectory())end,function()return mobile end,"back"),
back= newButton(640,590,180,60,color.white,40,back,nil,"path"),
},
}

View File

@@ -1,25 +1,22 @@
--[[
第一次搞这么大的工程~参考价值不是很大
如果你有时间并且也热爱俄罗斯方块的话,来看代码或者帮助优化的话当然欢迎!
顺便,不经允许直接盗用代码的先死个妈
(顺便,无授权直接盗用代码的先死个妈)
]]
local love=love
local gc,tm=love.graphics,love.timer
local ms,kb,tc=love.mouse,love.keyboard,love.touch
local fs,sys,wd=love.filesystem,love.system,love.window
local int,abs,rnd,max,min=math.floor,math.abs,math.random,math.max,math.min
local find=string.find
local ins,rem=table.insert,table.remove
local Timer=tm.getTime
local F=false
null=function()end
local gc,sys=love.graphics,love.system
local Timer=love.timer.getTime
local int,rnd,max,min=math.floor,math.random,math.max,math.min
local rem=table.remove
NULL=function()end
-------------------------------------------------------------
system=sys.getOS()
local mobile=system=="Android"or system=="iOS"
local xOy=love.math.newTransform()
local mx,my,mouseShow=-20,-20,false
local touching--1st touching ID
modeSel,levelSel=1,3--Initialize mode selection
players={alive={},human=0}
scr={x=0,y=0,w=gc.getWidth(),h=gc.getHeight(),k=1}
local scr=scr
@@ -58,22 +55,25 @@ setting={
sddas=0,sdarr=2,
quickR=true,swap=true,
--game
ghost=true,center=true,
smo=true,grid=false,
dropFX=3,
shakeFX=3,
atkFX=3,
frameMul=100,
--
fullscreen=false,
bg=true,
bgblock=true,
lang=1,
skin=1,
--graphic
sfx=8,bgm=6,
vib=3,voc=0,
--sound
keyMap={
{"left","right","x","z","c","up","down","space","tab","r","","",""},
{"","","","","","","","","","","","",""},
@@ -82,7 +82,7 @@ setting={
{"","","","","","","","","","","","",""},
{"","","","","","","","","","","","",""},
{"","","","","","","","","","","","",""},
{"","","","","","","","","","","","",""},
{"","","","","","","","","","","","",""},--keyboard
{"dpleft","dpright","a","b","y","dpup","dpdown","rightshoulder","x","leftshoulder","","",""},
{"","","","","","","","","","","","",""},
{"","","","","","","","","","","","",""},
@@ -90,18 +90,18 @@ setting={
{"","","","","","","","","","","","",""},
{"","","","","","","","","","","","",""},
{"","","","","","","","","","","","",""},
{"","","","","","","","","","","","",""},
},--keyboard & joystick
{"","","","","","","","","","","","",""},--joystick
},
virtualkey={
{80,720-80,6400,80},--moveLeft
{240,720-80,6400,80},--moveRight
{1280-240,720-80,6400,80},--rotRight
{1280-400,720-80,6400,80},--rotLeft
{1280-240,720-240,6400,80},--rotFlip
{1280-80,720-80,6400,80},--hardDrop
{1280-80,720-240,6400,80},--softDrop
{1280-80,720-400,6400,80},--hold
{80,80,6400,80},--restart
{80,720-80,6400,80}, --moveLeft
{240,720-80,6400,80}, --moveRight
{1280-240,720-80,6400,80}, --rotRight
{1280-400,720-80,6400,80}, --rotLeft
{1280-240,720-240,6400,80}, --rotFlip
{1280-80,720-80,6400,80}, --hardDrop
{1280-80,720-240,6400,80}, --softDrop
{1280-80,720-400,6400,80}, --hold
{80,80,6400,80}, --restart
},
virtualkeyAlpha=3,
virtualkeyIcon=true,
@@ -134,17 +134,17 @@ virtualkey={
]]
}
virtualkeyDown={F,F,F,F,F,F,F,F,F,F,F,F,F}
virtualkeyDown={X,X,X,X,X,X,X,X,X,X}
virtualkeyPressTime={0,0,0,0,0,0,0,0,0,0,0,0,0}
--User datas&settings
-------------------------------------------------------------
require("class")
require("toolfunc")
require("ai")
require("gamefunc")
require("toolfunc")
require("list")
require("dataList")
require("texture")
require("light")
local Tmr=require("timer")
local Pnt=require("paint")
require("player")
@@ -168,7 +168,6 @@ if sys.getPowerInfo()~="unknown"then
gc.line(61.5,.5,83.5,22.5)
elseif state=="charging"or state=="charged"then
gc.draw(chargeImage,84,3)
F=true
end
end
if pow then
@@ -214,7 +213,6 @@ local sceneInit={
updatePowerInfo()
end,
main=function()
modeSel,levelSel=modeSel or 1,levelSel or 3--Initialize mode selection
modeEnv={}
if not players[1]then
newDemoPlayer(1,900,35,1.1)
@@ -284,6 +282,7 @@ local sceneInit={
sel=1
end,
quit=function()
love.timer.sleep(.3)
love.event.quit()
end,
}
@@ -489,7 +488,7 @@ function keyDown.draw(key)
elseif key=="escape"then
back()
else
pen=find("123qwea#sdzxc",key)or pen
pen=string.find("123qwea#sdzxc",key)or pen
end
end
@@ -609,7 +608,7 @@ function keyDown.pause(key)
updateStat()
resetGameData()
gotoScene("play","none")
end--Restart
end--Restart with ctrl+R
end
function touchDown.play(id,x,y)
@@ -880,8 +879,10 @@ function love.touchreleased(id,x,y)
end
function love.keypressed(i)
mouseShow=false
if i=="f8"then devMode=(devMode+1)%3 end
if devMode==2 then
if i=="f8"then devMode=0
elseif i=="f9"then devMode=1
elseif i=="f10"then devMode=2
elseif devMode==2 then
if i=="k"then
for i=1,8 do
local P=players.alive[rnd(#players.alive)]
@@ -1045,6 +1046,7 @@ function love.update(dt)
-- end--update Widgets
end
local scs={1,2,1,2,1,2,1,2,1,2,1.5,1.5,.5,2.5}
local FPS=love.timer.getFPS
function love.draw()
gc.discard()--SPEED UPUPUP!
Pnt.BG[setting.bg and curBG or"grey"]()
@@ -1066,14 +1068,14 @@ function love.draw()
end--Draw widgets
if mouseShow and not touching then
local r=Timer()*.5
gc.setColor(1,1,1,min(1-abs(1-r%1*2),.3))
gc.setColor(1,1,1,min(1-math.abs(1-r%1*2),.3))
r=int(r)%7+1
gc.draw(mouseBlock[r],mx,my,Timer()%3.1416*4,20,20,scs[2*r]-.5,#blocks[r][0]-scs[2*r-1]+.5)
gc.setColor(1,1,1,.5)gc.circle("fill",mx,my,5)
gc.setColor(1,1,1)gc.circle("fill",mx,my,3)
end--Awesome mouse!
gc.setColor(1,1,1)
if powerInfoCanvas and scene~="draw"then
if powerInfoCanvas then
gc.draw(powerInfoCanvas)
end--Power Info
gc.setLineWidth(6)
@@ -1107,7 +1109,7 @@ function love.draw()
end--Black side
setFont(20)
gc.setColor(1,1,1)
gc.print(tm.getFPS(),5,700)
gc.print(FPS(),5,700)
if devMode>0 then
gc.setColor(1,devMode==2 and .5 or 1,1)
gc.print("Tasks:"..#Task,5,600)
@@ -1118,9 +1120,10 @@ function love.draw()
end
end
function love.run()
local lastFrame,lastUpdatePowerInfo=Timer(),Timer()
local readyDrawFrame=0
local T=love.timer
local lastFrame,lastUpdatePowerInfo=T.getTime(),T.getTime()
local readyDrawFrame=0
local mini=love.window.isMinimized
local PUMP,POLL=love.event.pump,love.event.poll
love.resize(gc.getWidth(),gc.getHeight())
scene="load"sceneInit.load()--System Launch
@@ -1138,7 +1141,7 @@ function love.run()
end
T.step()
love.update(T.getDelta())
if not wd.isMinimized()then
if not mini()then
readyDrawFrame=readyDrawFrame+setting.frameMul
if readyDrawFrame>=100 then
readyDrawFrame=readyDrawFrame-100
@@ -1157,13 +1160,14 @@ function love.run()
end
end
local fs=love.filesystem
userData,userSetting=fs.newFile("userdata"),fs.newFile("usersetting")
if fs.getInfo("userdata")then
loadData()
end
if fs.getInfo("usersetting")then
loadSetting()
elseif mobile then
elseif system=="Android"or system=="iOS" then
setting.virtualkeySwitch=true
setting.swap=false
end

View File

@@ -1,6 +1,4 @@
local gc=love.graphics
local mt=love.math
local gmatch=string.gmatch
local setFont=setFont
local int,abs,rnd,max,min,sin=math.floor,math.abs,math.random,math.max,math.min,math.sin
local format=string.format
@@ -88,7 +86,8 @@ local miniTitle_rect={
}
local function stencil_miniTitle()
for i=1,#miniTitle_rect do
gc.rectangle("fill",unpack(miniTitle_rect[i]))
local a,b,c,d=unpack(miniTitle_rect[i])
gc.rectangle("fill",250+a*30,150+b*30,c*30,d*30)
end
end
@@ -165,7 +164,6 @@ textFX={
gc.pop()
end,
}
local function drawAtkPointer(x,y)
local t=sin(Timer()*20)
gc.setColor(.2,.7+t*.2,1,.6+t*.4)
@@ -174,7 +172,6 @@ local function drawAtkPointer(x,y)
gc.setColor(0,.6,1,.8-a)
gc.circle("line",x,y,30*(1+a),6)
end
local function VirtualkeyPreview()
for i=1,#virtualkey do
local c=sel==i and .8 or 1
@@ -204,8 +201,6 @@ local function drawVirtualkey()
end
end
local scs={{1,2},nil,nil,nil,nil,{1.5,1.5},{0.5,2.5}}for i=2,5 do scs[i]=scs[1]end
local matrixT={}for i=0,15 do matrixT[i]={}for j=0,8 do matrixT[i][j]=mt.noise(i,j)+2 end end
local Pnt={BG={}}
function Pnt.BG.none()
gc.clear(.15,.15,.15)
@@ -244,6 +239,7 @@ function Pnt.BG.game5()
else gc.clear(0,0,0)
end
end--Lightning
local scs={1,2,1,2,1,2,1,2,1,2,1.5,1.5,.5,2.5}
function Pnt.BG.game6()
local t=1.2-Timer()%10%3%1.2
if t<.5 then gc.clear(t,t,t)
@@ -251,7 +247,7 @@ function Pnt.BG.game6()
end
gc.setColor(.3,.3,.3)
local r=7-int(Timer()*.5)%7
gc.draw(mouseBlock[r],640,360,Timer()%3.1416*6,400,400,scs[r][2]-.5,#blocks[r][0]-scs[r][1]+.5)
gc.draw(mouseBlock[r],640,360,Timer()%3.1416*6,400,400,scs[2*r]-.5,#blocks[r][0]-scs[2*r-1]+.5)
end--Fast lightning&spining tetromino
function Pnt.BG.rgb()
gc.clear(
@@ -266,6 +262,7 @@ function Pnt.BG.strap()
gc.draw(background2,x,0,nil,10)
gc.draw(background2,x-1280,0,nil,10)
end
local matrixT={}for i=0,15 do matrixT[i]={}for j=0,8 do matrixT[i][j]=love.math.noise(i,j)+2 end end
function Pnt.BG.matrix()
gc.clear(.15,.15,.15)
for i=0,15 do
@@ -289,14 +286,14 @@ function Pnt.load()
mStr(loadTip,640,400)
end
function Pnt.intro()
gc.push()
gc.translate(250,150)
gc.scale(30)
gc.stencil(stencil_miniTitle,"replace",1)
gc.stencil(stencil_miniTitle,"replace",1)
gc.setStencilTest("equal",1)
gc.setColor(1,1,1,min(count,80)*.005)
gc.rectangle("fill",0,0,26,14)
gc.pop()
gc.push("transform")
gc.translate(250,150)
gc.scale(30)
gc.rectangle("fill",0,0,26,14)
gc.pop()
gc.setColor(1,1,1,.06)
for i=41,5,-2 do
gc.setLineWidth(i)
@@ -573,12 +570,14 @@ function Pnt.setting_touch()
end
end
function Pnt.help()
setFont(32)
setFont(30)
gc.setColor(1,1,1)
for i=1,11 do
gc.printf(text.help[i],140,15+43*i,1000,"center")
for i=1,#text.help do
gc.printf(text.help[i],140,10+40*i,1000,"center")
end
gc.draw(titleImage,250,600,.2,1+.05*sin(Timer()*2),nil,206,35)
setFont(24)
gc.print(text.used,30,330)
gc.draw(titleImage,280,620,.1,1+.05*sin(Timer()*2),nil,206,35)
gc.setLineWidth(5)
gc.rectangle("line",17,17,260,260)
gc.rectangle("line",1077,17,186,186)

View File

@@ -1,10 +1,10 @@
-------------------------<Head>-------------------------
local int,ceil,abs,rnd,max,min=math.floor,math.ceil,math.abs,math.random,math.max,math.min
local sin=math.sin
local ins,rem=table.insert,table.remove
local gc=love.graphics
local Timer=love.timer.getTime
local format=string.format
local scr=scr--screen camera
-------------------------</Head>-------------------------
-------------------------<GameData>-------------------------
@@ -21,7 +21,7 @@ local gameEnv0={
block=true,
visible="show",--keepVisible=visile~="show"
Fkey=null,puzzle=false,ospin=true,
Fkey=NULL,puzzle=false,ospin=true,
freshLimit=1e99,easyFresh=true,
target=1e99,dropPiece="null",
bg="none",bgm="race"
@@ -169,12 +169,11 @@ AIRS[7]={
}
local CCblockID={4,3,5,6,1,2,0}
local freshMethod={
none=null,
none=NULL,
bag7=function(P)
if #P.next<6 then
local bag={1,2,3,4,5,6,7}
::L::
P:newNext(rem(bag,rnd(#bag)))
::L::P:newNext(rem(bag,rnd(#bag)))
if bag[1]then goto L end
end
end,
@@ -189,25 +188,21 @@ local freshMethod={
end
end,
rnd=function(P)
local i
::L::
i=rnd(7)
::L::local i=rnd(7)
if i==P.next[5]then goto L end
P:newNext(i)
end,--random
drought1=function(P)
if #P.next<6 then
local bag={1,2,3,4,5,6}
::L::
P:newNext(rem(bag,rnd(#bag)))
::L::P:newNext(rem(bag,rnd(#bag)))
if bag[1]then goto L end
end
end,
drought2=function(P)
if #P.next<6 then
local bag={1,1,1,1,2,2,2,2,6,6,6,6,3,3,4,4,5,7}
::L::
P:newNext(rem(bag,rnd(#bag)))
::L::P:newNext(rem(bag,rnd(#bag)))
if bag[1]then goto L end
end
end,
@@ -227,7 +222,6 @@ local attackColor={
{color.lightRed,color.white},
{color.darkGreen,color.cyan},
}
local function drawPixel(y,x,id)
gc.draw(blockSkin[id],30*x-30,600-30*y)
end
@@ -238,6 +232,197 @@ local function drawDial(x,y,speed)
gc.setColor(1,1,1,.6)
gc.draw(dialNeedle,x,y,2.094+(speed<=175 and .02094*speed or 4.712-52.36/(speed-125)),nil,nil,5,4)
end
local mesDisp={
--Default:font=35,white
sprint=function(P)
setFont(60)
local r=max(P.gameEnv.target-P.stat.row,0)
mStr(r,-82,265)
if r<21 and r>0 then
gc.setLineWidth(4)
gc.setColor(1,r>10 and 0 or rnd(),.5)
gc.line(0,600-30*r,300,600-30*r)
end
end,
marathon=function(P)
setFont(50)
mStr(P.stat.row,-82,320)
mStr(P.gameEnv.target,-82,370)
gc.rectangle("fill",-125,375,90,4)
end,
master=function(P)
setFont(50)
mStr(P.modeData.point,-82,320)
mStr((P.modeData.event+1)*100,-82,370)
gc.rectangle("fill",-125,375,90,4)
end,
classic=function(P)
setFont(80)
local r=P.gameEnv.target*.1
mStr(r<11 and 19+r or r==11 and"00"or r==12 and"0a"or format("%x",r*10-110),-82,210)
setFont(20)
mStr("speed level",-82,290)
setFont(50)
mStr(P.stat.row,-82,320)
mStr(P.gameEnv.target,-82,370)
gc.rectangle("fill",-125,375,90,4)
end,
zen=function(P)
setFont(75)
mStr(max(200-P.stat.row,0),-82,280)
end,
infinite=function(P)
setFont(50)
mStr(P.stat.atk,-82,310)
mStr(format("%.2f",P.stat.atk/P.stat.row),-82,420)
setFont(20)
mStr("Attack",-82,363)
mStr("Efficiency",-82,475)
end,
tsd=function(P)
setFont(35)
mStr("TSD",-82,407)
setFont(80)
mStr(P.modeData.event,-82,330)
end,
blind=function(P)
setFont(25)
mStr("Lines",-82,300)
mStr("Techrash",-82,420)
if curMode.lv==6 then
mStr("Point",-82,170)
setFont(60)
mStr(P.modeData.point*.1,-82,110)
end
setFont(80)
mStr(P.stat.row,-82,220)
mStr(P.stat.clear_4,-82,340)
end,
dig=function(P)
setFont(70)
mStr(P.modeData.event,-82,310)
setFont(30)
mStr("Wave",-82,375)
end,
survivor=function(P)
setFont(70)
mStr(P.modeData.event,-82,310)
setFont(30)
mStr("Wave",-82,375)
end,
defender=function(P)
setFont(60)
mStr(P.modeData.point,-82,315)
setFont(30)
mStr("RPM",-82,375)
end,
attacker=function(P)
setFont(60)
mStr(P.modeData.point,-82,315)
setFont(30)
mStr("RPM",-82,375)
end,
tech=function(P)
setFont(50)
mStr(P.stat.atk,-82,310)
mStr(format("%.2f",P.stat.atk/P.stat.row),-82,420)
setFont(20)
mStr("Attack",-82,363)
mStr("Efficiency",-82,475)
end,
c4wtrain=function(P)
setFont(50)
mStr(max(100-P.stat.row,0),-82,220)
mStr(P.combo,-82,310)
mStr(P.modeData.point,-82,400)
setFont(20)
mStr("combo",-82,358)
mStr("max combo",-82,450)
end,
pctrain=function(P)
setFont(22)
mStr("Perfect Clear",-82,412)
setFont(80)
mStr(P.stat.pc,-82,330)
end,
pcchallenge=function(P)
setFont(22)
mStr("Perfect Clear",-82,432)
setFont(80)
mStr(P.stat.pc,-82,350)
setFont(50)
mStr(max(100-P.stat.row,0),-82,250)
gc.setColor(.5,.5,.5)
if frame>179 then
local y=72*(7-(P.stat.piece+(P.hd.id>0 and 2 or 1))%7)-36
gc.line(320,y,442,y)
end
end,
techmino49=function(P)
setFont(40)
mStr(#players.alive.."/49",-82,175)
mStr(P.ko,-70,215)
setFont(25)
gc.print("KO",-127,225)
gc.setColor(1,.5,0,.6)
gc.print(P.badge,-47,227)
gc.setColor(1,1,1)
setFont(30)
gc.print(up0to4[P.strength],-132,290)
for i=1,P.strength do
gc.draw(badgeIcon,16*i-138,260)
end
end,
techmino99=function(P)
setFont(40)
mStr(#players.alive.."/99",-82,175)
mStr(P.ko,-70,215)
setFont(25)
gc.print("KO",-127,225)
gc.setColor(1,.5,0,.6)
gc.print(P.badge,-47,227)
gc.setColor(1,1,1)
setFont(30)
gc.print(up0to4[P.strength],-132,290)
for i=1,P.strength do
gc.draw(badgeIcon,16*i-138,260)
end
end,
drought=function(P)
setFont(75)
mStr(max(100-P.stat.row,0),-82,280)
end,
custom=function(P)
if P.gameEnv.puzzle or P.gameEnv.target>1e10 then
setFont(25)
mStr("Lines",-82,290)
setFont(60)
mStr(P.stat.row,-82,225)
else
setFont(60)
mStr(max(P.gameEnv.target-P.stat.row,0),-82,240)
end
if P.gameEnv.puzzle and P.modeData.event==0 then
gc.setLineWidth(3)
for y=1,preField.h do for x=1,10 do
local B=preField[y][x]
if B>7 then
gc.setColor(blockColor[B])
gc.rectangle("line",30*x-23,607-30*y,16,16)
elseif B>0 then
local c=blockColor[B]
gc.setColor(c[1],c[2],c[3],.6)
gc.rectangle("line",30*x-25,605-30*y,20,20)
gc.rectangle("line",30*x-20,610-30*y,10,10)
elseif B==-1 then
gc.setColor(1,1,1,.4)
gc.line(30*x-25,605-30*y,30*x-5,625-30*y)
gc.line(30*x-25,625-30*y,30*x-5,605-30*y)
end
end end
end
end
}
--------------Used in draw player↑
player={}local player=player
@@ -285,7 +470,7 @@ function newDemoPlayer(id,x,y,size)
block=true,
visible="show",
Fkey=null,puzzle=false,ospin=true,
Fkey=NULL,puzzle=false,ospin=true,
freshLimit=1e99,easyFresh=true,
target=1e99,dropPiece="null",
}
@@ -299,12 +484,13 @@ function newDemoPlayer(id,x,y,size)
P.dropDelay,P.lockDelay=1e99,1e99
P.freshTime=0
P.spinLast,P.lastClear=false,nil
P.spinSeq=0
local bag1={1,2,3,4,5,6,7}
for i=1,7 do
P:newNext(rem(bag1,rnd(#bag1)))
end
P.freshNext=function(P)if #P.next<6 then local bag={1,2,3,4,5,6,7}::L::P:newNext(rem(bag,rnd(#bag)))if bag[1]then goto L end end end
P.freshNext=freshMethod.bag7
if P.gameEnv.sequence==1 then P.bag={}--Bag7
elseif P.gameEnv.sequence==2 then P.his={}for i=1,4 do P.his[i]=P.next.id[i+3]end--History4
elseif P.gameEnv.sequence==3 then--Pure random
@@ -316,7 +502,7 @@ function newDemoPlayer(id,x,y,size)
P.AI_needFresh=false
P.AI_keys={}
P.AI_delay,P.AI_delay0=3,3
P.AIdata={next=5,hold=true,_20G=false,bag7=true,node=1e10}
P.AIdata={next=5,hold=true,_20G=false,bag7=true,node=80000}
if not BOT then P.AI_mode="9S"end
if P.AI_mode=="CC"then
P.RS=AIRS
@@ -411,6 +597,7 @@ function newPlayer(id,x,y,size,AIdata)
P.dropDelay,P.lockDelay=P.gameEnv.drop,P.gameEnv.lock
P.freshTime=0
P.spinLast,P.lastClear=false,nil
P.spinSeq=0--for Ospin,each digit mean a spin
P.his={rnd(7),rnd(7),rnd(7),rnd(7)}
local s=P.gameEnv.sequence
@@ -755,10 +942,11 @@ function player.draw(P)
--draw Canvas
else
gc.push("transform")
gc.translate(P.x,P.y)gc.scale(P.size)--Position
gc.setColor(0,0,0,.6)gc.rectangle("fill",0,0,600,690)--Background
gc.setLineWidth(7)
gc.setColor(frameColor[P.strength])gc.rectangle("line",0,0,600,690,3)--Big frame
gc.translate(P.x,P.y)gc.scale(P.size)
--Camera
gc.setColor(0,0,0,.6)gc.rectangle("fill",0,0,600,690)
gc.setLineWidth(7)gc.setColor(frameColor[P.strength])gc.rectangle("line",0,0,600,690,3)
--Frame
gc.translate(150+P.fieldOffX,70+P.fieldOffY)
if P.gameEnv.grid then
gc.setLineWidth(1)
@@ -768,27 +956,39 @@ function player.draw(P)
y=30*(y-int(P.fieldBeneath/30))+P.fieldBeneath
gc.line(0,y,300,y)
end
end--Grid lines
end--Grid
gc.translate(0,P.fieldBeneath)
gc.setScissor(scr.x+P.absFieldX*scr.k,scr.y+P.absFieldY*scr.k,300*P.size*scr.k,610*P.size*scr.k)
local dy,stepY=0,setting.smo and(P.falling/(P.gameEnv.fall+1))^2.5*30 or 30
local h=1
for j=int(P.fieldBeneath/30+1),#P.field do
while j==P.clearing[h]and P.falling>-1 do
h=h+1
dy=dy+stepY
gc.translate(0,-stepY)
gc.setColor(1,1,1,P.falling/P.gameEnv.fall)
gc.rectangle("fill",0,630-30*j,320,stepY)
end
for i=1,10 do
if P.field[j][i]>0 then
gc.setColor(1,1,1,min(P.visTime[j][i]*.05,1))
drawPixel(j,i,P.field[j][i])
if P.falling==-1 then
for j=int(P.fieldBeneath/30+1),#P.field do
for i=1,10 do
if P.field[j][i]>0 then
gc.setColor(1,1,1,min(P.visTime[j][i]*.05,1))
drawPixel(j,i,P.field[j][i])
end
end
end
end--Field
gc.translate(0,dy)
else--field block only
local dy,stepY=0,setting.smo and(P.falling/(P.gameEnv.fall+1))^2.5*30 or 30
local A=P.falling/P.gameEnv.fall
local h,H=1,#P.field
for j=int(P.fieldBeneath/30+1),H do
while j==P.clearing[h]do
h=h+1
dy=dy+stepY
gc.translate(0,-stepY)
gc.setColor(1,1,1,A)
gc.rectangle("fill",0,630-30*j,300,stepY)
end
for i=1,10 do
if P.field[j][i]>0 then
gc.setColor(1,1,1,min(P.visTime[j][i]*.05,1))
drawPixel(j,i,P.field[j][i])
end
end
end
gc.translate(0,dy)
end--Field with falling animation
for i=1,#P.shade do
local S=P.shade[i]
gc.setColor(1,1,1,S[1]*.12)
@@ -878,7 +1078,7 @@ function player.draw(P)
gc.rectangle("fill",303,599-h+(-bar+3),11,-(-bar+3)*(1-A.countdown/A.cd0))
--Timing
else
local t=sin((Timer()-i)*30)*.5+.5
local t=math.sin((Timer()-i)*30)*.5+.5
local c1,c2=attackColor[A.lv][1],attackColor[A.lv][2]
gc.setColor(c1[1]*t+c2[1]*(1-t),c1[2]*t+c2[2]*(1-t),c1[3]*t+c2[3]*(1-t))
gc.rectangle("fill",303,599-h,11,-bar+3)
@@ -897,10 +1097,10 @@ function player.draw(P)
gc.rectangle("fill",-14,599,11,-b*.5)
gc.setColor(P.b2b<40 and color.white or P.b2b<=1e3 and color.lightRed or color.lightBlue)
gc.rectangle("fill",-14,599,11,-a*.5)
if Timer()%1<.5 then
gc.setColor(1,1,1)
if Timer()%.5<.3 then
gc.rectangle("fill",-15,b<40 and 578.5 or 98.5,13,3)
end
gc.setColor(1,1,1)
gc.rectangle("line",-16,-3,15,604)--Draw b2b bar boarder
--B2B indictator
gc.translate(-P.fieldOffX,-P.fieldOffY)
@@ -974,27 +1174,41 @@ function player.draw(P)
end
function player.demoDraw(P)
gc.push("transform")
gc.translate(P.x,P.y)gc.scale(P.size)--Position
gc.setLineWidth(7)
gc.translate(P.fieldOffX,P.fieldOffY)
local dy,stepY=0,setting.smo and(P.falling/(P.gameEnv.fall+1))^2.5*30 or 30
local h=1
for j=1,#P.field do
while j==P.clearing[h]and P.falling>-1 do
h=h+1
dy=dy+stepY
gc.translate(0,-stepY)
gc.setColor(1,1,1,P.falling/P.gameEnv.fall)
gc.rectangle("fill",0,630-30*j,320,stepY)
end
for i=1,10 do
if P.field[j][i]>0 then
gc.setColor(1,1,1,min(P.visTime[j][i]*.05,1))
drawPixel(j,i,P.field[j][i])
gc.translate(P.x,P.y)gc.scale(P.size)gc.translate(P.fieldOffX,P.fieldOffY)
--Camera
gc.setColor(.1,.1,.1,.8)gc.rectangle("fill",0,0,300,600)
gc.setLineWidth(2)gc.setColor(1,1,1)gc.rectangle("line",-1,-1,302,602)
--Frame
if P.falling==-1 then
for j=int(P.fieldBeneath/30+1),#P.field do
for i=1,10 do
if P.field[j][i]>0 then
gc.setColor(1,1,1,min(P.visTime[j][i]*.05,1))
drawPixel(j,i,P.field[j][i])
end
end
end
end--Field
gc.translate(0,dy)
else--field block only
local dy,stepY=0,setting.smo and(P.falling/(P.gameEnv.fall+1))^2.5*30 or 30
local A=P.falling/P.gameEnv.fall
local h,H=1,#P.field
for j=int(P.fieldBeneath/30+1),H do
while j==P.clearing[h]do
h=h+1
dy=dy+stepY
gc.translate(0,-stepY)
gc.setColor(1,1,1,A)
gc.rectangle("fill",0,630-30*j,300,stepY)
end
for i=1,10 do
if P.field[j][i]>0 then
gc.setColor(1,1,1,min(P.visTime[j][i]*.05,1))
drawPixel(j,i,P.field[j][i])
end
end
end
gc.translate(0,dy)
end--Field with falling animation
for i=1,#P.shade do
local S=P.shade[i]
gc.setColor(1,1,1,S[1]*.12)
@@ -1022,8 +1236,6 @@ function player.demoDraw(P)
::E::
gc.setColor(1,1,1)
gc.draw(PTC.dust[P.id])
gc.setLineWidth(2)
gc.rectangle("line",-1,-11,302,612)--Draw boarder
gc.translate(-P.fieldOffX,-P.fieldOffY)
for i=1,#P.bonus do
P.bonus[i]:draw(min((30-abs(P.bonus[i].t-30))*.05,1)*(not P.bonus[i].inf and #P.field>(9-P.bonus[i].dy*.0333)and .7 or 1))
@@ -1107,6 +1319,51 @@ end
-------------------------</FX>-------------------------
-------------------------<Method>-------------------------
local function ifoverlap(P,bk,x,y)
if x<1 or x+#bk[1]>11 or y<1 then return true end
if y>#P.field then return end
for i=1,#bk do for j=1,#bk[1]do
if P.field[y+i-1]and bk[i][j]and P.field[y+i-1][x+j-1]>0 then return true end
end end
end
local function ckfull(P,i)
for j=1,10 do if P.field[i][j]<=0 then return end end
return true
end
local function checkrow(P,start,height)--(cy,r)
local c=0
local h=start
for i=1,height do
if ckfull(P,h)then
ins(P.clearing,h)
removeRow(P.field,h)
removeRow(P.visTime,h)
c=c+1
if not P.small then
local S=PTC.dust[P.id]
for k=1,120 do
S:setPosition(rnd(300),600-30*h+rnd(30))
S:emit(2)
end
end
else
h=h+1
end
end
h=#P.field
for i=c,1,-1 do
if P.clearing[i]>h then
P.clearing[i]=nil
end
end
return c
end
local function solid(P,x,y)
if x<1 or x>10 or y<1 then return true end
if y>#P.field then return false end
return P.field[y][x]>0
end
function player:garbageSend(R,send,time,...)
if setting.atkFX>0 then
self:createBeam(R,send,time,...)
@@ -1173,44 +1430,6 @@ function player:garbageRise(color,amount,pos)
end
if #self.field>40 then Event.lose(self)end
end
function player:ifoverlap(bk,x,y)
if x<1 or x+#bk[1]>11 or y<1 then return true end
if y>#self.field then return end
for i=1,#bk do for j=1,#bk[1]do
if self.field[y+i-1]and bk[i][j]and self.field[y+i-1][x+j-1]>0 then return true end
end end
end
function player:ckfull(i)
for j=1,10 do if self.field[i][j]<=0 then return end end
return true
end
function player:checkrow(start,height)--(cy,r)
local c=0
local h=start
for i=1,height do
if self:ckfull(h)then
ins(self.clearing,h)
removeRow(self.field,h)
removeRow(self.visTime,h)
c=c+1
if not self.small then
local S=PTC.dust[self.id]
for k=1,100 do
S:setPosition(rnd(300),600-30*h+rnd(30))
S:emit(3)
end
end
else
h=h+1
end
end
return c
end
function player:solid(x,y)
if x<1 or x>10 or y<1 then return true end
if y>#self.field then return false end
return self.field[y][x]>0
end
function player:freshTarget()
if self.atkMode==1 then
if not self.atking or not self.atking.alive or rnd()<.1 then
@@ -1248,7 +1467,7 @@ function player:changeAtk(R)
if self.atking then
local K=self.atking.atker
for i=1,#K do
if K[i]==P then
if K[i]==self then
rem(K,i)
goto L
end
@@ -1257,7 +1476,7 @@ function player:changeAtk(R)
::L::
if R then
self.atking=R
R.atker[#R.atker+1]=P
R.atker[#R.atker+1]=self
else
self.atking=nil
end
@@ -1265,7 +1484,7 @@ end
function player:freshgho()
self.y_img=min(#self.field+1,self.curY)
if self.gameEnv._20G or self.keyPressing[7]and self.gameEnv.sdarr==0 then
::L::if not self:ifoverlap(self.cur.bk,self.curX,self.y_img-1)then
::L::if not ifoverlap(self,self.cur.bk,self.curX,self.y_img-1)then
self.y_img=self.y_img-1
self.spinLast=false
goto L
@@ -1282,7 +1501,7 @@ function player:freshgho()
self.curY=self.y_img
end
else
::L::if not self:ifoverlap(self.cur.bk,self.curX,self.y_img-1)then
::L::if not ifoverlap(self,self.cur.bk,self.curX,self.y_img-1)then
self.y_img=self.y_img-1
goto L
end
@@ -1291,10 +1510,10 @@ end
function player:freshLockDelay()
if self.lockDelay<self.gameEnv.lock then
self.dropDelay=self.gameEnv.drop
self.freshTime=self.freshTime+1
if self.freshTime<=self.gameEnv.freshLimit then
self.lockDelay=self.gameEnv.lock
end
self.freshTime=self.freshTime+1
end
end
function player:lock()
@@ -1311,55 +1530,127 @@ function player:lock()
end
function player:spin(d,ifpre)
local idir=(self.dir+d)%4
--<Ospin>
if self.cur.id==6 then
if self.gameEnv.easyFresh then
self:freshLockDelay()
end
if self.gameEnv.ospin then
if self.curY==self.y_img then
self.spinSeq=self.spinSeq%100*10+d
local x,y=self.curX,self.curY
local id
if self.spinSeq==313 then--Z
if solid(self,x-1,y)and solid(self,x+2,y)then
if solid(self,x-1,y+2)and not solid(self,x-1,y+1)then--嵌
self.curX=x-1
self.dir=2
id=1
elseif not solid(self,x+1,y-1)and not solid(self,x+2,y-1)then--压
self.curY=y-1
self.dir=2
id=1
end
end
elseif self.spinSeq==131 then--S
if solid(self,x-1,y)and solid(self,x+2,y)then
if solid(self,x+2,y+2)and not solid(self,x+2,y+1)then--嵌
self.dir=2
id=2
elseif not solid(self,x,y-1)and not solid(self,x-1,y-1)then--压
self.curY=y-1
self.curX=x-1
self.dir=2
id=2
end
end
elseif self.spinSeq==331 then--L
if solid(self,x-1,y+1)and solid(self,x+2,y+1)then
if solid(self,x+2,y)and not solid(self,x-1,y)then--钩
self.curX=x-1
self.dir=0
id=3
elseif not solid(self,x,y-1)and not solid(self,x+2,y)then--扣
self.curY=y-1
self.dir=2
id=3
end
end
elseif self.spinSeq==113 then--J
if solid(self,x+2,y+1)and solid(self,x-2,y+1)then
if solid(self,x-2,y)and not solid(self,x+2,y)then--钩
self.dir=0
id=4
elseif not solid(self,x+1,y-1)and not solid(self,x-1,y)then--扣
self.curX=x-1
self.curY=y-1
self.dir=2
id=4
end
end
elseif self.spinSeq==111 then--T-R
if solid(self,x+2,y+1)and solid(self,x-1,y+1)and solid(self,x+2,y)and not solid(self,x-1,y)then
if solid(self,x,y-1)then--钩
self.curX=x-1
self.dir=0
id=5
else--转
self.curY=y-1
self.dir=1
id=5
end
end
elseif self.spinSeq==333 then--T-L
if solid(self,x-1,y+1)and solid(self,x-1,y)and solid(self,x+2,y+1)and not solid(self,x+2,y)then
if solid(self,x+1,y-1)then--钩
self.dir=0
id=5
else--转
self.curY=y-1
self.dir=3
id=5
end
end
elseif self.spinSeq==222 then--I
if solid(self,x+2,y+1)and solid(self,x-1,y+1)then
if not solid(self,x-1,y)then
if not solid(self,x+2,y)then
self.curX=x-1
self.dir=2
id=7
elseif not solid(self,x-2,y)then
self.curX=x-2
self.dir=2
id=7
end
elseif not solid(self,x+2,y)and not solid(self,x+3,y)then
self.dir=2
id=7
end
end
end
if id then--Transform successed
local C=self.cur
C.id=id
C.bk=blocks[id][self.dir]
self.r,self.c=#C.bk,#C.bk[1]
self.sc=scs[id][self.dir]
self.spinLast=2
self.stat.rotate=self.stat.rotate+1
self:freshgho()
SFX("rotatekick")
return
end
else
self.spinSeq=0
end
end
if self.human then
SFX(ifpre and"prerotate"or"rotate")
end
if self.gameEnv.ospin and self.freshTime>10 then
if d==1 then
if self.curY==self.y_img and self:solid(self.curX+2,self.curY+1)and self:solid(self.curX+2,self.curY)and self:solid(self.curX-1,self.curY+1)and not self:solid(self.curX-1,self.curY)then
if self:solid(self.curX-2,self.curY)then
self.curX=self.curX-1
goto T
else
self.curX=self.curX-2
goto I
end
end
elseif d==-1 then
if self.curY==self.y_img and self:solid(self.curX-1,self.curY+1)and self:solid(self.curX-1,self.curY)and self:solid(self.curX+2,self.curY+1)and not self:solid(self.curX+2,self.curY)then
if self:solid(self.curX+3,self.curY)then
goto T
else
goto I
end
end
elseif d==2 and self.curY==self.y_img and self:solid(self.curX-1,self.curY+1)and self:solid(self.curX+2,self.curY+1)and not self:solid(self.curX-1,self.curY)and not self:solid(self.curX+2,self.curY)then
self.curX=self.curX-1
goto I
end
do return end
::T::
self.cur.id=5
self.cur.bk=blocks[5][0]
self.sc=scs[5][0]
self.r,self.c,self.dir=2,3,0
self.spinLast=2
self.stat.rotate=self.stat.rotate+1
do return end
::I::
self.cur.id=7
self.cur.bk=blocks[7][2]
self.sc=scs[7][2]
self.r,self.c,self.dir=1,4,2
self.spinLast=2
self.stat.rotate=self.stat.rotate+1
end
return
end
--</Ospin>
local icb=blocks[self.cur.id][idir]
local isc=scs[self.cur.id][idir]
local ir,ic=#icb,#icb[1]
@@ -1367,7 +1658,7 @@ function player:spin(d,ifpre)
local t--succssful test
local iki=self.RS[self.cur.id][self.dir*10+idir]
for i=1,self.freshTime<=1.2*self.gameEnv.freshLimit and #iki or 1 do
if not self:ifoverlap(icb,ix+iki[i][1],iy+iki[i][2])then
if not ifoverlap(self,icb,ix+iki[i][1],iy+iki[i][2])then
ix,iy=ix+iki[i][1],iy+iki[i][2]
t=i
goto spin
@@ -1386,13 +1677,15 @@ function player:spin(d,ifpre)
if not ifpre then self:freshgho()end
if self.gameEnv.easyFresh or y0>self.curY then self:freshLockDelay()end
if self.human then
SFX(ifpre and"prerotate"or self:ifoverlap(self.cur.bk,self.curX,self.curY+1)and self:ifoverlap(self.cur.bk,self.curX-1,self.curY)and self:ifoverlap(self.cur.bk,self.curX+1,self.curY)and"rotatekick"or"rotate")
SFX(ifpre and"prerotate"or ifoverlap(self,self.cur.bk,self.curX,self.curY+1)and ifoverlap(self,self.cur.bk,self.curX-1,self.curY)and ifoverlap(self,self.cur.bk,self.curX+1,self.curY)and"rotatekick"or"rotate")
end
self.stat.rotate=self.stat.rotate+1
end
function player:hold(ifpre)
if not self.holded and self.waiting==-1 and self.gameEnv.hold then
self.holded=self.gameEnv.oncehold
self.spinLast=false
self.spinSeq=0
self.cur,self.hd=self.hd,self.cur
self.hd.bk=blocks[self.hd.id][0]
if self.cur.id==0 then
@@ -1404,14 +1697,14 @@ function player:hold(ifpre)
self.r,self.c=#self.cur.bk,#self.cur.bk[1]
self.curX,self.curY=blockPos[self.cur.id],21+ceil(self.fieldBeneath/30)-self.r+min(int(#self.field*.2),2)
if abs(self.moving)>self.gameEnv.das and not self:ifoverlap(self.cur.bk,self.curX+(self.moving>0 and 1 or -1),self.curY)then
if abs(self.moving)>self.gameEnv.das and not ifoverlap(self,self.cur.bk,self.curX+(self.moving>0 and 1 or -1),self.curY)then
self.curX=self.curX+(self.moving>0 and 1 or -1)
end
--IMS
self:freshgho()
self.dropDelay,self.lockDelay,self.freshTime=self.gameEnv.drop,self.gameEnv.lock,max(self.freshTime-5,0)
if self:ifoverlap(self.cur.bk,self.curX,self.curY)then self:lock()Event.lose(self)end
if ifoverlap(self,self.cur.bk,self.curX,self.curY)then self:lock()Event.lose(self)end
if self.human then
SFX(ifpre and"prehold"or"hold")
@@ -1423,7 +1716,10 @@ function player:newNext(n)
self.next[#self.next+1]={bk=blocks[n][0],id=n,color=self.gameEnv.bone and 8 or n,name=n}
end
function player:resetblock()
self.holded,self.spinLast=false,false
self.holded=false
self.spinLast=false
self.spinSeq=0
self.cur=rem(self.next,1)
self:freshNext()
if self.AI_mode=="CC"then BOT.addNext(self.AI_bot,CCblockID[self.next[self.AIdata.next].id])end
@@ -1434,13 +1730,13 @@ function player:resetblock()
if self.keyPressing[8]then self:hold(true)end
if self.keyPressing[3]then self:spin(1,true)end
if self.keyPressing[4]then self:spin(-1,true)end
if self.keyPressing[4]then self:spin(3,true)end
if self.keyPressing[5]then self:spin(2,true)end
if abs(self.moving)>self.gameEnv.das and not self:ifoverlap(self.cur.bk,self.curX+(self.moving>0 and 1 or -1),self.curY)then
if abs(self.moving)>self.gameEnv.das and not ifoverlap(self,self.cur.bk,self.curX+(self.moving>0 and 1 or -1),self.curY)then
self.curX=self.curX+(self.moving>0 and 1 or -1)
end
--Initial SYSs
if self:ifoverlap(self.cur.bk,self.curX,self.curY)then self:lock()Event.lose(self)end
if ifoverlap(self,self.cur.bk,self.curX,self.curY)then self:lock()Event.lose(self)end
self:freshgho()
if self.keyPressing[6]then self.act.hardDrop(self)self.keyPressing[6]=false end
end
@@ -1452,22 +1748,22 @@ function player:drop()--(Place piece)
if self.cur.id<6 then
local x,y=self.curX+self.sc[2]-1,self.curY+self.sc[1]-1
local c=0
if self:solid(x-1,y+1)then c=c+1 end
if self:solid(x+1,y+1)then c=c+1 end
if solid(self,x-1,y+1)then c=c+1 end
if solid(self,x+1,y+1)then c=c+1 end
if c==0 then goto NTC end
if self:solid(x-1,y-1)then c=c+1 end
if self:solid(x+1,y-1)then c=c+1 end
if solid(self,x-1,y-1)then c=c+1 end
if solid(self,x+1,y-1)then c=c+1 end
if c>2 then dospin=dospin+1 end
end--Three point
::NTC::
if self.cur.id~=6 and self:ifoverlap(self.cur.bk,self.curX-1,self.curY)and self:ifoverlap(self.cur.bk,self.curX+1,self.curY)and self:ifoverlap(self.cur.bk,self.curX,self.curY+1)then
if self.cur.id~=6 and ifoverlap(self,self.cur.bk,self.curX-1,self.curY)and ifoverlap(self,self.cur.bk,self.curX+1,self.curY)and ifoverlap(self,self.cur.bk,self.curX,self.curY+1)then
dospin=dospin+2
end--Immobile
end
self:lock()
local CHN=getFreeVoiceChannel()
local cc,send,exblock=self:checkrow(self.curY,self.r),0,0--Currect clear&send&sendTime
if cc>0 then self.falling=self.gameEnv.fall end
local cc,send,exblock=checkrow(self,self.curY,self.r),0,0--Currect clear&send&sendTime
if self.clearing[1]then self.falling=self.gameEnv.fall end
local cscore,sendTime=0,0
local mini
if self.spinLast then
@@ -1584,7 +1880,7 @@ function player:drop()--(Place piece)
send=send+(renATK[self.combo]or 3)
if #self.field==0 then
self:showText(text.PC,"flicker",70,-80)
send=min(send,4)+min(6+self.stat.pc,10)
send=min(send,3)+min(6+self.stat.pc,10)
exblock=exblock+2
sendTime=sendTime+60
if self.stat.row>4 then
@@ -1734,7 +2030,7 @@ function player.act.moveLeft(P,auto)
P:changeAtkMode(1)
end
elseif P.control and P.waiting==-1 then
if not P:ifoverlap(P.cur.bk,P.curX-1,P.curY)then
if not ifoverlap(P,P.cur.bk,P.curX-1,P.curY)then
P.curX=P.curX-1
local y0=P.curY
P:freshgho()
@@ -1755,7 +2051,7 @@ function player.act.moveRight(P,auto)
P:changeAtkMode(2)
end
elseif P.control and P.waiting==-1 then
if not P:ifoverlap(P.cur.bk,P.curX+1,P.curY)then
if not ifoverlap(P,P.cur.bk,P.curX+1,P.curY)then
P.curX=P.curX+1
local y0=P.curY
P:freshgho()
@@ -1778,7 +2074,7 @@ function player.act.rotRight(P)
end
function player.act.rotLeft(P)
if P.control and P.waiting==-1 then
P:spin(-1)
P:spin(3)
P.keyPressing[4]=false
end
end
@@ -1858,7 +2154,7 @@ function player.act.insDown(P)
end
function player.act.insLeft(P)
local x0,y0=P.curX,P.curY
::L::if not P:ifoverlap(P.cur.bk,P.curX-1,P.curY)then
::L::if not ifoverlap(P,P.cur.bk,P.curX-1,P.curY)then
P.curX=P.curX-1
if not P.small and setting.dropFX>0 then
P:createShade(P.curX+1,P.curY+P.r-1,P.curX+1,P.curY)
@@ -1875,7 +2171,7 @@ function player.act.insLeft(P)
end
function player.act.insRight(P)
local x0,y0=P.curX,P.curY
::L::if not P:ifoverlap(P.cur.bk,P.curX+1,P.curY)then
::L::if not ifoverlap(P,P.cur.bk,P.curX+1,P.curY)then
P.curX=P.curX+1
if not P.small and setting.dropFX>0 then
P:createShade(P.curX+P.c-1,P.curY+P.r-1,P.curX+P.c-1,P.curY)

16
shadowMapShader.cs Normal file
View File

@@ -0,0 +1,16 @@
#define PI 3.14
extern float yresolution;
vec4 effect(vec4 color,Image texture,vec2 texture_coords,vec2 screen_coords){
//Iterate through the occluder map's y-axis.
for(float y=0.;y<yresolution;y++){
//直角转极坐标
vec2 norm=vec2(texture_coords.s,y/yresolution)*2.-1.;
float theta=PI*1.5+norm.x*PI;
float r=(1.+norm.y)*.5;
//y/yresolution为到光源的距离(0~1)
//遮光物采样
vec4 data=Texel(texture,(vec2(-r*sin(theta),-r*cos(theta))*.5+.5));//vec2()..是遮光物采样的coord
if(data.a>.1)return vec4(vec3(y/yresolution),1.);//碰撞检测,像素透明度>.1即透光
}
return vec4(vec3(1),1.);//返回最远距离1
}

View File

@@ -41,10 +41,11 @@ function Tmr.load()
for i=1,#sfx do sfx[i]=nil end
loading=4
loadnum=1
SFX("welcome",.2)
end
elseif loading==4 then
loadnum=loadnum+1
if loadnum==15 then
if loadnum==48 then
stat.run=stat.run+1
gotoScene("intro","none")
end

View File

@@ -206,7 +206,7 @@ local swapDeck_data={
{7,0,8,9},{1,0,2,8},{5,2,4,8},{6,0,15,8},
}--Block id [ZSLJTOI] ,dir,x,y
local swap={
none={2,1,d=null},
none={2,1,d=NULL},
flash={8,1,d=function()gc.clear(1,1,1)end},
fade={30,15,d=function()
local t=1-abs(sceneSwaping.time*.06667-1)
@@ -265,6 +265,7 @@ local prevMenu={
play=function()
kb.setKeyRepeat(true)
updateStat()
saveData()
clearTask("play")
gotoScene(curMode.id~="custom"and"mode"or"custom","deck")
end,
@@ -289,6 +290,82 @@ function back()
t()
end
end
function randomTarget(P)
if #players.alive>1 then
local R
repeat
R=players.alive[rnd(#players.alive)]
until R~=P
return R
end
end--return a random opponent for P
function freshMostDangerous()
mostDangerous,secDangerous=nil
local m,m2=0,0
for i=1,#players.alive do
local h=#players.alive[i].field
if h>=m then
mostDangerous,secDangerous=players.alive[i],mostDangerous
m,m2=h,m
elseif h>=m2 then
secDangerous=players.alive[i]
m2=h
end
end
end
function freshMostBadge()
mostBadge,secBadge=nil
local m,m2=0,0
for i=1,#players.alive do
local h=players.alive[i].badge
if h>=m then
mostBadge,secBadge=players.alive[i],mostBadge
m,m2=h,m
elseif h>=m2 then
secBadge=players.alive[i]
m2=h
end
end
end
function royaleLevelup()
gameStage=gameStage+1
local spd
if(gameStage==3 or gameStage>4)and players[1].alive then
players[1]:showText(text.royale_remain(#players.alive),"beat",50,-100,.3)
end
if gameStage==2 then
spd=30
elseif gameStage==3 then
spd=15
garbageSpeed=.6
if players[1].alive then BGM("cruelty")end
elseif gameStage==4 then
spd=10
pushSpeed=3
elseif gameStage==5 then
spd=5
garbageSpeed=1
elseif gameStage==6 then
spd=3
if players[1].alive then BGM("final")end
end
for i=1,#players.alive do
players.alive[i].gameEnv.drop=spd
end
if curMode.lv==3 then
for i=1,#players.alive do
local P=players.alive[i]
P.gameEnv.drop=int(P.gameEnv.drop*.3)
if P.gameEnv.drop==0 then
P.curY=P.y_img
P.gameEnv._20G=true
if P.AI_mode=="CC"then CC_switch20G(P)end--little cheating,never mind
end
end
end
end
function pauseGame()
pauseTimer=0--Pause timer for animation
if not gamefinished then
@@ -307,6 +384,94 @@ end
function resumeGame()
gotoScene("play","fade")
end
function loadGame(mode,level)
--rec={}
curMode={id=modeID[mode],lv=level}
drawableText.modeName:set(text.modeName[mode])
drawableText.levelName:set(modeLevel[modeID[mode]][level])
needResetGameData=true
gotoScene("play","deck")
end
function resetPartGameData()
frame=30
destroyPlayers()
loadmode[curMode.id]()
if modeEnv.task then
for i=1,#players do
newTask(Event_task[modeEnv.task],players[i])
end
end
if modeEnv.royaleMode then
for i=1,#players do
players[i]:changeAtk(randomTarget(players[i]))
end
end
for i=1,#virtualkey do
virtualkey[i].press=false
end
collectgarbage()
end
function resetGameData()
gamefinished=false
frame=0
garbageSpeed=1
pushSpeed=3
pauseTime=0--Time paused
pauseCount=0--Times paused
destroyPlayers()
local E=defaultModeEnv[curMode.id]
modeEnv=E[curMode.lv]or E[1]
loadmode[curMode.id]()--bg/bgm need redefine in custom,so up here
if modeEnv.task then
for i=1,#players do
newTask(Event_task[modeEnv.task],players[i])
end
end
curBG=modeEnv.bg
BGM(modeEnv.bgm)
FX_badge={}
FX_attack={}
for _,v in next,PTC.dust do
v:release()
end
for i=1,#players do
if not players[i].small then
PTC.dust[i]=PTC.dust0:clone()
PTC.dust[i]:start()
end
end
if modeEnv.royaleMode then
for i=1,#players do
players[i]:changeAtk(randomTarget(players[i]))
end
mostBadge,mostDangerous,secBadge,secDangerous=nil
gameStage=1
garbageSpeed=.3
pushSpeed=2
end
for i=1,#virtualkey do
virtualkey[i].press=false
end
stat.game=stat.game+1
local m,p=#freeRow,40*#players+1
while freeRow[p]do
m,freeRow[m]=m-1
end
freeRow.L=#freeRow
SFX("ready")
collectgarbage()
end
function gameStart()
SFX("start")
for P=1,#players do
P=players[P]
P:resetblock()
P.timing=true
P.control=true
end
end
local dataOpt={
"run","game","time",
"key","rotate","hold","piece","row",
@@ -344,7 +509,6 @@ function saveData()
t[i]=dataOpt[i].."="..toS(stat[dataOpt[i]])
end
t=concat(t,"\r\n")
t=love.data.compress("string","zlib",t)
userData:open("w")
userData:write(t)
userData:close()
@@ -386,7 +550,7 @@ function loadSetting()
elseif t=="lang"then
setting[t]=toN(v:match("[123]"))or 1
elseif t=="skin"then
setting[t]=toN(v:match("[123456]"))or 1
setting[t]=toN(v:match("[12345678]"))or 1
elseif t=="keymap"then
v=splitS(v,"/")
for i=1,16 do
@@ -456,7 +620,6 @@ function saveSetting()
--not always i+2!
end
t=concat(t,"\r\n")
t=love.data.compress("string","zlib",t)
userSetting:open("w")
userSetting:write(t)
userSetting:close()

View File

@@ -1,23 +1,32 @@
local S=[=[
Future outlook:
GUI:
Normal Things:
force fineese mode
highscore of most modes
custom block color/direction
custom sequence
virtual key switch(all keys)
Normal Things:
combo mode
infinite c4w mode
any screen size
CC smarter(think of gaebage buffer)
fineese/bigbang mode & easier CTWC
new AI:task-Z
game recording
TTT mode
Hard Things:
Encrypt source code(JIT to byte code)
Technical things:
Encrypt source code(compile to byte code)
infinite 1v1
square mode
more FXs & 3d features & animations
0.7.27:
super O transform system
optimized light system(no used)
bug fixed
0.7.26:
new skin
import light lib
many bug fixed
0.7.25:
demo play at main menu
ALMOST reconstructed WHOLE PLAYER SYSTEM,NEED TEST