-
Notifications
You must be signed in to change notification settings - Fork 0
/
replits100DaysOfPython_day27_videoGameCharacters.py
62 lines (47 loc) · 1.23 KB
/
replits100DaysOfPython_day27_videoGameCharacters.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
import os # system()
import time # sleep()
import random # randint()
def roll_dice(sides):
return random.randint(1, sides)
def get_name():
name = input("Name your Legend: ")
return name
def get_type():
type = input("Character Type (Human, Elf, Wizard, Orc): ")
return type
def get_health():
return (roll_dice(6) * roll_dice(12)) / 2 + 10
def get_strength():
return (roll_dice(6) * roll_dice(12)) / 2 + 12
def generate_character():
name = get_name()
type = get_type()
health = get_health()
strength = get_strength()
print()
return name, type, health, strength
def print_character(name, type, health, strength):
print(f"Name: {name}")
time.sleep(.5)
print(f"Type: {type}")
time.sleep(.5)
print(f"Health: {health}")
time.sleep(.5)
print(f"Strength: {strength}")
time.sleep(.5)
print()
print("May your name go down in Legend...\n")
time.sleep(.5)
def print_menu():
os.system("clear")
print("⚔️ CHARACTER BUILDER ⚔️\n")
time.sleep(.5)
while True:
print_menu()
name, type, health, strength = generate_character()
print_character(name, type, health, strength)
choice = input("Again?: ")
if choice[0].strip().lower() == "y":
continue
else:
exit()