-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCreating_a_Text_Based_Adventure_Game.py
120 lines (109 loc) · 4.34 KB
/
Creating_a_Text_Based_Adventure_Game.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
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
def main():
print("Welcome to the Adventure Game!")
print("As an avid traveler, you have decided to visit the Catacombs of Paris.")
print("However, during your exploration , you find yourself lost.")
print("You can choose to walk in multiple directions to find a way out.")
print("Let's start with your name. ")
name= input()
print("Good luck, " + name+ ".")
introscene()
def introscene():
directions= ["left","right","forward","backward"]
print("You are at a crosswords, and you can choose to go down any of the four hallways. Where would you like to go?")
user_input= ""
while user_input not in directions:
print("Options: left/right/forward/backward")
user_input= input()
if user_input == "left":
ShowShadowFigure()
if user_input == "right":
ShowSkeletons()
if user_input == "forward":
HauntedRoom()
if user_input == "backward":
print("You find that this door opens into a wall.")
else:
print("Please enter a valid option.")
def ShowShadowFigure():
directions = ["right","left","backward"]
print("You see a dark shadowy figure appear in the distance. You are creeped out. Where would you like to go?")
user_input= ""
while user_input not in directions:
print("Options: right/left/backward")
user_input= input()
if user_input == "right":
CameraScene()
if user_input == "left":
print("You find that this door opens into a wall.")
if user_input == "backward":
introscene()
else:
print("Please enter a valid option.")
def CameraScene():
directions = ["forward","backward"]
print("You see a camera that has been dropped on the ground.Someone has been here recently. Where would you like to go?")
user_input= ""
while user_input not in directions:
print("Options: forward/backward")
user_input= input()
if user_input == "forward":
print("You made it!You've found an exit.")
quit()
if user_input == "backward":
ShowShadowFigure()
else:
print("Please enter a valid option.")
def HauntedRoom():
directions = ["right","left","backward"]
print("You hear strange voices.You think you have awoken some of the dead.Where would you like to go?")
user_input= ""
while user_input not in directions:
print("Options: right/left/backward")
user_input= input()
if user_input == "right":
print("Multiple ghoul -like creatures start emerging as you enter the room. You are killed.")
quit()
elif user_input == "left":
print("You made it! You've found an exit.")
quit()
elif user_input == "backward":
introscene()
else:
print("Please enter a valid option.")
weapon =False
def ShowSkeletons():
directions = ["backward","forward"]
global weapon
print("You see a wall of skeletons as you walk into the room.Someone is watching you.Where would you like to go?")
user_input= ""
while user_input not in directions:
print("Options: left/backward/forward")
user_input= input()
if user_input == "left":
print("You find that this door opens into a wall.You open some of the drywall to discover a knife.")
weapon = True
elif user_input == "backward":
introscene()
elif user_input == "forward":
StrangeCreature()
else:
print("Please enter a valid option.")
def StrangeCreature():
actions = ["right","flee"]
global weapon
print("A strange creature has appeared. You can either run or fight it.What would you like to go?")
user_input= ""
while user_input not in actions:
print("Options: flee/fight")
user_input= input()
if user_input == "fight":
if weapon:
print("You kill the creature with the knife you found earlier. After moving forward, you find one of the exits.Congrats!")
else:
print("The craeture has killed you.")
quit()
elif user_input == "flee":
ShowSkeletons()
else:
print("Please enter a valid option.")
main()