-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgame.py
More file actions
125 lines (107 loc) · 4.12 KB
/
Copy pathgame.py
File metadata and controls
125 lines (107 loc) · 4.12 KB
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# Local Modules
# Remember to do 'from directory import file' to use its functions, else it won't work for some reason
# the reason is that directories are NAMESPACES in python, and its files are CLASSES
# so its valuable thing. Learn more about OOP.
from everything import * # imports are now in another file
currentSave = savesengine.emptySave();
currentSaveId = 1
def save(): savesengine.writeSave(currentSave, currentSaveId)
# Credentials
pickedasave = False;
print("Hello, stranger. Would you like to start your adventure?")
print("Y/n")
ans = userChoice("", ["y", "n"])
if ans == "y": 0
if ans == "n": fancyPrint("Bye then", end=""); sleep(0.75); print("!", end=""); sleep(0.5); exit(0)
if savesengine.retrieveSaves().__len__() != 0:
fancyPrint("Found this saves: ")
fancyPrint(savesengine.retrieveSaves())
fancyPrint("Would you like to pick one?")
sleep(0.5)
fancyPrint("Y/n")
ans = userChoice("", ["y", "n"])
if ans == "y":
while True:
while True:
fancyPrint("Which one?")
fastFancyPrint("Note: pick only a number!")
selection = dinput()
if isint(selection): break;
fancyPrint(f"Picked save №{selection}. Are you sure?")
fancyPrint("Y/n")
ans = userChoice("", ["y", "n"])
if ans == "y": break;
currentSave = savesengine.getSave(int(selection))
pickedasave = True
if ans == "n":0
if pickedasave == False:
fancyPrint("OK then, so how do I call you?")
name = dinput()
#ask_restart() # why are you asking for a restart here?
fancyPrint(f"Hello, {name}.") # the same as "" + name, but simplier
currentSave["name"] = name
while True:
fancyPrint(f"Please write down the ID of your save file.")
ans = dinput()
if isint(ans): break;
currentSaveId = int(ans)
save()
fancyPrint("Would you like to name your save?")
sleep(0.5)
fastFancyPrint("Y/n")
ans = userChoice("", ["y", "n"])
if ans == "y":
while True:
fancyPrint("Please enter a name for your save.")
ans = dinput()
ans2 = userChoice("Are you sure?(Y/n)", ["y", "n"])
if ans2 == "y": break;
currentSave["saveName"] = ans
save()
gamelogo()
fastFancyPrint("Where would you like to start your adventure at? Type the ID of the area you want to start at to actually start!")
fastFancyPrint("Options:\n\"1\" to start in the woods\n\"2\" to start in a dungeon\n\"3\" to start in an haunted mansion")
start = int(userChoice("", [1, 2, 3]))
fancyPrint("Quick instructions: type the choice you want to make by saying the letter (ID) of the option you want to choose")
# Woods arc
if start == 1:
fancyPrint("You find yourself in the woods of MaterTua and there is a mysterious chest behind you")
sleep(0.5)
fastFancyPrint(value.woods1question)
while True:
opt = dinput()
if opt == "a":
perc = percentual(100)
if perc <= 75:
print("You obtained", end="")
sleep(1)
print(".", end="")
sleep(1)
print(".", end="")
sleep(1)
print(".")
print("A whole lot of nothing!")
# Continue from here
elif perc == 76:
fancyPrint("Hey wait, is that a bomb?.. BOOOM!!")
sleep(0.08)
fancyPrint("You died of explosion :(")
exit(0)
else:
fancyPrint("You found a lot of diamonds and gold!")
fancyPrint("That would be enough for you to retire")
fancyPrint("and live the rest of your life happily.")
print("\n\nEnd of story", end="")
sleep(0.25)
print("!")
exit(0)
break;
if opt == "b":
0
fancyPrint("Looks like you answered the wrong answer. Try again")
# Dungeon arc
elif start == 2:
print(value.indeverrormsg)
# Haunted Mansion arc
elif start == 3:
print(value.indeverrormsg)