Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f261906f1a | ||
|
|
48b68a876b |
BIN
SFX/error.ogg
Normal file
BIN
SFX/error.ogg
Normal file
Binary file not shown.
BIN
SFX/error_long.ogg
Normal file
BIN
SFX/error_long.ogg
Normal file
Binary file not shown.
BIN
SFX/welcome.ogg
Normal file
BIN
SFX/welcome.ogg
Normal file
Binary file not shown.
11
ai.lua
11
ai.lua
@@ -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
|
||||
@@ -119,9 +119,8 @@ local function ifoverlapAI(f,bk,x,y)
|
||||
end end
|
||||
end
|
||||
local function resetField(f0,f,start)
|
||||
::L::if f[start]then
|
||||
while f[start]do
|
||||
removeRow(f,start)
|
||||
goto L
|
||||
end
|
||||
for i=start,#f0 do
|
||||
f[i]=getNewRow(0)
|
||||
@@ -148,9 +147,8 @@ local function getScore(field,cb,cy)
|
||||
if #field==0 then return 1e99 end--PC best
|
||||
for x=1,10 do
|
||||
local h=#field
|
||||
::L::if field[h][x]==0 and h>1 then
|
||||
while field[h][x]==0 and h>1 do
|
||||
h=h-1
|
||||
goto L
|
||||
end
|
||||
height[x]=h
|
||||
if x>3 and x<8 and h>highest then highest=h end
|
||||
@@ -204,9 +202,8 @@ AI_think={
|
||||
local cb=blocks[bn][dir]
|
||||
for cx=1,11-#cb[1]do--each pos
|
||||
local cy=#Tfield+1
|
||||
::L::if not ifoverlapAI(Tfield,cb,cx,cy-1)then
|
||||
while not ifoverlapAI(Tfield,cb,cx,cy-1)do
|
||||
cy=cy-1
|
||||
goto L
|
||||
end--move to bottom
|
||||
for i=1,#cb do
|
||||
local y=cy+i-1
|
||||
|
||||
4
conf.lua
4
conf.lua
@@ -1,4 +1,4 @@
|
||||
gameVersion="Alpha V0.7.25"
|
||||
gameVersion="Alpha V0.7.28"
|
||||
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
|
||||
|
||||
306
dataList.lua
306
dataList.lua
@@ -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,
|
||||
@@ -1490,6 +1298,20 @@ defaultModeEnv={
|
||||
dropPiece="tech_reach_ultimate",
|
||||
bg="matrix",bgm="secret7th",
|
||||
},
|
||||
{
|
||||
drop=1e99,lock=60,
|
||||
freshLimit=15,
|
||||
fine=true,fineKill=true,
|
||||
dropPiece="tech_reach_hard",
|
||||
bg="flink",bgm="infinite",
|
||||
},
|
||||
{
|
||||
drop=1e99,lock=60,
|
||||
freshLimit=15,
|
||||
fine=true,fineKill=true,
|
||||
dropPiece="tech_reach_ultimate",
|
||||
bg="flink",bgm="infinite",
|
||||
},
|
||||
},
|
||||
c4wtrain={
|
||||
{
|
||||
|
||||
164
gamefunc.lua
164
gamefunc.lua
@@ -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
|
||||
BIN
image/block.png
BIN
image/block.png
Binary file not shown.
|
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 30 KiB |
BIN
image/icon.png
BIN
image/icon.png
Binary file not shown.
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 15 KiB |
@@ -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={
|
||||
"游戏运行次数:",
|
||||
@@ -150,6 +149,7 @@ return{
|
||||
"B2B数:",
|
||||
"PC数:",
|
||||
"效率:",
|
||||
"多余操作:"
|
||||
},
|
||||
help={
|
||||
"好像也没啥好帮助的吧?就当是关于了",
|
||||
@@ -160,10 +160,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 +252,9 @@ return{
|
||||
sdarrD="-",sdarrU="+",
|
||||
quickR="快速重新开始",
|
||||
swap="组合键切换攻击模式",
|
||||
fine="极简操作提示音",
|
||||
ctrl="键位设置",
|
||||
touch="触屏设置",
|
||||
back=BK,
|
||||
},
|
||||
setting_graphic={
|
||||
|
||||
@@ -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={
|
||||
"游戏运行次数:",
|
||||
@@ -150,6 +149,7 @@ return{
|
||||
"满贯数:",
|
||||
"全清数:",
|
||||
"效率:",
|
||||
"多余操作:"
|
||||
},
|
||||
help={
|
||||
"好像也没啥好帮助的吧?就当是关于了",
|
||||
@@ -160,10 +160,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 +253,9 @@ return{
|
||||
sdarrD="-",sdarrU="+",
|
||||
quickR="快速重新开始",
|
||||
swap="组合键切换攻击模式",
|
||||
fine="极简操作提示音",
|
||||
ctrl="键位设置",
|
||||
touch="触屏设置",
|
||||
back=BK,
|
||||
},
|
||||
setting_graphic={
|
||||
|
||||
@@ -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!~",
|
||||
"Techmino=Technique+tetromino",
|
||||
"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:",
|
||||
@@ -150,6 +150,7 @@ return{
|
||||
"B2B:",
|
||||
"PC:",
|
||||
"Efficiency:",
|
||||
"Fineese:"
|
||||
},
|
||||
help={
|
||||
"I don't think you need \"help\".",
|
||||
@@ -159,11 +160,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",
|
||||
@@ -244,7 +253,8 @@ return{
|
||||
sdarrD="-",sdarrU="+",
|
||||
quickR="Quick restart",
|
||||
swap="Combo key to change ATK mode",
|
||||
ctrl="Control Setting",
|
||||
fine="Fineese error SFX",
|
||||
ctrl="Key Setting",
|
||||
touch="Touch Setting",
|
||||
back=BK,
|
||||
},
|
||||
@@ -262,7 +272,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
80
light.lua
Normal 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
30
lightRenderShader.cs
Normal 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));
|
||||
}
|
||||
28
list.lua
28
list.lua
@@ -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,12 +49,13 @@ blockColor={
|
||||
color.darkGreen,
|
||||
}
|
||||
sfx={
|
||||
"welcome",
|
||||
"button","swipe",
|
||||
"ready","start","win","fail","collect",
|
||||
"move","rotate","rotatekick","hold",
|
||||
"prerotate","prehold",
|
||||
"lock","drop","fall",
|
||||
"reach",
|
||||
"error","error_long","reach",
|
||||
"ren_1","ren_2","ren_3","ren_4","ren_5","ren_6","ren_7","ren_8","ren_9","ren_10","ren_11","ren_mega",
|
||||
"clear_1","clear_2","clear_3","clear_4",
|
||||
"spin_0","spin_1","spin_2","spin_3",
|
||||
@@ -178,10 +175,10 @@ 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+",},
|
||||
tech={"NORMAL","NORMAL+","HARD","HARD+","LUNATIC","LUNATIC+","ULTIMATE","ULTIMATE+",},
|
||||
c4wtrain={"NORMAL","LUNATIC"},
|
||||
pctrain={"NORMAL","EXTRA"},
|
||||
pcchallenge={"NORMAL","HARD","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"),
|
||||
@@ -382,8 +379,9 @@ Widget={
|
||||
sddasU= newButton(400,340,50,50,color.white,40,function()setting.sddas=(setting.sddas+1)%11 end, nil,"sdarrD"),
|
||||
sdarrD= newButton(500,340,50,50,color.white,40,function()setting.sdarr=(setting.sdarr-1)%4 end, nil,"sdarrU"),
|
||||
sdarrU= newButton(720,340,50,50,color.white,40,function()setting.sdarr=(setting.sdarr+1)%4 end, nil,"quickR"),
|
||||
quickR= newSwitch(560,440,40,function()return setting.quickR end,function()setting.quickR=not setting.quickR end, nil,"swap"),
|
||||
swap= newSwitch(560,530,25,function()return setting.swap end,function()setting.swap=not setting.swap end, nil,"ctrl"),
|
||||
quickR= newSwitch(560,430,40,function()return setting.quickR end,function()setting.quickR=not setting.quickR end, nil,"swap"),
|
||||
swap= newSwitch(560,510,25,function()return setting.swap end,function()setting.swap=not setting.swap end, nil,"fine"),
|
||||
fine= newSwitch(560,590,25,function()return setting.fine end,function()setting.fine=not setting.fine end, nil,"ctrl"),
|
||||
ctrl= newButton(1020,230,320,80,color.white,40,function()gotoScene("setting_control")end, nil,"touch"),
|
||||
touch= newButton(1020,340,320,80,color.white,40,function()gotoScene("setting_touch")end, nil,"back"),
|
||||
back= newButton(1160,600,160,160,color.white,55,back,nil,"graphic"),
|
||||
@@ -403,7 +401,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 +409,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 +460,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,8 +469,8 @@ 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"),
|
||||
back= newButton(640,590,180,60,color.white,40,back,nil,"path"),
|
||||
path= newButton(980,620,250,60,color.white,30,function()love.system.openURL(love.filesystem.getSaveDirectory())end,function()return mobile end,"back"),
|
||||
back= newButton(640,620,180,60,color.white,40,back,nil,"path"),
|
||||
},
|
||||
}
|
||||
for S,L in next,Widget do
|
||||
|
||||
94
main.lua
94
main.lua
@@ -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
|
||||
@@ -57,23 +54,27 @@ setting={
|
||||
das=10,arr=2,
|
||||
sddas=0,sdarr=2,
|
||||
quickR=true,swap=true,
|
||||
fine=false,
|
||||
--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 +83,7 @@ setting={
|
||||
{"","","","","","","","","","","","",""},
|
||||
{"","","","","","","","","","","","",""},
|
||||
{"","","","","","","","","","","","",""},
|
||||
{"","","","","","","","","","","","",""},
|
||||
{"","","","","","","","","","","","",""},--keyboard
|
||||
{"dpleft","dpright","a","b","y","dpup","dpdown","rightshoulder","x","leftshoulder","","",""},
|
||||
{"","","","","","","","","","","","",""},
|
||||
{"","","","","","","","","","","","",""},
|
||||
@@ -90,18 +91,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,
|
||||
@@ -110,6 +111,7 @@ setting={
|
||||
}
|
||||
stat={
|
||||
run=0,game=0,time=0,
|
||||
extraPiece=0,extraRate=0,
|
||||
key=0,rotate=0,hold=0,piece=0,row=0,
|
||||
atk=0,send=0,recv=0,pend=0,
|
||||
clear_1=0,clear_2=0,clear_3=0,clear_4=0,
|
||||
@@ -134,17 +136,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 +170,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 +215,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 +284,7 @@ local sceneInit={
|
||||
sel=1
|
||||
end,
|
||||
quit=function()
|
||||
love.timer.sleep(.3)
|
||||
love.event.quit()
|
||||
end,
|
||||
}
|
||||
@@ -489,7 +490,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 +610,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 +881,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)]
|
||||
@@ -959,7 +962,6 @@ function love.resize(w,h)
|
||||
gc.origin()
|
||||
xOy=xOy:setTransformation(w*.5,h*.5,nil,scr.k,nil,640,360)
|
||||
gc.replaceTransform(xOy)
|
||||
collectgarbage()
|
||||
end
|
||||
function love.focus(f)
|
||||
if system~="Android" and not f and scene=="play"then pauseGame()end
|
||||
@@ -1021,19 +1023,18 @@ function love.update(dt)
|
||||
for i=1,#Q do
|
||||
Q[i]=Q[i+1]
|
||||
end
|
||||
end--play next when stop
|
||||
end--放完后放下一个
|
||||
else
|
||||
local n=1
|
||||
local L=voiceBank[Q[1]]
|
||||
::L::if L[n]:isPlaying()then
|
||||
while L[n]:isPlaying()do
|
||||
n=n+1
|
||||
if not L[n]then
|
||||
L[n]=L[n-1]:clone()
|
||||
L[n]:seek(0)
|
||||
goto quit
|
||||
break
|
||||
end
|
||||
goto L
|
||||
end::quit::
|
||||
end
|
||||
Q[1]=L[n]
|
||||
Q[1]:setVolume(setting.voc*.125)
|
||||
Q[1]:play()
|
||||
@@ -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
|
||||
|
||||
83
paint.lua
83
paint.lua
@@ -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
|
||||
@@ -52,6 +50,8 @@ local function dataOpt(i)
|
||||
return stat.pc
|
||||
elseif i==14 then
|
||||
return format("%0.2f",stat.atk/stat.row)
|
||||
elseif i==15 then
|
||||
return stat.extraPiece.."["..(int(stat.extraRate/stat.piece*10000)*.01).."%]"
|
||||
end
|
||||
end
|
||||
local statOptL={
|
||||
@@ -74,6 +74,8 @@ local function statOpt(i)
|
||||
return stat.pc
|
||||
elseif i==17 then
|
||||
return format("%0.2f",stat.atk/stat.row)
|
||||
elseif i==18 then
|
||||
return stat.extraPiece.."["..(int(stat.extraRate/stat.piece*10000)*.01).."%]"
|
||||
end
|
||||
end
|
||||
local miniTitle_rect={
|
||||
@@ -88,7 +90,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 +168,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 +176,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 +205,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)
|
||||
@@ -220,6 +219,27 @@ function Pnt.BG.glow()
|
||||
local t=((sin(Timer()*.5)+sin(Timer()*.7)+sin(Timer()*.9+1)+sin(Timer()*1.5)+sin(Timer()*2+3))+5)*.05
|
||||
gc.clear(t,t,t)
|
||||
end
|
||||
function Pnt.BG.rgb()
|
||||
gc.clear(
|
||||
sin(Timer()*1.2)*.15+.5,
|
||||
sin(Timer()*1.5)*.15+.5,
|
||||
sin(Timer()*1.9)*.15+.5
|
||||
)
|
||||
end
|
||||
function Pnt.BG.strap()
|
||||
gc.setColor(1,1,1)
|
||||
local x=Timer()%32*40
|
||||
gc.draw(background2,x,0,nil,10)
|
||||
gc.draw(background2,x-1280,0,nil,10)
|
||||
end
|
||||
function Pnt.BG.flink()
|
||||
local t=.13-Timer()%3%1.7
|
||||
if t<.25 then
|
||||
gc.clear(t,t,t)
|
||||
else
|
||||
gc.clear(0,0,0)
|
||||
end
|
||||
end
|
||||
function Pnt.BG.game1()
|
||||
gc.setColor(1,1,1)
|
||||
gc.draw(background1,640,360,Timer()*.15,12,nil,64,64)
|
||||
@@ -244,6 +264,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,21 +272,9 @@ 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(
|
||||
sin(Timer()*1.2)*.15+.5,
|
||||
sin(Timer()*1.5)*.15+.5,
|
||||
sin(Timer()*1.9)*.15+.5
|
||||
)
|
||||
end
|
||||
function Pnt.BG.strap()
|
||||
gc.setColor(1,1,1)
|
||||
local x=Timer()%32*40
|
||||
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 +298,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)
|
||||
@@ -488,13 +497,13 @@ function Pnt.pause()
|
||||
if pauseCount>0 then
|
||||
gc.print(text.pauseCount..":["..pauseCount.."] "..format("%0.2f",pauseTime).."s",110,150)
|
||||
end
|
||||
for i=1,7 do
|
||||
for i=1,8 do
|
||||
gc.print(text.stat[i+3],110,30*i+270)
|
||||
gc.print(dataOpt(i),305,30*i+270)
|
||||
end
|
||||
for i=8,14 do
|
||||
gc.print(text.stat[i+3],860,30*i+60)
|
||||
gc.print(dataOpt(i),1000,30*i+60)
|
||||
for i=9,15 do
|
||||
gc.print(text.stat[i+3],860,30*i+30)
|
||||
gc.print(dataOpt(i),1000,30*i+30)
|
||||
end
|
||||
setFont(40)
|
||||
if system~="Android"then
|
||||
@@ -573,12 +582,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)
|
||||
@@ -593,7 +604,7 @@ end
|
||||
function Pnt.stat()
|
||||
setFont(28)
|
||||
gc.setColor(1,1,1)
|
||||
for i=1,17 do
|
||||
for i=1,18 do
|
||||
gc.print(text.stat[i],400,30*i-5)
|
||||
gc.print(statOpt(i),720,30*i-5)
|
||||
end
|
||||
|
||||
975
player.lua
975
player.lua
File diff suppressed because it is too large
Load Diff
16
shadowMapShader.cs
Normal file
16
shadowMapShader.cs
Normal 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
|
||||
}
|
||||
@@ -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
|
||||
|
||||
188
toolfunc.lua
188
toolfunc.lua
@@ -44,6 +44,7 @@ function destroyPlayers()
|
||||
players.alive[i]=nil
|
||||
end
|
||||
players.human=0
|
||||
collectgarbage()
|
||||
end
|
||||
function getNewRow(val)
|
||||
local t=rem(freeRow)
|
||||
@@ -128,15 +129,14 @@ end
|
||||
function SFX(s,v)
|
||||
if setting.sfx>0 then
|
||||
local n=1
|
||||
::L::if sfx[s][n]:isPlaying()then
|
||||
while sfx[s][n]:isPlaying()do
|
||||
n=n+1
|
||||
if not sfx[s][n]then
|
||||
sfx[s][n]=sfx[s][n-1]:clone()
|
||||
sfx[s][n]:seek(0)
|
||||
goto quit
|
||||
break
|
||||
end
|
||||
goto L
|
||||
end::quit::
|
||||
end
|
||||
sfx[s][n]:setVolume((v or 1)*setting.sfx*.125)
|
||||
sfx[s][n]:play()
|
||||
end
|
||||
@@ -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)
|
||||
@@ -250,8 +250,9 @@ function gotoScene(s,style)
|
||||
end
|
||||
end
|
||||
function updateStat()
|
||||
for k,v in next,players[1].stat do
|
||||
stat[k]=stat[k]+v
|
||||
local S=players[1].stat
|
||||
for k,v in next,S do
|
||||
stat[k]=stat[k]+S[k]
|
||||
end
|
||||
end
|
||||
local prevMenu={
|
||||
@@ -265,6 +266,7 @@ local prevMenu={
|
||||
play=function()
|
||||
kb.setKeyRepeat(true)
|
||||
updateStat()
|
||||
saveData()
|
||||
clearTask("play")
|
||||
gotoScene(curMode.id~="custom"and"mode"or"custom","deck")
|
||||
end,
|
||||
@@ -289,6 +291,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,8 +385,97 @@ 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",
|
||||
"extraPiece","extraRate",
|
||||
"key","rotate","hold","piece","row",
|
||||
"atk","send","recv","pend",
|
||||
"clear_1","clear_2","clear_3","clear_4",
|
||||
@@ -344,7 +511,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()
|
||||
@@ -372,7 +538,7 @@ function loadSetting()
|
||||
setting.virtualkeyAlpha=min(int(abs(toN(v))),10)
|
||||
elseif
|
||||
t=="ghost"or t=="center"or t=="grid"or t=="swap"or
|
||||
t=="quickR"or t=="bgblock"or t=="smo"or
|
||||
t=="quickR"or t=="fine"or t=="bgblock"or t=="smo"or
|
||||
t=="virtualkeyIcon"or t=="virtualkeySwitch"
|
||||
then
|
||||
setting[t]=v=="true"
|
||||
@@ -386,7 +552,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
|
||||
@@ -414,6 +580,7 @@ local saveOpt={
|
||||
"sddas","sdarr",
|
||||
"quickR",
|
||||
"swap",
|
||||
"fine",
|
||||
|
||||
"ghost","center",
|
||||
"smo","grid",
|
||||
@@ -456,7 +623,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()
|
||||
|
||||
@@ -1,23 +1,40 @@
|
||||
local S=[=[
|
||||
Patron(rmb10+):
|
||||
gggf/T080/Ykzl/zxc
|
||||
[D*a]?
|
||||
Future outlook:
|
||||
GUI:
|
||||
Normal Things:
|
||||
ajustable next count
|
||||
bag line in all mode
|
||||
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.28:
|
||||
add fineese check
|
||||
code optimized
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user