Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
2.2 kB
1
Indexable
Never
import time

def intro():
    print("Welcome to the Adventure Game!")
    time.sleep(1)
    print("You find yourself in a mysterious forest...")
    time.sleep(1)
    print("Your goal is to find the hidden treasure.")
    time.sleep(1)

def choose_path():
    print("You come to a fork in the road.")
    time.sleep(1)
    print("Which path will you choose? (left/right)")
    choice = input().lower()
    if choice == "left":
        print("You chose the left path...")
        time.sleep(1)
        print("You encounter a wild bear!")
        time.sleep(1)
        print("What will you do? (fight/run)")
        action = input().lower()
        if action == "fight":
            print("You bravely fight the bear and manage to defeat it!")
            time.sleep(1)
            print("You continue on your journey...")
            time.sleep(1)
            print("You find the hidden treasure! Congratulations, you win!")
        elif action == "run":
            print("You run away from the bear and get lost in the forest...")
            time.sleep(1)
            print("Game Over!")
        else:
            print("Invalid choice. Please try again.")
            choose_path()
    elif choice == "right":
        print("You chose the right path...")
        time.sleep(1)
        print("You walk for a while and find a river blocking your path.")
        time.sleep(1)
        print("What will you do? (swim/look for a bridge)")
        action = input().lower()
        if action == "swim":
            print("You try to swim across the river but get swept away by the current...")
            time.sleep(1)
            print("Game Over!")
        elif action == "look for a bridge":
            print("You find a hidden bridge and safely cross the river.")
            time.sleep(1)
            print("You continue on your journey...")
            time.sleep(1)
            print("You find the hidden treasure! Congratulations, you win!")
        else:
            print("Invalid choice. Please try again.")
            choose_path()
    else:
        print("Invalid choice. Please try again.")
        choose_path()

def main():
    intro()
    choose_path()

if __name__ == "__main__":
    main()
Leave a Comment