-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patht-rex_bot.py
44 lines (38 loc) · 1.04 KB
/
t-rex_bot.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
from pyautogui import *
import pyautogui
import time
import keyboard
import random
import win32api, win32con
time.sleep(1)
jumps = 0
def jump():
global jumps
win32api.keybd_event(38, 0, 0, 0)
time.sleep(0.01)
win32api.keybd_event(38, 0, win32con.KEYEVENTF_KEYUP, 0)
jumps += 1
def duck():
win32api.keybd_event(40, 0, 0, 0)
time.sleep(0.4)
win32api.keybd_event(40, 0, win32con.KEYEVENTF_KEYUP, 0)
print("I see a Pterodactyl")
# Press 'q' to stop running
while not keyboard.is_pressed('q'):
if pyautogui.pixel(730, 468)[0] == 83:
jump()
print("I see a tall cactus!")
elif pyautogui.pixel(715, 490)[0] == 83:
jump()
print("I see a short cactus!")
if pyautogui.pixel(760, 460)[0] == 83:
duck()
# Speed increases
if jumps > 3:
if pyautogui.pixel(720, 468)[0] == 83:
jump()
print("I see a tall cactus!")
elif pyautogui.pixel(705, 490)[0] == 83:
jump()
if pyautogui.pixel(750, 460)[0] == 83:
duck()