-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplay.py
More file actions
28 lines (24 loc) · 833 Bytes
/
play.py
File metadata and controls
28 lines (24 loc) · 833 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import pyautogui
from time import sleep
screenX = 343
screenY = 506
screenW = 291
screenH = 1
offset = 10
def play():
while True:
img = pyautogui.screenshot(region = (screenX, screenY, screenW, screenH))
tileCol = int(screenW / 4) - offset
for i in range(1, 5):
pix = img.getpixel((tileCol * i, 0))
if pix[0] < 100 and pix[2] > 150:
actualX = tileCol * i + screenX - offset
actualY = screenY + 1
pyautogui.click(x = actualX, y = actualY)
elif pix[0] < 50 and pix[1] < 50 and pix[2] < 50:
actualX = tileCol * i + screenX - offset
actualY = screenY + 1
pyautogui.click(x = actualX, y = actualY)
print('Game starts in 5 sec')
sleep(5)
play()