From 31e8ad6e0a188b38f4bd6b78b6bb92a4bbb7d178 Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Wed, 24 Feb 2021 17:18:32 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=BC=80=E4=BA=86=E6=8C=89?= =?UTF-8?q?=E9=94=AE=E8=B7=9F=E8=B8=AA=E5=90=8E=E5=9B=9E=E6=94=BE=E5=BD=95?= =?UTF-8?q?=E5=83=8F=E4=BC=9A=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- parts/gametoolfunc.lua | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/parts/gametoolfunc.lua b/parts/gametoolfunc.lua index 2e4a997e..f3ee21e9 100644 --- a/parts/gametoolfunc.lua +++ b/parts/gametoolfunc.lua @@ -426,29 +426,32 @@ function pressVirtualkey(t,x,y) local B=VK[t] B.isDown=true B.pressTime=10 - if SETTING.VKTrack then - --Auto follow - local O=VK_org[t] - local _FW,_CW=SETTING.VKTchW,1-SETTING.VKCurW - local _OW=1-_FW-_CW - --(finger+current+origin) - B.x=x*_FW+B.x*_CW+O.x*_OW - B.y=y*_FW+B.y*_CW+O.y*_OW - --Button collision (not accurate) - if SETTING.VKDodge then - for i=1,#VK do - local b=VK[i] - local d=B.r+b.r-((B.x-b.x)^2+(B.y-b.y)^2)^.5--Hit depth(Neg means distance) - if d>0 then - b.x=b.x+(b.x-B.x)*d*b.r*6.2e-5 - b.y=b.y+(b.y-B.y)*d*b.r*6.2e-5 + if x then + if SETTING.VKTrack then + --Auto follow + local O=VK_org[t] + local _FW,_CW=SETTING.VKTchW,1-SETTING.VKCurW + local _OW=1-_FW-_CW + --(finger+current+origin) + B.x=x*_FW+B.x*_CW+O.x*_OW + B.y=y*_FW+B.y*_CW+O.y*_OW + + --Button collision (not accurate) + if SETTING.VKDodge then + for i=1,#VK do + local b=VK[i] + local d=B.r+b.r-((B.x-b.x)^2+(B.y-b.y)^2)^.5--Hit depth(Neg means distance) + if d>0 then + b.x=b.x+(b.x-B.x)*d*b.r*6.2e-5 + b.y=b.y+(b.y-B.y)*d*b.r*6.2e-5 + end end end end + SFX.play("virtualKey",SETTING.VKSFX) + VIB(SETTING.VKVIB) end - SFX.play("virtualKey",SETTING.VKSFX) - VIB(SETTING.VKVIB) end function updateVirtualkey() if SETTING.VKSwitch then