forked from Gautam-J/Self-Driving-Car
-
Notifications
You must be signed in to change notification settings - Fork 1
/
startgame.py
87 lines (62 loc) · 1.5 KB
/
startgame.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
import time
from countdown import CountDown
from directkeys import PressKey, ReleaseKey
from directkeys import UP, DOWN, LEFT, RIGHT, ENTER, ESC, TWO
def left():
PressKey(LEFT)
time.sleep(0.1)
ReleaseKey(LEFT)
time.sleep(1)
def right():
PressKey(RIGHT)
time.sleep(0.1)
ReleaseKey(RIGHT)
time.sleep(1)
def up():
PressKey(UP)
time.sleep(0.1)
ReleaseKey(UP)
time.sleep(1)
def down():
PressKey(DOWN)
time.sleep(0.1)
ReleaseKey(DOWN)
time.sleep(1)
def enter():
PressKey(ENTER)
time.sleep(0.1)
ReleaseKey(ENTER)
time.sleep(1)
def esc():
PressKey(ESC)
time.sleep(0.1)
ReleaseKey(ESC)
time.sleep(1)
def two():
PressKey(TWO)
time.sleep(0.1)
ReleaseKey(TWO)
time.sleep(1)
free_roam = [enter, enter, enter, enter, enter, left, enter]
graphic = [esc, right, right, right, enter, right, enter, right, right, right, right, down,
right, right, right, enter, left, enter]
advanced = [enter, two, up, right, up, right, up, right, enter, left, enter]
def StartGame():
print('Make sure the game window is on focus...')
CountDown(5)
# going into free roam mode
for action in free_roam:
action()
time.sleep(5)
# changing graphic settings
for action in graphic:
action()
time.sleep(5)
# changing advanced graphic settings
for action in advanced:
action()
esc()
esc()
print('Game is now ready')
if __name__ == '__main__':
StartGame()