forked from prathimacode-hub/Awesome_Python_Scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadventure_based_game(text game).py
45 lines (37 loc) · 1.57 KB
/
adventure_based_game(text 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
#getting the name of player
name = input("Type your name: ")
print("Welcome", name, "to this adventure!")
#first question
answer = input(
"You are on a dirt road, it has come to an end and you can go left or right. Which way would you like to go? ").lower()
# if left was answered
if answer == "left":
answer = input(
"You come to a river, you can walk around it or swim accross? Type walk to walk around and swim to swim accross: ")
if answer == "swim":
print("You swam acrross and were eaten by an alligator.")
elif answer == "walk":
print("You walked for many miles, ran out of water and you lost the game.")
else:
print('Not a valid option. You lose.')
#if right was answered
elif answer == "right":
answer = input(
"You come to a bridge, it looks wobbly, do you want to cross it or head back (cross/back)? ")
if answer == "back":
print("You go back and lose.")
elif answer == "cross":
answer = input(
"You cross the bridge and meet a stranger. Do you talk to them (yes/no)? ")
if answer == "yes":
print("You talk to the stanger and they give you gold. You WIN!")
elif answer == "no":
print("You ignore the stranger and they are offended and you lose.")
else:
print('Not a valid option. You lose.')
else:
print('Not a valid option. You lose.')
#if something else was answered then showing invalid
else:
print('Not a valid option. You lose.')
print("Thank you for trying", name)