How do you make a text adventure game in python
I’ve been trying to learn how to make a text adventure game in Python but none works.
Hi! Try out some tutorials:
https://www.derekshidler.com/how-to-create-a-text-based-adventure-and-quiz-game-in-python/
https://blog.trinket.io/python-text-adventure/
https://www.techradar.com/how-to/computing/how-to-code-your-own-adventure-game-in-python-1313296
I'll make a tutorial on this soon too
hi there!
first of all to make a text adventure game, you should choose your plot story. It could be anything, like a mountain trailing hike, or a post apocalyptic society, etc. Then, make some questions.
The 1st question could be like do you want to run away or fight a monster. Then, include a variable to keep track of how brave you are; for brave actions + 1 for coward actions - 1. Here is a list of some questions:
fight/run away
turn light on/dont
save person/leave them to die
share food/dont
share water/dont
go to plains/go to mountain
cross bridge/swim
go inside town/stay in fields
go inside motel/go to barn
and here is a text adventure game i made a while ago:
https://repl.it/talk/share/OBLIVION/37512
also here some resources to help you: http://coding-grace-guide.readthedocs.io/en/latest/guide/lessonplans/beginners-python-text-based-adventure.html
https://letstalkdata.com/2014/08/how-to-write-a-text-adventure-in-python/
https://trinket.io/python/e5a03e7cbc
https://www.derekshidler.com/how-to-create-a-text-based-adventure-and-quiz-game-in-python/
@rperm Hi,
Follow up with this video...
It will be really helpful.
Click here
Thanks!
Hope this helps
It's pretty simple, just create a story, and at each important point in the story, give the player a two options. If they pick the wrong option, they die, or something like that. Here's a simple one:
You can make the story as complicated or uncomplicated as you like, but have fun with it.
@InvisibleOne
I can only do two choices, choice3 does not work?
I am new to python :p
It should just be another
elif
@SandwichBlamwich
@InvisibleOne no i mean in "if choice3 == '2':"
does not work (without the "")
Hmm... Could I see the code in context? @SandwichBlamwich
@InvisibleOne this is a snippet, i have the choice3 = input(), just i did not copy it.
'''
if choice3 == '1':
print("it was a trap! as you pick up the bottle, placing coins on the table, the shopkeeper pounces and takes you away!")
print("the end...")
elif choice3 == '2':
print("you pass through and continue on. ")
print("it starts to get dark...")
print("[1] set up camp [2] continue")
choice = input("")
if choice == '1':
print("test")
elif choice == '2':
print("test")
'''
@InvisibleOne
elif choice3 == '2':
does not work. the if choice3 == '1':
works...
elif choice3 == '2': is the code that is not working...
if choice3 == '1': works!?
I'm not sure what the problem is, unless it is an indentation issue. Here's an example code yours should be something like this: https://replit.com/@InvisibleOne/example#main.py @SandwichBlamwich