Python Forum

Full Version: Simple Game - Choice Based
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am very very new to python and trying to make a simple game where you type a choice and something happens depending on the choice but I'm not quite sure how to start as I dont really understand how to do it at all.
Im not even sure if im using the forum correctly- bear with me please
If your question is unrelated to a current thread, it's best to start a new thread. I've split your question off into it's own thread for you :)

Your question isn't really specific, but what you're explaining can be handled through user input (https://docs.python.org/3/library/functions.html#input), and branching based on the result of that input (https://docs.python.org/3/tutorial/contr...statements)

As a simple example, take a look at this:
print("The tunnel splits here.  Do you want to go left (1), or right (2)?")
choice = None
while choice not in ("1", "2"):
    choice = input("1|2: ")

if "1" == choice:
    print("You go left.  You find a fountain granting eternal life.")
elif "2" == choice:
    print("Being bold, you head right.  There's a bowl of candy!")
You might also want to check out my text adventure tutorial.
Hey
I am new like u..
I choosed Renpy
u might check
more python