国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 編程 > Python > 正文

微信跳一跳輔助python代碼實(shí)現(xiàn)

2020-02-16 11:28:33
字體:
供稿:網(wǎng)友

微信跳一跳輔助的python具體實(shí)現(xiàn)代碼,供大家參考,具體內(nèi)容如下

這是一個(gè) 2.5D 插畫風(fēng)格的益智游戲,玩家可以通過按壓屏幕時(shí)間的長(zhǎng)短來控制這個(gè)「小人」跳躍的距離。可能剛開始上手的時(shí)候,因?yàn)闀r(shí)間距離之間的關(guān)系把握不恰當(dāng),只能跳出幾個(gè)就掉到了臺(tái)子下面。
玩法類似于《flappy bird》

下載github的一個(gè)程序,但是在windows10下不能運(yùn)行,原因是windows10下沒有copy命令了,修改為Python自帶的復(fù)制方法,即可完成。今天運(yùn)行好像一開始不能正確跳第一次,人工輔助后,后續(xù)的跳的很好。

部分代碼:

wechat_jump_iOS_py3.py

import wdaimport numpy as npimport matplotlib.pyplot as pltimport matplotlib.animation as animationfrom PIL import Imageimport mathimport timeimport os# 截圖距離 * time_coefficient = 按鍵時(shí)長(zhǎng)# 此數(shù)據(jù)是 iPhoneX 的推薦系數(shù),可根據(jù)手機(jī)型號(hào)進(jìn)行調(diào)整time_coefficient = 0.00125c = 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 = 0cor = [0, 0]pull_screenshot()img = np.array(Image.open('1.png'))update = Trueclick_count = 0cor = []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 = Truefig.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 npimport matplotlib.pyplot as pltimport matplotlib.animation as animationfrom PIL import Imageimport mathimport timeimport osdef 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 = 0cor = [0, 0]pull_screenshot()img = np.array(Image.open('1.png'))update = True click_count = 0cor = []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()            
發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 清镇市| 秭归县| 呼伦贝尔市| 英德市| 宁德市| 龙门县| 望江县| 昔阳县| 阳城县| 洛浦县| 景东| 隆昌县| 全南县| 巴彦县| 乐业县| 新余市| 韩城市| 铁岭市| 武冈市| 阿拉善左旗| 响水县| 汉中市| 延吉市| 瑞昌市| 太仆寺旗| 崇仁县| 连州市| 吉林市| 红河县| 凯里市| 枣强县| 潞西市| 驻马店市| 梨树县| 上高县| 老河口市| 渭南市| 北流市| 天峨县| 新邵县| 丰县|