-
Notifications
You must be signed in to change notification settings - Fork 0
/
character.py
55 lines (48 loc) · 1.45 KB
/
character.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
class Character:
"""the graphic interface of the progress of the game"""
head_lvl:str
body_lvl:str
foot_lvl:str
ui:str
def __init__(self) -> None:
self.reset_state()
def reset_state(self) -> None:
"""clean the interface"""
self.head_lvl = ""
self.body_lvl = ""
self.foot_lvl = ""
def define_state(self, state:int):
"""to change the way the graphic is showed up"""
if state > 4:
self.head_lvl = "°"
self.body_lvl = ""
self.foot_lvl = ""
elif state > 3:
self.head_lvl = "°"
self.body_lvl = "|"
self.foot_lvl = ""
elif state > 2:
self.head_lvl = "°"
self.body_lvl = "-|"
self.foot_lvl = ""
elif state > 1:
self.head_lvl = "°"
self.body_lvl = "-|-"
self.foot_lvl = ""
elif state > 0:
self.head_lvl = "°"
self.body_lvl = "-|-"
self.foot_lvl = "-|"
else:
self.head_lvl = "°"
self.body_lvl = "-|-"
self.foot_lvl = "_|_"
def show_ui(self) -> None:
"""prints in console the current state of the interface"""
self.ui = f"""
------
| {self.head_lvl}
| {self.body_lvl}
| {self.foot_lvl}
"""
print(self.ui)