整理代码,两个远古时期的游戏相关全局变量移入GAME
This commit is contained in:
@@ -14,7 +14,7 @@ local ins,rem=table.insert,table.remove
|
|||||||
-- 11~13:LL,RR,DD
|
-- 11~13:LL,RR,DD
|
||||||
local blockPos={4,4,4,4,4,5,4}
|
local blockPos={4,4,4,4,4,5,4}
|
||||||
-------------------------------------------------Cold clear
|
-------------------------------------------------Cold clear
|
||||||
local _CC=LOADLIB("CC")
|
local _CC=LOADLIB("CC")cc=nil
|
||||||
if _CC then
|
if _CC then
|
||||||
local CCblockID={6,5,4,3,2,1,0}
|
local CCblockID={6,5,4,3,2,1,0}
|
||||||
CC={
|
CC={
|
||||||
|
|||||||
@@ -409,7 +409,7 @@ end
|
|||||||
|
|
||||||
function pauseGame()
|
function pauseGame()
|
||||||
if not SCN.swapping then
|
if not SCN.swapping then
|
||||||
restartCount=0--Avoid strange darkness
|
GAME.restartCount=0--Avoid strange darkness
|
||||||
if not GAME.result then
|
if not GAME.result then
|
||||||
GAME.pauseCount=GAME.pauseCount+1
|
GAME.pauseCount=GAME.pauseCount+1
|
||||||
end
|
end
|
||||||
@@ -435,7 +435,7 @@ function loadGame(M,ifQuickPlay)
|
|||||||
GAME.modeEnv=GAME.curMode.env
|
GAME.modeEnv=GAME.curMode.env
|
||||||
drawableText.modeName:set(text.modes[M][1])
|
drawableText.modeName:set(text.modes[M][1])
|
||||||
drawableText.levelName:set(text.modes[M][2])
|
drawableText.levelName:set(text.modes[M][2])
|
||||||
needResetGameData=true
|
GAME.init=true
|
||||||
SCN.swapTo("play",ifQuickPlay and"swipeD"or"fade_togame")
|
SCN.swapTo("play",ifQuickPlay and"swipeD"or"fade_togame")
|
||||||
SFX.play("enter")
|
SFX.play("enter")
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -168,6 +168,9 @@ BAG={}--Sequence for custom game
|
|||||||
MISSION={}--Clearing mission for custom game
|
MISSION={}--Clearing mission for custom game
|
||||||
|
|
||||||
GAME={--Global game data
|
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
|
frame=0, --Frame count
|
||||||
result=false, --Game result (string)
|
result=false, --Game result (string)
|
||||||
pauseTime=0, --Time paused
|
pauseTime=0, --Time paused
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ function Tmr.load()
|
|||||||
gc.setLineWidth(3)
|
gc.setLineWidth(3)
|
||||||
for i=1,17 do
|
for i=1,17 do
|
||||||
puzzleMark[i]=C(30,30)
|
puzzleMark[i]=C(30,30)
|
||||||
_=SKIN.libColor[i]
|
local _=SKIN.libColor[i]
|
||||||
gc.setColor(_[1],_[2],_[3],.6)
|
gc.setColor(_[1],_[2],_[3],.6)
|
||||||
gc.rectangle("line",5,5,20,20)
|
gc.rectangle("line",5,5,20,20)
|
||||||
gc.rectangle("line",10,10,10,10)
|
gc.rectangle("line",10,10,10,10)
|
||||||
|
|||||||
@@ -26,10 +26,10 @@ end
|
|||||||
|
|
||||||
function sceneInit.play()
|
function sceneInit.play()
|
||||||
love.keyboard.setKeyRepeat(false)
|
love.keyboard.setKeyRepeat(false)
|
||||||
restartCount=0
|
GAME.restartCount=0
|
||||||
if needResetGameData then
|
if GAME.init then
|
||||||
resetGameData()
|
resetGameData()
|
||||||
needResetGameData=nil
|
GAME.init=nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -197,16 +197,16 @@ function Tmr.play(dt)
|
|||||||
P.moving=0
|
P.moving=0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if restartCount>0 then restartCount=restartCount-1 end
|
if GAME.restartCount>0 then GAME.restartCount=GAME.restartCount-1 end
|
||||||
return
|
return
|
||||||
elseif P1.keyPressing[10]then
|
elseif P1.keyPressing[10]then
|
||||||
restartCount=restartCount+1
|
GAME.restartCount=GAME.restartCount+1
|
||||||
if restartCount>20 then
|
if GAME.restartCount>20 then
|
||||||
resetGameData()
|
resetGameData()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
elseif restartCount>0 then
|
elseif GAME.restartCount>0 then
|
||||||
restartCount=restartCount>2 and restartCount-2 or 0
|
GAME.restartCount=GAME.restartCount>2 and GAME.restartCount-2 or 0
|
||||||
end
|
end
|
||||||
|
|
||||||
--Update players
|
--Update players
|
||||||
@@ -347,8 +347,8 @@ function Pnt.play()
|
|||||||
gc.rectangle("fill",0,0,SCR.w,SCR.h)
|
gc.rectangle("fill",0,0,SCR.w,SCR.h)
|
||||||
gc.setShader()
|
gc.setShader()
|
||||||
end
|
end
|
||||||
if restartCount>0 then
|
if GAME.restartCount>0 then
|
||||||
gc.setColor(0,0,0,restartCount*.05)
|
gc.setColor(0,0,0,GAME.restartCount*.05)
|
||||||
gc.rectangle("fill",0,0,SCR.w,SCR.h)
|
gc.rectangle("fill",0,0,SCR.w,SCR.h)
|
||||||
end
|
end
|
||||||
gc.pop()
|
gc.pop()
|
||||||
|
|||||||
Reference in New Issue
Block a user