from the Internet some god code and ideas, write this place up click coordinates jump jump to play this game ideas

the whole idea of

and a piece where the next step to, according to the two coordinates to calculate the distance between two points of jump.


1, according to the order distribution method to obtain the initial map screenshot saved to the mobile phone, and then uploaded to a local folder,

2 will get into the new screenshots of axis (Matplotlib) in

3, through the mouse click access in the initial coordinates and point coordinates, and calculate the distance of

4 and

jump, jump after the empty coordinate and update the screenshots of

three, the related technologies used in

1, python3 or

module based on

2, numpy

3, matplotlib

4, python OS, ADB

5 module




__author__ = 'Zhou Yanbing' import OS import PIL, numpy import matplotlib.pyplot as PLT from matplotlib.animation import FuncAnimation I Mport time need_update = True get_screen_image (DEF # for mobile phone screenshot): os.system ('adb shell screencap -p /sdcard/screen.png') # mobile phone gets the current interface ('adb pull /sdcard/screen.png') os.system screenshot screenshot to # download the current folder under the current computer return numpy.array ( ('screen.png')) # to array # returns string length def jump_to_next calculation (point1, point2): x1, Y1 = point1; y2 = X2, point2 = distance ((x2-x1) + **2 (y2-y1) **2) **0.5 os.system ('adb # calculated the length of the string shell input swipe 320410320410 {}'.format (int (distance*1))) # bounce coefficient of vertical and horizontal screen press release left horizontal and vertical coordinates of the pressing time 1 2K def on_calck # binding mouse click event (event, coor=[]): # [(x, y), (X2, Y2 global need_update (coor.append)] ( Event.xdata, event.ydata)) # obtaining X and Y coordinates into the coor array in if len (coor) = 2: (coor.pop), jump_to_next (coor.pop) (#) access to the length and empty array need_update = True def update_screen calculation of the two coordinate (frame): Global need_update if need_update: # update pictures (1 time.sleep #) because the jump takes time so there need to sleep 1s, then to get the picture axes_image.set_array (get_screen_image) False return (need_update) = axes_image, figure = plt.figure (# Yuanzu return) # canvas axes_image = plt.imshow create a blank image object (get_screen_image) / (animated=True, #) to get the picture in the figure.canvas.mpl_connect axis ('button_press_event', on_calck) ani = FuncAnimation (figure, update_screen, Interval=50, blit=True) # canvas image update FuncAnimation 50 50ms (instantiated) # display coordinates

please click here for jump

source code

more content you can refer to special "WeChat jump" learning.

is the whole content of this article, I hope to help you, and hope that you can support a lot of scripting home.

This concludes the body part