可以写脚本 实现游戏界面上的触摸滑动吗

发布于 2021-11-30 14:10:43

可以写脚本 实现游戏界面上的触摸滑动吗
还有可以获取触摸屏幕的坐标

查看更多

关注者
0
被浏览
599
2 个回答
Evan
Evan 认证专家 2021-12-06

使用vscode获取坐标

1043141712
1043141712 2022-06-06

函数:
function clickMove(x1, y1, x2, y2, n) ---滑动

local w = math.abs(x2 - x1)
local h = math.abs(y2 - y1)
touchDown(0, x1, y1)
mSleep(50)
if x1 < x2 then
    w1 = n
else
    w1 = -n
end
if y1 < y2 then
    h1 = n
else
    h1 = -n
end
if w >= h then
    for i = 1, w, n do
        x1 = x1 + w1
        if y1 == y2 then
        else
            y1 = y1 + math.ceil(h * h1 / w)
        end
        touchMove(0, x1, y1)
        mSleep(10)
    end
else
    for i = 1, h, n do
        y1 = y1 + h1
        if x1 == x2 then
        else
            x1 = x1 + math.ceil(w * w1 / h)
        end
        touchMove(0, x1, y1)
        mSleep(10)
    end
end
mSleep(50)
touchUp(0)

end
实例:
clickMove(100,100,200,200,5);--x1,y1为起始位置坐标,x2、y2为终点位置坐标,n是每次移动多少个像素

撰写答案

请登录后再发布答案,点击登录

发布
问题

分享
好友

手机
浏览

扫码手机浏览