当前位置:网站首页>跳一跳小游戏辅助(手动版本)py代码实现
跳一跳小游戏辅助(手动版本)py代码实现
2022-06-25 18:19:00 【幻丶城】
核心思路就是一个勾股定理的作用。通过2次计算完成跳跃,这些包我都打了注释。。。怎么安装,包安装方法 pip install 包名字,包安装完成就是adb。。百度安装。。配置环境变量。。。注意:单纯研究游戏原理。和练习py才写的,切勿滥用。否则后果自负。
#!/usr/bin/python
#-*-coding:utf-8 -*-
#FileName:wechat_main.py
#Author:gjt
#Date:2018/1/6 20:45
#os模块包含普通操作系统的功能
import os
#是python image library的缩写,,图像处理模块 numpy是python的一个科学计算库
import PIL,numpy
#matplotlib绘制直线,第二个矩形区域,Pyplot绘图
import matplotlib.pyplot as plt
#自定义动画函数
from matplotlib.animation import FuncAnimation
#py的时间模块
import time
need_updata = True
#获取手机截屏
def get_screen_image():
os.system('adb shell screencap -p /sdcard/screen.png') #获取当前手机目录截屏
os.system('adb pull /sdcard/screen.png') #下载当前截图到电脑上
return numpy.array(PIL.Image.open('screen.png')) #image需要大写。
#计算弦长
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 swipe 320 410 320 410 {}'.format(int(distance*1.35)))
#绑定鼠标的单击事件
def on_click(event,coor=[]):
global need_updata
coor.append((event.xdata,event.ydata))
if len(coor)==2:
jump_to_next(coor.pop(),coor.pop())
need_updata = True
#重新绘制图片
def updata_screen(frame):
global need_updata
if need_updata:
time.sleep(1)
axes_image.set_array(get_screen_image())
need_updata = False
return axes_image,
figure = plt.figure()#创建一个空白区域(设置图片对象)生成一张图片
axes_image = plt.imshow(get_screen_image(),animated = True); #把图片拿到
figure.canvas.mpl_connect('button_press_event',on_click)
ani = FuncAnimation(figure,updata_screen,interval=5,blit=True)
plt.show() #展示出来 边栏推荐
- Boiled peanuts
- 【深入理解TcaplusDB技术】TcaplusDB运维单据
- Some recursive and iterative problem solving ideas of binary tree (clear and easy to understand)
- QT中QString包含“\u0000“的处理方式
- RMAN backup database_ Manage backup window
- 158_模型_Power BI 使用 DAX + SVG 打通制作商業圖錶幾乎所有可能
- [in depth understanding of tcapulusdb technology] tcapulusdb operation and maintenance
- . How to exit net worker service gracefully
- JVM problem replication
- Install spark + run Scala related projects with commands + crontab scheduled execution
猜你喜欢

Optimization of lazyagg query rewriting in parsing data warehouse

LeetCode力扣(剑指offer 26-30)26. 树的子结构 27. 二叉树的镜像 28. 对称的二叉树 29. 顺时针打印矩阵 30. 包含min函数的栈
![[in depth understanding of tcapulusdb technology] new models of tcapulusdb](/img/10/f94a5e1ebeaa803c754dd77351950f.png)
[in depth understanding of tcapulusdb technology] new models of tcapulusdb
![[deeply understand tcapulusdb technology] tmonitor module architecture](/img/82/24a8502604fccb89fea9963c3f3495.png)
[deeply understand tcapulusdb technology] tmonitor module architecture

【深入理解TcaplusDB技术】 Tmonitor模块架构

Addition, deletion, modification and query of mysql~ tables (detailed and easy to understand)

anaconda下载清华源

【深入理解TcaplusDB技術】TcaplusDB業務數據備份

Chapter 4:win10 installing mingw64

【深入理解TcaplusDB技术】集群管理操作
随机推荐
RMAN备份数据库_使用RMAN做拆分镜像(split mirror)备份
【深入理解TcaplusDB技术】单据受理之事务执行
05 virtual machine stack
正则表达式总结
Fixed frequency and voltage regulation scheme of Qi v1.2.4 protocol
将Graph Explorer搬上JupyterLab:使用GES4Jupyter连接GES并进行图探索
【深入理解TcaplusDB技术】TcaplusDB常规单据
Redis趋势—NVM内存
LeetCode 322. Change exchange & dynamic planning
RMAN备份数据库_目录
《痞子衡嵌入式半月刊》 第 57 期
Redis6
Trample hole record -- a series of coincidences caused by thread pool rejection policy
Some recursive and iterative problem solving ideas of binary tree (clear and easy to understand)
【ELT.ZIP】OpenHarmony啃论文俱乐部—见证文件压缩系统EROFS
158_模型_Power BI 使用 DAX + SVG 打通制作商业图表几乎所有可能
Detailed explanation of route add command
1. Understanding of norm
【深入理解TcaplusDB技术】Tmonitor系统升级
[in depth understanding of tcapulusdb technology] business guide for creating doc acceptance