Wechat_jump_game: 小米5用的默认参数刷了三次都是100左右,需要修改哪里的参数吗?

Created on 1 Jan 2018  ·  7Comments  ·  Source: wangshub/wechat_jump_game

小米5用的默认参数刷了三次都是100左右,需要修改哪里的参数吗?

Most helpful comment

我用的小米5默认参数,但是最后算出的结果每次跳在柱子边缘,直接在jump(math.sqrt((board_x - piece_x) * 2 + (board_y - piece_y) * 2)+40) 加了40距离,每次都能跳正中了

All 7 comments

命令行运行的时候会出现如下

(weChat) kiritodeMacBook-Pro:weChat kirito$ python wechat_jump_auto.py
Load config file from /Users/kirito/Documents/wechat_jump_game/weChat/config/1920x1080/config.json
如果你的脚本无法工作,上报issue时请copy如下信息:
**********        

关注一下你的load config file from的地址 修改那个地址下的文件的参数

参数需要参照什么来修改?

代码中的读取文件路径好像有点问题,我自己直接改成相对路径
{
"under_game_score_y": 300,
"press_coefficient": 1.475,
"piece_base_height_1_2": 20,
"piece_body_width": 80
}
def jump(distance):
tmp = 0
print("input distance:",distance)
if distance < 220:
tmp = 36
print("distance<220-------- temp ",tmp)
elif distance < 300:
tmp = 32
print("distance<300-------- temp ",tmp)
elif distance < 360:
tmp = 20
print("distance<360-------- temp:",tmp)
elif distance < 500:
tmp = 0

elif distance < 650:
    tmp = -7
    print("500<distance<650--------  temp:",tmp)
else:
    tmp = -10
    print("distance>650--------  temp:",tmp)  

distance = distance + tmp
print("distance : ", distance)
press_time = distance * press_coefficient
press_time = max(press_time, 200)   # 设置 200 ms 是最小的按压时间
press_time = int(press_time)
cmd = 'adb shell input swipe {x1} {y1} {x2} {y2} {duration}'.format(
    x1=swipe['x1'],
    y1=swipe['y1'],
    x2=swipe['x2'],
    y2=swipe['y2'],
    duration=press_time
)
print(cmd)
os.system(cmd)

由于按压系数与距离并不完全是正比 稍作调整 运气好的话可以无限刷
pull_screenshot()
im = Image.open('./autojump.png')
set_button_position(im)
设置点击位置放在这个位置可以不用配置初始位置 记得改下全局变量名字

你可以参考 #269 以及 #212

找到了。读的json文件是默认的1920*1080里面的,我把小米5对应的参数换进去貌似就好了

我用的小米5默认参数,但是最后算出的结果每次跳在柱子边缘,直接在jump(math.sqrt((board_x - piece_x) * 2 + (board_y - piece_y) * 2)+40) 加了40距离,每次都能跳正中了

@maoxianfei
对我的小米5也管用,之前一直跳得都短一些,加上40效果明显就好了。

Was this page helpful?
0 / 5 - 0 ratings