Skip to content

Commit 5b60c38

Browse files
authored
Add files via upload
1 parent 0450e0d commit 5b60c38

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

day93/t-rex_bot.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
from pyautogui import *
2+
import pyautogui
3+
import time
4+
import keyboard
5+
import random
6+
import win32api, win32con
7+
8+
time.sleep(1)
9+
jumps = 0
10+
11+
def jump():
12+
global jumps
13+
win32api.keybd_event(38, 0, 0, 0)
14+
time.sleep(0.01)
15+
win32api.keybd_event(38, 0, win32con.KEYEVENTF_KEYUP, 0)
16+
jumps += 1
17+
18+
19+
def duck():
20+
win32api.keybd_event(40, 0, 0, 0)
21+
time.sleep(0.4)
22+
win32api.keybd_event(40, 0, win32con.KEYEVENTF_KEYUP, 0)
23+
print("I see a Pterodactyl")
24+
25+
26+
# Press 'q' to stop running
27+
while not keyboard.is_pressed('q'):
28+
if pyautogui.pixel(730, 468)[0] == 83:
29+
jump()
30+
print("I see a tall cactus!")
31+
elif pyautogui.pixel(715, 490)[0] == 83:
32+
jump()
33+
print("I see a short cactus!")
34+
if pyautogui.pixel(760, 460)[0] == 83:
35+
duck()
36+
# Speed increases
37+
if jumps > 3:
38+
if pyautogui.pixel(720, 468)[0] == 83:
39+
jump()
40+
print("I see a tall cactus!")
41+
elif pyautogui.pixel(705, 490)[0] == 83:
42+
jump()
43+
if pyautogui.pixel(750, 460)[0] == 83:
44+
duck()

0 commit comments

Comments
 (0)