微调两个小程序的返回按钮功能,修复移动端触屏无法退出dropper

This commit is contained in:
MrZ626
2021-03-14 21:38:14 +08:00
parent 3e25f9c1d7
commit 32b75cbec3
2 changed files with 26 additions and 38 deletions

View File

@@ -61,22 +61,12 @@ function scene.keyDown(key)
state="move" state="move"
end end
elseif key=="escape"then elseif key=="escape"then
if state=="menu"or state=="dead"then SCN.back()
SCN.back()
else
move.x,move.y,move.l=1e99,0,0
highScore=max(score,highScore)
highFloor=max(floor,floor)
SFX.play("lose")
state="dead"
end
end end
end end
function scene.mouseDown(k) function scene.mouseDown(_,_,k)
if k==1 then if k==1 then
scene.keyDown("space") scene.keyDown("space")
elseif k==2 then
scene.keyDown("escape")
end end
end end
function scene.touchDown() function scene.touchDown()

View File

@@ -47,34 +47,32 @@ end
function scene.keyDown(k) function scene.keyDown(k)
if k=="escape"then if k=="escape"then
SCN.back() SCN.back()
else elseif k=="space"then
if state==0 then--main
end if timer==0 then
if k~="space"then return end state=1
if state==0 then--main end
if timer==0 then elseif state==3 then--play
state=1 local c=(math.floor((pos-ang)*side/tau)-1)%side+1
end if hit[c]==0 then
elseif state==3 then--play hit[c]=1
local c=(math.floor((pos-ang)*side/tau)-1)%side+1 count=count+1
if hit[c]==0 then SFX.play(side<26 and"ren_"..rnd(5)or"ren_"..rnd(6,11))
hit[c]=1 if count>=12 then
count=count+1 SFX.play("ren_mega",(count-11)/15)
SFX.play(side<26 and"ren_"..rnd(5)or"ren_"..rnd(6,11)) end
if count>=12 then if count==side then
SFX.play("ren_mega",(count-11)/15) state=1
end SFX.play("spin_0")
if count==side then else
SFX.play("lock")
end
else
hit[c]=2
SFX.play("emit")
needReset=true
state=1 state=1
SFX.play("spin_0")
else
SFX.play("lock")
end end
else
hit[c]=2
SFX.play("emit")
needReset=true
state=1
end end
end end
end end