python版微信跳一跳遊戲輔助,python版輔助

來源:互聯網
上載者:User

python版跳一跳遊戲輔助,python版輔助

本文執行個體為大家分享了跳一跳遊戲輔助python代碼,供大家參考,具體內容如下

import osimport PILimport numpyimport matplotlibmatplotlib.use('TKAgg')import matplotlib.pyplot as pltimport timefrom matplotlib.animation import FuncAnimation# 是否需要進行圖片更新need_update = Truedef get_screen_image(): # 截取手機當前圖片 os.system('adb shell screencap -p /sdcard/screen.png') # 拉取到PC端 os.system('adb pull /sdcard/screen.png') # 將映像轉成數組返回 return numpy.array(PIL.Image.open('screen.png'))def jump_to_next(point1, point2): x1, y1 = point1; x2, y2 = point2 distance = ((x2 - x1) ** 2 + (y2 - y1) ** 2) ** 0.5 # 計算按壓指令和按壓時間長度 os.system("adb shell input touchscreen swipe 320 410 320 410 %d" % (distance * 1.35))def on_clack(event, coor=[]): global need_update coor.append((event.xdata, event.ydata)) if len(coor) == 2: # 執行跳步指令 jump_to_next(coor.pop(), coor.pop()) # 進行圖片重新整理 need_update = Truedef update_screen(frame): global need_update if need_update: time.sleep(2) axes_image.set_array(get_screen_image()) # 已重新整理,設定為false need_update = False return axes_image,figure = plt.figure()axes_image = plt.imshow(get_screen_image(), animated=True)figure.canvas.mpl_connect('button_press_event', on_clack)# 定時更新ani = FuncAnimation(figure, update_screen, interval=50, blit=True)plt.show()

更多內容大家可以參考專題《跳一跳》進行學習。

以上就是本文的全部內容,希望對大家的學習有所協助,也希望大家多多支援幫客之家。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.