整理代码

This commit is contained in:
MrZ626
2021-09-19 04:20:16 +08:00
parent 4654e9f7c7
commit ec04da06d7
6 changed files with 24 additions and 19 deletions

View File

@@ -8,6 +8,7 @@ local gc_draw,gc_rectangle,gc_line,gc_printf=gc.draw,gc.rectangle,gc.line,gc.pri
local ins,rem=table.insert,table.remove
local SETTING,GAME,SCR=SETTING,GAME,SCR
local PLAYERS=PLAYERS

View File

@@ -45,10 +45,10 @@ return{
},
load=function()
PLY.newPlayer(1)
local P=PLAYERS[1]
local P1=PLAYERS[1]
for _=1,8 do
P:garbageRise(13,1,generateLine(P.holeRND:random(10)))
P1:garbageRise(13,1,generateLine(P1.holeRND:random(10)))
end
P.fieldBeneath=0
P1.fieldBeneath=0
end,
}

View File

@@ -3,6 +3,7 @@ local rem=table.remove
local WS,TIME=WS,TIME
local yield=YIELD
local PLAYERS=PLAYERS
local NET={
allow_online=false,

View File

@@ -16,6 +16,8 @@ local shader_alpha,shader_lighter=SHADER.alpha,SHADER.lighter
local shader_fieldSatur,shader_blockSatur=SHADER.fieldSatur,SHADER.blockSatur
local drawableText,missionEnum,minoColor=drawableText,missionEnum,minoColor
local PLAYERS,PLY_ALIVE=PLAYERS,PLY_ALIVE
local RCPB={10,33,200,33,105,5,105,60}
local attackColor={
{COLOR.dH,COLOR.Z},

View File

@@ -2,6 +2,7 @@ local gc,tc=love.graphics,love.touch
local sin=math.sin
local SCR,VK=SCR,VK
local GAME=GAME
local PLAYERS=PLAYERS
local noTouch,noKey=false,false
local touchMoveLastFrame=false
@@ -221,11 +222,11 @@ function scene.keyDown(key,isRep)
gameRate=gameRate==0 and .125 or 0
end
_updateRepButtons()
elseif key=='f2'then
elseif key=="f2"then
if not isRep then
_speedDown()
end
elseif key=='f3'then
elseif key=="f3"then
if gameRate==0 then
_step()
elseif not isRep then
@@ -387,15 +388,15 @@ function scene.draw()
end
scene.widgetList={
WIDGET.newKey{name="rep0", x=40,y=50,w=60,code=_rep0,fText=TEXTURE.rep.rep0},
WIDGET.newKey{name="repP8", x=105,y=50,w=60,code=_repP8,fText=TEXTURE.rep.repP8},
WIDGET.newKey{name="repP2", x=170,y=50,w=60,code=_repP2,fText=TEXTURE.rep.repP2},
WIDGET.newKey{name="rep1", x=235,y=50,w=60,code=_rep1,fText=TEXTURE.rep.rep1},
WIDGET.newKey{name="rep2", x=300,y=50,w=60,code=_rep2,fText=TEXTURE.rep.rep2},
WIDGET.newKey{name="rep5", x=365,y=50,w=60,code=_rep5,fText=TEXTURE.rep.rep5},
WIDGET.newKey{name="step", x=430,y=50,w=60,code=_step,fText=TEXTURE.rep.step},
WIDGET.newKey{name="restart",x=0,y=45,w=60,code=_restart,fText=TEXTURE.game.restart},
WIDGET.newKey{name="pause", x=0,y=45,w=60,code=pauseGame,fText=TEXTURE.game.pause},
WIDGET.newKey{name="rep0", x=40,y=50,w=60, code=_rep0, fText=TEXTURE.rep.rep0},
WIDGET.newKey{name="repP8", x=105,y=50,w=60,code=_repP8, fText=TEXTURE.rep.repP8},
WIDGET.newKey{name="repP2", x=170,y=50,w=60,code=_repP2, fText=TEXTURE.rep.repP2},
WIDGET.newKey{name="rep1", x=235,y=50,w=60,code=_rep1, fText=TEXTURE.rep.rep1},
WIDGET.newKey{name="rep2", x=300,y=50,w=60,code=_rep2, fText=TEXTURE.rep.rep2},
WIDGET.newKey{name="rep5", x=365,y=50,w=60,code=_rep5, fText=TEXTURE.rep.rep5},
WIDGET.newKey{name="step", x=430,y=50,w=60,code=_step, fText=TEXTURE.rep.step},
WIDGET.newKey{name="restart",x=0,y=45,w=60, code=_restart, fText=TEXTURE.game.restart},
WIDGET.newKey{name="pause", x=0,y=45,w=60, code=pauseGame,fText=TEXTURE.game.pause},
}
return scene

View File

@@ -33,8 +33,8 @@ function scene.sceneInit(org)
if org:find("setting")then
TEXT.show(text.needRestart,640,410,50,'fly',.6)
end
local P=PLAYERS[1]
local S=P.stat
local P1=PLAYERS[1]
local S=P1.stat
timer1=org=='game'and 0 or 50
timer2=timer1
@@ -98,8 +98,8 @@ function scene.sceneInit(org)
val[2*i-1],val[2*i]=val[i]*standard[2*i-1],val[i]*standard[2*i]
end
if P.result=='win'and P.stat.piece>4 then
local acc=P.stat.finesseRate*.2/P.stat.piece
if P1.result=='win'and P1.stat.piece>4 then
local acc=P1.stat.finesseRate*.2/P1.stat.piece
rank=
acc==1. and"Z"or
acc>.97 and"S"or
@@ -112,7 +112,7 @@ function scene.sceneInit(org)
if acc==1 then
trophy=text.finesse_ap
trophyColor=COLOR.Y
elseif P.stat.maxFinesseCombo==P.stat.piece then
elseif P1.stat.maxFinesseCombo==P1.stat.piece then
trophy=text.finesse_fc
trophyColor=COLOR.lC
else