温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

如何使用python实现微信跳一跳辅助

发布时间:2021-08-02 09:50:07 来源:亿速云 阅读:123 作者:小新 栏目:开发技术

这篇文章主要介绍如何使用python实现微信跳一跳辅助,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!

具体内容如下

这是一个 2.5D 插画风格的益智游戏,玩家可以通过按压屏幕时间的长短来控制这个「小人」跳跃的距离。可能刚开始上手的时候,因为时间距离之间的关系把握不恰当,只能跳出几个就掉到了台子下面。
玩法类似于《flappy bird》

下载github的一个程序,但是在windows10下不能运行,原因是windows10下没有copy命令了,修改为Python自带的复制方法,即可完成。今天运行好像一开始不能正确跳第一次,人工辅助后,后续的跳的很好。

部分代码:

wechat_jump_iOS_py3.py

import wda
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from PIL import Image
import math
import time
import os

# 截图距离 * time_coefficient = 按键时长
# 此数据是 iPhoneX 的推荐系数,可根据手机型号进行调整
time_coefficient = 0.00125

c = wda.Client()
s = c.session()

def pull_screenshot():
 c.screenshot('1.png')

def jump(distance):
 press_time = distance * time_coefficient
 press_time = press_time
 print(press_time)
 s.tap_hold(200,200,press_time)

fig = plt.figure()
index = 0
cor = [0, 0]
pull_screenshot()
img = np.array(Image.open('1.png'))

update = True
click_count = 0
cor = []

def update_data():
 return np.array(Image.open('1.png'))

im = plt.imshow(img, animated=True)

def updatefig(*args):
 global update
 if update:
 time.sleep(1)
 pull_screenshot()
 im.set_array(update_data())
 update = False
 return im,

def onClick(event):
 global update
 global ix, iy
 global click_count
 global cor

 # next screenshot
 ix, iy = event.xdata, event.ydata
 coords = []
 coords.append((ix, iy))
 print('now = ', coords)
 cor.append(coords)


 click_count += 1
 if click_count > 1:
 click_count = 0

 cor1 = cor.pop()
 cor2 = cor.pop()

 distance = (cor1[0][0] - cor2[0][0])**2 + (cor1[0][1] - cor2[0][1])**2
 distance = distance ** 0.5
 print('distance = ', distance)
 jump(distance)
 update = True

fig.canvas.mpl_connect('button_press_event', onClick)
ani = animation.FuncAnimation(fig, updatefig, interval=50, blit=True)
plt.show()

wechat_jump_py3.py

import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from PIL import Image
import math
import time
import os

def pull_screenshot():
 os.system('adb shell screencap -p /sdcard/1.png')
 os.system('adb pull /sdcard/1.png .')

def jump(distance):
 press_time = distance * 1.35
 press_time = int(press_time)
 cmd = 'adb shell input swipe 320 410 320 410 ' + str(press_time)
 print(cmd)
 os.system(cmd)

fig = plt.figure()
index = 0
cor = [0, 0]

pull_screenshot()
img = np.array(Image.open('1.png'))

update = True 
click_count = 0
cor = []

def update_data():
 return np.array(Image.open('1.png'))

im = plt.imshow(img, animated=True)


def updatefig(*args):
 global update
 if update:
 time.sleep(1.5)
 pull_screenshot()
 im.set_array(update_data())
 update = False
 return im,

def onClick(event): 
 global update 
 global ix, iy
 global click_count
 global cor

 # next screenshot
 
 ix, iy = event.xdata, event.ydata
 coords = []
 coords.append((ix, iy))
 print('now = ', coords)
 cor.append(coords)
 

 click_count += 1
 if click_count > 1:
 click_count = 0
 
 cor1 = cor.pop()
 cor2 = cor.pop()

 distance = (cor1[0][0] - cor2[0][0])**2 + (cor1[0][1] - cor2[0][1])**2 
 distance = distance ** 0.5
 print('distance = ', distance)
 jump(distance)
 update = True
 


fig.canvas.mpl_connect('button_press_event', onClick)
ani = animation.FuncAnimation(fig, updatefig, interval=50, blit=True)
plt.show()

以上是“如何使用python实现微信跳一跳辅助”这篇文章的所有内容,感谢各位的阅读!希望分享的内容对大家有帮助,更多相关知识,欢迎关注亿速云行业资讯频道!

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI