0.190718α
0
BGM/32000Hz 86kbps
Normal file
BIN
BGM/blank.ogg
Normal file
BIN
BGM/push.ogg
Normal file
BIN
BGM/race.ogg
Normal file
BIN
BGM/reason.ogg
Normal file
BIN
BGM/way.ogg
Normal file
BIN
SFX/button.ogg
Normal file
BIN
SFX/clear_1.ogg
Normal file
BIN
SFX/clear_2.ogg
Normal file
BIN
SFX/clear_3.ogg
Normal file
BIN
SFX/clear_4.ogg
Normal file
BIN
SFX/drop.ogg
Normal file
BIN
SFX/fall.ogg
Normal file
BIN
SFX/hold.ogg
Normal file
BIN
SFX/move.ogg
Normal file
BIN
SFX/perfectclear.ogg
Normal file
BIN
SFX/prehold.ogg
Normal file
BIN
SFX/prerotate.ogg
Normal file
BIN
SFX/reach.ogg
Normal file
BIN
SFX/ready.ogg
Normal file
BIN
SFX/ren_1.ogg
Normal file
BIN
SFX/ren_10.ogg
Normal file
BIN
SFX/ren_11.ogg
Normal file
BIN
SFX/ren_2.ogg
Normal file
BIN
SFX/ren_3.ogg
Normal file
BIN
SFX/ren_4.ogg
Normal file
BIN
SFX/ren_5.ogg
Normal file
BIN
SFX/ren_6.ogg
Normal file
BIN
SFX/ren_7.ogg
Normal file
BIN
SFX/ren_8.ogg
Normal file
BIN
SFX/ren_9.ogg
Normal file
BIN
SFX/rotate.ogg
Normal file
BIN
SFX/rotatekick.ogg
Normal file
BIN
SFX/spin.ogg
Normal file
BIN
SFX/spin_0.ogg
Normal file
BIN
SFX/spin_1.ogg
Normal file
BIN
SFX/spin_2.ogg
Normal file
BIN
SFX/spin_3.ogg
Normal file
BIN
SFX/start.ogg
Normal file
75
SRS.lua
Normal file
@@ -0,0 +1,75 @@
|
||||
blocks={
|
||||
{[0]={{0,1,1},{1,1,0}},{{1,0},{1,1},{0,1}},{{0,1,1},{1,1,0}},{{1,0},{1,1},{0,1}}},--Z
|
||||
{[0]={{1,1,0},{0,1,1}},{{0,1},{1,1},{1,0}},{{1,1,0},{0,1,1}},{{0,1},{1,1},{1,0}}},--S
|
||||
{[0]={{1,1,1},{0,0,1}},{{1,1},{1,0},{1,0}},{{1,0,0},{1,1,1}},{{0,1},{0,1},{1,1}}},--L
|
||||
{[0]={{1,1,1},{1,0,0}},{{1,0},{1,0},{1,1}},{{0,0,1},{1,1,1}},{{1,1},{0,1},{0,1}}},--J
|
||||
{[0]={{1,1,1},{0,1,0}},{{1,0},{1,1},{1,0}},{{0,1,0},{1,1,1}},{{0,1},{1,1},{0,1}}},--T
|
||||
{[0]={{1,1},{1,1}},{{1,1},{1,1}},{{1,1},{1,1}},{{1,1},{1,1}}},--O
|
||||
{[0]={{1,1,1,1}},{{1},{1},{1},{1}},{{1,1,1,1}},{{1},{1},{1},{1}}},--I
|
||||
}
|
||||
do--SRS data
|
||||
local K={0,0}
|
||||
local D,E,L,S,R,Q,J,C={0,1},{1,1},{1,0},{1,-1},{0,-1},{-1,-1},{-1,0},{-1,1}
|
||||
local B,I,P,F,M,T={-2,1},{-2,0},{-2,-1},{2,1},{2,0},{2,-1}
|
||||
local X,Y,Z={-1,-2},{0,-2},{1,-2}
|
||||
local F,G,N={-1,2},{0,2},{1,2}
|
||||
scs={N,N,N,N,N,{1.5,1.5},{.5,2.5}}
|
||||
SRS={
|
||||
[1]={
|
||||
[01]={K,J,C,Y,X,D},
|
||||
[10]={K,L,S,G,N,R},
|
||||
[12]={K,L,S,G,N},
|
||||
[21]={K,J,C,Y,X},
|
||||
[23]={K,L,E,Y,Z},
|
||||
[32]={K,J,Q,G,F},
|
||||
[30]={K,J,Q,G,F},
|
||||
[03]={K,L,E,Y,Z},
|
||||
[02]={K,L,J,R,D},
|
||||
[20]={K,J,L,D,R},
|
||||
[13]={K,D,R,J,L,G},
|
||||
[31]={K,R,D,L,J,G},
|
||||
},
|
||||
[2]={
|
||||
[01]={K,J,C,Y,X},
|
||||
[10]={K,L,S,G,N},
|
||||
[12]={K,L,S,G,N},
|
||||
[21]={K,J,C,Y,X},
|
||||
[23]={K,L,E,Y,Z},
|
||||
[32]={K,J,Q,G,F},
|
||||
[30]={K,J,Q,G,F,R},
|
||||
[03]={K,L,E,Y,Z,D},
|
||||
[02]={K,J,L,R,D},
|
||||
[20]={K,L,J,D,R},
|
||||
[13]={K,R,D,L,J,G},
|
||||
[31]={K,D,R,J,L,G},
|
||||
},
|
||||
[5]={
|
||||
[01]={K,J,C,Y,X},
|
||||
[10]={K,L,S,G,N},
|
||||
[12]={K,L,S,G,N},
|
||||
[21]={K,J,C,Y,X},
|
||||
[23]={K,L,E,Y,Z},
|
||||
[32]={K,J,Q,G,F},
|
||||
[30]={K,J,Q,G,F,R},
|
||||
[03]={K,L,E,Y,Z,D},
|
||||
[02]={K,J,L,R,D},
|
||||
[20]={K,L,J,D,R},
|
||||
[13]={K,R,D,L,J,G},
|
||||
[31]={K,R,D,J,L,G},
|
||||
},
|
||||
[7]={
|
||||
[01]={K,I,L,P,N},
|
||||
[10]={K,M,J,F,X},
|
||||
[12]={K,J,M,F,T},
|
||||
[21]={K,L,I,Z,B},
|
||||
[23]={K,M,J,F,X},
|
||||
[32]={K,I,L,P,N},
|
||||
[30]={K,L,I,Z,B},
|
||||
[03]={K,J,M,F,T},
|
||||
[02]={K,J,L,D},
|
||||
[20]={K,L,J,R},
|
||||
[13]={K,L},
|
||||
[31]={K,J},
|
||||
}
|
||||
}SRS[3],SRS[4],SRS[6]=SRS[2],SRS[1],SRS[1]
|
||||
end
|
||||
137
ai.lua
Normal file
@@ -0,0 +1,137 @@
|
||||
--[[
|
||||
HighestBlock
|
||||
HorizontalTransitions
|
||||
VerticalTransitions
|
||||
BlockedCells
|
||||
Wells
|
||||
FilledLines
|
||||
TetrisShape
|
||||
BlockedWells;
|
||||
]]
|
||||
spinNeed={2,2,4,4,4,1,2}
|
||||
spinOffset={
|
||||
{1,0,0},--S
|
||||
{1,0,0},--Z
|
||||
{1,0,0},--L
|
||||
{1,0,0},--J
|
||||
{1,0,0},--T
|
||||
{0,0,0},--O
|
||||
{2,0,1},--I
|
||||
}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
|
||||
if y>#field then return nil end
|
||||
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
|
||||
end end
|
||||
end
|
||||
function resetField(f0,start)
|
||||
while field[start]do
|
||||
rem(field,start)
|
||||
end
|
||||
for i=start,#f0 do
|
||||
field[i]={}
|
||||
for j=1,10 do
|
||||
field[i][j]=f0[i][j]
|
||||
end
|
||||
end
|
||||
end
|
||||
function getScore(field,cb,cx,cy)
|
||||
local highest=0
|
||||
local height={}
|
||||
local rough=0
|
||||
local clear=0
|
||||
local hole=0
|
||||
|
||||
for i=cy+#cb-1,cy,-1 do
|
||||
local f=true
|
||||
for j=1,10 do
|
||||
if field[i][j]==0 then f=false;break end
|
||||
end
|
||||
if f then
|
||||
rem(field,i)
|
||||
clear=clear+1
|
||||
end
|
||||
end
|
||||
if #field==0 then return 9e99 end--PC best
|
||||
for x=1,10 do
|
||||
local h=#field
|
||||
while field[h][x]==0 and h>1 do
|
||||
h=h-1
|
||||
end
|
||||
height[x]=h
|
||||
if x>3 and x<8 and h>highest then highest=h end
|
||||
if h>1 then
|
||||
for h=h-1,1,-1 do
|
||||
if field[h][x]==0 then hole=hole+1 end
|
||||
end
|
||||
end
|
||||
end
|
||||
for x=1,9 do
|
||||
local dh=abs(height[x]-height[x])
|
||||
if dh>1 then
|
||||
rough=rough+dh^1.5
|
||||
end
|
||||
end
|
||||
return
|
||||
-highest*10
|
||||
-rough*10
|
||||
-cy*15
|
||||
+clear^1.5*15
|
||||
-hole*20
|
||||
end
|
||||
--controlname:mL,mR,rR,rL,rF,hD,sD,H,LL,RR
|
||||
function AI_getControls(ctrl)
|
||||
local field_org,cb,cx,cy={}
|
||||
for i=1,#field do
|
||||
field_org[i]={}
|
||||
for j=1,10 do
|
||||
field_org[i][j]=field[i][j]
|
||||
end
|
||||
end
|
||||
local best={x=1,dir=0,hold=false,score=-9e99}
|
||||
for ifhold=0,1 do
|
||||
local bn=ifhold==0 and bn or hn>0 and hn or nxt[1]
|
||||
for dir=0,spinNeed[bn]-1 do--for each direction
|
||||
cb=blocks[bn][dir]
|
||||
for cx=1,11-#cb[1]do--for each positioon
|
||||
cy=#field+1
|
||||
while not ifoverlapAI(field,cb,cx,cy-1)do
|
||||
cy=cy-1
|
||||
end--move to bottom
|
||||
for i=1,#cb do
|
||||
local y=cy+i-1
|
||||
if not field[y]then field[y]={0,0,0,0,0,0,0,0,0,0}end
|
||||
for j=1,#cb[1]do
|
||||
if cb[i][j]~=0 then
|
||||
field[y][cx+j-1]=1
|
||||
end
|
||||
end
|
||||
end--simulate lock
|
||||
local score=getScore(field,cb,cx,cy)
|
||||
if score>best.score then
|
||||
best={bn=bn,x=cx,dir=dir,hold=ifhold==1,score=score}
|
||||
end
|
||||
resetField(field_org,cy)
|
||||
end
|
||||
end
|
||||
end--ifHold
|
||||
|
||||
cb,cx,cy=cb_org,cx_org,cy_org
|
||||
if best.hold then
|
||||
ins(ctrl,8)
|
||||
end
|
||||
if best.dir==1 then
|
||||
ins(ctrl,3)
|
||||
elseif best.dir==2 then
|
||||
ins(ctrl,5)
|
||||
elseif best.dir==3 then
|
||||
ins(ctrl,4)
|
||||
end--rotate
|
||||
best.x=best.x-spinOffset[best.bn][best.dir]
|
||||
local n=blockPos[best.bn]<best.x and 2 or 1
|
||||
for i=1,abs(blockPos[best.bn]-best.x)do
|
||||
ins(ctrl,n)
|
||||
end--move
|
||||
ins(ctrl,6)--harddrop
|
||||
end
|
||||
67
button.lua
Normal file
@@ -0,0 +1,67 @@
|
||||
Buttons={
|
||||
load={},
|
||||
intro={},
|
||||
main={
|
||||
{x=500,y=300,w=320,h=60,rgb={1,0,0},alpha=0,t="Play",code=function()gotoScene("mode")end},
|
||||
{x=500,y=380,w=320,h=60,rgb={0,0,1},alpha=0,t="Settings",code=function()gotoScene("setting")end},
|
||||
{x=415,y=460,w=150,h=60,rgb={1,1,0},alpha=0,t="Help",code=function()gotoScene("help")end},
|
||||
{x=585,y=460,w=150,h=60,rgb={0,1,1},alpha=0,t="Statistics",code=function()gotoScene("stat")end},
|
||||
{x=500,y=540,w=320,h=60,rgb={.5,.5,.5},alpha=0,t="Quit",code=function()gotoScene("quit")end},
|
||||
},
|
||||
mode={
|
||||
{x=350,y=200,w=220,h=70,rgb={1,1,1},alpha=0,t="Marathon",code=function()startGame("marathon")end},
|
||||
{x=350,y=300,w=220,h=70,rgb={1,1,1},alpha=0,t="40 Lines",code=function()startGame("sprint")end},
|
||||
{x=650,y=200,w=220,h=70,rgb={1,1,1},alpha=0,t="Zen",code=function()startGame("zen")end},
|
||||
{x=650,y=300,w=220,h=70,rgb={1,1,1},alpha=0,t="Battle",code=function()startGame("battle")end},
|
||||
{x=500,y=520,w=350,h=80,rgb={1,1,1},alpha=0,t="Back",code=function()gotoScene("main")end},
|
||||
},
|
||||
play={
|
||||
{x=950,y=30,w=80,h=40,rgb={1,1,1},alpha=0,t="Back",code=function()gotoScene("mode")end},
|
||||
},
|
||||
setting={
|
||||
{x=120,y=80,w=30,h=30,rgb={1,1,1},alpha=0,t="-",code=function()setting.das=(setting.das-1)%41 end,hold=true},
|
||||
{x=280,y=80,w=30,h=30,rgb={1,1,1},alpha=0,t="+",code=function()setting.das=(setting.das+1)%41 end,hold=true},
|
||||
{x=320,y=80,w=30,h=30,rgb={1,1,1},alpha=0,t="-",code=function()setting.arr=(setting.arr-1)%21 end,hold=true},
|
||||
{x=480,y=80,w=30,h=30,rgb={1,1,1},alpha=0,t="+",code=function()setting.arr=(setting.arr+1)%21 end,hold=true},
|
||||
{x=200,y=200,w=190,h=40,rgb={1,1,1},alpha=0,t=function()return setting.ghost and"Ghost ON"or"Ghost OFF"end,code=function()setting.ghost=not setting.ghost end},
|
||||
{x=400,y=200,w=190,h=40,rgb={1,1,1},alpha=0,t=function()return setting.center and"Center ON"or"Center OFF"end,code=function()setting.center=not setting.center end},
|
||||
|
||||
|
||||
{x=700,y=80,w=280,h=50,rgb={1,1,1},alpha=0,t=function()return setting.sfx and"Disable SFX"or"Enable SFX"end,code=function()setting.sfx=not setting.sfx end},
|
||||
{x=700,y=150,w=280,h=50,rgb={1,1,1},alpha=0,t=function()return setting.bgm and"Disable BGM"or"Enable BGM"end,
|
||||
code=function()
|
||||
setting.bgm=not setting.bgm
|
||||
if setting.bgm then BGM("blank")else BGM()end
|
||||
end
|
||||
},
|
||||
{x=700,y=220,w=280,h=50,rgb={1,1,1},alpha=0,t=function()return setting.fullscreen and"Disable fullscreen"or"Enable fullscreen"end,
|
||||
code=function()
|
||||
setting.fullscreen=not setting.fullscreen
|
||||
love.window.setFullscreen(setting.fullscreen)
|
||||
end
|
||||
},
|
||||
|
||||
{x=300,y=400,w=230,h=50,rgb={1,1,1},alpha=0,t="More settings",code=function()gotoScene("setting2")end},
|
||||
{x=500,y=500,w=100,h=50,rgb={1,1,1},alpha=0,t="Back",code=function()back()end},
|
||||
},
|
||||
setting2={
|
||||
{x=350,y=70,w=210,h=43,rgb={1,1,1},alpha=0,t=function()return setting.key[1]end,code=function()keysetting=1 end},
|
||||
{x=350,y=120,w=210,h=43,rgb={1,1,1},alpha=0,t=function()return setting.key[2]end,code=function()keysetting=2 end},
|
||||
{x=350,y=170,w=210,h=43,rgb={1,1,1},alpha=0,t=function()return setting.key[3]end,code=function()keysetting=3 end},
|
||||
{x=350,y=220,w=210,h=43,rgb={1,1,1},alpha=0,t=function()return setting.key[4]end,code=function()keysetting=4 end},
|
||||
{x=350,y=270,w=210,h=43,rgb={1,1,1},alpha=0,t=function()return setting.key[5]end,code=function()keysetting=5 end},
|
||||
{x=350,y=320,w=210,h=43,rgb={1,1,1},alpha=0,t=function()return setting.key[6]end,code=function()keysetting=6 end},
|
||||
{x=350,y=370,w=210,h=43,rgb={1,1,1},alpha=0,t=function()return setting.key[7]end,code=function()keysetting=7 end},
|
||||
{x=350,y=420,w=210,h=43,rgb={1,1,1},alpha=0,t=function()return setting.key[8]end,code=function()keysetting=8 end},
|
||||
{x=320,y=500,w=130,h=43,rgb={1,1,1},alpha=0,t="Reset",code=function()setting.key={"left","right","x","z","c","up","down","space","LEFT","RIGHT"}end},
|
||||
{x=500,y=500,w=100,h=50,rgb={1,1,1},alpha=0,t="Back",code=function()back()end},
|
||||
},
|
||||
help={
|
||||
{x=500,y=500,w=200,h=60,rgb={1,1,1},alpha=0,t="Back",code=function()back()end},
|
||||
},
|
||||
stat={
|
||||
{x=500,y=500,w=200,h=60,rgb={1,1,1},alpha=0,t="Back",code=function()back()end},
|
||||
},
|
||||
sel=nil,--selected button Obj
|
||||
pressing=0,--pressing time
|
||||
}
|
||||
49
conf.lua
Normal file
@@ -0,0 +1,49 @@
|
||||
function love.conf(t)
|
||||
local X=nil
|
||||
t.identity="Techmino"--The name of the save directory (string)
|
||||
t.appendidentity=X--Search files in source directory before save directory (boolean)
|
||||
t.version="11.2"
|
||||
t.console=X
|
||||
t.accelerometerjoystick=X--Enable the accelerometer on iOS and Android by exposing it as a Joystick (boolean)
|
||||
t.externalstorage=X
|
||||
t.gammacorrect=true
|
||||
-- t.audio.mixwithsystem=true--Keep background music playing when opening LOVE (boolean, iOS and Android only)
|
||||
|
||||
t.window.title="Techmino"
|
||||
t.window.icon="/image/icon.png"
|
||||
t.window.width=1000
|
||||
t.window.height=600
|
||||
t.window.borderless=X
|
||||
t.window.resizable=true
|
||||
t.window.minwidth=500
|
||||
t.window.minheight=300
|
||||
t.window.fullscreen=X
|
||||
t.window.fullscreentype="desktop"--Choose between "desktop" fullscreen or "exclusive" fullscreen mode (string)
|
||||
t.window.vsync=1
|
||||
t.window.msaa=0--The number of samples to use with multi-sampled antialiasing (number)
|
||||
t.window.depth=nil--The number of bits per sample in the depth buffer
|
||||
t.window.stencil=nil--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.highdpi=X--Enable high-dpi mode for the window on a Retina display (boolean)
|
||||
t.window.x=nil
|
||||
t.window.y=nil
|
||||
|
||||
t.modules.audio=true
|
||||
t.modules.data=true
|
||||
t.modules.event=true
|
||||
t.modules.font=true
|
||||
t.modules.graphics=true
|
||||
t.modules.image=true
|
||||
t.modules.joystick=X
|
||||
t.modules.keyboard=true
|
||||
t.modules.math=true
|
||||
t.modules.mouse=true
|
||||
t.modules.physics=X
|
||||
t.modules.sound=true
|
||||
t.modules.system=true
|
||||
t.modules.thread=X
|
||||
t.modules.timer=true
|
||||
t.modules.touch=X
|
||||
t.modules.video=X
|
||||
t.modules.window=true
|
||||
end
|
||||
57
control.lua
Normal file
@@ -0,0 +1,57 @@
|
||||
function love.mousemoved(x,y)
|
||||
x,y=mouseConvert(x,y)
|
||||
mx,my=x,y
|
||||
Buttons.sel=nil
|
||||
for i=1,#Buttons[scene]do
|
||||
local B=Buttons[scene][i]
|
||||
if not(B.hide and B.hide())then
|
||||
if abs(x-B.x)<B.w*.5 and abs(y-B.y)<B.h*.5 then
|
||||
Buttons.sel=B
|
||||
return nil
|
||||
end
|
||||
end
|
||||
end
|
||||
if not Buttons.sel then Buttons.pressing=0 end
|
||||
end
|
||||
function love.mousepressed(x,y,k)
|
||||
x,y=mouseConvert(x,y)
|
||||
if mouseDown[scene]then mouseDown[scene](x,y,k)end
|
||||
if k==1 then
|
||||
if not sceneSwaping and Buttons.sel then
|
||||
local B=Buttons.sel
|
||||
if B.hold then Buttons.pressing=max(Buttons.pressing,1)end
|
||||
B.code()
|
||||
B.alpha=1
|
||||
Buttons.sel=nil
|
||||
love.mousemoved(mx,my)
|
||||
SFX("button")
|
||||
end
|
||||
elseif k==3 then
|
||||
back()
|
||||
end
|
||||
end
|
||||
function love.mousereleased(x,y,k)
|
||||
Buttons.pressing=0
|
||||
end
|
||||
--[[
|
||||
function love.touchpressed(id,x,y)
|
||||
local i=love.touch.getTouches
|
||||
if #i==1 then
|
||||
love.mousemoved(x,y)
|
||||
end
|
||||
end
|
||||
function love.touchrealeased(id,x,y)
|
||||
love.mousepressed(x,y,1)
|
||||
end]]
|
||||
function love.keypressed(i)
|
||||
if keyDown[scene]then keyDown[scene](i)
|
||||
elseif i=="escape"then back()
|
||||
end
|
||||
end
|
||||
function love.keyreleased(i)
|
||||
if keyUp[scene]then keyUp[scene](i)
|
||||
end
|
||||
end
|
||||
function love.wheelmoved(x,y)
|
||||
if wheelmoved[scene]then wheelmoved[scene](x,y)end
|
||||
end
|
||||
55
game_scene.lua
Normal file
@@ -0,0 +1,55 @@
|
||||
game={}
|
||||
function game.load()
|
||||
scene="load"
|
||||
curBG="none"
|
||||
mouseShow=true
|
||||
loading=1--Loading mode
|
||||
loadnum=1--Loading counter
|
||||
loadprogress=0--Loading bar
|
||||
end
|
||||
function game.intro()
|
||||
scene="intro"
|
||||
curBG="none"
|
||||
mouseShow=true
|
||||
end
|
||||
function game.main()
|
||||
scene="main"
|
||||
curBG="none"
|
||||
mouseShow=true
|
||||
BGM("blank")
|
||||
end
|
||||
function game.mode()
|
||||
scene="mode"
|
||||
curBG="none"
|
||||
mouseShow=true
|
||||
BGM("blank")
|
||||
end
|
||||
function game.play()
|
||||
scene="play"
|
||||
--curBG="game1"
|
||||
SFX("ready")
|
||||
end
|
||||
function game.setting()
|
||||
scene="setting"
|
||||
curBG="none"
|
||||
BGM("blank")
|
||||
end
|
||||
function game.setting2()
|
||||
scene="setting2"
|
||||
curBG="none"
|
||||
keyssetting=nil
|
||||
BGM("blank")
|
||||
end
|
||||
function game.help()
|
||||
scene="help"
|
||||
curBG="none"
|
||||
BGM("blank")
|
||||
end
|
||||
function game.stat()
|
||||
scene="stat"
|
||||
curBG="none"
|
||||
BGM("blank")
|
||||
end
|
||||
function game.quit()
|
||||
love.event.quit()
|
||||
end
|
||||
BIN
image/BG/1.png
Normal file
|
After Width: | Height: | Size: 9.3 KiB |
BIN
image/block.png
Normal file
|
After Width: | Height: | Size: 5.1 KiB |
BIN
image/icon.gfie
Normal file
BIN
image/icon.ico
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
image/icon.png
Normal file
|
After Width: | Height: | Size: 4.4 KiB |
BIN
image/title.png
Normal file
|
After Width: | Height: | Size: 201 B |
BIN
image/title/chi.png
Normal file
|
After Width: | Height: | Size: 48 KiB |
BIN
image/title/eng.png
Normal file
|
After Width: | Height: | Size: 60 KiB |
253
paint.lua
Normal file
@@ -0,0 +1,253 @@
|
||||
Pnt={BG={}}
|
||||
function Pnt.BG.none()
|
||||
gc.clear(.2,.2,.2)
|
||||
end
|
||||
function Pnt.BG.menu()
|
||||
gc.setLineWidth(40)
|
||||
gc.setColor(1,.9,.9)
|
||||
local t=(Timer()%1)*100
|
||||
for i=-6,9 do
|
||||
gc.line(t+100*i,-50,t+100*i+600,650)
|
||||
end
|
||||
gc.setLineWidth(2)
|
||||
end
|
||||
function Pnt.BG.game1()
|
||||
gc.setColor(1,1,1)
|
||||
gc.draw(background[1],500,300,Timer()*.15,nil,nil,600,600)
|
||||
end
|
||||
function Pnt.BG.game2()
|
||||
gc.setColor(1,.5,.5)
|
||||
gc.draw(background[1],500,300,Timer()*.15,nil,nil,600,600)
|
||||
end
|
||||
function Pnt.BG.game3()
|
||||
gc.push("transform")
|
||||
gc.translate(500,300)
|
||||
gc.scale(1,.6)
|
||||
gc.setColor(1,.9,.9)
|
||||
gc.setLineWidth(30)
|
||||
local t=(Timer()%1)*60
|
||||
for x=0,8 do
|
||||
local d=60*x+t
|
||||
gc.rectangle("line",-d,-d,2*d,2*d)
|
||||
end
|
||||
gc.setLineWidth(2)
|
||||
gc.pop()
|
||||
end
|
||||
function Pnt.BG.game4()
|
||||
local t=215+sin(Timer()*6)*40
|
||||
gc.setColor(255,t,t)
|
||||
gc.rectangle("fill",0,0,1000,600)
|
||||
end
|
||||
function Pnt.BG.game5()
|
||||
gc.setColor(1,.9,.9)
|
||||
local t=(Timer()%1)*50
|
||||
for x=0,20 do
|
||||
for y=0,12 do
|
||||
if(x+y)%2==0 then
|
||||
gc.rectangle("fill",50*x-t,50*y-t,50,50)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function Pnt.load()
|
||||
if loadprogress then
|
||||
gc.setLineWidth(3)
|
||||
gc.setColor(.8,.8,.8)
|
||||
gc.rectangle("fill",200,280,loadprogress*600,40)
|
||||
gc.setColor(1,1,1)
|
||||
gc.rectangle("line",200,280,600,40)
|
||||
setFont(30)
|
||||
mStr("Loading...",500,285)
|
||||
end
|
||||
end
|
||||
function Pnt.intro()
|
||||
gc.setColor(1,1,1)
|
||||
gc.draw(img.title[setting.lang],500,300,nil,nil,nil,250,100)
|
||||
end
|
||||
function Pnt.main()
|
||||
gc.setColor(1,1,1)
|
||||
gc.draw(img.title[setting.lang],500,120,nil,nil,nil,250,60)
|
||||
end
|
||||
function Pnt.play()
|
||||
for p=1,#players do
|
||||
P=players[p]
|
||||
setmetatable(_G,P.index)
|
||||
gc.push("transform")
|
||||
gc.translate(x,y)gc.scale(size)--Scale
|
||||
gc.setColor(0,0,0,.7)gc.rectangle("fill",0,0,620,690)--Back
|
||||
gc.setLineWidth(3)
|
||||
gc.setColor(1,1,1)gc.rectangle("line",0,0,620,690)--Big frame
|
||||
gc.translate(160,70)
|
||||
gc.stencil(stencil_field, "replace", 1)
|
||||
gc.translate(0,fieldBeneath)
|
||||
love.graphics.setStencilTest("equal",1)
|
||||
for j=1,#field do
|
||||
if falling<=0 or without(clearing,j)then
|
||||
for i=1,10 do
|
||||
if field[j][i]>0 then
|
||||
drawPixel(j,i,field[j][i],min(visTime[j][i],20)*.05)
|
||||
end
|
||||
end
|
||||
else
|
||||
gc.setColor(1,1,1,falling/gameEnv.fall)
|
||||
gc.rectangle("fill",0,600-30*j,300,30)
|
||||
end
|
||||
end--Field
|
||||
if waiting<=0 then
|
||||
if gameEnv.ghost then
|
||||
for i=1,r do for j=1,c do
|
||||
if cb[i][j]>0 then
|
||||
drawPixel(i+y_img-1,j+cx-1,gameEnv.color[bn],.4)
|
||||
end
|
||||
end end
|
||||
end--Ghost
|
||||
for i=1,r do for j=1,c do
|
||||
if cb[i][j]>0 then
|
||||
drawPixel(i+cy-1,j+cx-1,gameEnv.color[bn],1)
|
||||
end
|
||||
end end--Block
|
||||
end
|
||||
gc.draw(PTC.dust[p])--Draw game field
|
||||
love.graphics.setStencilTest()--In-field mask
|
||||
gc.translate(0,-fieldBeneath)
|
||||
gc.setColor(1,1,1)gc.rectangle("line",-1,-1,300,600)--Draw boarder
|
||||
|
||||
local h=0
|
||||
for i=1,#atkBuffer do
|
||||
local a=atkBuffer[i]
|
||||
local bar=a.amount*30
|
||||
if not a.sent then
|
||||
if a.time<20 then
|
||||
bar=bar*(20*a.time)^.5*.05
|
||||
--Appear
|
||||
end
|
||||
if a.countdown>0 then
|
||||
gc.setColor(1,0,0)
|
||||
gc.rectangle("fill",302,600-h,8,-bar+5)
|
||||
gc.setColor(1,1,0)
|
||||
gc.rectangle("fill",302,600-h+(-bar+5),8,-(-bar+5)*(1-a.countdown/a.cd0))
|
||||
--Time count
|
||||
else
|
||||
gc.setColor(1,(sin((Timer()-i)*20)+1)*.5,0)
|
||||
gc.rectangle("fill",302,600-h,8,-bar+5)
|
||||
--warning
|
||||
end
|
||||
else
|
||||
gc.setColor(1,0,0)
|
||||
bar=bar*(20-a.time)*.05
|
||||
gc.rectangle("fill",302,600-h,8,-bar+5)
|
||||
--Disappear
|
||||
end
|
||||
h=h+bar
|
||||
if h>600 then break end
|
||||
end--Buffer line
|
||||
|
||||
setFont(40)
|
||||
if gameEnv.hold then
|
||||
gc.setColor(1,1,1)
|
||||
gc.print("Hold",-113,0)
|
||||
for i=1,#hb do
|
||||
for j=1,#hb[1] do
|
||||
if hb[i][j]>0 then
|
||||
drawPixel(i+17.5-#hb*.5,j-2.5-#hb[1]*.5,holded and 13 or gameEnv.color[hn],1)
|
||||
end
|
||||
end
|
||||
end
|
||||
end--Hold
|
||||
for N=1,gameEnv.next do
|
||||
gc.setColor(1,1,1)
|
||||
gc.print("Next",336,0)
|
||||
local b=nb[N]
|
||||
for i=1,#b do
|
||||
for j=1,#b[1] do
|
||||
if b[i][j]>0 then
|
||||
drawPixel(i+20-2.4*N-#b*.5,j+12.5-#b[1]*.5,gameEnv.color[nxt[N]],1)
|
||||
end
|
||||
end
|
||||
end
|
||||
end--Next
|
||||
if count then
|
||||
gc.push("transform")
|
||||
gc.translate(155,220)
|
||||
gc.setColor(1,1,1)
|
||||
setFont(100)
|
||||
if count%60>45 then gc.scale(1+(count%60-45)^2*.01,1)end
|
||||
mStr(int(count/60+1),0,0)
|
||||
gc.pop()
|
||||
end--Draw starting counter
|
||||
for i=1,#bonus do
|
||||
bonus[i]:draw()
|
||||
end--Effects
|
||||
mesDisp[gamemode]()--Draw message
|
||||
setFont(45)
|
||||
gc.translate(380,550)
|
||||
gc.setColor(1,1,1)
|
||||
mStr(int(dropSpeed),0,-21)
|
||||
gc.setColor(.6,.6,.6)gc.setLineWidth(5)
|
||||
gc.circle("line",0,0,50)
|
||||
gc.setColor(1,1,1)gc.setLineWidth(2)
|
||||
gc.circle("line",0,0,50)
|
||||
gc.rotate(2.0944+(dropSpeed<=175 and .020944*dropSpeed or 4.712389-52.35988/(dropSpeed-125)))
|
||||
gc.setColor(.4,.4,.4,.5)gc.setLineWidth(5)
|
||||
gc.line(0,0,40,0)
|
||||
gc.setColor(.6,.6,.6,.5)gc.setLineWidth(3)
|
||||
gc.line(0,0,40,0)
|
||||
--Speed dial
|
||||
|
||||
gc.pop()
|
||||
end--Draw players
|
||||
gc.setLineWidth(3)
|
||||
for i=1,#FX.beam do
|
||||
local b=FX.beam[i]
|
||||
local t=b.t/45
|
||||
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
|
||||
setmetatable(_G,nil)
|
||||
end
|
||||
function Pnt.setting()
|
||||
setFont(30)
|
||||
gc.setColor(1,1,1)
|
||||
mStr("DAS:"..setting.das,200,65)
|
||||
mStr("ARR:"..setting.arr,400,65)
|
||||
end
|
||||
function Pnt.setting2()
|
||||
setFont(30)
|
||||
gc.setColor(1,1,1)
|
||||
for i=1,8 do
|
||||
gc.printf(actName_[i]..":",80,5+50*i,150,"right")
|
||||
end
|
||||
if keysetting then
|
||||
setFont(35)
|
||||
gc.print("<<",470,50*keysetting)
|
||||
end
|
||||
end
|
||||
function Pnt.help()
|
||||
gc.setColor(1,1,1)
|
||||
gc.draw(img.title[setting.lang],60,420,.2,.5+.05*sin(Timer()*2))
|
||||
end
|
||||
function Pnt.stat()
|
||||
setFont(30)
|
||||
gc.setColor(1,1,1)
|
||||
gc.print(Text.stat[1],250,60)
|
||||
gc.print(Text.stat[2],250,100)
|
||||
gc.print(Text.stat[3],250,140)
|
||||
gc.print(Text.stat[4],250,180)
|
||||
|
||||
gc.print(stat.game,600,60)
|
||||
gc.print(format("%0.2f",stat.gametime).."s",600,100)
|
||||
gc.print(stat.piece,600,140)
|
||||
gc.print(stat.row,600,180)
|
||||
gc.draw(img.title[setting.lang],60,420,.2,.5+.05*sin(Timer()*2))
|
||||
end
|
||||
2
question note.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
1.缓冲条位置
|
||||
2.
|
||||
169
timer.lua
Normal file
@@ -0,0 +1,169 @@
|
||||
Tmr={}
|
||||
function Tmr.load()
|
||||
if loading==1 then
|
||||
loadnum=loadnum+1
|
||||
loadprogress=loadnum/10
|
||||
if loadnum==5 then
|
||||
--require("load_texture")
|
||||
elseif loadnum==10 then
|
||||
loadnum=1
|
||||
loading=2
|
||||
end
|
||||
elseif loading==2 then
|
||||
if loadnum<=#bgm then
|
||||
bgm[bgm[loadnum]]=love.audio.newSource("/BGM/"..bgm[loadnum]..".ogg","stream")
|
||||
bgm[bgm[loadnum]]:setLooping(true)
|
||||
loadprogress=loadnum/#bgm
|
||||
loadnum=loadnum+1
|
||||
else
|
||||
for i=1,#bgm do bgm[i]=nil end
|
||||
loading=3
|
||||
loadnum=1
|
||||
end
|
||||
elseif loading==3 then
|
||||
if loadnum<=#sfx then
|
||||
sfx[sfx[loadnum]]=love.audio.newSource("/SFX/"..sfx[loadnum]..".ogg","static")
|
||||
loadprogress=loadnum/#sfx
|
||||
loadnum=loadnum+1
|
||||
else
|
||||
for i=1,#sfx do sfx[i]=nil end
|
||||
loading=4
|
||||
loadnum=1
|
||||
end
|
||||
elseif loading==4 then
|
||||
loadnum=loadnum+1
|
||||
if loadnum==20 then
|
||||
gotoScene("main")
|
||||
end
|
||||
end
|
||||
end
|
||||
function Tmr.play(dt)
|
||||
frame=frame+1
|
||||
if count then
|
||||
count=count-1
|
||||
if count==0 then
|
||||
count=nil
|
||||
SFX("start")
|
||||
for P=1,#players do
|
||||
P=players[P]
|
||||
_G.P=P
|
||||
setmetatable(_G,P.index)
|
||||
P.control=true
|
||||
resetblock()
|
||||
end
|
||||
setmetatable(_G,nil)
|
||||
elseif count%60==0 then
|
||||
SFX("ready")
|
||||
end
|
||||
return nil
|
||||
end
|
||||
for p=1,#players do
|
||||
P=players[p]
|
||||
setmetatable(_G,P.index)
|
||||
if control then P.time=time+dt end
|
||||
|
||||
local v=0
|
||||
for i=2,10 do v=v+i*(i-1)*7.2/(frame-keyTime[i])end P.keySpeed=keySpeed*.99+v*.1
|
||||
v=0 for i=2,10 do v=v+i*(i-1)*7.2/(frame-dropTime[i])end P.dropSpeed=dropSpeed*.99+v*.1
|
||||
--Update speeds
|
||||
|
||||
if P.ai then
|
||||
P.ai.controlDelay=P.ai.controlDelay-1
|
||||
if P.ai.controlDelay==0 then
|
||||
if #P.ai.controls>0 then
|
||||
pressKey(P.ai.controls[1],P)
|
||||
releaseKey(P.ai.controls[1],P)
|
||||
rem(P.ai.controls,1)
|
||||
P.ai.controlDelay=P.ai.controlDelay0
|
||||
else
|
||||
AI_getControls(P.ai.controls)
|
||||
P.ai.controlDelay=2*P.ai.controlDelay0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
for j=1,#field do for i=1,10 do
|
||||
if visTime[j][i]>0 then P.visTime[j][i]=visTime[j][i]-1 end
|
||||
end end
|
||||
--Fresh visible time
|
||||
if keyPressing[1]or keyPressing[2]then
|
||||
P.moving=moving+sgn(moving)
|
||||
local d=abs(moving)-gameEnv.das
|
||||
if d>1 then
|
||||
if gameEnv.arr>0 then
|
||||
if d%gameEnv.arr==0 then
|
||||
act[moving>0 and"moveRight"or"moveLeft"](true)
|
||||
end
|
||||
else
|
||||
act[moving>0 and"toRight"or"toLeft"]()
|
||||
end
|
||||
end
|
||||
else
|
||||
P.moving=0
|
||||
end
|
||||
if keyPressing[7]then
|
||||
act.softDrop()
|
||||
P.downing=downing+1
|
||||
else
|
||||
P.downing=0
|
||||
end
|
||||
if falling>0 then
|
||||
P.falling=falling-1
|
||||
if falling<=0 then
|
||||
if #field>clearing[1]then SFX("fall")end
|
||||
for i=1,#clearing do
|
||||
rem(field,clearing[i])
|
||||
rem(visTime,clearing[i])
|
||||
end
|
||||
P.clearing={}
|
||||
end
|
||||
elseif waiting>0 then
|
||||
P.waiting=waiting-1
|
||||
if waiting<=0 then
|
||||
resetblock()
|
||||
end
|
||||
else
|
||||
if cy~=y_img then
|
||||
if dropDelay>1 then
|
||||
P.dropDelay=dropDelay-1
|
||||
else
|
||||
drop()
|
||||
P.dropDelay,P.lockDelay=gameEnv.drop,gameEnv.lock
|
||||
end
|
||||
else
|
||||
if lockDelay>0 then P.lockDelay=lockDelay-1
|
||||
else drop()
|
||||
end
|
||||
end
|
||||
end
|
||||
for i=#bonus,1,-1 do
|
||||
bonus[i].t=bonus[i].t+1
|
||||
if bonus[i].t>60 then rem(bonus,i)end
|
||||
end
|
||||
for i=#task,1,-1 do
|
||||
if task[i]()then rem(task,i)end
|
||||
end
|
||||
for i=#atkBuffer,1,-1 do
|
||||
local atk=atkBuffer[i]
|
||||
atk.time=atk.time+1
|
||||
if not atk.sent then
|
||||
if atk.countdown>0 then
|
||||
atk.countdown=atk.countdown-1
|
||||
end
|
||||
else
|
||||
if atk.time>20 then
|
||||
rem(atkBuffer,i)
|
||||
end
|
||||
end
|
||||
end
|
||||
if fieldBeneath>0 then P.fieldBeneath=fieldBeneath-1 end
|
||||
PTC.dust[p]:update(dt)
|
||||
end
|
||||
for i=#FX.beam,1,-1 do
|
||||
FX.beam[i].t=FX.beam[i].t+1
|
||||
if FX.beam[i].t>45 then
|
||||
rem(FX.beam,i)
|
||||
end
|
||||
end
|
||||
setmetatable(_G,nil)
|
||||
end
|
||||
47
user_actions.lua
Normal file
@@ -0,0 +1,47 @@
|
||||
act={
|
||||
moveLeft=function(auto)
|
||||
if not auto then P.moving=-1 end
|
||||
if not ifoverlap(cb,cx-1,cy)then
|
||||
P.cx=cx-1
|
||||
freshgho()
|
||||
P.lockDelay=gameEnv.lock
|
||||
if cy==y_img then SFX("move")end
|
||||
end
|
||||
end,
|
||||
moveRight=function(auto)
|
||||
if not auto then P.moving=1 end
|
||||
if not ifoverlap(cb,cx+1,cy)then
|
||||
P.cx=cx+1
|
||||
freshgho()
|
||||
P.lockDelay=gameEnv.lock
|
||||
if cy==y_img then SFX("move")end
|
||||
end
|
||||
end,
|
||||
hardDrop=function()
|
||||
if P.waiting<=0 then
|
||||
if cy~=y_img then
|
||||
P.cy=y_img
|
||||
SFX("drop")
|
||||
end
|
||||
drop()
|
||||
P.keyPressing[6]=false
|
||||
end
|
||||
end,
|
||||
softDrop=function()
|
||||
act.toDown()
|
||||
P.downing=1
|
||||
end,
|
||||
rotRight=function()spin(1)end,
|
||||
rotLeft=function()spin(-1)end,
|
||||
rotFlip=function()spin(2)end,
|
||||
hold=hold,
|
||||
--Player movements
|
||||
|
||||
down1=function()drop()end,
|
||||
down4=function()for i=1,4 do if cy~=y_img then drop()else break end end end,
|
||||
toDown=function()P.cy,P.lockDelay=y_img,gameEnv.lock 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,
|
||||
quit=function()Event.gameover.lose()end,
|
||||
--System movements
|
||||
}
|
||||