小游戏ten增加竞速开关,操作更灵活并且延迟更小
This commit is contained in:
@@ -639,6 +639,7 @@ return{
|
|||||||
reset="Reset",
|
reset="Reset",
|
||||||
next="Next",
|
next="Next",
|
||||||
blind="Blind",
|
blind="Blind",
|
||||||
|
fast="Fast",
|
||||||
},
|
},
|
||||||
mg_dtw={
|
mg_dtw={
|
||||||
reset="Reset",
|
reset="Reset",
|
||||||
|
|||||||
@@ -549,6 +549,7 @@ return{
|
|||||||
reset="Réinitialiser",
|
reset="Réinitialiser",
|
||||||
next="Prévisualisations",
|
next="Prévisualisations",
|
||||||
blind="Aveugler",
|
blind="Aveugler",
|
||||||
|
-- fast="Fast",
|
||||||
},
|
},
|
||||||
mg_dtw={
|
mg_dtw={
|
||||||
reset="Réinitialiser",
|
reset="Réinitialiser",
|
||||||
|
|||||||
@@ -638,6 +638,7 @@ return{
|
|||||||
reset="Resetar",
|
reset="Resetar",
|
||||||
next="Próxima",
|
next="Próxima",
|
||||||
blind="Cego",
|
blind="Cego",
|
||||||
|
-- fast="Fast",
|
||||||
},
|
},
|
||||||
mg_dtw={
|
mg_dtw={
|
||||||
reset="Resetar",
|
reset="Resetar",
|
||||||
|
|||||||
@@ -555,6 +555,7 @@ return{
|
|||||||
reset="Reiniciar",
|
reset="Reiniciar",
|
||||||
next="Siguiente",
|
next="Siguiente",
|
||||||
blind="A ciegas",
|
blind="A ciegas",
|
||||||
|
-- fast="Fast",
|
||||||
},
|
},
|
||||||
mg_dtw={
|
mg_dtw={
|
||||||
reset="Reiniciar",
|
reset="Reiniciar",
|
||||||
|
|||||||
@@ -482,6 +482,7 @@ return{
|
|||||||
reset="R",
|
reset="R",
|
||||||
next="→",
|
next="→",
|
||||||
blind="???",
|
blind="???",
|
||||||
|
fast="~~→",
|
||||||
},
|
},
|
||||||
mg_dtw={
|
mg_dtw={
|
||||||
reset="R",
|
reset="R",
|
||||||
|
|||||||
@@ -641,6 +641,7 @@ return{
|
|||||||
reset="重置",
|
reset="重置",
|
||||||
next="预览",
|
next="预览",
|
||||||
blind="盲打",
|
blind="盲打",
|
||||||
|
fast="速打",
|
||||||
},
|
},
|
||||||
mg_dtw={
|
mg_dtw={
|
||||||
reset="重置",
|
reset="重置",
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
local gc=love.graphics
|
local gc=love.graphics
|
||||||
|
local msIsDown,kbIsDown,tcTouches=love.mouse.isDown,love.keyboard.isDown,love.touch.getTouches
|
||||||
local setColor,rectangle=gc.setColor,gc.rectangle
|
local setColor,rectangle=gc.setColor,gc.rectangle
|
||||||
|
|
||||||
local int,rnd=math.floor,math.random
|
local int,rnd=math.floor,math.random
|
||||||
@@ -33,6 +34,7 @@ local score
|
|||||||
|
|
||||||
local nexts
|
local nexts
|
||||||
local blind
|
local blind
|
||||||
|
local fast
|
||||||
|
|
||||||
local function reset()
|
local function reset()
|
||||||
progress={}
|
progress={}
|
||||||
@@ -110,7 +112,7 @@ local function merge()
|
|||||||
"spin_0"
|
"spin_0"
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
fallingTimer=15
|
fallingTimer=fast and 8 or 12
|
||||||
else
|
else
|
||||||
board[cy][cx]=chosen
|
board[cy][cx]=chosen
|
||||||
end
|
end
|
||||||
@@ -143,6 +145,10 @@ function scene.keyDown(key)
|
|||||||
if state==0 then
|
if state==0 then
|
||||||
blind=not blind
|
blind=not blind
|
||||||
end
|
end
|
||||||
|
elseif key=="e"then
|
||||||
|
if state==0 then
|
||||||
|
fast=not fast
|
||||||
|
end
|
||||||
elseif key=="escape"then
|
elseif key=="escape"then
|
||||||
SCN.back()
|
SCN.back()
|
||||||
end
|
end
|
||||||
@@ -156,9 +162,11 @@ function scene.mouseDown(x,y)
|
|||||||
merge()
|
merge()
|
||||||
end
|
end
|
||||||
|
|
||||||
scene.touchDown=scene.mouseMove
|
|
||||||
scene.touchMove=scene.mouseMove
|
scene.touchMove=scene.mouseMove
|
||||||
scene.touchClick=scene.mouseDown
|
scene.touchDown=scene.mouseMove
|
||||||
|
function scene.touchClick(x,y)
|
||||||
|
scene.mouseDown(x,y)
|
||||||
|
end
|
||||||
|
|
||||||
function scene.update()
|
function scene.update()
|
||||||
if state==1 then
|
if state==1 then
|
||||||
@@ -193,10 +201,16 @@ function scene.update()
|
|||||||
state=2
|
state=2
|
||||||
SFX.play("fail")
|
SFX.play("fail")
|
||||||
else
|
else
|
||||||
fallingTimer=6
|
fallingTimer=fast and 4 or 5
|
||||||
SFX.play("move")
|
SFX.play("move")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
elseif fast and(
|
||||||
|
msIsDown(1)or
|
||||||
|
#tcTouches()>0 or
|
||||||
|
kbIsDown("space")
|
||||||
|
)then
|
||||||
|
merge()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -231,7 +245,7 @@ function scene.draw()
|
|||||||
if state==2 then
|
if state==2 then
|
||||||
--Draw no-setting area
|
--Draw no-setting area
|
||||||
setColor(1,0,0,.3)
|
setColor(1,0,0,.3)
|
||||||
rectangle("fill",15,245,285,140)
|
rectangle("fill",15,200,285,210)
|
||||||
end
|
end
|
||||||
gc.setLineWidth(10)
|
gc.setLineWidth(10)
|
||||||
setColor(1,1,1)
|
setColor(1,1,1)
|
||||||
@@ -274,8 +288,9 @@ end
|
|||||||
|
|
||||||
scene.widgetList={
|
scene.widgetList={
|
||||||
WIDGET.newButton{name="reset", x=160,y=100,w=180,h=100,color="lGreen",font=40,code=pressKey"r"},
|
WIDGET.newButton{name="reset", x=160,y=100,w=180,h=100,color="lGreen",font=40,code=pressKey"r"},
|
||||||
WIDGET.newSwitch{name="next", x=240,y=280,font=40,disp=function()return nexts end,code=pressKey"q",hide=function()return state==1 end},
|
WIDGET.newSwitch{name="next", x=240,y=235,font=40,disp=function()return nexts end,code=pressKey"q",hide=function()return state==1 end},
|
||||||
WIDGET.newSwitch{name="blind", x=240,y=350,font=40,disp=function()return blind end,code=pressKey"w",hide=function()return state==1 end},
|
WIDGET.newSwitch{name="blind", x=240,y=305,font=40,disp=function()return blind end,code=pressKey"w",hide=function()return state==1 end},
|
||||||
|
WIDGET.newSwitch{name="fast", x=240,y=375,font=30,disp=function()return fast end,code=pressKey"e",hide=function()return state==1 end},
|
||||||
WIDGET.newButton{name="back", x=1140,y=640,w=170,h=80,font=40,code=backScene},
|
WIDGET.newButton{name="back", x=1140,y=640,w=170,h=80,font=40,code=backScene},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user