-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPianoTilesBot.py
61 lines (53 loc) · 2.23 KB
/
PianoTilesBot.py
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
from pyautogui import *
import pyautogui
import time
import keyboard
import random
import win32api, win32con
## This code is written to win on https://poki.com/en/g/piano-tiles-2 , it was written in an hour cuz I was bored, yes the numbers below are manually aquired (wont work on different screens)
## Tile 1: 715
##Tile 2: 810
## Tile 3: 923
##Tile 4: 1020
## Y for all: 650
## Start button value 54 159 198
## Hold: 0 2 33
def click(x,y):
win32api.SetCursorPos((x,y))
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,0,0)
time.sleep(0.001)
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,0,0)
GameStarted = False
try:
while keyboard.is_pressed('q') == False:
if GameStarted == False:
if pyautogui.pixel(715,650)[0] == 54 and pyautogui.pixel(715,650)[1] == 159 and pyautogui.pixel(715,650)[2] == 198:
click(715,650)
GameStarted=True
print(GameStarted)
if pyautogui.pixel(810,650)[0] == 54 and pyautogui.pixel(810,650)[1] == 159 and pyautogui.pixel(810,650)[2] == 198:
click(810,650)
GameStarted=True
print(GameStarted)
if pyautogui.pixel(923,650)[0] == 54 and pyautogui.pixel(923,650)[1] == 159 and pyautogui.pixel(923,650)[2] == 198:
click(923,650)
GameStarted=True
print(GameStarted)
if pyautogui.pixel(1020,650)[0] == 54 and pyautogui.pixel(1020,650)[1] == 159 and pyautogui.pixel(1020,650)[2] == 198:
click(1020,650)
GameStarted=True
print(GameStarted)
if pyautogui.pixel(715,650)[1] == 1 or pyautogui.pixel(715,650)[1] == 2 :
click(715,650)
time.sleep(0.01)
if pyautogui.pixel(810,650)[1] == 1 or pyautogui.pixel(810,650)[1] == 2:
click(810,650)
time.sleep(0.01)
if pyautogui.pixel(923,650)[1] == 1 or pyautogui.pixel(923,650)[1] == 2:
click(923,650)
time.sleep(0.01)
if pyautogui.pixel(1020,650)[1] == 1 or pyautogui.pixel(1020,650)[1] == 2:
click(1020,650)
time.sleep(0.01)
except :
pass