Skip to content

Commit a82ad7a

Browse files
authored
Fantasy character select menu
1 parent 1d05b4e commit a82ad7a

File tree

1 file changed

+106
-0
lines changed

1 file changed

+106
-0
lines changed

menu.py

+106
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
w = "\n We will not survive this!"
2+
3+
x = "\n Size does not matter!"
4+
5+
y = "\n I have no fear!"
6+
7+
z = "\n Don't pick the dwarf!"
8+
9+
10+
class Player:
11+
def __init__(self):
12+
self.type = ""
13+
self.name = ""
14+
self.health = 0
15+
self.attack = 0
16+
self.defense = 0
17+
self.magic = ""
18+
19+
def print(self):
20+
print("\n Type:", self.type)
21+
print(" Name:", self.name)
22+
print(" Health:", self.health)
23+
print(" Attack:", self.attack)
24+
print(" Defense:", self.defense)
25+
print(" Magic:", self.magic)
26+
27+
28+
warrior = Player()
29+
warrior.type = "Warrior"
30+
warrior.name = "Hugo"
31+
warrior.health = 100
32+
warrior.attack = 150
33+
warrior.defense = 50
34+
warrior.magic = "Fire"
35+
36+
dwarf = Player()
37+
dwarf.type = "Dwarf"
38+
dwarf.name = "Roald"
39+
dwarf.health = 100
40+
dwarf.attack = 50
41+
dwarf.defense = 150
42+
dwarf.magic = "Earth"
43+
44+
rogue = Player()
45+
rogue.type = "Rogue"
46+
rogue.name = "Donovan"
47+
rogue.health = 150
48+
rogue.attack = 75
49+
rogue.defense = 75
50+
rogue.magic = "Water"
51+
52+
elf = Player()
53+
elf.type = "Elf"
54+
elf.name = "Helmer"
55+
elf.health = 200
56+
elf.attack = 50
57+
elf.defense = 50
58+
elf.magic = "Air"
59+
60+
61+
def start():
62+
print("\n Please select a character. (1, 2, 3 or 4)")
63+
print(" 1. Warrior")
64+
print(" 2. Dwarf")
65+
print(" 3. Rogue")
66+
print(" 4. Elf")
67+
print("\n Press (q) to exit.")
68+
69+
answer = input("\n > ")
70+
71+
if answer == "q":
72+
exit()
73+
74+
elif answer == "1":
75+
warrior.print()
76+
77+
print(w)
78+
79+
start()
80+
81+
elif answer == "2":
82+
dwarf.print()
83+
84+
print(x)
85+
86+
start()
87+
88+
elif answer == "3":
89+
rogue.print()
90+
91+
print(y)
92+
93+
start()
94+
95+
elif answer == "4":
96+
elf.print()
97+
98+
print(z)
99+
100+
start()
101+
102+
else:
103+
start()
104+
105+
106+
start()

0 commit comments

Comments
 (0)