Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. from PIL import ImageGrab, ImageOps
  2. from numpy import *
  3. import pyautogui
  4. import time
  5.  
  6. class Cordinates():
  7. replayBtn = (995, 565)
  8. player = (730, 582)
  9. # Top Left: 740,566 Bottom Right: 785, 598
  10.  
  11. def restartGame():
  12. pyautogui.click(Cordinates.replayBtn)
  13. pyautogui.keyDown('down')
  14.  
  15. def pressSpace():
  16. pyautogui.keyUp('down')
  17. pyautogui.keyDown('space')
  18. time.sleep(0.17)
  19. pyautogui.keyUp('space')
  20. pyautogui.keyDown('down')
  21.  
  22. def imageGrab():
  23. box = (Cordinates.player[0]+50,Cordinates.player[1],
  24. Cordinates.player[0]+150 ,Cordinates.player[1]+10)
  25. image = ImageGrab.grab(box)
  26. grayImage = ImageOps.grayscale(image)
  27. a = array(grayImage.getcolors())
  28. print(a.sum())
  29. return (a.sum())
  30.  
  31. def main():
  32. restartGame()
  33. jumps = 0
  34. while True:
  35. if(imageGrab() != 1255):
  36. pressSpace()
  37.  
  38. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement