您好,登錄后才能下訂單哦!
這篇文章主要介紹如何使用python實現(xiàn)微信跳一跳輔助,文中介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們一定要看完!
具體內(nèi)容如下
這是一個 2.5D 插畫風格的益智游戲,玩家可以通過按壓屏幕時間的長短來控制這個「小人」跳躍的距離??赡軇傞_始上手的時候,因為時間距離之間的關系把握不恰當,只能跳出幾個就掉到了臺子下面。
玩法類似于《flappy bird》
下載github的一個程序,但是在windows10下不能運行,原因是windows10下沒有copy命令了,修改為Python自帶的復制方法,即可完成。今天運行好像一開始不能正確跳第一次,人工輔助后,后續(xù)的跳的很好。
部分代碼:
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 = 按鍵時長 # 此數(shù)據(jù)是 iPhoneX 的推薦系數(shù),可根據(jù)手機型號進行調(diào)整 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實現(xiàn)微信跳一跳輔助”這篇文章的所有內(nèi)容,感謝各位的閱讀!希望分享的內(nèi)容對大家有幫助,更多相關知識,歡迎關注億速云行業(yè)資訊頻道!
免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權內(nèi)容。