Wechat_jump_game: 附上python3 mac测试成功代码

Created on 29 Dec 2017  ·  34Comments  ·  Source: wangshub/wechat_jump_game

python2的库mac安装有问题
python3一切完美

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()
晒分晒参数

Most helpful comment

安装python3
安装引用库
pip3 install matplotlib
pip3 install Pillow
然后开始游戏
然后运行python3 wechat_jump.py
点击目标点击黑感叹号底部中心, done!

All 34 comments

安装python3
安装引用库
pip3 install matplotlib
pip3 install Pillow
然后开始游戏
然后运行python3 wechat_jump.py
点击目标点击黑感叹号底部中心, done!

我的 2.x 各种报错。按照你说的装 3 试一下看看

分辨率适配有点问题

成功了,根据我自己的手机调整了一下系数,现在刷到好友第一了。

@zhuweiyou 请问下,如何调整呢

@Fennay distance * 1.5 我改的 1.5 刚好符合我的手机。。你调整这个值,测试下就行了

@zhuweiyou
adb shell input swipe 320 410 320 410 509
3035 KB/s (31102 bytes in 0.010s)
卡这里了,已经修改为1.5
手机是红米3s,分辨率是1280*720
还会有别的影响吗...

@Fennay MIUI8之后的小米手机需要打开USB调试(安全调试)

可以的

MIX2参数设成1.4最佳😎

iPhone 只能看看,好想去秀秀

小米5s经过调试完美运行

所以这个到底怎么玩啊,求详细教程

有没有 纯小白教程?

坚果手机,把参数调整为:

adb shell input swipe 320 410 320 930

即可

@vuuihc 感谢,开启调试后,完美运行

@vuuihc 多谢老哥 红米手机已ok。

mac 上python3.6 onClick(event)函数没有被调用啊 大神 刚接触python

三星s7 edge系数调到1.05正好

有没有老哥告诉一声s8改成什么参数效果最佳

酷派大神F2 系数调为 1.98能到100多 😂
swipe值调为323 1057 323 1059可以无限重玩

没发现底部的黑色感叹号啊

@sqrtqiezi 我是坚果 Pro,调成这个参数发现也没用啊

多谢老哥,有一点点误差,2个小瓶子之间操作不好容易翻车

运行之后有两个错误
img =np.array(Image.open('1.png'))
还有FileNotFoundError: [Errno 2] No such file or directory: '1.png'

Traceback (most recent call last):
File "", line 1, in
NameError: name 'plt' is not defined

Traceback (most recent call last):
File "", line 1, in
NameError: name 'plt' is not defined 怎么板

raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8100): Max retries exceeded with url: /status (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 61] Connection refused',))

mac os下 python3.6

iPhone 7 plus跳一步之后界面刷新不完整,有大佬遇到过么,求解决方法。

赞赞赞~!

我的设备是 Mac,目前Mac+iPhone和Mac+Android 都成功了,大家可以参考下这篇文章:http://kuiblog.com/archives/402/

安装web的时候,运行会报缺少依赖库的问题,有遇见过得吗?

  1. 请使用最新版代码
  2. 使用adb免配置版本
  3. 使用最新版release app一键起跳https://github.com/wangshub/wechat_jump_game/releases
    下次请规范提交issue,谢谢
Was this page helpful?
0 / 5 - 0 ratings

Related issues

df71012 picture df71012  ·  6Comments

UsingMisz picture UsingMisz  ·  5Comments

mrmoll picture mrmoll  ·  8Comments

ameizi picture ameizi  ·  6Comments

lijinkun4089980 picture lijinkun4089980  ·  5Comments