diff options
Diffstat (limited to 'bot.py')
-rw-r--r-- | bot.py | 20 |
1 files changed, 16 insertions, 4 deletions
@@ -2,9 +2,12 @@ import time | |||
2 | 2 | ||
3 | import mss | 3 | import mss |
4 | import pyautogui as pg | 4 | import pyautogui as pg |
5 | from keyboard import send | ||
6 | from numpy import array, uint8 | 5 | from numpy import array, uint8 |
7 | 6 | ||
7 | #from keyboard import send | ||
8 | |||
9 | from pynput.keyboard import Key, Controller | ||
10 | keyboard = Controller() | ||
8 | 11 | ||
9 | def begin(): | 12 | def begin(): |
10 | pg.click(440, 900, 2) | 13 | pg.click(440, 900, 2) |
@@ -36,7 +39,16 @@ with mss.mss() as sct: | |||
36 | left = [img[x, posY[0]] for x in posX] | 39 | left = [img[x, posY[0]] for x in posX] |
37 | for i in range(6): | 40 | for i in range(6): |
38 | if is_tree(left[i]): | 41 | if is_tree(left[i]): |
39 | send("right, right", True, True) | 42 | keyboard.press(Key.right) |
43 | keyboard.release(Key.right) | ||
44 | time.sleep(0.014) | ||
45 | keyboard.press(Key.right) | ||
46 | keyboard.release(Key.right) | ||
40 | else: | 47 | else: |
41 | send("left, left", True, True) | 48 | keyboard.press(Key.left) |
42 | time.sleep(0.145) | 49 | keyboard.release(Key.left) |
50 | time.sleep(0.014) | ||
51 | keyboard.press(Key.left) | ||
52 | keyboard.release(Key.left) | ||
53 | time.sleep(0.17) | ||
54 | |||