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.
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:
#get the player's name name = input("Name: ") print("Hello " + name) print("You are on an adventure, what do you want to do?") print(" Hunt a dragon  Jump in a hole filled with spikes") #then get the player's choice choice = input() #check to see what the player chose to do if choice == '1': print("You attack a dragon and killed it") #Now give them another choice to keep the story going print(" Jump in a hole filled with spikes  Hunt another dragon") choice2 = input() if choice2 == '1': print("You died...") elif choice2 == '2': print("You hunted a dragon and won!") #Then you continue on elif choice == '2': #This is the result of them choosing to jump into the hole the first time print("You died...")
You can make the story as complicated or uncomplicated as you like, but have fun with it.
Hi! Try out some tutorials:
I'll make a tutorial on this soon too
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:
turn light on/dont
save person/leave them to die
go to plains/go to mountain
go inside town/stay in fields
go inside motel/go to barn
and here is a text adventure game i made a while ago:
also here some resources to help you: http://coding-grace-guide.readthedocs.io/en/latest/guide/lessonplans/beginners-python-text-based-adventure.html