Very helpful Video for a beginner like me. I have one question. How can you make the if/else clause repeat, in case the user enters an invalid option, so he can choose again right away?
I feel like using lower() to make the input not case sensitive would be an easy addition to improve this...but then, if we did every little thing to improve on the idea of a text adventure in Python, the video would be considerably longer, lol. I just wish that Python had some sort of getch command built in so every input didn't need to end with the press of the enter key.
If anyone sees this please answer; What code do I use to return it back to the input/question I ask the player if put in an invalid choice? Or perhaps revert the game back to the beginning if they die without starting the game over themselves?
What about continuing this game with another episode, you could have a drawing of location layouts of the mansion (not ingame but as an example of designing our map on paper) and how you add a navigate around the game world, where the player can navigate with n or e as traditionally with interactive fiction games. Or you could do a new setting where the player is walking through a forest where there are several paths to follow. This would be a great addition to learning how to make basic gameworld maps. I guess the very simple method would be giving several direction choices at the end of the location desc.." To the west is a swamp." And I guess, match input keyword of west or w to the current location the player is at. You could do a simple method for one half of the video and a more advanced version which might involve functions that handle the map system, on the other half of the video using the same adventure game setting.
that is one way to solve this problem, hope it helps ### choice print("do you want to enter the room?") choicebool = True while choicebool == True: choice = input("> ") if choice == "yes": print("you entered the room") choicebool = False elif choice == "no": print("you did not enter the room") choicebool = False else: print("invalid input, please enter yes or no.") print("end")
Maybe? I've started thinking about doing a project like this, and I'm considering using a variable to set the current location, and based on the location call a function for that location. I'm also thinking about how I would implement an inventory system, which would need to include character inventory as well as inventory for each location, with the ability to move things between the current location and the character inventory.
Are they on the same part, for example hideChoice = input("> ") if(hideChoice == "yes"): print("You hide and you see the horrifying demons rush past you") print("Before you know it your running out the door") print("You win") elif(hideChoice == "no"): print("The demons catch up with you and your eaten") print("You Lose")
Hi my friend, can you help me. it says that pitbull is not defined can you fix it for me? print("Welcome to the hounted mansion!") print("You are a distant family member of a rich millionaire who has been passed away living this / mansion to you ") print("as a new found owner, you decide to pay a visit to the mansion") print("the hause isdated, creaky, and a falling appart. you walk in the front door.") print("do you want to enter the living room or dinning room?") roomChoice = input ("> ") if(roomChoice == "living room"): print("you enter the living room") print("as you walk in you see a sleeping pitbull guarding some gold jewerly") print(" do you want to steal the jeverly from the pitbul?")
pitBullchoice = input (" > ")
if(pitBullChoice == "yes"): print("you attempt to stela jewelry, but it wakes up and rips you shreds") print("you are now dead") elif(pitBullChoice == "No"): Print("You decide to not to steal dog's jewerly") print("you decide to turn and leave the house safely") else: print("invalid choice. Please enter yes or no")
elif(roomChoice == "dinning room"): print("you chose to go into the dinning room") print("as you walk in, you see a shiny vase on the table") print("do you want to open the vase")
vasechoice = input ("> ")
if (vasechoice == "yes"): print("you open the vase and find a pile of bones") elif(vasechoice == "no"): print("you decide not to open the shiny vase") print("as you turn to leave,you heare a ckacking sound comming from the corner") print("a dark figure with glowind red eyes launches at you, knockin you unconcious") print("you wake up in your bad.it was all a dream") else: print("invalid choice.please enter yes or no.")
else: print("invalid choice. please enter living room or dinning room")
Thank you, Shuan. I was able to break off of your code really quickly, but I learned a lot. I even added an Easter egg for the shiny vase
Thanks so much you helped me complete the school work
thanks! i was absolutely stuck on what to make for my first real project!
I have so many ideas. RPGs are my favorite! Thanks a bunch 😊
Bro has Minecraft in his Hot Bar what a legend..
👏👏👏👏🗿🗿🗿🗿🗿🗿🗿🦸♂🦸♂🦸♂
no he’s not a legend because its bedrock edition
@@edgarplayz1021it doesn’t matter
@@jbomb11 It does 💀
Bro really called it a hotbar its a taskbar
I was actualy searching about how to make a text based game, like a phone game. Not necessarily a mobile game but a game that's like a smartphone
Very helpful Video for a beginner like me. I have one question. How can you make the if/else clause repeat, in case the user enters an invalid option, so he can choose again right away?
I would use a while loop. For example
while choice != "yes" or choice != "no":
choice = input("No such option, please enter yes or no: ")
@dolfinw4179
Absolute legend, tried figure it own on my own for days
@@dolfinw4179 ur goated for this
I feel like using lower() to make the input not case sensitive would be an easy addition to improve this...but then, if we did every little thing to improve on the idea of a text adventure in Python, the video would be considerably longer, lol. I just wish that Python had some sort of getch command built in so every input didn't need to end with the press of the enter key.
If anyone sees this please answer;
What code do I use to return it back to the input/question I ask the player if put in an invalid choice? Or perhaps revert the game back to the beginning if they die without starting the game over themselves?
Your tutorial is a lifesaver.
Thank you!
Good content as always! I love your vids
Throw in a continue after the catch statement so they can redo the input without having to start over :)
What is the code on how to do this, I’ve been trying to find out how for a while?
@dontmindme3740
Make sure that the try section is inside a loop or else it won't work.
try:
Code
except:
Error message
continue
@@dontmindme3740Id like to know too
I got stuck on how to make the "carrot symbol" on my keyboard. I am from norway so couldn't find it. Had to copy it from some text
caret. He said caret (^) but did "greater than" > shift-dot, between comma and slash. A caret is shift-6.
That was very good keep it up!
:D
How can I get the player back to first set of options after choosing a particular choice route?
While loop
I really like this one very informative
how to set the game asking like " Do you wanna play again ?"
yes or no, Y/N
@@summerlovinxx thank you my friend.
What about continuing this game with another episode, you could have a drawing of location layouts of the mansion (not ingame but as an example of designing our map on paper) and how you add a navigate around the game world, where the player can navigate with n or e as traditionally with interactive fiction games. Or you could do a new setting where the player is walking through a forest where there are several paths to follow. This would be a great addition to learning how to make basic gameworld maps. I guess the very simple method would be giving several direction choices at the end of the location desc.." To the west is a swamp." And I guess, match input keyword of west or w to the current location the player is at.
You could do a simple method for one half of the video and a more advanced version which might involve functions that handle the map system, on the other half of the video using the same adventure game setting.
It is a ‘text’ adventure
Tusen takk!
Thank you so much is very helpful ❤
If you make an invalid choice, how to you make it prompt you to answer the last question again instead of having to re run the game from the start?
that is one way to solve this problem, hope it helps
### choice
print("do you want to enter the room?")
choicebool = True
while choicebool == True:
choice = input("> ")
if choice == "yes":
print("you entered the room")
choicebool = False
elif choice == "no":
print("you did not enter the room")
choicebool = False
else:
print("invalid input, please enter yes or no.")
print("end")
Good content as always. But why is he stealing from his own house???
Good question!
I edged it to this video thank you 😊
this is great! ty
can we made this using tkinter and how??
the fan part killed me lmao
that was so helpful I would like to ask you a question.
caret: ^ greater than sign: >
Can you make it with less nesting?
No
Maybe? I've started thinking about doing a project like this, and I'm considering using a variable to set the current location, and based on the location call a function for that location. I'm also thinking about how I would implement an inventory system, which would need to include character inventory as well as inventory for each location, with the ability to move things between the current location and the character inventory.
Do you have a pastebin?
Yo can someone tell me why;
roomChoice = ("> ")
if(roomChoice == "blue"):
Doesn’t work?
Are they on the same part, for example
hideChoice = input("> ")
if(hideChoice == "yes"):
print("You hide and you see the horrifying demons rush past you")
print("Before you know it your running out the door")
print("You win")
elif(hideChoice == "no"):
print("The demons catch up with you and your eaten")
print("You Lose")
if i see a pitbull im gonna pet da baby bc teddy bear dog
meme break? how mature of you.
Hi my friend, can you help me. it says that pitbull is not defined can you fix it for me?
print("Welcome to the hounted mansion!")
print("You are a distant family member of a rich millionaire who has been passed away living this / mansion to you ")
print("as a new found owner, you decide to pay a visit to the mansion")
print("the hause isdated, creaky, and a falling appart. you walk in the front door.")
print("do you want to enter the living room or dinning room?")
roomChoice = input ("> ")
if(roomChoice == "living room"):
print("you enter the living room")
print("as you walk in you see a sleeping pitbull guarding some gold jewerly")
print(" do you want to steal the jeverly from the pitbul?")
pitBullchoice = input (" > ")
if(pitBullChoice == "yes"):
print("you attempt to stela jewelry, but it wakes up and rips you shreds")
print("you are now dead")
elif(pitBullChoice == "No"):
Print("You decide to not to steal dog's jewerly")
print("you decide to turn and leave the house safely")
else:
print("invalid choice. Please enter yes or no")
elif(roomChoice == "dinning room"):
print("you chose to go into the dinning room")
print("as you walk in, you see a shiny vase on the table")
print("do you want to open the vase")
vasechoice = input ("> ")
if (vasechoice == "yes"):
print("you open the vase and find a pile of bones")
elif(vasechoice == "no"):
print("you decide not to open the shiny vase")
print("as you turn to leave,you heare a ckacking sound comming from the corner")
print("a dark figure with glowind red eyes launches at you, knockin you unconcious")
print("you wake up in your bad.it was all a dream")
else:
print("invalid choice.please enter yes or no.")
else:
print("invalid choice. please enter living room or dinning room")
Probably a spelling error, you first typed pitBullchoice with small c and then if(pitBullChoice) with capitalized c. Not sure tho just a thought.