Git Product home page Git Product logo

wechat_jump_game's Introduction

教你用Python来玩微信跳一跳

2017年12月28日下午,微信发布了 6.6.1 版本,加入了「小游戏」功能,并提供了官方 demo「跳一跳」。

https://wangshub.github.io

项目地址

游戏模式

这是一个 2.5D 插画风格的益智游戏,玩家可以通过按压屏幕时间的长短来控制这个「小人」跳跃的距离。可能刚开始上手的时候,因为时间距离之间的关系把握不恰当,只能跳出几个就掉到了台子下面。 玩法类似于《flappy bird》

如果能精确测量出起始和目标点之间测距离,就可以估计按压的时间来精确跳跃?所以花2个小时写了一个python脚本进行验证

希望不要把分数刷太高,容易没朋友的。。。

工具介绍

  • Python 2.7
  • Android 手机
  • Adb 驱动
  • Python Matplot绘图

原理说明

  1. 将手机点击到《跳一跳》小程序界面;
  2. 用Adb 工具获取当前手机截图,并用adb将截图pull上来
    adb shell screencap -p /sdcard/1.png
    adb pull /sdcard/1.png .
  1. 用matplot显示截图;
  2. 用鼠标点击起始点和目标位置,计算像素距离;
  3. 根据像素距离,计算按压时间;
  4. 用Adb工具点击屏幕蓄力一跳;
    adb shell input swipe x y x y time

实验结果

TODO

可以对拉上来的图片进行颜色分割,识别小人和目标中心店,这样就不需要手动点击自动弹跳。 事实证明,机器人比人更会玩儿游戏。

wechat_jump_game's People

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.