none
I canf get past the question to the user choice = choose path and that part is stopping me!!!!!!!!!!!!!!!!!!!!!! RRS feed

  • General discussion

  • #Selina Cellucci
    #Adventure Game
    import random
    import time
    import string
    #Display the Introduction of the game and set the scene
    def displayIntro():
        print(" Hello, you have chosen to play THE CHOICE IS YOURS")
        print("This is an adventure game where the choices that you make decide your fate.")
        print("If you make the wrong choice your character could be injured or killed.")
        print("Enjoy playing and remember... THE CHOICE IS YOURS!")
        time.sleep(3)
        print("You have awaken in a cold dark warehouse alone.")
        print("As your eyes start to adjust to the darkness you're able to make out your surroundings")
        print("You notice that theres a window high up and it's dark outside.")
        print("The second thing you can make out are stairs going down.")
        print("Then you see a blinking light and below it there's a door.")
        print()
        time.sleep(3)
        print("Enter Window, Door or Stairs.")
       
    #Input Validation
       
    def choosePath():
       
        while path != "window" and path != "stairs" and path!= "door":
            path = input("Which path will you choose? (window,stairs or door): ").lowercase
        return path
    def checkPath(chosenPath):
        if path == "window" :
            print("You pulled yourself up to the window and pushed on it as hard as your could!")
            time.sleep(3)
            print("SNAP!!! Your arm got caught in a bear trap, you panick and rip it out...")
            time.sleep(3)
            print("You are very injured and need to think quickly pick a different path and hurry!")
            #Prompt user to pick a different path
        elif path == "stairs" :
            print("You run to the stairs and see a lantern you grab it and start running down them.")
            time.sleep(3)
            print("You hear someone running after you.")
            #Here is where I want to ask if they want to throw the lantern behind them hoping the light they see up ahead is the exit
            #or turn around and get caught and killed. If they keep running they win
        elif path == "door" :
            print("You see a man in the corner with blood and dirt all over them and tape over his mouth")
            time.sleep(2)
            #Here is where I want to promp the user to pick if they want to take the tape off and listen to him or shut the door.
            #If they listen to the man it takes them to the stairs where they make those decisions
           
           
       
          
        correctPath = random.randint(1, 2)
       
        if chosenPath == str(correctPath):
            print("Good call, that could of turned out to be very ugly.")
        else:
            print("I hope you are sure about this there is no turning back now!")

    playAgain = "yes"
    while playAgain == "yes" or playAgain == "y":
        displayIntro()
        choice = choosePath()
        checkPath(choice)
       
        playAgain = input("Do you want to play again? (yes or y to continue playing): ")
    • Moved by Reed KimbleMVP Wednesday, May 2, 2018 1:13 PM python posted in VB language
    • Changed type Bill_Stewart Friday, July 27, 2018 6:34 PM
    • Moved by Bill_Stewart Friday, July 27, 2018 6:35 PM This is not "someone do my homework for me" forum
    Wednesday, May 2, 2018 2:00 AM

All replies

  • Please edit your post and place your code into a code block (second button from the right)

    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Wednesday, May 2, 2018 2:23 AM
  • Your recommended place for language support seems to be here: https://www.python.org/community/

    You might also get assistance here: https://github.com/Microsoft/PTVS

     
    Wednesday, May 2, 2018 2:44 AM
  • 1.path=""

    def choosePath():
        path=""
        while path != "window" and path != "stairs" and path!= "door":
            path = input("Which path will you choose? (window,stairs or door): ").lower()
        return path

    2.chosenpath

    def checkPath(chosenPath):
        if chosenPath == "window" :
            print("You pulled yourself up to the window and pushed on it as hard as your could!")
            time.sleep(3)
            print("SNAP!!! Your arm got caught in a bear trap, you panick and rip it out...")
            time.sleep(3)
            print("You are very injured and need to think quickly pick a different path and hurry!")
            #Prompt user to pick a different path
        elif chosenPath == "stairs" :
            print("You run to the stairs and see a lantern you grab it and start running down them.")
            time.sleep(3)
            print("You hear someone running after you.")
            #Here is where I want to ask if they want to throw the lantern behind them hoping the light they see up ahead is the exit
            #or turn around and get caught and killed. If they keep running they win
        elif chosenPath == "door" :
            print("You see a man in the corner with blood and dirt all over them and tape over his mouth")
            time.sleep(2)
            #Here is where I want to promp the user to pick if they want to take the tape off and listen to him or shut the door.
            #If they listen to the man it takes them to the stairs where they make those decisions


    Wednesday, May 2, 2018 4:26 AM
  • The "official scripting guys forum" appears to offer some general python support.  I'll move this thread to that forum as it is the closest relevant forum I can find.

    Reed Kimble - "When you do things right, people won't be sure you've done anything at all"

    Wednesday, May 2, 2018 1:12 PM
  • Python is out of scope for this forum unfortunately.

    -- Bill Stewart [Bill_Stewart]

    Wednesday, May 2, 2018 2:14 PM