优化小程序ten的手感,外框颜色会变化

This commit is contained in:
MrZ626
2021-03-13 00:58:17 +08:00
parent 17c301c775
commit a22cc09675

View File

@@ -26,6 +26,7 @@ local tileColor={
} }
local board,preview,cx,cy local board,preview,cx,cy
local failPos
local startTime,time local startTime,time
local maxTile,maxNew local maxTile,maxNew
local state,progress local state,progress
@@ -70,6 +71,7 @@ local function merge()
state=1 state=1
startTime=TIME() startTime=TIME()
end end
if failPos==cy*10+cx then return end
local chosen=board[cy][cx] local chosen=board[cy][cx]
local connected={{cy,cx}} local connected={{cy,cx}}
local count=1 local count=1
@@ -113,8 +115,10 @@ local function merge()
) )
end end
fallingTimer=fast and 8 or 12 fallingTimer=fast and 8 or 12
failPos=false
else else
board[cy][cx]=chosen board[cy][cx]=chosen
failPos=cy*10+cx
end end
end end
function scene.keyDown(key) function scene.keyDown(key)
@@ -248,7 +252,11 @@ function scene.draw()
rectangle("fill",15,200,285,210) rectangle("fill",15,200,285,210)
end end
gc.setLineWidth(10) gc.setLineWidth(10)
setColor(1,1,1) setColor(COLOR[
state==0 and"G"or
state==1 and(fast and"R"or"W")or
state==2 and"Y"
])
rectangle("line",315,35,650,650) rectangle("line",315,35,650,650)
gc.setLineWidth(4) gc.setLineWidth(4)