Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from PIL import ImageGrab, ImageOps
- from numpy import *
- import pyautogui
- import time
- class Cordinates():
- replayBtn = (995, 565)
- player = (730, 582)
- # Top Left: 740,566 Bottom Right: 785, 598
- def restartGame():
- pyautogui.click(Cordinates.replayBtn)
- pyautogui.keyDown('down')
- def pressSpace():
- pyautogui.keyUp('down')
- pyautogui.keyDown('space')
- time.sleep(0.17)
- pyautogui.keyUp('space')
- pyautogui.keyDown('down')
- def imageGrab():
- box = (Cordinates.player[0]+50,Cordinates.player[1],
- Cordinates.player[0]+150 ,Cordinates.player[1]+10)
- image = ImageGrab.grab(box)
- grayImage = ImageOps.grayscale(image)
- a = array(grayImage.getcolors())
- print(a.sum())
- return (a.sum())
- def main():
- restartGame()
- jumps = 0
- while True:
- if(imageGrab() != 1255):
- pressSpace()
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement