Compare commits
2 Commits
v0.0.19072
...
v0.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a85da670c8 | ||
|
|
2436a2d0bf |
14
BGblock.lua
Normal file
14
BGblock.lua
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
local count=0
|
||||||
|
BGblockList={}for i=1,16 do BGblockList[i]={}end
|
||||||
|
|
||||||
|
function getNewBlock()
|
||||||
|
count=count+1
|
||||||
|
if count==17 then count=1 end
|
||||||
|
local t=BGblockList[count]
|
||||||
|
t.bn,t.size=rnd(7),2+3*rnd()
|
||||||
|
t.b=blocks[t.bn][rnd(0,3)]
|
||||||
|
t.x=rnd(-#t.b[1]*t.size*30+100,1180)
|
||||||
|
t.y=-#t.b*30*t.size
|
||||||
|
t.v=t.size*(1+rnd())
|
||||||
|
return t
|
||||||
|
end
|
||||||
Binary file not shown.
10
TRS.lua
10
TRS.lua
@@ -8,7 +8,15 @@ blocks={
|
|||||||
{[0]={{1,1,1,1}},{{1},{1},{1},{1}},{{1,1,1,1}},{{1},{1},{1},{1}}},--I
|
{[0]={{1,1,1,1}},{{1},{1},{1},{1}},{{1,1,1,1}},{{1},{1},{1},{1}}},--I
|
||||||
}
|
}
|
||||||
do
|
do
|
||||||
scs={{1,2},{1,2},{1,2},{1,2},{1,2},{1.5,1.5},{.5,2.5}}
|
scs={
|
||||||
|
{[0]={1,2},{2,1},{2,2},{2,2}},
|
||||||
|
{[0]={1,2},{2,1},{2,2},{2,2}},
|
||||||
|
{[0]={1,2},{2,1},{2,2},{2,2}},
|
||||||
|
{[0]={1,2},{2,1},{2,2},{2,2}},
|
||||||
|
{[0]={1,2},{2,1},{2,2},{2,2}},
|
||||||
|
{[0]={1.5,1.5},{1.5,1.5},{1.5,1.5},{1.5,1.5},},
|
||||||
|
{[0]={.5,2.5},{2.5,0.5},{1.5,2.5},{2.5,1.5}},
|
||||||
|
}
|
||||||
TRS={
|
TRS={
|
||||||
[1]={
|
[1]={
|
||||||
[01]={{0,0},{-1,0},{-1,1},{0,-2},{-1,-2},{0,1}},
|
[01]={{0,0},{-1,0},{-1,1},{0,-2},{-1,-2},{0,1}},
|
||||||
|
|||||||
71
ai.lua
71
ai.lua
@@ -8,7 +8,7 @@ FilledLines
|
|||||||
TetrisShape
|
TetrisShape
|
||||||
BlockedWells;
|
BlockedWells;
|
||||||
]]
|
]]
|
||||||
spinNeed={2,2,4,4,4,1,2}
|
dirCount={1,1,3,3,3,0,1}
|
||||||
spinOffset={
|
spinOffset={
|
||||||
{1,0,0},--S
|
{1,0,0},--S
|
||||||
{1,0,0},--Z
|
{1,0,0},--Z
|
||||||
@@ -18,27 +18,28 @@ spinOffset={
|
|||||||
{0,0,0},--O
|
{0,0,0},--O
|
||||||
{2,0,1},--I
|
{2,0,1},--I
|
||||||
}for i=1,7 do spinOffset[i][0]=0 end
|
}for i=1,7 do spinOffset[i][0]=0 end
|
||||||
function ifoverlapAI(field,bk,x,y)
|
|
||||||
if x<1 or x+#bk[1]>11 or y<1 then return true end
|
function ifoverlapAI(f,bk,x,y)
|
||||||
if y>#field then return nil end
|
if y<1 then return true end
|
||||||
|
if y>#f then return nil end
|
||||||
for i=1,#bk do for j=1,#bk[1]do
|
for i=1,#bk do for j=1,#bk[1]do
|
||||||
if field[y+i-1]and bk[i][j]>0 and field[y+i-1][x+j-1]>0 then return true end
|
if f[y+i-1]and bk[i][j]>0 and f[y+i-1][x+j-1]>0 then return true end
|
||||||
end end
|
end end
|
||||||
end
|
end
|
||||||
function resetField(f0,start)
|
function resetField(f0,f,start)
|
||||||
while field[start]do
|
while f[start]do
|
||||||
rem(field,start)
|
removeRow(f,start)
|
||||||
end
|
end
|
||||||
for i=start,#f0 do
|
for i=start,#f0 do
|
||||||
field[i]={}
|
f[i]=getNewRow()
|
||||||
for j=1,10 do
|
for j=1,10 do
|
||||||
field[i][j]=f0[i][j]
|
f[i][j]=f0[i][j]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function getScore(field,cb,cx,cy)
|
function getScore(field,cb,cx,cy)
|
||||||
local highest=0
|
local highest=0
|
||||||
local height={}
|
local height=getNewRow()
|
||||||
local rough=0
|
local rough=0
|
||||||
local clear=0
|
local clear=0
|
||||||
local hole=0
|
local hole=0
|
||||||
@@ -49,7 +50,7 @@ function getScore(field,cb,cx,cy)
|
|||||||
if field[i][j]==0 then f=false;break end
|
if field[i][j]==0 then f=false;break end
|
||||||
end
|
end
|
||||||
if f then
|
if f then
|
||||||
rem(field,i)
|
removeRow(field,i)
|
||||||
clear=clear+1
|
clear=clear+1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -63,61 +64,67 @@ function getScore(field,cb,cx,cy)
|
|||||||
if x>3 and x<8 and h>highest then highest=h end
|
if x>3 and x<8 and h>highest then highest=h end
|
||||||
if h>1 then
|
if h>1 then
|
||||||
for h=h-1,1,-1 do
|
for h=h-1,1,-1 do
|
||||||
if field[h][x]==0 then hole=hole+1 end
|
if field[h][x]==0 then hole=hole+1 if hole>5 then break end end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
for x=1,9 do
|
for x=1,9 do
|
||||||
local dh=abs(height[x]-height[x])
|
local dh=abs(height[x]-height[x])
|
||||||
if dh>1 then
|
if dh>1 then
|
||||||
rough=rough+dh^1.5
|
rough=rough+min(dh^2,10)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
ins(freeRow,height)
|
||||||
return
|
return
|
||||||
-highest*5
|
-highest*5
|
||||||
-rough*20
|
-rough*15
|
||||||
-cy*15
|
-cy*20
|
||||||
|
-#cb*10
|
||||||
+clear^2*4
|
+clear^2*4
|
||||||
-hole*20
|
-hole*15
|
||||||
end
|
end
|
||||||
--controlname:mL,mR,rR,rL,rF,hD,sD,H,LL,RR
|
--controlname:mL,mR,rR,rL,rF,hD,sD,H,LL,RR
|
||||||
function AI_getControls(ctrl)
|
function AI_getControls(ctrl)
|
||||||
local field_org,cb,cx,cy={}
|
local Tfield={}--test field
|
||||||
for i=1,#field do
|
local field_org=field
|
||||||
field_org[i]={}
|
for i=1,#field_org do
|
||||||
|
Tfield[i]=getNewRow()
|
||||||
for j=1,10 do
|
for j=1,10 do
|
||||||
field_org[i][j]=field[i][j]
|
Tfield[i][j]=field_org[i][j]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local best={x=1,dir=0,hold=false,score=-9e99}
|
local best={x=1,dir=0,hold=false,score=-9e99}
|
||||||
for ifhold=0,1 do
|
for ifhold=0,1 do
|
||||||
local bn=ifhold==0 and bn or hn>0 and hn or nxt[1]
|
local bn=ifhold==0 and bn or hn>0 and hn or nxt[1]
|
||||||
for dir=0,spinNeed[bn]-1 do--for each direction
|
for dir=0,dirCount[bn] do--for each direction
|
||||||
cb=blocks[bn][dir]
|
local cb=blocks[bn][dir]
|
||||||
for cx=1,11-#cb[1]do--for each positioon
|
for cx=1,11-#cb[1]do--for each positioon
|
||||||
cy=#field+1
|
local cy=#Tfield+1
|
||||||
while not ifoverlapAI(field,cb,cx,cy-1)do
|
while not ifoverlapAI(Tfield,cb,cx,cy-1)do
|
||||||
cy=cy-1
|
cy=cy-1
|
||||||
end--move to bottom
|
end--move to bottom
|
||||||
for i=1,#cb do
|
for i=1,#cb do
|
||||||
local y=cy+i-1
|
local y=cy+i-1
|
||||||
if not field[y]then field[y]={0,0,0,0,0,0,0,0,0,0}end
|
if not Tfield[y]then Tfield[y]=getNewRow()end
|
||||||
for j=1,#cb[1]do
|
for j=1,#cb[1]do
|
||||||
if cb[i][j]~=0 then
|
if cb[i][j]~=0 then
|
||||||
field[y][cx+j-1]=1
|
Tfield[y][cx+j-1]=1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end--simulate lock
|
end--simulate lock
|
||||||
local score=getScore(field,cb,cx,cy)
|
local score=getScore(Tfield,cb,cx,cy)
|
||||||
if score>best.score then
|
if score>best.score then
|
||||||
best={bn=bn,x=cx,dir=dir,hold=ifhold==1,score=score}
|
best={bn=bn,x=cx,dir=dir,hold=ifhold==1,score=score}
|
||||||
end
|
end
|
||||||
resetField(field_org,cy)
|
resetField(field_org,Tfield,cy)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end--ifHold
|
end--ifHold loop
|
||||||
|
|
||||||
|
while #Tfield>0 do
|
||||||
|
removeRow(Tfield,1)
|
||||||
|
end--Release cache
|
||||||
|
|
||||||
cb,cx,cy=cb_org,cx_org,cy_org
|
|
||||||
if best.hold then
|
if best.hold then
|
||||||
ins(ctrl,8)
|
ins(ctrl,8)
|
||||||
end
|
end
|
||||||
@@ -127,7 +134,7 @@ function AI_getControls(ctrl)
|
|||||||
ins(ctrl,5)
|
ins(ctrl,5)
|
||||||
elseif best.dir==3 then
|
elseif best.dir==3 then
|
||||||
ins(ctrl,4)
|
ins(ctrl,4)
|
||||||
end--rotate
|
end--hold&rotate
|
||||||
best.x=best.x-spinOffset[best.bn][best.dir]
|
best.x=best.x-spinOffset[best.bn][best.dir]
|
||||||
local n=blockPos[best.bn]<best.x and 2 or 1
|
local n=blockPos[best.bn]<best.x and 2 or 1
|
||||||
for i=1,abs(blockPos[best.bn]-best.x)do
|
for i=1,abs(blockPos[best.bn]-best.x)do
|
||||||
|
|||||||
94
button.lua
94
button.lua
@@ -2,57 +2,75 @@ Buttons={
|
|||||||
load={},
|
load={},
|
||||||
intro={},
|
intro={},
|
||||||
main={
|
main={
|
||||||
{x=240,y=300,w=320,h=60,rgb=color.red,t="Play",code=function()gotoScene("mode")end},
|
{x=250,y=300,w=330,h=60,rgb=color.red,t="Play",code=function()gotoScene("mode")end,down=2},
|
||||||
{x=240,y=380,w=320,h=60,rgb=color.blue,t="Settings",code=function()gotoScene("setting")end},
|
{x=250,y=380,w=330,h=60,rgb=color.blue,t="Settings",code=function()gotoScene("setting")end,up=1,down=3},
|
||||||
{x=155,y=460,w=150,h=60,rgb=color.yellow,t="Help",code=function()gotoScene("help")end},
|
{x=165,y=460,w=160,h=60,rgb=color.yellow,t="Help",code=function()gotoScene("help")end,up=2,down=5,right=4},
|
||||||
{x=325,y=460,w=150,h=60,rgb=color.cyan,t="Statistics",code=function()gotoScene("stat")end},
|
{x=335,y=460,w=160,h=60,rgb=color.cyan,t="Statistics",code=function()gotoScene("stat")end,up=2,down=5,left=3},
|
||||||
{x=240,y=540,w=320,h=60,rgb=color.grey,t="Quit",code=function()gotoScene("quit")end},
|
{x=250,y=540,w=330,h=60,rgb=color.grey,t="Quit",code=function()gotoScene("quit")end,up=3},
|
||||||
},
|
},
|
||||||
mode={
|
mode={
|
||||||
{x=330,y=140,w=280,h=70,rgb=color.white,t="40 Lines",code=function()startGame("sprint")end},
|
{x=330,y=140,w=280,h=70,rgb=color.white,t="40 Lines",code=function()startGame("sprint")end,down=4,right=2},
|
||||||
{x=640,y=140,w=280,h=70,rgb=color.white,t="Zen",code=function()startGame("zen")end},
|
{x=640,y=140,w=280,h=70,rgb=color.white,t="Zen",code=function()startGame("zen")end,down=5,left=1,right=3},
|
||||||
{x=950,y=140,w=280,h=70,rgb=color.white,t="GM Roll",code=function()startGame("gmroll")end},
|
{x=950,y=140,w=280,h=70,rgb=color.white,t="GM Roll",code=function()startGame("gmroll")end,down=6,left=2},
|
||||||
{x=330,y=250,w=280,h=70,rgb=color.white,t="Marathon",code=function()startGame("marathon")end},
|
{x=330,y=250,w=280,h=70,rgb=color.white,t="Marathon",code=function()startGame("marathon")end,up=1,down=7,right=5},
|
||||||
{x=330,y=360,w=280,h=70,rgb=color.white,t="Death",code=function()startGame("death")end},
|
{x=640,y=250,w=280,h=70,rgb=color.white,t="Tetris 21",code=function()startGame("tetris21")end,up=2,down=8,left=4,right=6},
|
||||||
{x=640,y=250,w=280,h=70,rgb=color.white,t="Tetris 25",code=function()startGame("tetris25")end},
|
{x=950,y=250,w=280,h=70,rgb=color.white,t="Blind",code=function()startGame("blind")end,up=3,down=9,left=5},
|
||||||
{x=640,y=360,w=280,h=70,rgb=color.white,t="AI Solo",code=function()startGame("solo")end},
|
{x=330,y=360,w=280,h=70,rgb=color.white,t="Death",code=function()startGame("death")end,up=4,down=10,right=8},
|
||||||
{x=950,y=250,w=280,h=70,rgb=color.white,t="Blind",code=function()startGame("blind")end},
|
{x=640,y=360,w=280,h=70,rgb=color.white,t="AI Solo",code=function()startGame("solo")end,up=5,down=10,right=9,left=7},
|
||||||
{x=950,y=360,w=280,h=70,rgb=color.white,t="Asymmetry Solo",code=function()startGame("asymsolo")end},
|
{x=950,y=360,w=280,h=70,rgb=color.white,t="Asymmetry Solo",code=function()startGame("asymsolo")end,up=6,down=10,left=8},
|
||||||
{x=640,y=590,w=180,h=60,rgb=color.white,t="Back",code=function()gotoScene("main")end},
|
{x=640,y=590,w=180,h=60,rgb=color.white,t="Back",code=function()gotoScene("main")end,up=8},
|
||||||
},
|
},
|
||||||
play={
|
play={
|
||||||
{x=1230,y=30,w=80,h=40,rgb=color.white,t="Back",code=function()gotoScene("mode")end},
|
|
||||||
},
|
},
|
||||||
setting={
|
setting={
|
||||||
{x=330,y=100,w=200,h=60,rgb=color.white,t=function()return setting.ghost and"Ghost ON"or"Ghost OFF"end,code=function()setting.ghost=not setting.ghost end},
|
{x=330,y=100,w=200,h=60,rgb=color.white,t=function()return setting.ghost and"Ghost ON"or"Ghost OFF"end,code=function()setting.ghost=not setting.ghost end,down=6,right=2},
|
||||||
{x=540,y=100,w=200,h=60,rgb=color.white,t=function()return setting.center and"Center ON"or"Center OFF"end,code=function()setting.center=not setting.center end},
|
{x=540,y=100,w=200,h=60,rgb=color.white,t=function()return setting.center and"Center ON"or"Center OFF"end,code=function()setting.center=not setting.center end,down=6,left=1,right=3},
|
||||||
{x=870,y=100,w=340,h=60,rgb=color.white,t=function()return setting.sfx and"Disable SFX"or"Enable SFX"end,code=function()setting.sfx=not setting.sfx end},
|
{x=870,y=100,w=340,h=60,rgb=color.white,t=function()return setting.sfx and"Disable SFX"or"Enable SFX"end,code=function()setting.sfx=not setting.sfx end,down=4,left=2},
|
||||||
{x=870,y=180,w=340,h=60,rgb=color.white,t=function()return setting.bgm and"Disable BGM"or"Enable BGM"end,code=function()BGM()setting.bgm=not setting.bgmBGM("blank")end},
|
{x=870,y=180,w=340,h=60,rgb=color.white,t=function()return setting.bgm and"Disable BGM"or"Enable BGM"end,code=function()BGM()setting.bgm=not setting.bgm;BGM("blank")end,up=3,down=5,left=2},
|
||||||
{x=870,y=260,w=340,h=60,rgb=color.white,t=function()return setting.fullscreen and"Disable fullscreen"or"Enable fullscreen"end,
|
{x=870,y=260,w=340,h=60,rgb=color.white,t=function()return setting.fullscreen and"Disable fullscreen"or"Enable fullscreen"end,
|
||||||
code=function()
|
code=function()
|
||||||
setting.fullscreen=not setting.fullscreen
|
setting.fullscreen=not setting.fullscreen
|
||||||
love.window.setFullscreen(setting.fullscreen)
|
love.window.setFullscreen(setting.fullscreen)
|
||||||
end
|
end,
|
||||||
|
up=4,down=7,left=6
|
||||||
},
|
},
|
||||||
{x=390,y=250,w=320,h=60,rgb=color.white,t="Advanced settings",code=function()gotoScene("setting2")end},
|
{x=435,y=250,w=320,h=60,rgb=color.white,t="Advanced settings",code=function()gotoScene("setting2")end,up=1,down=7,right=5},
|
||||||
{x=640,y=590,w=180,h=60,rgb=color.white,t="Back",code=function()back()end},
|
{x=640,y=590,w=180,h=60,rgb=color.white,t="Back",code=function()back()end,up=6},
|
||||||
},
|
},
|
||||||
setting2={
|
setting2={
|
||||||
{x=850,y=90,w=40,h=40,rgb=color.white,t="-",code=function()setting.das=(setting.das-1)%31 end,hold=true},
|
{x=290,y=70 ,w=160,h=45,rgb=color.white,t=function()return setting.key[1]end,code=function()keysetting,gamepadsetting=1 end,up=1,down=2,right=10},
|
||||||
{x=1210,y=90,w=40,h=40,rgb=color.white,t="+",code=function()setting.das=(setting.das+1)%31 end,hold=true},
|
{x=290,y=130,w=160,h=45,rgb=color.white,t=function()return setting.key[2]end,code=function()keysetting,gamepadsetting=2 end,up=1,down=3,right=11},
|
||||||
{x=1260,y=90,w=40,h=40,rgb=color.white,t="-",code=function()setting.arr=(setting.arr-1)%16 end,hold=true},
|
{x=290,y=190,w=160,h=45,rgb=color.white,t=function()return setting.key[3]end,code=function()keysetting,gamepadsetting=3 end,up=2,down=4,right=12},
|
||||||
{x=1430,y=90,w=40,h=40,rgb=color.white,t="+",code=function()setting.arr=(setting.arr+1)%16 end,hold=true},
|
{x=290,y=250,w=160,h=45,rgb=color.white,t=function()return setting.key[4]end,code=function()keysetting,gamepadsetting=4 end,up=3,down=5,right=13},
|
||||||
{x=420,y=70,w=190,h=45,rgb=color.white,t=function()return setting.key[1]end,code=function()keysetting=1 end},
|
{x=290,y=310,w=160,h=45,rgb=color.white,t=function()return setting.key[5]end,code=function()keysetting,gamepadsetting=5 end,up=4,down=6,right=14},
|
||||||
{x=420,y=130,w=190,h=45,rgb=color.white,t=function()return setting.key[2]end,code=function()keysetting=2 end},
|
{x=290,y=370,w=160,h=45,rgb=color.white,t=function()return setting.key[6]end,code=function()keysetting,gamepadsetting=6 end,up=5,down=7,right=15},
|
||||||
{x=420,y=190,w=190,h=45,rgb=color.white,t=function()return setting.key[3]end,code=function()keysetting=3 end},
|
{x=290,y=430,w=160,h=45,rgb=color.white,t=function()return setting.key[7]end,code=function()keysetting,gamepadsetting=7 end,up=6,down=8,right=16},
|
||||||
{x=420,y=250,w=190,h=45,rgb=color.white,t=function()return setting.key[4]end,code=function()keysetting=4 end},
|
{x=290,y=490,w=160,h=45,rgb=color.white,t=function()return setting.key[8]end,code=function()keysetting,gamepadsetting=8 end,up=7,down=9,right=17},
|
||||||
{x=420,y=310,w=190,h=45,rgb=color.white,t=function()return setting.key[5]end,code=function()keysetting=5 end},
|
{x=290,y=550,w=160,h=45,rgb=color.white,t=function()return setting.key[9]end,code=function()keysetting,gamepadsetting=9 end,up=8,down=27,right=18},
|
||||||
{x=420,y=370,w=190,h=45,rgb=color.white,t=function()return setting.key[6]end,code=function()keysetting=6 end},
|
--1~9
|
||||||
{x=420,y=430,w=190,h=45,rgb=color.white,t=function()return setting.key[7]end,code=function()keysetting=7 end},
|
{x=540,y=70 ,w=230,h=45,rgb=color.white,t=function()return setting.gamepad[1]end,code=function()gamepadsetting,keysetting=1 end,up=10,down=11,left=1,right=19},
|
||||||
{x=420,y=490,w=190,h=45,rgb=color.white,t=function()return setting.key[8]end,code=function()keysetting=8 end},
|
{x=540,y=130,w=230,h=45,rgb=color.white,t=function()return setting.gamepad[2]end,code=function()gamepadsetting,keysetting=2 end,up=10,down=12,left=2,right=19},
|
||||||
{x=420,y=550,w=190,h=45,rgb=color.white,t=function()return setting.key[9]end,code=function()keysetting=9 end},
|
{x=540,y=190,w=230,h=45,rgb=color.white,t=function()return setting.gamepad[3]end,code=function()gamepadsetting,keysetting=3 end,up=11,down=13,left=3,right=23},
|
||||||
{x=420,y=630,w=120,h=55,rgb=color.white,t="Reset",code=function()setting.key={"left","right","x","z","c","up","down","space","r","LEFT","RIGHT"}end},
|
{x=540,y=250,w=230,h=45,rgb=color.white,t=function()return setting.gamepad[4]end,code=function()gamepadsetting,keysetting=4 end,up=12,down=14,left=4,right=23},
|
||||||
{x=640,y=590,w=180,h=60,rgb=color.white,t="Back",code=function()keysetting=nil;back()end},
|
{x=540,y=310,w=230,h=45,rgb=color.white,t=function()return setting.gamepad[5]end,code=function()gamepadsetting,keysetting=5 end,up=13,down=15,left=5,right=28},
|
||||||
|
{x=540,y=370,w=230,h=45,rgb=color.white,t=function()return setting.gamepad[6]end,code=function()gamepadsetting,keysetting=6 end,up=14,down=16,left=6,right=28},
|
||||||
|
{x=540,y=430,w=230,h=45,rgb=color.white,t=function()return setting.gamepad[7]end,code=function()gamepadsetting,keysetting=7 end,up=15,down=17,left=7,right=28},
|
||||||
|
{x=540,y=490,w=230,h=45,rgb=color.white,t=function()return setting.gamepad[8]end,code=function()gamepadsetting,keysetting=8 end,up=16,down=18,left=8,right=28},
|
||||||
|
{x=540,y=550,w=230,h=45,rgb=color.white,t=function()return setting.gamepad[9]end,code=function()gamepadsetting,keysetting=9 end,up=17,down=27,left=9,right=28},
|
||||||
|
--10~18
|
||||||
|
{x=745,y=90,w=40,h=40,rgb=color.white,t="-",code=function()setting.das=(setting.das-1)%31 end,hold=true,left=10,right=20,down=23},
|
||||||
|
{x=910,y=90,w=40,h=40,rgb=color.white,t="+",code=function()setting.das=(setting.das+1)%31 end,hold=true,left=19,right=21,down=24},
|
||||||
|
{x=960,y=90,w=40,h=40,rgb=color.white,t="-",code=function()setting.arr=(setting.arr-1)%16 end,hold=true,left=20,right=22,down=25},
|
||||||
|
{x=1125,y=90,w=40,h=40,rgb=color.white,t="+",code=function()setting.arr=(setting.arr+1)%16 end,hold=true,left=21,down=26},
|
||||||
|
--19~22
|
||||||
|
{x=745,y=150,w=40,h=40,rgb=color.white,t="-",code=function()setting.sddas=(setting.sddas-1)%11 end,hold=true,up=19,down=28,left=10,right=24},
|
||||||
|
{x=910,y=150,w=40,h=40,rgb=color.white,t="+",code=function()setting.sddas=(setting.sddas+1)%11 end,hold=true,up=20,down=28,left=23,right=25},
|
||||||
|
{x=960,y=150,w=40,h=40,rgb=color.white,t="-",code=function()setting.sdarr=(setting.sdarr-1)%6 end,hold=true,up=21,down=28,left=24,right=26},
|
||||||
|
{x=1125,y=150,w=40,h=40,rgb=color.white,t="+",code=function()setting.sdarr=(setting.sdarr+1)%4 end,hold=true,up=22,down=28,left=25},
|
||||||
|
--23~26
|
||||||
|
{x=405,y=630,w=130,h=60,rgb=color.white,t="Reset",code=function()for i=1,#setting.key do setting.key[i]=gameEnv0.key[i] end end,up=9,right=28},
|
||||||
|
{x=840,y=630,w=180,h=60,rgb=color.white,t="Back",code=function()keysetting=nil;back()end,up=9,left=27},
|
||||||
|
--27~28
|
||||||
},
|
},
|
||||||
help={
|
help={
|
||||||
{x=640,y=590,w=180,h=60,rgb=color.white,t="Back",code=function()back()end},
|
{x=640,y=590,w=180,h=60,rgb=color.white,t="Back",code=function()back()end},
|
||||||
|
|||||||
16
conf.lua
16
conf.lua
@@ -7,7 +7,7 @@ function love.conf(t)
|
|||||||
t.accelerometerjoystick=X--Enable the accelerometer on iOS and Android by exposing it as a Joystick (boolean)
|
t.accelerometerjoystick=X--Enable the accelerometer on iOS and Android by exposing it as a Joystick (boolean)
|
||||||
t.externalstorage=X
|
t.externalstorage=X
|
||||||
t.gammacorrect=true
|
t.gammacorrect=true
|
||||||
-- t.audio.mixwithsystem=true--Keep background music playing when opening LOVE (boolean, iOS and Android only)
|
-- t.audio.mixwithsystem=true--Keep background music playing when opening LOVE (boolean, iOS and Android only)
|
||||||
|
|
||||||
t.window.title="Techmino Alpha"
|
t.window.title="Techmino Alpha"
|
||||||
t.window.icon="/image/icon.png"
|
t.window.icon="/image/icon.png"
|
||||||
@@ -23,27 +23,27 @@ function love.conf(t)
|
|||||||
t.window.msaa=X--The number of samples to use with multi-sampled antialiasing (number)
|
t.window.msaa=X--The number of samples to use with multi-sampled antialiasing (number)
|
||||||
t.window.depth=X--The number of bits per sample in the depth buffer
|
t.window.depth=X--The number of bits per sample in the depth buffer
|
||||||
t.window.stencil=1--The number of bits per sample in the stencil buffer
|
t.window.stencil=1--The number of bits per sample in the stencil buffer
|
||||||
t.window.display=1--Index of the monitor to show the window in (number)
|
t.window.display=1--Monitor ID
|
||||||
t.window.highdpi=X--Enable high-dpi mode for the window on a Retina display (boolean)
|
t.window.highdpi=X--Enable high-dpi mode for the window on a Retina display (boolean)
|
||||||
t.window.x=nil
|
t.window.x=nil
|
||||||
t.window.y=nil
|
t.window.y=nil
|
||||||
|
|
||||||
|
t.modules.window=true
|
||||||
|
t.modules.system=true
|
||||||
t.modules.audio=true
|
t.modules.audio=true
|
||||||
t.modules.data=true
|
t.modules.data=true
|
||||||
t.modules.event=true
|
t.modules.event=true
|
||||||
t.modules.font=true
|
t.modules.font=true
|
||||||
t.modules.graphics=true
|
t.modules.graphics=true
|
||||||
t.modules.image=true
|
t.modules.image=true
|
||||||
t.modules.joystick=X
|
t.modules.joystick=true
|
||||||
t.modules.keyboard=true
|
t.modules.keyboard=true
|
||||||
t.modules.math=true
|
t.modules.math=true
|
||||||
t.modules.mouse=true
|
t.modules.mouse=true
|
||||||
t.modules.physics=X
|
|
||||||
t.modules.sound=true
|
t.modules.sound=true
|
||||||
t.modules.system=true
|
|
||||||
t.modules.thread=X
|
|
||||||
t.modules.timer=true
|
t.modules.timer=true
|
||||||
t.modules.touch=X
|
t.modules.touch=true
|
||||||
|
t.modules.physics=X
|
||||||
|
t.modules.thread=X
|
||||||
t.modules.video=X
|
t.modules.video=X
|
||||||
t.modules.window=true
|
|
||||||
end
|
end
|
||||||
94
control.lua
94
control.lua
@@ -1,11 +1,49 @@
|
|||||||
|
function buttonControl_key(i)
|
||||||
|
mouseShow=false
|
||||||
|
if i=="up"or i=="down"or i=="left"or i=="right"then
|
||||||
|
if not Buttons.sel then
|
||||||
|
Buttons.sel=1
|
||||||
|
else
|
||||||
|
Buttons.sel=Buttons[scene][Buttons.sel][i]or Buttons.sel
|
||||||
|
end
|
||||||
|
elseif i=="space"or i=="return"then
|
||||||
|
if not sceneSwaping and Buttons.sel then
|
||||||
|
local B=Buttons[scene][Buttons.sel]
|
||||||
|
B.code()
|
||||||
|
B.alpha=1
|
||||||
|
sysSFX("button")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
function buttonControl_gamepad(i)
|
||||||
|
if i=="dpup"or i=="dpdown"or i=="dpleft"or i=="dpright"then
|
||||||
|
|
||||||
|
if not Buttons.sel then
|
||||||
|
Buttons.sel=1
|
||||||
|
mouseShow=false
|
||||||
|
else
|
||||||
|
Buttons.sel=Buttons[scene][Buttons.sel][i=="dpup"and"up"or i=="dpdown"and"down"or i=="dpleft"and"left"or"right"]or Buttons.sel
|
||||||
|
end
|
||||||
|
elseif i=="start"then
|
||||||
|
if not sceneSwaping and Buttons.sel then
|
||||||
|
local B=Buttons[scene][Buttons.sel]
|
||||||
|
if B.hold then Buttons.pressing=max(Buttons.pressing,1)end
|
||||||
|
B.code()
|
||||||
|
B.alpha=1
|
||||||
|
sysSFX("button")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function love.mousemoved(x,y)
|
function love.mousemoved(x,y)
|
||||||
|
mouseShow=true
|
||||||
mx,my=mouseConvert(x,y)
|
mx,my=mouseConvert(x,y)
|
||||||
Buttons.sel=nil
|
Buttons.sel=nil
|
||||||
for i=1,#Buttons[scene]do
|
for i=1,#Buttons[scene]do
|
||||||
local B=Buttons[scene][i]
|
local B=Buttons[scene][i]
|
||||||
if not(B.hide and B.hide())then
|
if not(B.hide and B.hide())then
|
||||||
if abs(mx-B.x)<B.w*.5 and abs(my-B.y)<B.h*.5 then
|
if abs(mx-B.x)<B.w*.5 and abs(my-B.y)<B.h*.5 then
|
||||||
Buttons.sel=B
|
Buttons.sel=i
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -13,17 +51,18 @@ function love.mousemoved(x,y)
|
|||||||
if not Buttons.sel then Buttons.pressing=0 end
|
if not Buttons.sel then Buttons.pressing=0 end
|
||||||
end
|
end
|
||||||
function love.mousepressed(x,y,k)
|
function love.mousepressed(x,y,k)
|
||||||
|
mouseShow=true
|
||||||
mx,my=mouseConvert(x,y)
|
mx,my=mouseConvert(x,y)
|
||||||
if mouseDown[scene]then mouseDown[scene](mx,my,k)end
|
if mouseDown[scene]then mouseDown[scene](mx,my,k)end
|
||||||
if k==1 then
|
if k==1 then
|
||||||
if not sceneSwaping and Buttons.sel then
|
if not sceneSwaping and Buttons.sel then
|
||||||
local B=Buttons.sel
|
local B=Buttons[scene][Buttons.sel]
|
||||||
if B.hold then Buttons.pressing=max(Buttons.pressing,1)end
|
if B.hold then Buttons.pressing=max(Buttons.pressing,1)end
|
||||||
B.code()
|
B.code()
|
||||||
B.alpha=1
|
B.alpha=1
|
||||||
Buttons.sel=nil
|
Buttons.sel=nil
|
||||||
love.mousemoved(x,y)
|
love.mousemoved(x,y)
|
||||||
SFX("button")
|
sysSFX("button")
|
||||||
end
|
end
|
||||||
elseif k==3 then
|
elseif k==3 then
|
||||||
back()
|
back()
|
||||||
@@ -45,33 +84,44 @@ function love.touchmoved(id,x,y,dx,dy)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function love.keypressed(i)
|
function love.keypressed(i)
|
||||||
--[[
|
|
||||||
if Buttons.sel then
|
|
||||||
local b=Buttons.sel
|
|
||||||
if i=="up"then b.y=b.y-10
|
|
||||||
elseif i=="down"then b.y=b.y+10
|
|
||||||
elseif i=="left"then b.x=b.x-10
|
|
||||||
elseif i=="right"then b.x=b.x+10
|
|
||||||
elseif i=="k"then b.w=b.w-10
|
|
||||||
elseif i=="l"then b.w=b.w+10
|
|
||||||
elseif i==","then b.h=b.h-10
|
|
||||||
elseif i=="."then b.h=b.h+10
|
|
||||||
elseif i=="s"then
|
|
||||||
print("")
|
|
||||||
for i=1,#Buttons[scene]do
|
|
||||||
local b=Buttons[scene][i]
|
|
||||||
print(b.t,b.x,b.y,b.w,b.h)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end]]
|
|
||||||
if keyDown[scene]then keyDown[scene](i)
|
if keyDown[scene]then keyDown[scene](i)
|
||||||
elseif i=="escape"then back()
|
elseif i=="escape"then back()
|
||||||
|
else buttonControl_key(i)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function love.keyreleased(i)
|
function love.keyreleased(i)
|
||||||
if keyUp[scene]then keyUp[scene](i)
|
if keyUp[scene]then keyUp[scene](i)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function love.gamepadpressed(joystick,i)
|
||||||
|
if scene~="play"or scene=="setting2"and not gamepadsetting then
|
||||||
|
if i=="dpup"or i=="dpdown"or i=="dpleft"or i=="dpright"then
|
||||||
|
if not Buttons.sel then
|
||||||
|
Buttons.sel=1
|
||||||
|
mouseShow=false
|
||||||
|
else
|
||||||
|
Buttons.sel=Buttons[scene][Buttons.sel][i]or Buttons.sel
|
||||||
|
end
|
||||||
|
elseif i=="start"then
|
||||||
|
if not sceneSwaping and Buttons.sel then
|
||||||
|
local B=Buttons[scene][Buttons.sel]
|
||||||
|
if B.hold then Buttons.pressing=max(Buttons.pressing,1)end
|
||||||
|
B.code()
|
||||||
|
B.alpha=1
|
||||||
|
sysSFX("button")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if gamepadDown[scene]then return gamepadDown[scene](i)
|
||||||
|
elseif i=="back"then return back()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
function love.gamepadreleased(joystick,i)
|
||||||
|
if gamepadUp[scene]then gamepadUp[scene](i)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function love.wheelmoved(x,y)
|
function love.wheelmoved(x,y)
|
||||||
if wheelmoved[scene]then wheelmoved[scene](x,y)end
|
if wheelmoved[scene]then wheelmoved[scene](x,y)end
|
||||||
end
|
end
|
||||||
@@ -28,8 +28,7 @@ function game.play()
|
|||||||
scene="play"
|
scene="play"
|
||||||
--curBG="game1"
|
--curBG="game1"
|
||||||
resetGameData()
|
resetGameData()
|
||||||
collectgarbage()
|
sysSFX("ready")
|
||||||
SFX("ready")
|
|
||||||
end
|
end
|
||||||
function game.setting()
|
function game.setting()
|
||||||
scene="setting"
|
scene="setting"
|
||||||
|
|||||||
BIN
image/attack_1.png
Normal file
BIN
image/attack_1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 404 B |
BIN
image/attack_2.png
Normal file
BIN
image/attack_2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 882 B |
BIN
image/attack_3.png
Normal file
BIN
image/attack_3.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 973 B |
BIN
image/block.png
BIN
image/block.png
Binary file not shown.
|
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 5.7 KiB |
13
lists.lua
Normal file
13
lists.lua
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
loseReason={"Finished","Block out"}
|
||||||
|
blockName={"Z","S","L","J","T","O","I"}
|
||||||
|
clearName={"Single","Double","Triple"}
|
||||||
|
actName={"moveLeft","moveRight","rotRight","rotLeft","rotFlip","hardDrop","softDrop","hold","restart","toLeft","toRight"}
|
||||||
|
actName_show={"move left","move right","rotate right","rotate left","rotate flip","hard drop","soft drop","hold","restart","toLeft","toRight"}
|
||||||
|
blockPos={4,4,4,4,4,5,4}
|
||||||
|
renATK={[0]=0,0,0,1,1,2,2,3,3,3}--4 else
|
||||||
|
b2bATK={3,5,8}
|
||||||
|
|
||||||
|
marathon_drop={[0]=60,48,40,30,24,18,15,12,10,8,7,6,5,4,3,2,1,1,0,0}
|
||||||
|
death_lock={10,9,8,7,6}
|
||||||
|
death_wait={6,5,4,3,2}
|
||||||
|
death_fall={10,8,7,6,5}
|
||||||
381
main.lua
381
main.lua
@@ -3,6 +3,40 @@ toN,toS=tonumber,tostring
|
|||||||
int,ceil,abs,rnd,max,min,sin,cos,atan,pi=math.floor,math.ceil,math.abs,math.random,math.max,math.min,math.sin,math.cos,math.atan,math.pi
|
int,ceil,abs,rnd,max,min,sin,cos,atan,pi=math.floor,math.ceil,math.abs,math.random,math.max,math.min,math.sin,math.cos,math.atan,math.pi
|
||||||
sub,gsub,find,format,byte,char=string.sub,string.gsub,string.find,string.format,string.byte,string.char
|
sub,gsub,find,format,byte,char=string.sub,string.gsub,string.find,string.format,string.byte,string.char
|
||||||
ins,rem,sort=table.insert,table.remove,table.sort
|
ins,rem,sort=table.insert,table.remove,table.sort
|
||||||
|
--[[
|
||||||
|
freeRow={}
|
||||||
|
for i=1,50 do
|
||||||
|
freeRow[i]={0,0,0,0,0,0,0,0,0,0}
|
||||||
|
end
|
||||||
|
]]--Reset freeRow,in resetGameData
|
||||||
|
function getNewRow(val)
|
||||||
|
if not val then val=0 end
|
||||||
|
local t=rem(freeRow)
|
||||||
|
for i=1,10 do
|
||||||
|
t[i]=val or 0
|
||||||
|
end
|
||||||
|
--clear a row and move to active list
|
||||||
|
if #freeRow==0 then
|
||||||
|
for i=1,20 do
|
||||||
|
ins(freeRow,{0,0,0,0,0,0,0,0,0,0})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
--prepare new rows
|
||||||
|
return t
|
||||||
|
end
|
||||||
|
function removeRow(t,k)
|
||||||
|
ins(freeRow,rem(t,k))
|
||||||
|
end
|
||||||
|
function restockRow()
|
||||||
|
for p=1,#players do
|
||||||
|
local f,f2=players[p].field,players[p].visTime
|
||||||
|
while #f>0 do
|
||||||
|
removeRow(f,1)
|
||||||
|
removeRow(f2,1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
--to save cache,all rows pruduced and removed here!
|
||||||
|
|
||||||
function sortByTime(a,b)
|
function sortByTime(a,b)
|
||||||
return a.time>b.time
|
return a.time>b.time
|
||||||
@@ -10,7 +44,7 @@ end
|
|||||||
|
|
||||||
ww,wh=gc.getWidth(),gc.getHeight()
|
ww,wh=gc.getWidth(),gc.getHeight()
|
||||||
|
|
||||||
Timer=tm.getTime
|
Timer=tm.getTime--Easy get time
|
||||||
mx,my,mouseShow=-10,-10,true
|
mx,my,mouseShow=-10,-10,true
|
||||||
pause=0--pause countdown(frame)
|
pause=0--pause countdown(frame)
|
||||||
focus=true
|
focus=true
|
||||||
@@ -26,7 +60,10 @@ languages={"eng"}
|
|||||||
prevMenu={
|
prevMenu={
|
||||||
load=love.event.quit,
|
load=love.event.quit,
|
||||||
ready="mode",
|
ready="mode",
|
||||||
play="mode",
|
play=function()
|
||||||
|
restockRow()
|
||||||
|
gotoScene("mode")
|
||||||
|
end,
|
||||||
mode="main",
|
mode="main",
|
||||||
help="main",
|
help="main",
|
||||||
stat="main",
|
stat="main",
|
||||||
@@ -50,6 +87,10 @@ Texts={
|
|||||||
"Total block used:",
|
"Total block used:",
|
||||||
"Total rows cleared:",
|
"Total rows cleared:",
|
||||||
"Total lines sent:",
|
"Total lines sent:",
|
||||||
|
"Total key pressed:",
|
||||||
|
"Total rotate:",
|
||||||
|
"Total hold:",
|
||||||
|
"Total spin:",
|
||||||
},
|
},
|
||||||
help={
|
help={
|
||||||
"I think you don't need \"help\".",
|
"I think you don't need \"help\".",
|
||||||
@@ -193,21 +234,32 @@ color={
|
|||||||
white={1,1,1},
|
white={1,1,1},
|
||||||
grey={.6,.6,.6},
|
grey={.6,.6,.6},
|
||||||
}
|
}
|
||||||
|
attackColor={
|
||||||
|
{color.red,color.yellow},
|
||||||
|
{color.red,color.purple},
|
||||||
|
{color.blue,color.white},
|
||||||
|
animate={
|
||||||
|
function(t)
|
||||||
|
gc.setColor(1,t,0)
|
||||||
|
end,
|
||||||
|
function(t)
|
||||||
|
gc.setColor(1,0,t)
|
||||||
|
end,
|
||||||
|
function(t)
|
||||||
|
gc.setColor(t,t,1)
|
||||||
|
end,
|
||||||
|
}--3 animation-colorsets of attack buffer bar
|
||||||
|
}
|
||||||
-- for k,v in pairs(color) do
|
-- for k,v in pairs(color) do
|
||||||
-- v[1],v[2],v[3]=255*v[1],255*v[2],255*v[3]
|
-- v[1],v[2],v[3]=255*v[1],255*v[2],255*v[3]
|
||||||
-- end
|
-- end
|
||||||
|
|
||||||
loseReason={"Finished","Block out"}
|
|
||||||
blockName={"Z","S","L","J","T","O","I"}
|
|
||||||
clearName={"Single","Double","Triple"}
|
|
||||||
actName={"moveLeft","moveRight","rotRight","rotLeft","rotFlip","hardDrop","softDrop","hold","restart","toLeft","toRight"}
|
|
||||||
actName_show={"move left","move right","rotate right","rotate left","rotate flip","hard drop","soft drop","hold","restart","toLeft","toRight"}
|
|
||||||
blockPos={4,4,4,4,4,5,4}
|
|
||||||
renATK={[0]=0,0,0,1,1,1,2,2,2,3,3,3}--4 else
|
|
||||||
b2bATK={3,5,8}
|
|
||||||
require("TRS")--load block&TRS kick
|
require("TRS")--load block&TRS kick
|
||||||
|
require("lists")
|
||||||
|
|
||||||
gameEnv0={
|
gameEnv0={
|
||||||
das=6,arr=1,
|
das=10,arr=2,
|
||||||
|
sddas=0,sdarr=2,
|
||||||
ghost=true,center=true,
|
ghost=true,center=true,
|
||||||
drop=30,lock=45,
|
drop=30,lock=45,
|
||||||
wait=0,fall=20,
|
wait=0,fall=20,
|
||||||
@@ -216,6 +268,7 @@ gameEnv0={
|
|||||||
_20G=false,target=9e99,
|
_20G=false,target=9e99,
|
||||||
freshLimit=9e99,
|
freshLimit=9e99,
|
||||||
key={"left","right","x","z","c","up","down","space","LEFT","RIGHT"},
|
key={"left","right","x","z","c","up","down","space","LEFT","RIGHT"},
|
||||||
|
gamepad={"dpleft","dpright","a","b","y","dpup","dpdown","rightshoulder","leftshoulder","LEFT","RIGHT"},
|
||||||
reach=function()end,--Called when reach row target
|
reach=function()end,--Called when reach row target
|
||||||
}
|
}
|
||||||
randomMethod={
|
randomMethod={
|
||||||
@@ -318,7 +371,7 @@ loadmode={
|
|||||||
curBG="game2"
|
curBG="game2"
|
||||||
BGM("push")
|
BGM("push")
|
||||||
end,
|
end,
|
||||||
tetris25=function()
|
tetris21=function()
|
||||||
modeEnv={
|
modeEnv={
|
||||||
wait=1,
|
wait=1,
|
||||||
fall=1,
|
fall=1,
|
||||||
@@ -415,36 +468,23 @@ Event={
|
|||||||
if s>=20 then
|
if s>=20 then
|
||||||
Event.gameover.win()
|
Event.gameover.win()
|
||||||
else
|
else
|
||||||
gameEnv.drop=Data.marathon_drop[s]
|
gameEnv.drop=marathon_drop[s]
|
||||||
if s==18 then gameEnv._20G=true end
|
if s==18 then gameEnv._20G=true end
|
||||||
gameEnv.target=s*10+10
|
gameEnv.target=s*10+10
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
death_reach=function()
|
death_reach=function()
|
||||||
if gameEnv.target==50 then
|
if gameEnv.target==250 then
|
||||||
gameEnv.lock=9
|
Event.gameover.win()
|
||||||
gameEnv.wait=5
|
else
|
||||||
gameEnv.fall=8
|
gameEnv.target=gameEnv.target+50
|
||||||
showText("STAGE 2","fly",80,-100)
|
local t=gameEnv.target/50
|
||||||
elseif gameEnv.target==100 then
|
gameEnv.lock=death_lock[t]
|
||||||
gameEnv.lock=8
|
gameEnv.wait=death_wait[t]
|
||||||
gameEnv.wait=4
|
gameEnv.fall=death_fall[t]
|
||||||
gameEnv.fall=6
|
showText("STAGE "..t,"fly",80,-120)
|
||||||
showText("STAGE 3","fly",80,-100)
|
SFX("reach")
|
||||||
elseif gameEnv.target==150 then
|
|
||||||
gameEnv.lock=7
|
|
||||||
gameEnv.wait=3
|
|
||||||
gameEnv.fall=5
|
|
||||||
showText("STAGE 4","fly",80,-100)
|
|
||||||
elseif gameEnv.target==200 then
|
|
||||||
gameEnv.lock=6
|
|
||||||
gameEnv.wait=2
|
|
||||||
gameEnv.fall=4
|
|
||||||
showText("STAGE 5","fly",80,-100)
|
|
||||||
gameEnv.target=250
|
|
||||||
end
|
end
|
||||||
gameEnv.target=gameEnv.target+50
|
|
||||||
SFX("reach")
|
|
||||||
end,
|
end,
|
||||||
task={
|
task={
|
||||||
win=function()
|
win=function()
|
||||||
@@ -466,71 +506,63 @@ Event={
|
|||||||
gameover=gameover+1
|
gameover=gameover+1
|
||||||
if gameover%3==0 then
|
if gameover%3==0 then
|
||||||
local j=gameover/3
|
local j=gameover/3
|
||||||
if j<=#field then
|
if field[j]then
|
||||||
for i=1,10 do
|
for i=1,10 do
|
||||||
if field[j][i]>0 then field[j][i]=13 end
|
if field[j][i]>0 then field[j][i]=13 end
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if gameover>80 then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
Data={
|
|
||||||
marathon_drop={[0]=60,48,40,30,24,18,15,12,10,8,7,6,5,4,3,2,1,1,0,0},
|
|
||||||
shirase_drop={[0]=0},
|
|
||||||
shirase_lock={[0]=0},
|
|
||||||
shirase_are={[0]=0},
|
|
||||||
shirase_lare={[0]=0},
|
|
||||||
}
|
|
||||||
mesDisp={
|
mesDisp={
|
||||||
--Default:font=40,white
|
--Default:font=40,white
|
||||||
sprint=function()
|
sprint=function()
|
||||||
setFont(75)
|
setFont(75)
|
||||||
mStr(max(40-P.cstat.row,0),-76,280)
|
mStr(max(40-P.cstat.row,0),-75,280)
|
||||||
end,
|
end,
|
||||||
zen=function()
|
zen=function()
|
||||||
setFont(75)
|
setFont(75)
|
||||||
mStr(max(200-P.cstat.row,0),-76,280)
|
mStr(max(200-P.cstat.row,0),-75,280)
|
||||||
end,
|
end,
|
||||||
gmroll=function()
|
gmroll=function()
|
||||||
setFont(35)
|
setFont(35)
|
||||||
gc.print("Tetris",-120,390)
|
gc.print("Tetris",-120,390)
|
||||||
setFont(80)
|
setFont(80)
|
||||||
mStr(cstat.tetris,-77,420)
|
mStr(cstat.tetris,-75,420)
|
||||||
end,
|
end,
|
||||||
marathon=function()
|
marathon=function()
|
||||||
mStr(P.cstat.row.."/"..gameEnv.target,-76,250)
|
mStr(P.cstat.row.."/"..gameEnv.target,-75,250)
|
||||||
end,
|
end,
|
||||||
death=function()
|
death=function()
|
||||||
mStr(P.cstat.row.."/"..gameEnv.target,-76,250)
|
mStr(P.cstat.row.."/"..gameEnv.target,-75,250)
|
||||||
end,
|
end,
|
||||||
tetris25=function()
|
tetris21=function()
|
||||||
gc.print("Remain",-142,510)
|
gc.print("Remain",-140,450)
|
||||||
gc.print("Attack",-132,365)
|
gc.print("Attack",-130,305)
|
||||||
setFont(80)
|
setFont(80)
|
||||||
mStr(#players.alive,-77,440)
|
mStr(#players.alive,-75,380)
|
||||||
mStr(cstat.atk,-77,300)
|
mStr(cstat.atk,-75,240)
|
||||||
end,
|
end,
|
||||||
blind=function()
|
blind=function()
|
||||||
setFont(35)
|
setFont(35)
|
||||||
gc.print("Rows",-115,220)
|
gc.print("Rows",-115,220)
|
||||||
gc.print("Tetris",-120,390)
|
gc.print("Tetris",-120,390)
|
||||||
setFont(80)
|
setFont(80)
|
||||||
mStr(P.cstat.row,-77,250)
|
mStr(P.cstat.row,-75,250)
|
||||||
mStr(cstat.tetris,-77,420)
|
mStr(cstat.tetris,-75,420)
|
||||||
end,
|
end,
|
||||||
solo=function()
|
solo=function()
|
||||||
gc.print("Attack",-132,365)
|
gc.print("Attack",-130,365)
|
||||||
setFont(80)
|
setFont(80)
|
||||||
mStr(cstat.atk,-77,300)
|
mStr(cstat.atk,-75,300)
|
||||||
end,
|
end,
|
||||||
asymsolo=function()
|
asymsolo=function()
|
||||||
gc.print("Attack",-132,365)
|
gc.print("Attack",-132,365)
|
||||||
setFont(80)
|
setFont(80)
|
||||||
mStr(cstat.atk,-77,300)
|
mStr(cstat.atk,-75,300)
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
--Game system Data
|
--Game system Data
|
||||||
@@ -539,9 +571,11 @@ setting={
|
|||||||
sfx=true,bgm=true,
|
sfx=true,bgm=true,
|
||||||
fullscreen=false,
|
fullscreen=false,
|
||||||
lang="eng",
|
lang="eng",
|
||||||
das=5,arr=0,
|
das=10,arr=2,
|
||||||
|
sddas=0,sdarr=2,
|
||||||
ghost=true,center=true,
|
ghost=true,center=true,
|
||||||
key={"left","right","x","z","c","up","down","space","r","LEFT","RIGHT"},
|
key={"left","right","x","z","c","up","down","space","r","LEFT","RIGHT"},
|
||||||
|
gamepad={"dpleft","dpright","a","b","y","dpup","dpdown","rightshoulder","leftshoulder","LEFT","RIGHT"},
|
||||||
}
|
}
|
||||||
stat={
|
stat={
|
||||||
run=0,
|
run=0,
|
||||||
@@ -597,11 +631,35 @@ function mouseConvert(x,y)
|
|||||||
return x*1280/ww,360+(y-wh*.5)*1280/ww
|
return x*1280/ww,360+(y-wh*.5)*1280/ww
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
function sysSFX(s,v)
|
||||||
|
if setting.sfx then
|
||||||
|
local n=1
|
||||||
|
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)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
sfx[s][n]:setVolume(v or 1)
|
||||||
|
sfx[s][n]:play()
|
||||||
|
end
|
||||||
|
end
|
||||||
function SFX(s,v)
|
function SFX(s,v)
|
||||||
if setting.sfx then
|
if setting.sfx then
|
||||||
sfx[s]:stop()
|
local n=1
|
||||||
sfx[s]:setVolume(v or 1)
|
while sfx[s][n]:isPlaying()do
|
||||||
sfx[s]:play()
|
n=n+1
|
||||||
|
if not sfx[s][n]then
|
||||||
|
sfx[s][n]=sfx[s][n-1]:clone()
|
||||||
|
sfx[s][n]:seek(0)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if P.id>1 then
|
||||||
|
v=1/(#players.alive-1)
|
||||||
|
end
|
||||||
|
sfx[s][n]:setVolume(v or 1)
|
||||||
|
sfx[s][n]:play()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function BGM(s)
|
function BGM(s)
|
||||||
@@ -621,9 +679,11 @@ function gotoScene(s,style)
|
|||||||
time=swap[style][1],mid=swap[style][2],
|
time=swap[style][1],mid=swap[style][2],
|
||||||
draw=swap[style].d
|
draw=swap[style].d
|
||||||
}
|
}
|
||||||
|
Buttons.sel=nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function resetGameData()
|
function resetGameData()
|
||||||
|
if players then restockRow()end--Avoid first start game error
|
||||||
players={alive={}}
|
players={alive={}}
|
||||||
loadmode[gamemode]()
|
loadmode[gamemode]()
|
||||||
|
|
||||||
@@ -636,6 +696,12 @@ function resetGameData()
|
|||||||
PTC.dust[i]:start()
|
PTC.dust[i]:start()
|
||||||
end
|
end
|
||||||
stat.game=stat.game+1
|
stat.game=stat.game+1
|
||||||
|
|
||||||
|
freeRow={}
|
||||||
|
for i=1,50*#players do
|
||||||
|
freeRow[i]={0,0,0,0,0,0,0,0,0,0}
|
||||||
|
end
|
||||||
|
collectgarbage()
|
||||||
end
|
end
|
||||||
function startGame(mode)
|
function startGame(mode)
|
||||||
--rec=""
|
--rec=""
|
||||||
@@ -674,12 +740,12 @@ function loaddata()
|
|||||||
for i=#v+1,8 do v[i]="N/A"end
|
for i=#v+1,8 do v[i]="N/A"end
|
||||||
setting.key=v
|
setting.key=v
|
||||||
--Settings
|
--Settings
|
||||||
elseif t=="das"or t=="arr"then
|
elseif t=="das"or t=="arr"or t=="sddas"or t=="sdarr"then
|
||||||
v=toN(v)if not v or v<0 then v=0 end
|
v=toN(v)if not v or v<0 then v=0 end
|
||||||
setting[t]=v
|
setting[t]=int(v)
|
||||||
elseif t=="ghost"or t=="center"then
|
elseif t=="ghost"or t=="center"then
|
||||||
setting[t]=v=="true"
|
setting[t]=v=="true"
|
||||||
elseif t=="run"or t=="game"or t=="gametime"or t=="piece"or t=="row"or t=="atk"or t=="key"then
|
elseif t=="run"or t=="game"or t=="gametime"or t=="piece"or t=="row"or t=="atk"or t=="key"or t=="rotate"or t=="hold"or t=="spin"then
|
||||||
v=toN(v)if not v or v<0 then v=0 end
|
v=toN(v)if not v or v<0 then v=0 end
|
||||||
stat[t]=v
|
stat[t]=v
|
||||||
--Statistics
|
--Statistics
|
||||||
@@ -701,8 +767,13 @@ function savedata()
|
|||||||
t=t..stringPack("row=",stat.row)
|
t=t..stringPack("row=",stat.row)
|
||||||
t=t..stringPack("atk=",stat.atk)
|
t=t..stringPack("atk=",stat.atk)
|
||||||
t=t..stringPack("key=",stat.key)
|
t=t..stringPack("key=",stat.key)
|
||||||
|
t=t..stringPack("rotate=",stat.rotate)
|
||||||
|
t=t..stringPack("hold=",stat.hold)
|
||||||
|
t=t..stringPack("spin=",stat.spin)
|
||||||
t=t..stringPack("das=",setting.das)
|
t=t..stringPack("das=",setting.das)
|
||||||
t=t..stringPack("arr=",setting.arr)
|
t=t..stringPack("arr=",setting.arr)
|
||||||
|
t=t..stringPack("sddas=",setting.sddas)
|
||||||
|
t=t..stringPack("sdarr=",setting.sdarr)
|
||||||
t=t..stringPack("keyset=",string.concat(setting.key))
|
t=t..stringPack("keyset=",string.concat(setting.key))
|
||||||
--t=love.math.compress(t,"zlib"):getString()
|
--t=love.math.compress(t,"zlib"):getString()
|
||||||
userdata:open("w")
|
userdata:open("w")
|
||||||
@@ -773,7 +844,8 @@ function createPlayer(id,x,y,size,AIspeed,data)
|
|||||||
P.fieldBeneath=0
|
P.fieldBeneath=0
|
||||||
|
|
||||||
P.combo=0
|
P.combo=0
|
||||||
P.b2b=false
|
P.b2b=0
|
||||||
|
P.b2b1=0
|
||||||
|
|
||||||
P.task={}
|
P.task={}
|
||||||
P.bonus={}
|
P.bonus={}
|
||||||
@@ -781,9 +853,16 @@ end
|
|||||||
function showText(text,type,font,dy)
|
function showText(text,type,font,dy)
|
||||||
ins(P.bonus,{t=0,text=text,draw=FX[type],font=font,dy=dy or 0})
|
ins(P.bonus,{t=0,text=text,draw=FX[type],font=font,dy=dy or 0})
|
||||||
end
|
end
|
||||||
function createBeam(s,r)--Player id
|
function createBeam(s,r,level)--Player id
|
||||||
s,r=players[s],players[r]
|
s,r=players[s],players[r]
|
||||||
ins(FX.beam,{s.x+308*s.size,s.y+680*s.size,r.x+308*r.size,r.y+680*r.size,t=0})
|
ins(FX.beam,{
|
||||||
|
s.x+(30*(cx+sc[2]-1)-30+15+150)*s.size,
|
||||||
|
s.y+(600-30*(cy+sc[1]-1)+15+70)*s.size,
|
||||||
|
r.x+308*r.size,
|
||||||
|
r.y+450*r.size,
|
||||||
|
t=0,
|
||||||
|
lv=level,
|
||||||
|
})
|
||||||
end
|
end
|
||||||
function freshgho()
|
function freshgho()
|
||||||
if not P.gameEnv._20G then
|
if not P.gameEnv._20G then
|
||||||
@@ -822,8 +901,8 @@ function checkrow(s,num)--(cy,r)
|
|||||||
ins(clearing,1,i)
|
ins(clearing,1,i)
|
||||||
P.falling=gameEnv.fall
|
P.falling=gameEnv.fall
|
||||||
c=c+1--row cleared+1
|
c=c+1--row cleared+1
|
||||||
for k=1,1000 do
|
for k=1,250 do
|
||||||
PTC.dust[P.id]:setPosition(rnd(0,300),600-30*i+rnd(30))
|
PTC.dust[P.id]:setPosition(rnd(300),600-30*i+rnd(30))
|
||||||
PTC.dust[P.id]:emit(1)
|
PTC.dust[P.id]:emit(1)
|
||||||
end
|
end
|
||||||
end end
|
end end
|
||||||
@@ -838,7 +917,7 @@ function resetblock()
|
|||||||
P.holded=false
|
P.holded=false
|
||||||
P.spinLast=false
|
P.spinLast=false
|
||||||
P.freshNext()
|
P.freshNext()
|
||||||
P.sc={scs[bn][1],scs[bn][2]}P.dir=0
|
P.sc,P.dir=scs[bn][0],0
|
||||||
P.r,P.c=#cb,#cb[1]
|
P.r,P.c=#cb,#cb[1]
|
||||||
P.cx,P.cy=blockPos[bn],21+ceil(fieldBeneath/30)
|
P.cx,P.cy=blockPos[bn],21+ceil(fieldBeneath/30)
|
||||||
P.dropDelay,P.lockDelay,P.freshTime=gameEnv.drop,gameEnv.lock,0
|
P.dropDelay,P.lockDelay,P.freshTime=gameEnv.drop,gameEnv.lock,0
|
||||||
@@ -846,7 +925,7 @@ function resetblock()
|
|||||||
if keyPressing[3]then spin(1,true)end
|
if keyPressing[3]then spin(1,true)end
|
||||||
if keyPressing[4]then spin(-1,true)end
|
if keyPressing[4]then spin(-1,true)end
|
||||||
if keyPressing[5]then spin(2,true)end
|
if keyPressing[5]then spin(2,true)end
|
||||||
if ifoverlap(cb,cx,cy)then Event.gameover.lose()end
|
if ifoverlap(cb,cx,cy)then lock()Event.gameover.lose()end
|
||||||
freshgho()
|
freshgho()
|
||||||
if keyPressing[6]then act.hardDrop()P.keyPressing[6]=false end
|
if keyPressing[6]then act.hardDrop()P.keyPressing[6]=false end
|
||||||
end
|
end
|
||||||
@@ -865,8 +944,11 @@ function pressKey(i,player)
|
|||||||
elseif i==2 then
|
elseif i==2 then
|
||||||
P.moving=1
|
P.moving=1
|
||||||
end
|
end
|
||||||
P.cstat.key=P.cstat.key+1;ins(keyTime,1,frame)rem(keyTime,11)
|
|
||||||
stat.key=stat.key+1
|
ins(keyTime,1,frame)rem(keyTime,11)
|
||||||
|
cstat.key=cstat.key+1
|
||||||
|
if not player then stat.key=stat.key+1 end
|
||||||
|
--Key count
|
||||||
end
|
end
|
||||||
-- if playmode=="recording"then ins(rec,{i,frame})end
|
-- if playmode=="recording"then ins(rec,{i,frame})end
|
||||||
end
|
end
|
||||||
@@ -909,12 +991,12 @@ function hold(ifpre)
|
|||||||
P.hb,P.cb=blocks[hn][0],hb
|
P.hb,P.cb=blocks[hn][0],hb
|
||||||
|
|
||||||
if bn==0 then freshNext()end
|
if bn==0 then freshNext()end
|
||||||
P.sc={scs[bn][1],scs[bn][2]}P.dir=0
|
P.sc,P.dir=scs[bn][0],0
|
||||||
P.r,P.c=#cb,#cb[1]
|
P.r,P.c=#cb,#cb[1]
|
||||||
P.cx,P.cy=blockPos[bn],21+ceil(fieldBeneath/30)
|
P.cx,P.cy=blockPos[bn],21+ceil(fieldBeneath/30)
|
||||||
freshgho()
|
freshgho()
|
||||||
P.dropDelay,P.lockDelay,P.freshTime=gameEnv.drop,gameEnv.lock,0
|
P.dropDelay,P.lockDelay,P.freshTime=gameEnv.drop,gameEnv.lock,0
|
||||||
if ifoverlap(cb,cx,cy) then Event.gameover.lose()end
|
if ifoverlap(cb,cx,cy) then lock()Event.gameover.lose()end
|
||||||
P.holded=true
|
P.holded=true
|
||||||
SFX(ifpre and"prehold"or"hold")
|
SFX(ifpre and"prehold"or"hold")
|
||||||
stat.hold=stat.hold+1
|
stat.hold=stat.hold+1
|
||||||
@@ -944,35 +1026,46 @@ function drop()
|
|||||||
|
|
||||||
P.combo=P.combo+1--combo=0 is under
|
P.combo=P.combo+1--combo=0 is under
|
||||||
if cc==4 then
|
if cc==4 then
|
||||||
if b2b then
|
if b2b>480 then
|
||||||
|
showText("Tetris B2B2B","fly",70)
|
||||||
|
csend=7
|
||||||
|
elseif b2b>=100 then
|
||||||
showText("Tetris B2B","drive",70)
|
showText("Tetris B2B","drive",70)
|
||||||
csend=5
|
csend=5
|
||||||
else
|
else
|
||||||
showText("Tetris","stretch",80)
|
showText("Tetris","stretch",80)
|
||||||
csend=4
|
csend=4
|
||||||
P.b2b=true
|
|
||||||
end
|
end
|
||||||
|
P.b2b=P.b2b+100
|
||||||
sendTime=120
|
sendTime=120
|
||||||
P.cstat.tetris=P.cstat.tetris+1
|
P.cstat.tetris=P.cstat.tetris+1
|
||||||
elseif cc>0 then
|
elseif cc>0 then
|
||||||
if dospin then
|
if dospin then
|
||||||
local t=blockName[bn].." spin "..clearName[cc]
|
local t=blockName[bn].." spin "..clearName[cc]
|
||||||
if b2b then
|
if b2b>480 then
|
||||||
|
t=t.." B2B2B"
|
||||||
|
showText(t,"spin",40)
|
||||||
|
csend=b2bATK[cc]+1
|
||||||
|
elseif b2b>=100 then
|
||||||
t=t.." B2B"
|
t=t.." B2B"
|
||||||
showText(t,"spin",40)
|
showText(t,"spin",40)
|
||||||
csend=b2bATK[cc]
|
csend=b2bATK[cc]
|
||||||
sendTime=csend*40
|
|
||||||
else
|
else
|
||||||
showText(t,"spin",50)
|
showText(t,"spin",50)
|
||||||
csend=2*cc
|
csend=2*cc
|
||||||
sendTime=csend*30
|
|
||||||
P.b2b=true
|
|
||||||
end
|
end
|
||||||
if mini then showText("Mini","drive",40,10)sendTime=sendTime+30 end
|
sendTime=csend*35
|
||||||
|
if mini then
|
||||||
|
showText("Mini","drive",40,10)
|
||||||
|
sendTime=sendTime+60
|
||||||
|
P.b2b=P.b2b+90+10*cc
|
||||||
|
else
|
||||||
|
P.b2b=P.b2b+80+20*cc
|
||||||
|
end
|
||||||
SFX("spin_"..cc)
|
SFX("spin_"..cc)
|
||||||
stat.spin=stat.spin+1
|
stat.spin=stat.spin+1
|
||||||
else
|
elseif #clearing<#field then
|
||||||
P.b2b=false
|
P.b2b=P.b2b-400
|
||||||
showText(clearName[cc],"appear",50)
|
showText(clearName[cc],"appear",50)
|
||||||
csend=cc-1
|
csend=cc-1
|
||||||
sendTime=20+csend*20
|
sendTime=20+csend*20
|
||||||
@@ -982,13 +1075,16 @@ function drop()
|
|||||||
if dospin then
|
if dospin then
|
||||||
showText(blockName[bn].." spin","appear",50)
|
showText(blockName[bn].." spin","appear",50)
|
||||||
SFX("spin_0")
|
SFX("spin_0")
|
||||||
|
P.b2b=b2b+30
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if cc>0 and #clearing==#field then
|
if cc>0 and #clearing==#field then
|
||||||
showText("Perfect Clear","flicker",70,-60)
|
showText("Perfect Clear","flicker",70)
|
||||||
csend=csend+6
|
csend=csend+6
|
||||||
sendTime=sendTime+90
|
sendTime=sendTime+30
|
||||||
SFX("perfectclear")
|
SFX("perfectclear")
|
||||||
|
P.b2b=b2b+100
|
||||||
end
|
end
|
||||||
csend=csend+(renATK[combo]or 4)
|
csend=csend+(renATK[combo]or 4)
|
||||||
sendTime=sendTime+20*combo
|
sendTime=sendTime+20*combo
|
||||||
@@ -996,6 +1092,13 @@ function drop()
|
|||||||
SFX("clear_"..cc)
|
SFX("clear_"..cc)
|
||||||
SFX("ren_"..min(combo,11))
|
SFX("ren_"..min(combo,11))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if b2b<0 then
|
||||||
|
P.b2b=0
|
||||||
|
elseif b2b>600 then
|
||||||
|
P.b2b=600
|
||||||
|
end
|
||||||
|
|
||||||
if csend>0 then
|
if csend>0 then
|
||||||
if mini then csend=int(csend*.7)end
|
if mini then csend=int(csend*.7)end
|
||||||
--mini attack decrease
|
--mini attack decrease
|
||||||
@@ -1029,7 +1132,7 @@ end
|
|||||||
function lock()
|
function lock()
|
||||||
for i=1,r do
|
for i=1,r do
|
||||||
local y=cy+i-1
|
local y=cy+i-1
|
||||||
if not P.field[y]then P.field[y],P.visTime[y]={0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0}end
|
if not P.field[y]then P.field[y],P.visTime[y]=getNewRow(),getNewRow()end
|
||||||
for j=1,c do
|
for j=1,c do
|
||||||
if cb[i][j]~=0 then
|
if cb[i][j]~=0 then
|
||||||
P.field[y][cx+j-1]=P.bn
|
P.field[y][cx+j-1]=P.bn
|
||||||
@@ -1040,11 +1143,12 @@ function lock()
|
|||||||
end
|
end
|
||||||
function garbageSend(sender,send,time)
|
function garbageSend(sender,send,time)
|
||||||
local pos,r=rnd(10)
|
local pos,r=rnd(10)
|
||||||
|
local level=send<4 and 1 or send<7 and 2 or 3
|
||||||
repeat
|
repeat
|
||||||
r=players.alive[rnd(#players.alive)]
|
r=players.alive[rnd(#players.alive)]
|
||||||
until r~=P.id
|
until r~=P.id
|
||||||
createBeam(sender,r)
|
createBeam(sender,r,level)
|
||||||
ins(players[r].atkBuffer,{pos,amount=send,countdown=time,cd0=time,time=0,sent=false})
|
ins(players[r].atkBuffer,{pos,amount=send,countdown=time,cd0=time,time=0,sent=false,lv=level})
|
||||||
sort(players[r].atkBuffer,sortByTime)
|
sort(players[r].atkBuffer,sortByTime)
|
||||||
end
|
end
|
||||||
function garbageRelease()
|
function garbageRelease()
|
||||||
@@ -1053,8 +1157,8 @@ function garbageRelease()
|
|||||||
local atk=P.atkBuffer[i]
|
local atk=P.atkBuffer[i]
|
||||||
if not atk.sent and atk.countdown==0 then
|
if not atk.sent and atk.countdown==0 then
|
||||||
for j=1,atk.amount do
|
for j=1,atk.amount do
|
||||||
ins(P.field,1,{13,13,13,13,13,13,13,13,13,13})
|
ins(P.field,1,getNewRow(13))
|
||||||
ins(P.visTime,1,{t,t,t,t,t,t,t,t,t,t})
|
ins(P.visTime,1,getNewRow(t))
|
||||||
for k=1,#atk do
|
for k=1,#atk do
|
||||||
P.field[1][atk[k]]=0
|
P.field[1][atk[k]]=0
|
||||||
end
|
end
|
||||||
@@ -1085,10 +1189,13 @@ end
|
|||||||
function keyDown.setting2(key)
|
function keyDown.setting2(key)
|
||||||
if key=="escape"then
|
if key=="escape"then
|
||||||
back()
|
back()
|
||||||
|
keysetting,gamepadsetting=nil
|
||||||
elseif keysetting then
|
elseif keysetting then
|
||||||
setting.key[keysetting]=key
|
setting.key[keysetting]=key
|
||||||
|
keysetting,gamepadsetting=nil
|
||||||
|
else
|
||||||
|
buttonControl_key(key)
|
||||||
end
|
end
|
||||||
keysetting=nil
|
|
||||||
end
|
end
|
||||||
keyUp={}
|
keyUp={}
|
||||||
function keyUp.play(key)
|
function keyUp.play(key)
|
||||||
@@ -1100,8 +1207,42 @@ function keyUp.play(key)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
gamepadDown={}
|
||||||
|
function gamepadDown.play(key)
|
||||||
|
local k=players[1].gameEnv.gamepad
|
||||||
|
for i=1,11 do
|
||||||
|
if key==k[i]then
|
||||||
|
pressKey(i,players[1])
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if key=="escape"then back()end
|
||||||
|
end
|
||||||
|
function gamepadDown.setting2(key)
|
||||||
|
if key=="back"then
|
||||||
|
back()
|
||||||
|
keysetting,gamepadsetting=nil
|
||||||
|
elseif gamepadsetting then
|
||||||
|
setting.gamepad[gamepadsetting]=key
|
||||||
|
keysetting,gamepadsetting=nil
|
||||||
|
else
|
||||||
|
buttonControl_gamepad(key)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
gamepadUp={}
|
||||||
|
function gamepadUp.play(key)
|
||||||
|
local k=players[1].gameEnv.gamepad
|
||||||
|
for i=1,10 do
|
||||||
|
if key==k[i]then
|
||||||
|
releaseKey(i,players[1])
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
wheelmoved={}
|
wheelmoved={}
|
||||||
|
--Warning,these are not system callbacks!
|
||||||
|
|
||||||
|
require("BGblock")--BG block module
|
||||||
require("ai")--AI module
|
require("ai")--AI module
|
||||||
require("timer")--Timer
|
require("timer")--Timer
|
||||||
require("paint")--Paint
|
require("paint")--Paint
|
||||||
@@ -1114,20 +1255,16 @@ function love.update(dt)
|
|||||||
for k,v in pairs(players[1])do
|
for k,v in pairs(players[1])do
|
||||||
if rawget(_G,k)then print(k)end
|
if rawget(_G,k)then print(k)end
|
||||||
end
|
end
|
||||||
end--variables flew debugging]]
|
end--check player data flew(debugging)
|
||||||
|
]]
|
||||||
for i=#BGblock,1,-1 do
|
for i=#BGblock,1,-1 do
|
||||||
BGblock[i].y=BGblock[i].y+BGblock[i].v
|
BGblock[i].y=BGblock[i].y+BGblock[i].v
|
||||||
if BGblock[i].y>720 then rem(BGblock[i])end
|
if BGblock[i].y>720 then rem(BGblock,i)end
|
||||||
end
|
end
|
||||||
BGblock.ct=BGblock.ct-1
|
BGblock.ct=BGblock.ct-1
|
||||||
if BGblock.ct==0 then
|
if BGblock.ct==0 then
|
||||||
local t={bn=rnd(7),size=2+3*rnd()}
|
ins(BGblock,getNewBlock())
|
||||||
t.b=blocks[t.bn][rnd(0,3)]
|
BGblock.ct=rnd(20,30)
|
||||||
t.x=rnd(-#t.b[1]*t.size*30+100,1180)
|
|
||||||
t.y=-#t.b*30*t.size
|
|
||||||
t.v=t.size*(1+rnd())
|
|
||||||
ins(BGblock,t)
|
|
||||||
BGblock.ct=rnd(20,40)
|
|
||||||
end
|
end
|
||||||
--Background blocks update
|
--Background blocks update
|
||||||
|
|
||||||
@@ -1202,6 +1339,10 @@ function love.draw()
|
|||||||
|
|
||||||
numFont(20)gc.setColor(1,1,1)
|
numFont(20)gc.setColor(1,1,1)
|
||||||
gc.print(tm.getFPS(),0,700)
|
gc.print(tm.getFPS(),0,700)
|
||||||
|
gc.print(gcinfo(),0,680)
|
||||||
|
-- numFont(80)
|
||||||
|
-- gc.print(gcinfo(),400,370)
|
||||||
|
|
||||||
--if gcinfo()>500 then collectgarbage()end
|
--if gcinfo()>500 then collectgarbage()end
|
||||||
end
|
end
|
||||||
function love.resize(x,y)
|
function love.resize(x,y)
|
||||||
@@ -1232,7 +1373,7 @@ function love.run()
|
|||||||
tm.step()
|
tm.step()
|
||||||
love.resize(1280,720)
|
love.resize(1280,720)
|
||||||
game.load()--Launch
|
game.load()--Launch
|
||||||
math.randomseed(os.time()*626)--true ultheur's naim!
|
math.randomseed(os.time()*626)--true ultheur's I D!
|
||||||
-- while true do
|
-- while true do
|
||||||
return function()
|
return function()
|
||||||
love.event.pump()
|
love.event.pump()
|
||||||
@@ -1282,12 +1423,34 @@ do--Particle
|
|||||||
PTC={dust={}}--Particle systems
|
PTC={dust={}}--Particle systems
|
||||||
c=gc.newCanvas(6,6)gc.setCanvas(c)
|
c=gc.newCanvas(6,6)gc.setCanvas(c)
|
||||||
gc.clear(1,1,1)
|
gc.clear(1,1,1)
|
||||||
PTC.dust[0]=gc.newParticleSystem(c,10000)
|
PTC.dust[0]=gc.newParticleSystem(c,1000)
|
||||||
PTC.dust[0]:setParticleLifetime(.2,.3)
|
PTC.dust[0]:setParticleLifetime(.2,.3)
|
||||||
PTC.dust[0]:setEmissionRate(0)
|
PTC.dust[0]:setEmissionRate(0)
|
||||||
PTC.dust[0]:setLinearAcceleration(-1500,-200,1500,200)
|
PTC.dust[0]:setLinearAcceleration(-1500,-200,1500,200)
|
||||||
PTC.dust[0]:setColors(1,1,1,.4,1,1,1,0)
|
PTC.dust[0]:setColors(1,1,1,.5,1,1,1,0)
|
||||||
|
c:release()
|
||||||
--Dust particles
|
--Dust particles
|
||||||
|
|
||||||
|
PTC.attack={}
|
||||||
|
PTC.attack[1]=gc.newParticleSystem(gc.newImage("/image/attack_1.png"),200)
|
||||||
|
PTC.attack[1]:setParticleLifetime(.25)
|
||||||
|
PTC.attack[1]:setEmissionRate(0)
|
||||||
|
PTC.attack[1]:setSpin(10)
|
||||||
|
PTC.attack[1]:setColors(1,1,1,.7,1,1,1,0)
|
||||||
|
|
||||||
|
PTC.attack[2]=gc.newParticleSystem(gc.newImage("/image/attack_2.png"),200)
|
||||||
|
PTC.attack[2]:setParticleLifetime(.3)
|
||||||
|
PTC.attack[2]:setEmissionRate(0)
|
||||||
|
PTC.attack[2]:setSpin(8)
|
||||||
|
PTC.attack[2]:setColors(1,1,1,.7,1,1,1,0)
|
||||||
|
|
||||||
|
PTC.attack[3]=gc.newParticleSystem(gc.newImage("/image/attack_3.png"),200)
|
||||||
|
PTC.attack[3]:setParticleLifetime(.4)
|
||||||
|
PTC.attack[3]:setEmissionRate(0)
|
||||||
|
PTC.attack[3]:setSpin(6)
|
||||||
|
PTC.attack[3]:setColors(1,1,1,.7,1,1,1,0)
|
||||||
|
--Attack particles
|
||||||
|
|
||||||
gc.setCanvas()
|
gc.setCanvas()
|
||||||
end
|
end
|
||||||
c=nil
|
c=nil
|
||||||
|
|||||||
95
paint.lua
95
paint.lua
@@ -37,7 +37,7 @@ function drawButton()
|
|||||||
for i=1,#Buttons[scene]do
|
for i=1,#Buttons[scene]do
|
||||||
local B=Buttons[scene][i]
|
local B=Buttons[scene][i]
|
||||||
if not(B.hide and B.hide())then
|
if not(B.hide and B.hide())then
|
||||||
local t=B==Buttons.sel and .3 or 0
|
local t=i==Buttons.sel and .3 or 0
|
||||||
B.alpha=abs(B.alpha-t)>.02 and(B.alpha+(B.alpha<t and .02 or -.02))or t
|
B.alpha=abs(B.alpha-t)>.02 and(B.alpha+(B.alpha<t and .02 or -.02))or t
|
||||||
if B.alpha>t then B.alpha=B.alpha-.02 elseif B.alpha<t then B.alpha=B.alpha+.02 end
|
if B.alpha>t then B.alpha=B.alpha-.02 elseif B.alpha<t then B.alpha=B.alpha+.02 end
|
||||||
gc.setColor(B.rgb[1],B.rgb[2],B.rgb[3],B.alpha)
|
gc.setColor(B.rgb[1],B.rgb[2],B.rgb[3],B.alpha)
|
||||||
@@ -88,28 +88,28 @@ function Pnt.BG.game1()
|
|||||||
end
|
end
|
||||||
function Pnt.BG.game2()
|
function Pnt.BG.game2()
|
||||||
gc.setColor(1,.5,.5)
|
gc.setColor(1,.5,.5)
|
||||||
gc.draw(background[1],640,360,Timer()*.15,nil,nil,768,768)
|
gc.draw(background[1],640,360,Timer()*.2,nil,nil,768,768)
|
||||||
end
|
end
|
||||||
function Pnt.BG.game3()
|
function Pnt.BG.game3()
|
||||||
gc.setColor(.6,.6,1)
|
gc.setColor(.6,.6,1)
|
||||||
gc.draw(background[1],640,360,Timer()*.15,nil,nil,768,768)
|
gc.draw(background[1],640,360,Timer()*.25,nil,nil,768,768)
|
||||||
end
|
end
|
||||||
|
|
||||||
function Pnt.load()
|
function Pnt.load()
|
||||||
if loadprogress then
|
gc.setLineWidth(4)
|
||||||
gc.setLineWidth(4)
|
gc.setColor(1,1,1,.5)
|
||||||
gc.setColor(.8,.8,.8)
|
gc.rectangle("fill",340,340,loadprogress*640,40)
|
||||||
gc.rectangle("fill",340,340,loadprogress*640,40)
|
gc.setColor(1,1,1)
|
||||||
gc.setColor(1,1,1)
|
gc.rectangle("line",340,340,640,40)
|
||||||
gc.rectangle("line",340,340,640,40)
|
setFont(30)
|
||||||
setFont(30)
|
mStr(Text.load[loading],640,345)
|
||||||
mStr("Loading...",640,345)
|
setFont(20)
|
||||||
end
|
mStr("not animation,real loading!",640,392)
|
||||||
end
|
end
|
||||||
function Pnt.main()
|
function Pnt.main()
|
||||||
gc.setColor(1,1,1)
|
gc.setColor(1,1,1)
|
||||||
setFont(30)
|
setFont(30)
|
||||||
gc.print("Alpha 0.0.19726",370,150)
|
gc.print("Alpha 0.1+",370,150)
|
||||||
gc.draw(img.title[setting.lang],30,30)
|
gc.draw(img.title[setting.lang],30,30)
|
||||||
end
|
end
|
||||||
function Pnt.play()
|
function Pnt.play()
|
||||||
@@ -167,7 +167,7 @@ function Pnt.play()
|
|||||||
gc.draw(PTC.dust[p])--Draw game field
|
gc.draw(PTC.dust[p])--Draw game field
|
||||||
love.graphics.setStencilTest()--In-playField mask
|
love.graphics.setStencilTest()--In-playField mask
|
||||||
gc.translate(0,-fieldBeneath)
|
gc.translate(0,-fieldBeneath)
|
||||||
gc.setColor(1,1,1)gc.rectangle("line",-1,-1,300,600)--Draw boarder
|
gc.setColor(1,1,1)gc.rectangle("line",-2,-12,304,614)--Draw boarder
|
||||||
|
|
||||||
local h=0
|
local h=0
|
||||||
for i=1,#atkBuffer do
|
for i=1,#atkBuffer do
|
||||||
@@ -179,26 +179,34 @@ function Pnt.play()
|
|||||||
--Appear
|
--Appear
|
||||||
end
|
end
|
||||||
if a.countdown>0 then
|
if a.countdown>0 then
|
||||||
gc.setColor(1,0,0)
|
gc.setColor(attackColor[a.lv][1])
|
||||||
gc.rectangle("fill",302,600-h,8,-bar+5)
|
gc.rectangle("fill",305,600-h,8,-bar+5)
|
||||||
gc.setColor(1,1,0)
|
gc.setColor(attackColor[a.lv][2])
|
||||||
gc.rectangle("fill",302,600-h+(-bar+5),8,-(-bar+5)*(1-a.countdown/a.cd0))
|
gc.rectangle("fill",305,600-h+(-bar+5),8,-(-bar+5)*(1-a.countdown/a.cd0))
|
||||||
--Timing
|
--Timing
|
||||||
else
|
else
|
||||||
gc.setColor(1,(sin((Timer()-i)*20)+1)*.5,0)
|
attackColor.animate[a.lv]((sin((Timer()-i)*20)+1)*.5)
|
||||||
gc.rectangle("fill",302,600-h,8,-bar+5)
|
gc.rectangle("fill",305,600-h,8,-bar+5)
|
||||||
--Warning
|
--Warning
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
gc.setColor(1,0,0)
|
gc.setColor(attackColor[a.lv][1])
|
||||||
bar=bar*(20-a.time)*.05
|
bar=bar*(20-a.time)*.05
|
||||||
gc.rectangle("fill",302,600-h,8,-bar+5)
|
gc.rectangle("fill",305,600-h,8,-bar+5)
|
||||||
--Disappear
|
--Disappear
|
||||||
end
|
end
|
||||||
h=h+bar
|
h=h+bar
|
||||||
if h>600 then break end
|
if h>600 then break end
|
||||||
end--Buffer line
|
end--Buffer line
|
||||||
|
|
||||||
|
gc.setColor(1,1,1)
|
||||||
|
gc.rectangle("fill",-15,600,10,-b2b1)
|
||||||
|
gc.setColor(1,.4,.4)
|
||||||
|
gc.rectangle("line",-20,600-100,15,2)
|
||||||
|
gc.setColor(.4,.4,1)
|
||||||
|
gc.rectangle("line",-20,600-480,15,2)
|
||||||
|
--B2B bar
|
||||||
|
|
||||||
setFont(40)
|
setFont(40)
|
||||||
if gameEnv.hold then
|
if gameEnv.hold then
|
||||||
gc.setColor(1,1,1)
|
gc.setColor(1,1,1)
|
||||||
@@ -251,37 +259,25 @@ function Pnt.play()
|
|||||||
--Speed dials
|
--Speed dials
|
||||||
gc.pop()
|
gc.pop()
|
||||||
end--Draw players
|
end--Draw players
|
||||||
gc.setLineWidth(3)
|
gc.setColor(1,1,1)
|
||||||
for i=1,#FX.beam do
|
for i=1,3 do
|
||||||
local b=FX.beam[i]
|
gc.draw(PTC.attack[i])
|
||||||
local t=b.t/30
|
|
||||||
if t<.25 then
|
|
||||||
t=t*4
|
|
||||||
gc.setColor(1,1,1,4*t)
|
|
||||||
gc.line(b[1],b[2],b[1]+t*(b[3]-b[1]),b[2]+t*(b[4]-b[2]))
|
|
||||||
elseif t<.75 then
|
|
||||||
gc.setColor(1,1,1)
|
|
||||||
gc.line(b[1],b[2],b[3],b[4])
|
|
||||||
else
|
|
||||||
t=4*t-3
|
|
||||||
gc.setColor(1,1,1,4-4*t)
|
|
||||||
gc.line(b[1]+t*(b[3]-b[1]),b[2]+t*(b[4]-b[2]),b[3],b[4])
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
setmetatable(_G,nil)
|
setmetatable(_G,nil)
|
||||||
end
|
end
|
||||||
function Pnt.setting2()
|
function Pnt.setting2()
|
||||||
|
gc.setColor(1,1,1)
|
||||||
|
setFont(18)
|
||||||
|
mStr("softdropDAS:"..setting.sddas,828,138)
|
||||||
|
mStr("softdropARR:"..setting.sdarr,1043,138)
|
||||||
setFont(35)
|
setFont(35)
|
||||||
gc.setColor(1,1,1)
|
mStr("DAS:"..setting.das,828,73)
|
||||||
mStr("DAS:"..setting.das,330,72)
|
mStr("ARR:"..setting.arr,1043,73)
|
||||||
mStr("ARR:"..setting.arr,545,72)
|
|
||||||
gc.setColor(1,1,1)
|
|
||||||
for i=1,9 do
|
for i=1,9 do
|
||||||
gc.printf(actName_show[i]..":",100,60*i-8,200,"right")
|
gc.printf(actName_show[i]..":",0,60*i-8,180,"right")
|
||||||
end
|
end
|
||||||
if keysetting then
|
if keysetting or gamepadsetting then
|
||||||
setFont(35)
|
gc.print("<<",keysetting and 380 or 670,60*(keysetting or gamepadsetting)-10)
|
||||||
gc.print("<<",550,60*keysetting-10)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function Pnt.help()
|
function Pnt.help()
|
||||||
@@ -295,7 +291,7 @@ end
|
|||||||
function Pnt.stat()
|
function Pnt.stat()
|
||||||
setFont(30)
|
setFont(30)
|
||||||
gc.setColor(1,1,1)
|
gc.setColor(1,1,1)
|
||||||
for i=1,6 do
|
for i=1,10 do
|
||||||
gc.print(Text.stat[i],250,20+40*i)
|
gc.print(Text.stat[i],250,20+40*i)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -305,5 +301,10 @@ function Pnt.stat()
|
|||||||
gc.print(stat.piece,600,180)
|
gc.print(stat.piece,600,180)
|
||||||
gc.print(stat.row,600,220)
|
gc.print(stat.row,600,220)
|
||||||
gc.print(stat.atk,600,260)
|
gc.print(stat.atk,600,260)
|
||||||
|
gc.print(stat.key,600,300)
|
||||||
|
gc.print(stat.rotate,600,340)
|
||||||
|
gc.print(stat.hold,600,380)
|
||||||
|
gc.print(stat.spin,600,420)
|
||||||
|
|
||||||
gc.draw(img.title[setting.lang],180,600,.2,.7+.05*sin(Timer()*2),nil,140,100)
|
gc.draw(img.title[setting.lang],180,600,.2,.7+.05*sin(Timer()*2),nil,140,100)
|
||||||
end
|
end
|
||||||
71
timer.lua
71
timer.lua
@@ -22,7 +22,7 @@ function Tmr.load()
|
|||||||
end
|
end
|
||||||
elseif loading==3 then
|
elseif loading==3 then
|
||||||
if loadnum<=#sfx then
|
if loadnum<=#sfx then
|
||||||
sfx[sfx[loadnum]]=love.audio.newSource("/SFX/"..sfx[loadnum]..".ogg","static")
|
sfx[sfx[loadnum]]={love.audio.newSource("/SFX/"..sfx[loadnum]..".ogg","static")}
|
||||||
loadprogress=loadnum/#sfx
|
loadprogress=loadnum/#sfx
|
||||||
loadnum=loadnum+1
|
loadnum=loadnum+1
|
||||||
else
|
else
|
||||||
@@ -40,11 +40,26 @@ end
|
|||||||
function Tmr.play(dt)
|
function Tmr.play(dt)
|
||||||
frame=frame+1
|
frame=frame+1
|
||||||
stat.gametime=stat.gametime+dt
|
stat.gametime=stat.gametime+dt
|
||||||
|
|
||||||
|
for i=#FX.beam,1,-1 do
|
||||||
|
local b=FX.beam[i]
|
||||||
|
b.t=b.t+1
|
||||||
|
local t=b.t*.025
|
||||||
|
PTC.attack[b.lv]:setPosition(b[1]+(b[3]-b[1])*t,b[2]+(b[4]-b[2])*t-100*(4*t*(1-t)))
|
||||||
|
PTC.attack[b.lv]:emit(1)
|
||||||
|
if t==1 then
|
||||||
|
rem(FX.beam,i)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
for i=1,3 do
|
||||||
|
PTC.attack[i]:update(dt)
|
||||||
|
end
|
||||||
|
-- Update attack beam
|
||||||
if count then
|
if count then
|
||||||
count=count-1
|
count=count-1
|
||||||
if count==0 then
|
if count==0 then
|
||||||
count=nil
|
count=nil
|
||||||
SFX("start")
|
sysSFX("start")
|
||||||
for P=1,#players do
|
for P=1,#players do
|
||||||
P=players[P]
|
P=players[P]
|
||||||
_G.P=P
|
_G.P=P
|
||||||
@@ -55,10 +70,22 @@ function Tmr.play(dt)
|
|||||||
end
|
end
|
||||||
setmetatable(_G,nil)
|
setmetatable(_G,nil)
|
||||||
elseif count%60==0 then
|
elseif count%60==0 then
|
||||||
SFX("ready")
|
sysSFX("ready")
|
||||||
end
|
end
|
||||||
return nil
|
|
||||||
end--Start counting
|
if count then
|
||||||
|
for p=1,#players do
|
||||||
|
P=players[p]
|
||||||
|
setmetatable(_G,P.index)
|
||||||
|
if keyPressing[1]or keyPressing[2]then
|
||||||
|
P.moving=moving+sgn(moving)
|
||||||
|
else
|
||||||
|
P.moving=0
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
end--Start counting,include pre-das
|
||||||
for p=1,#players do
|
for p=1,#players do
|
||||||
P=players[p]
|
P=players[p]
|
||||||
setmetatable(_G,P.index)
|
setmetatable(_G,P.index)
|
||||||
@@ -89,7 +116,6 @@ function Tmr.play(dt)
|
|||||||
end end
|
end end
|
||||||
--Fresh visible time
|
--Fresh visible time
|
||||||
if keyPressing[1]or keyPressing[2]then
|
if keyPressing[1]or keyPressing[2]then
|
||||||
P.moving=moving+sgn(moving)
|
|
||||||
local d=abs(moving)-gameEnv.das
|
local d=abs(moving)-gameEnv.das
|
||||||
if d>1 then
|
if d>1 then
|
||||||
if gameEnv.arr>0 then
|
if gameEnv.arr>0 then
|
||||||
@@ -100,11 +126,21 @@ function Tmr.play(dt)
|
|||||||
act[moving>0 and"toRight"or"toLeft"]()
|
act[moving>0 and"toRight"or"toLeft"]()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
P.moving=moving+sgn(moving)
|
||||||
else
|
else
|
||||||
P.moving=0
|
P.moving=0
|
||||||
end
|
end
|
||||||
if keyPressing[7]then
|
if keyPressing[7]then
|
||||||
act.softDrop()
|
local d=abs(downing)-gameEnv.sddas
|
||||||
|
if d>1 then
|
||||||
|
if gameEnv.sdarr>0 then
|
||||||
|
if d%gameEnv.sdarr==0 then
|
||||||
|
act.down1()
|
||||||
|
end
|
||||||
|
else
|
||||||
|
act.toDown()
|
||||||
|
end
|
||||||
|
end
|
||||||
P.downing=downing+1
|
P.downing=downing+1
|
||||||
else
|
else
|
||||||
P.downing=0
|
P.downing=0
|
||||||
@@ -114,8 +150,8 @@ function Tmr.play(dt)
|
|||||||
if falling<=0 then
|
if falling<=0 then
|
||||||
if #field>clearing[1]then SFX("fall")end
|
if #field>clearing[1]then SFX("fall")end
|
||||||
for i=1,#clearing do
|
for i=1,#clearing do
|
||||||
rem(field,clearing[i])
|
removeRow(field,clearing[i])
|
||||||
rem(visTime,clearing[i])
|
removeRow(visTime,clearing[i])
|
||||||
end
|
end
|
||||||
P.clearing={}
|
P.clearing={}
|
||||||
end
|
end
|
||||||
@@ -139,6 +175,7 @@ function Tmr.play(dt)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
if P.b2b>480 then P.b2b=P.b2b-1 end
|
||||||
else--Alive
|
else--Alive
|
||||||
P.keySpeed=keySpeed*.96+cstat.key/time*60*.04
|
P.keySpeed=keySpeed*.96+cstat.key/time*60*.04
|
||||||
P.dropSpeed=dropSpeed*.96+cstat.piece/time*60*.04
|
P.dropSpeed=dropSpeed*.96+cstat.piece/time*60*.04
|
||||||
@@ -148,16 +185,15 @@ function Tmr.play(dt)
|
|||||||
if falling<=0 then
|
if falling<=0 then
|
||||||
if #field>clearing[1]then SFX("fall")end
|
if #field>clearing[1]then SFX("fall")end
|
||||||
for i=1,#clearing do
|
for i=1,#clearing do
|
||||||
rem(field,clearing[i])
|
removeRow(field,clearing[i])
|
||||||
rem(visTime,clearing[i])
|
removeRow(visTime,clearing[i])
|
||||||
end
|
end
|
||||||
P.clearing={}
|
P.clearing={}
|
||||||
end
|
end
|
||||||
end--Rows cleared drop
|
end--Rows cleared drop
|
||||||
for j=1,#field do for i=1,10 do
|
for j=1,#field do for i=1,10 do
|
||||||
if visTime[j][i]<20 then P.visTime[j][i]=visTime[j][i]+.5 end
|
if visTime[j][i]<20 then P.visTime[j][i]=visTime[j][i]+.5 end
|
||||||
end end
|
end end--Make field visible
|
||||||
--Make field visible
|
|
||||||
end--Dead
|
end--Dead
|
||||||
for i=#bonus,1,-1 do
|
for i=#bonus,1,-1 do
|
||||||
bonus[i].t=bonus[i].t+1
|
bonus[i].t=bonus[i].t+1
|
||||||
@@ -179,14 +215,9 @@ function Tmr.play(dt)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if fieldBeneath>0 then P.fieldBeneath=fieldBeneath-2 end
|
if fieldBeneath>0 then P.fieldBeneath=fieldBeneath-3 end
|
||||||
|
P.b2b1=P.b2b1*.95+P.b2b*.05
|
||||||
PTC.dust[p]:update(dt)
|
PTC.dust[p]:update(dt)
|
||||||
end
|
end
|
||||||
for i=#FX.beam,1,-1 do
|
|
||||||
FX.beam[i].t=FX.beam[i].t+1
|
|
||||||
if FX.beam[i].t>30 then
|
|
||||||
rem(FX.beam,i)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
setmetatable(_G,nil)
|
setmetatable(_G,nil)
|
||||||
end
|
end
|
||||||
@@ -31,7 +31,7 @@ act={
|
|||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
softDrop=function()
|
softDrop=function()
|
||||||
act.toDown()
|
if cy~=y_img then P.cy=cy-1 end
|
||||||
P.downing=1
|
P.downing=1
|
||||||
end,
|
end,
|
||||||
rotRight=function()spin(1)end,
|
rotRight=function()spin(1)end,
|
||||||
@@ -43,8 +43,8 @@ act={
|
|||||||
resetGameData()
|
resetGameData()
|
||||||
count=60+26--Althour'z neim
|
count=60+26--Althour'z neim
|
||||||
end,
|
end,
|
||||||
down1=function()drop()end,
|
down1=function()if cy~=y_img then P.cy=cy-1 end end,
|
||||||
down4=function()for i=1,4 do if cy~=y_img then drop()else break end end end,
|
down4=function()for i=1,4 do if cy~=y_img then P.cy=cy-1 else break end end end,
|
||||||
toDown=function()if cy~= y_img then P.cy,P.lockDelay,P.spinLast=y_img,gameEnv.lock,false end end,
|
toDown=function()if cy~= y_img then P.cy,P.lockDelay,P.spinLast=y_img,gameEnv.lock,false end end,
|
||||||
toLeft=function()while not ifoverlap(cb,cx-1,cy)do P.cx,P.lockDelay=cx-1,gameEnv.lock;freshgho()end end,
|
toLeft=function()while not ifoverlap(cb,cx-1,cy)do P.cx,P.lockDelay=cx-1,gameEnv.lock;freshgho()end end,
|
||||||
toRight=function()while not ifoverlap(cb,cx+1,cy)do P.cx,P.lockDelay=cx+1,gameEnv.lock;freshgho()end end,
|
toRight=function()while not ifoverlap(cb,cx+1,cy)do P.cx,P.lockDelay=cx+1,gameEnv.lock;freshgho()end end,
|
||||||
|
|||||||
Reference in New Issue
Block a user