From ba486b5de7450c38b525111268cbce0ff761f810 Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Sun, 15 Nov 2020 23:28:09 +0800 Subject: [PATCH] =?UTF-8?q?A=20to=20Z=E5=B0=8F=E6=B8=B8=E6=88=8F=E6=9B=B4?= =?UTF-8?q?=E9=9A=BE=E4=BD=9C=E5=BC=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- parts/scenes/AtoZ.lua | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/parts/scenes/AtoZ.lua b/parts/scenes/AtoZ.lua index 088e719a..cab664d0 100644 --- a/parts/scenes/AtoZ.lua +++ b/parts/scenes/AtoZ.lua @@ -26,19 +26,25 @@ function sceneInit.AtoZ() level="A_Z", target=levels.A_Z, count=1, + frameKeyCount=0, error=0, startTime=0, time=0, state=0, } + love.keyboard.setKeyRepeat(false) +end +function sceneBack.AtoZ() + love.keyboard.setKeyRepeat(true) end function keyDown.AtoZ(key) local S=sceneTemp if #key==1 then - if S.state<2 then + if S.state<2 and S.frameKeyCount<3 then if key:upper():byte()==S.target:byte(S.count)then S.count=S.count+1 + S.frameKeyCount=S.frameKeyCount+1 TEXT.show(key:upper(),rnd(320,960),rnd(100,240),90,"score",2.6) SFX.play("move") if S.count==2 then @@ -67,6 +73,7 @@ end function Tmr.AtoZ() local S=sceneTemp if S.state==1 then + S.frameKeyCount=0 S.time=Timer()-S.startTime end end