小程序Link移除速打,添加FC机制

This commit is contained in:
MrZ626
2021-09-14 03:44:15 +08:00
parent 890264ef7d
commit 280f2c0af5
7 changed files with 45 additions and 41 deletions

View File

@@ -716,7 +716,6 @@ return{
app_link={ app_link={
reset="Reset", reset="Reset",
invis="Invis", invis="Invis",
fast="Fast",
}, },
savedata={ savedata={
export="Export to clipboard", export="Export to clipboard",

View File

@@ -621,7 +621,6 @@ return{
app_link={ app_link={
reset="Reiniciar", reset="Reiniciar",
invis="A ciegas", invis="A ciegas",
fast="Rápido",
}, },
savedata={ savedata={
export="Exportar al portapapeles", export="Exportar al portapapeles",

View File

@@ -623,7 +623,6 @@ return{
app_link={ app_link={
reset="Réinitialiser", reset="Réinitialiser",
invis="Aveugler", invis="Aveugler",
-- fast="Fast",
}, },
savedata={ savedata={
-- export="Export to clipboard", -- export="Export to clipboard",

View File

@@ -705,7 +705,6 @@ return{
app_link={ app_link={
reset="Resetar", reset="Resetar",
invis="Cego", invis="Cego",
-- fast="Fast",
}, },
savedata={ savedata={
-- export="Export to clipboard", -- export="Export to clipboard",

View File

@@ -210,7 +210,6 @@ return{
}, },
app_link={ app_link={
invis="", invis="",
fast="",
}, },
savedata={ savedata={
export="复制走", export="复制走",

View File

@@ -717,7 +717,6 @@ return{
app_link={ app_link={
reset="重置", reset="重置",
invis="盲打", invis="盲打",
fast="速打",
}, },
savedata={ savedata={
export="导出到剪切板", export="导出到剪切板",

View File

@@ -1,4 +1,5 @@
local ms=love.mouse local ms=love.mouse
local msIsDown,kbIsDown=ms.isDown,love.keyboard.isDown
local gc=love.graphics local gc=love.graphics
local gc_setColor,gc_rectangle=gc.setColor,gc.rectangle local gc_setColor,gc_rectangle=gc.setColor,gc.rectangle
local setFont=setFont local setFont=setFont
@@ -38,13 +39,14 @@ local colorList={
COLOR.lF, COLOR.lF,
} }
local sure=0 local sure=0
local invis,fast local invis
local state local state
local startTime,time local startTime,time
local progress,level local progress,level
local score,score1,combo,comboTime,maxCombo local score,score1
local combo,comboTime,maxCombo,noComboBreak
local field={ local field={
x=160,y=30, x=160,y=40,
w=960,h=640, w=960,h=640,
c=16,r=10, c=16,r=10,
remain=0, remain=0,
@@ -81,6 +83,9 @@ local function resetBoard()
field[y][x]=ri field[y][x]=ri
end end
end end
noComboBreak=true
comboTime=comboTime+2
SYSFX.newShade(2,field.x,field.y,field.w,field.h,1,1,1) SYSFX.newShade(2,field.x,field.y,field.w,field.h,1,1,1)
end end
local function newGame() local function newGame()
@@ -149,7 +154,7 @@ local function checkLink(x1,y1,x2,y2)
end end
return bestLine return bestLine
end end
local function touch(x,y) local function tap(x,y)
if x>=1 and x<=field.c and y>=1 and y<=field.r then if x>=1 and x<=field.c and y>=1 and y<=field.r then
if state==0 then if state==0 then
state=1 state=1
@@ -172,15 +177,30 @@ local function touch(x,y)
TEXT.show(s,1205,500,20,'score') TEXT.show(s,1205,500,20,'score')
--Combo --Combo
if comboTime==0 then combo=0 end if comboTime==0 then
combo=0
noComboBreak=false
end
comboTime=comboTime*max(1-combo*.001,.95)+max(1-combo*.01,.8) comboTime=comboTime*max(1-combo*.001,.95)+max(1-combo*.01,.8)
combo=combo+1 combo=combo+1
if combo>maxCombo then maxCombo=combo end if combo>maxCombo then maxCombo=combo end
--Check win --Check win
if field.remain==0 then if field.remain==0 then
if noComboBreak then
SFX.play('emit')
SFX.play('clear_4')
TEXT.show("FULL COMBO",640,360,100,'beat',.626)
comboTime=comboTime+3
end
if levels[level+1]then if levels[level+1]then
ins(progress,("%s - %.3fs"):format(level,TIME()-startTime)) local pText
if noComboBreak then
pText=("%s [FC] %.2fs"):format(level,TIME()-startTime)
else
pText=("%s - %.2fs"):format(level,TIME()-startTime)
end
ins(progress,pText)
level=level+1 level=level+1
resetBoard() resetBoard()
SFX.play('reach') SFX.play('reach')
@@ -189,17 +209,21 @@ local function touch(x,y)
SFX.play('win') SFX.play('win')
end end
else else
SFX.play('clear_1') SFX.play(
combo<50 and'clear_1'or
combo<100 and'clear_2'or
'clear_3',.8
)
end end
selX,selY=false,false selX,selY=false,false
else else
selX,selY=x,y selX,selY=x,y
SFX.play('lock') SFX.play('lock',.9)
end end
else else
if field[y][x]and(x~=selX or y~=selY)then if field[y][x]and(x~=selX or y~=selY)then
selX,selY=x,y selX,selY=x,y
SFX.play('lock') SFX.play('lock',.8)
end end
end end
end end
@@ -209,9 +233,9 @@ end
local scene={} local scene={}
function scene.sceneInit() function scene.sceneInit()
invis,fast=false,false invis=false
newGame() newGame()
BGM.play('hang out') BGM.play('truth')
end end
function scene.keyDown(key,isRep) function scene.keyDown(key,isRep)
@@ -235,31 +259,18 @@ function scene.keyDown(key,isRep)
elseif state==0 then elseif state==0 then
if key=="q"then if key=="q"then
invis=not invis invis=not invis
elseif key=="w"then
fast=not fast
end end
end end
end end
function scene.mouseDown(x,y,k) local function touch(x,y)
if k==1 or k==2 or not k then x=int((x-field.x)/field.w*field.c+1)
x=int((x-field.x)/field.w*field.c+1) y=int((y-field.y)/field.h*field.r+1)
y=int((y-field.y)/field.h*field.r+1) tap(x,y)
touch(x,y)
end
end
function scene.mouseMove(x,y)
if fast then
scene.mouseDown(x,y)
end
end
function scene.touchDown(x,y)
scene.mouseDown(x,y,1)
end
function scene.touchMove(x,y)
if fast then
scene.mouseDown(x,y)
end
end end
function scene.mouseDown(x,y,k)if k==1 or k==2 or not k then touch(x,y)end end
function scene.mouseMove(x,y)if(msIsDown(1)or kbIsDown("z","x"))then touch(x,y)end end
function scene.touchDown(x,y)touch(x,y)end
function scene.touchMove(x,y)touch(x,y)end
function scene.update(dt) function scene.update(dt)
if state==1 then if state==1 then
@@ -325,7 +336,7 @@ function scene.draw()
if state==2 then if state==2 then
--Draw no-setting area --Draw no-setting area
gc.setColor(1,0,0,.3) gc.setColor(1,0,0,.3)
gc.rectangle('fill',15,295,285,250) gc.rectangle('fill',0,100,155,80)
gc.setColor(.9,.9,0)--win gc.setColor(.9,.9,0)--win
elseif state==1 then elseif state==1 then
@@ -346,7 +357,7 @@ function scene.draw()
--Combo Rectangle --Combo Rectangle
if comboTime>0 then if comboTime>0 then
local r=36*comboTime^.3 local r=32*comboTime^.3
gc.setColor(1,1,1,min(.6+comboTime,1)*.25) gc.setColor(1,1,1,min(.6+comboTime,1)*.25)
gc.rectangle('fill',1205-r,400-r,2*r,2*r,2) gc.rectangle('fill',1205-r,400-r,2*r,2*r,2)
gc.setColor(1,1,1,min(.6+comboTime,1)) gc.setColor(1,1,1,min(.6+comboTime,1))
@@ -372,7 +383,6 @@ end
scene.widgetList={ scene.widgetList={
WIDGET.newButton{name="reset",x=80,y=60,w=120,h=60,color='lG',code=pressKey"r",hideF=function()return state==0 end}, WIDGET.newButton{name="reset",x=80,y=60,w=120,h=60,color='lG',code=pressKey"r",hideF=function()return state==0 end},
WIDGET.newSwitch{name="invis",x=100,y=140,disp=function()return invis end,code=pressKey"q",hideF=function()return state==1 end}, WIDGET.newSwitch{name="invis",x=100,y=140,disp=function()return invis end,code=pressKey"q",hideF=function()return state==1 end},
WIDGET.newSwitch{name="fast", x=100,y=210,disp=function()return fast end,code=pressKey"w",hideF=function()return state==1 end},
WIDGET.newButton{name="back",x=1210,y=670,w=100,h=60,fText=TEXTURE.back,code=pressKey"escape"}, WIDGET.newButton{name="back",x=1210,y=670,w=100,h=60,fText=TEXTURE.back,code=pressKey"escape"},
} }