-
Notifications
You must be signed in to change notification settings - Fork 0
/
controls.py
74 lines (52 loc) · 1.94 KB
/
controls.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
#!/usr/bin/env python3
"""
Capturing Input
"""
_upleft = ['KP7', 'y']
_up = ['KP8', 'k']
_upright = ['KP9', 'u']
_left = ['KP4', 'h']
_wait = ['KP5', '.']
_right = ['KP6', 'l']
_downleft = ['KP1', 'b']
_down = ['KP2', 'j']
_downright = ['KP3', 'n']
def up_left(user_input):
return user_input.type == 'KEYDOWN' and any(i in [user_input.key, user_input.text] for i in _upleft)
def up(user_input):
return user_input.type == 'KEYDOWN' and any(i in [user_input.key, user_input.text] for i in _up)
def up_right(user_input):
return user_input.type == 'KEYDOWN' and any(i in [user_input.key, user_input.text] for i in _upright)
def left(user_input):
return user_input.type == 'KEYDOWN' and any(i in [user_input.key, user_input.text] for i in _left)
def wait(user_input):
return user_input.type == 'KEYDOWN' and any(i in [user_input.key, user_input.text] for i in _wait)
def right(user_input):
return user_input.type == 'KEYDOWN' and any(i in [user_input.key, user_input.text] for i in _right)
def down_left(user_input):
return user_input.type == 'KEYDOWN' and any(i in [user_input.key, user_input.text] for i in _downleft)
def down(user_input):
return user_input.type == 'KEYDOWN' and any(i in [user_input.key, user_input.text] for i in _down)
def down_right(user_input):
return user_input.type == 'KEYDOWN' and any(i in [user_input.key, user_input.text] for i in _downright)
def pick_up(user_input):
return user_input.type == 'KEYDOWN' and user_input.text == 'g'
def inventory(user_input):
return user_input.type == 'KEYDOWN' and user_input.text == 'i'
def drop(user_input):
return user_input.type == 'KEYDOWN' and user_input.text == 'd'
"""
Displaying information
"""
# y k u
# \|/
# h-.-l
# /|\
# b j n
# 7 8 9
# \|/
# 4-5-6
# /|\
# 1 2 3
strlines_hjk = ['y k u',' \|/ ','h-.-l',' /|\ ', 'b j n']
strlines_numpad = ['7 8 9',' \|/ ','4-5-6',' /|\ ','1 2 3']