From fe632b71d6b78a313d400cb9ff7e75d2902d16e3 Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Sun, 15 Nov 2020 21:06:24 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=95=E5=AD=97=E6=A3=8B?= =?UTF-8?q?=E5=9C=A8=E5=B9=B3=E5=B1=80=E7=BB=93=E6=9D=9F=E6=B8=B8=E6=88=8F?= =?UTF-8?q?=E6=97=B6=E4=B8=8D=E7=BB=93=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- parts/scenes/UTTT.lua | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/parts/scenes/UTTT.lua b/parts/scenes/UTTT.lua index c993810c..d35a8300 100644 --- a/parts/scenes/UTTT.lua +++ b/parts/scenes/UTTT.lua @@ -37,7 +37,6 @@ local function restart() end end end - local function checkBoard(b,p) for i=1,8 do for j=1,3 do @@ -49,9 +48,17 @@ local function checkBoard(b,p) ::nextLine:: end end - +local function full(L) + for i=1,9 do + if not L[i]then + return false + end + end + return true +end local function place(X,x) board[X][x]=round + SFX.play("move") lastX,lastx=X,x curX,curx=nil placeTime=Timer() @@ -59,25 +66,24 @@ local function place(X,x) score[X]=round if checkBoard(score,round)then gameover=round + SFX.play("win") return else - for i=1,9 do - if not score[i]then - goto continueGame - end + if full(score)then + gameover=true + return end - gameover=true - do return end - ::continueGame:: end + SFX.play("reach") else - for i=1,9 do - if not board[X][i]then - goto continueGame + if full(board[X])then + SFX.play("emit") + score[X]=true + if full(score)then + gameover=true + return end end - score[X]=true - ::continueGame:: end if score[x]then target=false @@ -89,10 +95,10 @@ end function sceneInit.UTTT() restart() + BGM.set("truth") BG.set("bg2") end - function Pnt.UTTT() gc.push("transform") --origin pos:0,140; scale:4 @@ -125,7 +131,7 @@ function Pnt.UTTT() elseif score[X]==1 then gc.setColor(0,0,.5) else - gc.setColor(.5,.5,.5) + gc.setColor(0,0,0) end gc.rectangle("fill",(X-1)%3*30,int((X-1)/3)*30,30,30) end