创建python项目jump_weixin,新建python程序jump.py

需要4个辅助文件【adb.exe,AdbWinApi.dll,AdbWinUsbApi.dll,fastboot.exe】,放到项目根目录

辅助文件下载地址:链接:https://pan.baidu.com/s/1sljznFR 密码:gzeg

目录结构如下:

编辑jump.py:

import os
import numpy
import matplotlib.pyplot as plt
import PIL
from matplotlib.animation import FuncAnimation
import time

need_update = 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'))

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 300 400 300 400 {}'.format(int((distance * 1.35))))  # 按下的坐标,抬起的坐标,按压的时间
    global need_update
    need_update = True
    # time.sleep(1)

def on_click(event, coor=[]):
    # 参数event是点击的位置
    x, y = event.xdata, event.ydata  # 刚刚点击的坐标
    coor.append((x, y))  # 把一次点击的坐标添加到列表
    if len(coor) == 2:  # 通过坐标的数量,判断当前是否点击了两次
        # jump_to_next(coor[0],coor[1])
        # coor=[]
        # 用列表的pop代替上面的方法
        jump_to_next(coor.pop(), coor.pop())

def update_screen(frames):
    global need_update
    if need_update:
        time.sleep(1)
        axes_image.set_array(get_screen_image())
        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_click)  # 绑定鼠标事件
ani = FuncAnimation(figure, update_screen, interval=300, blit=True)
plt.show()  # 显示

执行时,需要将手机调成开启USB调试模式,打开微信跳一跳界面,用手机数据线连接电脑。

执行方式:打开命令行工具cmd,进入jump_weixin项目目录,执行python jump.py

会弹出如下图形程序,用鼠标点击开始点与结束点,等待图片刷新后,再次点击开始点与结束点。

好了,大致就是这样了,

看看我刷的(第三的是我,我不是朋友圈里唯一刷分的,强中自有强中手):

是不是瞬间失去了游戏的乐趣?

补充:

C:\Users\lcg>pip install numpy
Collecting numpy
  Downloading numpy--cp36-none-win_amd64.whl (.4MB)
    % |████████████████████████████████| .4MB 75kB/s
Installing collected packages: numpy
Successfully installed numpy-

C:\Users\lcg>pip install matplotlib
Collecting matplotlib
  Downloading matplotlib--cp36-cp36m-win_amd64.whl (.7MB)
    % |████████████████████████████████| .7MB 55kB/s
Collecting six>=1.10 (from matplotlib)
  Downloading six--py2.py3-none-any.whl
Requirement already satisfied: numpy>= in c:\python36\lib\site-packages (from matplotlib)
Collecting pyparsing!=,!=,!=,>= (from matplotlib)
  Downloading pyparsing--py2.py3-none-any.whl (56kB)
    % |████████████████████████████████| 61kB 58kB/s
Collecting python-dateutil>=2.0 (from matplotlib)
  Downloading python_dateutil--py2.py3-none-any.whl (194kB)
    % |████████████████████████████████| 194kB 141kB/s
Requirement already satisfied: pytz in c:\python36\lib\site-packages (from matplotlib)
Collecting cycler>=0.10 (from matplotlib)
  Downloading cycler--py2.py3-none-any.whl
Installing collected packages: six, pyparsing, python-dateutil, cycler, matplotlib
Successfully installed cycler- matplotlib- pyparsing- python-dateutil- six-

C:\Users\lcg>pip install pillow
Collecting pillow
  Downloading Pillow--cp36-cp36m-win_amd64.whl (.6MB)
    % |████████████████████████████████| .6MB 199kB/s
Installing collected packages: pillow
Successfully installed pillow-

外部库的安装

利用Python玩微信跳一跳的更多相关文章

  1. Python 帮你玩微信跳一跳 GitHub Python脚本

    前言想自己搞游戏小程序的 在github 有人已经利用 python程序, 通过adb 获取不同型号安卓手机的系统截图,然后通过计算小人与目标位置距离之后得到准确的触摸时间,再通过 开发者模式里的 a ...

  2. Python操作微信跳一跳

    “跳一跳”这个东西还是今天刚接触到的,看到了python群中有人再问“微信跳一跳的外挂有人写了没”,“早就有了”,“github”,“等着出个更详细的教程教程没看懂,主要没有用过adb”. 不过没关系 ...

  3. Python版本微信跳一跳,软件配置

    一.安装python3的环境: 直接从python官方网站下载python3的安装包,直接安装. 记得将python3放到PATH环境变量中,安装的过程中在该配置地方打钩就可以了. 如果安装的过程中出 ...

  4. 【辅助工具】Python实现微信跳一跳

    最近迷上了微信跳一跳小游戏,正好也看到知乎上有大神分享了技术贴,我也参考了好多资料,原理就是通过abd命令截取图片,python计算两个点距离,然后转化按压时间,让电脑来完成游戏.我花了很长时间才把程 ...

  5. 教你用.Net来玩微信跳一跳

    目前开发的所有代码都已经上传到了GitHub.欢迎大家来Star https://github.com/GiantLiu/AutoJump 目前程序分为“全自动版本”和“半自动版本” 全自动版本 We ...

  6. 用Python来玩微信跳一跳

    微信2017年12月28日发布了新版本,在小程序里面有一个跳一跳小游戏,试着点一点玩了下.第二天刚好在一篇技术公众号中,看到有大神用Python代码计算出按压时间,向手机发送android adb命令 ...

  7. 使用python编写微信跳一跳的自动脚本

    实现思路: 调用adb命令,截图 寻找小小人的底部中心点role(从下到上扫描,直到找到小小人相同像素的点,至于小小人像素点rgb是什么,可以使用photoshop查看) 寻找棋盘最高点top,然后寻 ...

  8. 微信跳一跳辅助自动跳Python

    一.说明 此代码借鉴github一位大神所写,已经做了简化合并处理,如果能成功连上手机并运行,可以实现程序自动玩游戏,刷个1000+的分数轻轻松松 github源码地址 https://github. ...

  9. 微信跳一跳,Python辅助自动跳程序

    一.说明 此代码借鉴一位大神提供在gitHub上的源码,已经做了简化合并处理,成功连上手机并运行后,可实现自动玩微信跳一跳游戏,刷个1000+的分数轻轻松松 github源码地址 https://gi ...

随机推荐

  1. sql Server中临时表与数据表的区别

    sql server 中临时表与数据表的区别 1.如何判断临时表和数据表已生成 --如何判断临时表是否已创建--- if exists(select * from tempdb..sysobjects ...

  2. Openwrt Udev Configure(3)

    1      Scope of Document This document describes how to write udev script, when enum usb device mayb ...

  3. mongodb的capped Collection集合

    db.createCollection(name, {capped: true, autoIndexId: true, size: 1000, max :100} ) name:集合的名字 cappe ...

  4. sgu106.The equation 拓展欧几里得 难度:0

    106. The equation time limit per test: 0.25 sec. memory limit per test: 4096 KB There is an equation ...

  5. oracle多表查询之内连接,外连接语句总结

    后期会补充建表语句. 现有两张表,westemp员工表,有(wtdempid,wtdempname,wtddeptid)列,westdept部门表,有(wtddeptid,wtddeptname,wt ...

  6. Superset 制作图表

    参考资料: http://lxw1234.com/archives/2018/03/904.htm https://wenku.baidu.com/view/49ffdf8b77eeaeaad1f34 ...

  7. mongo长连接

    php mongoclient默认都是长连接 mongo close方法可以关闭长连接 redis,mysql 短连接和长连接可选 他们的close方法都不可以关闭长连接

  8. C++11标准的类型别名

    1.typedef 类型名  类型别名(类型别名列表):这是传统的C++类型别名声明. 2.C++11标准下,使用using,即using 类型别名=类型名.

  9. L238

    Betty was offended because she felt that her friends had ignored her purposefully(deliberately) at t ...

  10. jquery 中事件

    jQuery 事件 - submit() 方法 定义和用法 当提交表单时,会发生 submit 事件. 该事件只适用于表单元素. submit() 方法触发 submit 事件,或规定当发生 subm ...