From 9442da2b440b2317fd28b5bd4dd8a21f35c2c009 Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Fri, 20 Nov 2020 01:03:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B4=E7=90=86=E4=BB=A3=E7=A0=81=EF=BC=8C?= =?UTF-8?q?=E4=B8=A4=E4=B8=AA=E8=BF=9C=E5=8F=A4=E6=97=B6=E6=9C=9F=E7=9A=84?= =?UTF-8?q?=E6=B8=B8=E6=88=8F=E7=9B=B8=E5=85=B3=E5=85=A8=E5=B1=80=E5=8F=98?= =?UTF-8?q?=E9=87=8F=E7=A7=BB=E5=85=A5GAME?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- parts/ai.lua | 2 +- parts/gametoolfunc.lua | 4 ++-- parts/globalTables.lua | 3 +++ parts/scenes/load.lua | 2 +- parts/scenes/play.lua | 20 ++++++++++---------- 5 files changed, 17 insertions(+), 14 deletions(-) diff --git a/parts/ai.lua b/parts/ai.lua index 45d825ae..801f3006 100644 --- a/parts/ai.lua +++ b/parts/ai.lua @@ -14,7 +14,7 @@ local ins,rem=table.insert,table.remove -- 11~13:LL,RR,DD local blockPos={4,4,4,4,4,5,4} -------------------------------------------------Cold clear -local _CC=LOADLIB("CC") +local _CC=LOADLIB("CC")cc=nil if _CC then local CCblockID={6,5,4,3,2,1,0} CC={ diff --git a/parts/gametoolfunc.lua b/parts/gametoolfunc.lua index edf73a07..c5142949 100644 --- a/parts/gametoolfunc.lua +++ b/parts/gametoolfunc.lua @@ -409,7 +409,7 @@ end function pauseGame() if not SCN.swapping then - restartCount=0--Avoid strange darkness + GAME.restartCount=0--Avoid strange darkness if not GAME.result then GAME.pauseCount=GAME.pauseCount+1 end @@ -435,7 +435,7 @@ function loadGame(M,ifQuickPlay) GAME.modeEnv=GAME.curMode.env drawableText.modeName:set(text.modes[M][1]) drawableText.levelName:set(text.modes[M][2]) - needResetGameData=true + GAME.init=true SCN.swapTo("play",ifQuickPlay and"swipeD"or"fade_togame") SFX.play("enter") end diff --git a/parts/globalTables.lua b/parts/globalTables.lua index 35f9be56..f737d698 100644 --- a/parts/globalTables.lua +++ b/parts/globalTables.lua @@ -168,6 +168,9 @@ BAG={}--Sequence for custom game MISSION={}--Clearing mission for custom game GAME={--Global game data + init=false, --If need initializing game when enter scene-play + restartCount=0, --Keep +=1 if player hold restart button after game start + frame=0, --Frame count result=false, --Game result (string) pauseTime=0, --Time paused diff --git a/parts/scenes/load.lua b/parts/scenes/load.lua index 0a16da80..4dae24b0 100644 --- a/parts/scenes/load.lua +++ b/parts/scenes/load.lua @@ -91,7 +91,7 @@ function Tmr.load() gc.setLineWidth(3) for i=1,17 do puzzleMark[i]=C(30,30) - _=SKIN.libColor[i] + local _=SKIN.libColor[i] gc.setColor(_[1],_[2],_[3],.6) gc.rectangle("line",5,5,20,20) gc.rectangle("line",10,10,10,10) diff --git a/parts/scenes/play.lua b/parts/scenes/play.lua index b2840a18..a9b72519 100644 --- a/parts/scenes/play.lua +++ b/parts/scenes/play.lua @@ -26,10 +26,10 @@ end function sceneInit.play() love.keyboard.setKeyRepeat(false) - restartCount=0 - if needResetGameData then + GAME.restartCount=0 + if GAME.init then resetGameData() - needResetGameData=nil + GAME.init=nil end end @@ -197,16 +197,16 @@ function Tmr.play(dt) P.moving=0 end end - if restartCount>0 then restartCount=restartCount-1 end + if GAME.restartCount>0 then GAME.restartCount=GAME.restartCount-1 end return elseif P1.keyPressing[10]then - restartCount=restartCount+1 - if restartCount>20 then + GAME.restartCount=GAME.restartCount+1 + if GAME.restartCount>20 then resetGameData() return end - elseif restartCount>0 then - restartCount=restartCount>2 and restartCount-2 or 0 + elseif GAME.restartCount>0 then + GAME.restartCount=GAME.restartCount>2 and GAME.restartCount-2 or 0 end --Update players @@ -347,8 +347,8 @@ function Pnt.play() gc.rectangle("fill",0,0,SCR.w,SCR.h) gc.setShader() end - if restartCount>0 then - gc.setColor(0,0,0,restartCount*.05) + if GAME.restartCount>0 then + gc.setColor(0,0,0,GAME.restartCount*.05) gc.rectangle("fill",0,0,SCR.w,SCR.h) end gc.pop()