示例#1
0
def play():

    print("Escape from Cave Terror!")
    world.parse_world_dsl()
    player = Player()
    while player.is_alive() and not player.victory:
        room = world.tile_at(player.x, player.y)
        print(room.intro_text())
        room.modify_player(player)
        if player.is_alive() and not player.victory:
            choose_action(room, player)
        elif not player.is_alive():
            print("Your journey has come to an early end!")

        if action_input in ['n', 'N']:
            player.move_north()
        elif action_input in ['s', 'S']:
            player.move_south()
        elif action_input in ['e', 'E']:
            player.move_east()
        elif action_input in ['w', 'W']:
            player.move_west()
        elif action_input in ['i', 'I']:
            player.print_inventory()
        elif action_input in ['a', 'A']:
            player.attack()
        elif action_input in ['h', 'H']:
            player.heal()
        else:
            print("Invalid action!")
def play():

    print("Escape from Cave Terror!")
    world.parse_world_dsl()
    player = Player()
    while player.is_alive() and not player.victory:
        room = world.tile_at(player.x, player.y)
        print(room.intro_text())
        room.modify_player(player)
        if player.is_alive() and not player.victory:
            choose_action(room, player)
        elif not player.is_alive():
            print("Your journey has come to an early end!")

        if action_input in ['n', 'N']:
            player.move_north()
        elif action_input in ['s', 'S']:
            player.move_south()
        elif action_input in ['e', 'E']:
            player.move_east()
        elif action_input in ['w', 'W']:
            player.move_west()
        elif action_input in ['i', 'I']:
            player.print_inventory()
        elif action_input in ['a', 'A']:
            player.attack()
        elif action_input in ['h', 'H']:
            player.heal()
        else:
            print("Invalid action!")
示例#3
0
def play():

    world.parse_world_dsl()  # load tiles
    player = Player()

    #These lines load the starting room and display the text
    room = world.tile_exists(player.location_x, player.location_y)
    print(room.intro_text())

    while player.is_alive() and not player.victory:
        #Loop begins here
        room = world.tile_exists(player.location_x, player.location_y)
        room.modify_player(player)

        # Check again since the room could have changed the player's state
        if player.is_alive() and not player.victory:
            print("Choose an action:\n")
            available_actions = room.available_actions()
            for action in available_actions:
                print(action)
            action_input = input('Action: ')
            for action in available_actions:
                if action_input == action.hotkey:
                    player.do_action(action, **action.kwargs)
                    break
示例#4
0
文件: game.py 项目: cbesaw/txt_adv
def play():
    print("""
        After five days of traveling you arrive in the abandoned city of 
        Norbrook. You are here to look for your Lord, who disappeared after
        traveling to the city over two months ago. Norbrook has been abandoned
        for over a hundred years, but hushed whispers spread rumors of sound
        and shadow coming from the once bustling city. 
        
        Your Lord never told you why he came to this place, but the head cleric
        of your order has tasked you with finding information about his
        whereabouts.
        
        You feel nervous. Your training had only just begun as a paladin of
        the order when your lord disappeared. Shadows and light dance in your
        periphery. It is hard to tell if there is movement or whether your
        tired eyes are playing tricks on you. 
        
        You stand in an intersection after entering the city gate. The city,
        while abandoned, surprisingly does not look ruinous. 
          """)
    world.parse_world_dsl()
    player = Player()
    while True:
        room = world.tile_at(player.x, player.y)
        print(room.intro_text())
        choose_action(room, player)
        room.modify_player(player)
示例#5
0
    def __init__(self, master):

        root.geometry("2000x1000")
        root.title("Escape from Mansion!")
        Text = Text(height=50, width=100)
        world.parse_world_dsl()
        self.player = Player()

        Button1 = Button(root, text="North", command=self.move_northgui)
        Button2 = Button(root, text="South", command=self.player.move_southgui)
        Button3 = Button(root, text="East", command=self.player.move_eastgui)
        Button4 = Button(root, text="West", command=self.player.move_westgui)
        Button5 = Button(
            root,
            text="Heal",
        )
        Button6 = Button(root, text="Inventory")
        Button7 = Button(root, text="Attack")

        Text.pack(side=LEFT, expand=1)
        Button1.pack(side=RIGHT, padx=10)
        Button2.pack(side=RIGHT, padx=10)
        Button3.pack(side=RIGHT, padx=10)
        Button4.pack(side=RIGHT, padx=10)
        Button5.pack(side=RIGHT, padx=10)
        Button6.pack(side=RIGHT, padx=10)
        Button7.pack(side=RIGHT, padx=10)
示例#6
0
def play():
    print("Escape from Cave Terror!")
    world.parse_world_dsl()
    player = Player()
    while True:
        room = world.tile_at(player.x, player.y)
        print(room.intro_text())
        room.modify_player(player)
        choose_action(room, player)
def play():
    print("Ollie's Adventure!")
    world.parse_world_dsl()
    player = Player()
    while not player.victory:
        room = world.tile_at(player.x, player.y)
        print(room.intro_text(player))
        room.modify_player(player)
        choose_action(room, player)
示例#8
0
def play():
    print("Explore this mystical land of myth and legend!")
    world.parse_world_dsl()
    player = Player()
    while True:
        room = world.tile_at(player.x, player.y)
        print(room.intro_text())
        room.modify_player(player)
        choose_action(room, player)
示例#9
0
文件: game.py 项目: Shpaackle/DDQ
def play():
    print("Escape from Mother’s Dungeon!")
    print(world.start_tile_location)
    world.parse_world_dsl()
    player = Player()
    while True:
        room = world.tile_at(player.x, player.y)
        print(room.intro_text())
        room.modify_player(player)
        choose_action(room, player)
示例#10
0
def play():
    print("Challenge and beat the legendary Dragon!")
    world.parse_world_dsl()
    player = Player()
    while player.is_alive() and not player.victory:
        room = world.tile_at(player.x, player.y)
        print(room.intro())
        room.modify_player(player)
        if player.is_alive() and not player.victory:
            choose_action(room, player)
        elif not player.is_alive():
            print("Your journey has come to an early end!")
示例#11
0
def play():
    print("Escape from the Valley of Homicide!")
    world.parse_world_dsl()
    player = Player()
    while player.is_alive() and not player.victory:
        room = world.tile_at(player.x, player.y)
        print(room.intro_text())
        room.modify_player(player)
        if player.is_alive() and not player.vicrory:
            choose_action(room, player)
        elif not player.is_alive():
            print("Your journey has come to an early end!")
示例#12
0
def play():
    print("Welcome to the Mansion of No Escape!")
    world.parse_world_dsl()
    player = Player()
    while player.is_alive() and not player.victory:
        room = world.tile_at(player.x, player.y)
        print(room.intro_text())
        room.modify_player(player)
        if player.is_alive() and not player.victory:
            choose_action(room, player)
        if player.is_dead:
            print("Your adventure got cut short!")
示例#13
0
def play():
    print("The Adventures of the gloomy forest! \nTry to escape..")
    world.parse_world_dsl()
    player = Player()
    while player.is_alive() and not player.victory:
        room = world.tile_at(player.x, player.y)
        print(room.intro_text())
        room.modify_player(player)
        if player.is_alive() and not player.victory:
            choose_action(room, player)
        elif not player.is_alive():
            print("Your journey has come to an early end...")
示例#14
0
def play():
    print("Escape from Cave Terror!")
    world.parse_world_dsl()
    player = Player()
    while player.is_alive() and not player.victory:
        room = world.tile_at(player.x, player.y)
        print(room.intro_text())
        room.modify_player(player)
        if player.is_alive() and not player.victory:
            choose_action(room, player)
        elif not player.is_alive():
            print("You Died!")
示例#15
0
def play():
    print("Escape from the abandoned mansion!")
    world.parse_world_dsl()
    player = Player()
    while player.is_alive() and not player.victory:
        room = world.tile_at(player.x, player.y)
        print(room.intro_text())
        room.modify_player(player)
        if player.is_alive() and not player.victory:
            choose_action(room, player)
        elif not player.is_alive():
            print("Your journey has been cut short!")
def play():                                                     # main() starts here..
    print(" // Game title & caption goes here..")
    world.parse_world_dsl()
    player = Player()
    while player.is.alive() and not player.victory:
        room = world.tile_at(player.x, player.y)
        print(room.intro_text())
        room.modify_player(player)
        if player.is_alive() and not player.victory:
            choose_action(room,player)
        elif not player.is_alive():
            print(" Game end & caption goes here..")
示例#17
0
def play():
    print('Escape from Cave Terror!')
    world.parse_world_dsl()
    player = Player()
    while player.is_alive() and not player.victory:
        room = world.tile_at(player.x, player.y)
        print(room.intro_text())
        room.modify_player(player)
        if player.is_alive() and not player.victory:
            choose_action(room, player)
        elif not player.is_alive():
            print('Your journey has come to an early end!')
示例#18
0
def play():
    print("A Long Journey")

    world.parse_world_dsl()
    player = Player()
    while player.is_alive() and not player.victory:
        room = world.tile_at(player.x, player.y)
        player.update_inventory(room.intro_text(player.return_inventory()))
        room.modify_player(player)
        if player.is_alive() and not player.victory:
            choose_action(room, player)
        elif not player.is_alive():
            print("You have succumbed to the evils of this world...")
示例#19
0
def play():
    print('The Mansion.')
    world.parse_world_dsl()
    player = Player()

    while player.is_alive() and not player.victory:
        room = world.tile_at(player.x, player.y)  # which tile
        print(room.intro_text())
        room.modify_player(player)  # what the room does to the player
        if player.is_alive() and not player.victory:
            choose_action(room, player)
        elif not player.is_alive():
            print("Your journey has come to an early end!\n" "YOU  ARE  DEAD.")
示例#20
0
def play():
    print("Press q at any moment to quit.")
    world.parse_world_dsl()
    player = Player()
    while player.is_alive() and not player.victory:
        room = world.tile_at(player.x, player.y)
        print(room.intro_text())
        room.modify_player(player)
        if player.is_alive() and not player.victory:
            choose_action(room, player)
        elif not player.is_alive():
            print("Your journey has come to an early end...")
            return
示例#21
0
def play():
    print("Escape from Cave Terror!")
    world.parse_world_dsl()
    player = Player()
    while player.is_alive() and not player.victory:
        room = world.tile_at(player.x, player.y)
        print(room.intro_text())
        room.modify_player(player)
        room.modify_mana(player)
        if player.is_alive() and not player.victory:
            choose_action(room, player)
            dashline()  # makes dash lines on the screen
        elif not player.is_alive():
            print("Your journey has come to an early end!")
def play():
    print("--------------")
    print("Undead Escape!")
    print("--------------")
    world.parse_world_dsl()
    player = Player()
    while player.is_alive() and not player.victory:
        room = world.tile_at(player.x, player.y)
        print(room.intro_text())
        room.modify_player(player)
        if player.is_alive() and not player.victory:
            choose_action(room, player)
        elif not player.is_alive():
            print("You failed to survive....")
示例#23
0
def play():
    print("Escape from terror cave!")
    world.parse_world_dsl()
    player = Player()
    while player.is_alive() and not player.victory:
        room = world.tile_at(player.x, player.y)
        print(room.intro_text())
        if not room.enemy_que == []:
            for bad_guy in room.enemy_que:
                bad_guy.modify_player(player)
        room.modify_player(player)
        if player.is_alive() and not player.victory:
            choose_action(room, player)
        elif not player.is_alive():
            print("Your journey has come to an early end!")
示例#24
0
def play():
    print("""
                    Witch Cave: Double Boil, Toil, and Trouble
            A text-adventure game that will challenge even the literate.
                    By: Eric Kvale for Computer Science I Fall 2017 
 ********************************************************************************
*                    /   \              /'\       _                              *
*\_..           /'.,/     \_         .,'   \     / \_                            *
*    \         /            \      _/       \_  /    \     _                     *
*     \__,.   /              \    /           \/.,   _|  _/ \                    *
*          \_/                \  /',.,''\      \_ \_/  \/    \                   *
*                           _  \/   /    ',../',.\    _/      \                  *
*             /           _/m\  \  /    |         \  /.,/'\   _\                 *
*           _/           /MMmm\  \_     |          \/      \_/  \                *
*          /      \     |MMMMmm|   \__   \          \_       \   \_              *
*                  \   /MMMMMMm|      \   \           \       \    \             *
*                   \  |MMMMMMmm\      \___            \_      \_   \            *
*                    \|MMMMMMMMmm|____.'  /\_            \       \   \_          *
*                    /'.,___________...,,'   \            \   \        \         *
*                   /       \          |      \    |__     \   \_       \        *
*                 _/        |           \      \_     \     \    \       \_      *
*                /                               \     \     \_   \        \     *
*                                                 \     \      \   \__      \    *
*                                                  \     \_     \     \      \   *
*                                                   |      \     \     \      \  *
*                                                    \            |            \ *
 ********************************************************************************""")
    input("Hit any key if you dare to continue...")
    print("You are in a dark cave."
          " In the middle, there is a cauldron boiling. "
          "With a clasp of thunder, three witches suddenly appear before you. ")
    input(">")
    spooky = pyglet.media.load("resources/seacave.wav", streaming=True)
    spooky.play()

    world.parse_world_dsl()
    player = Player()

    while player.is_alive() and not player.victory:
        room = world.tile_at(player.x, player.y)
        print(room.intro_text())
        room.modify_player(player)
        if player.is_alive() and not player.victory:
            choose_action(room, player)
        elif not player.is_alive():
            print(ascii.grimreaper)
            print("You have failed. The witches feast on your body, and throw your soul into the underworld.")
            input("")
示例#25
0
def play():
    print("Escape the Prison Planet!")

    world.parse_world_dsl()
    player = Player()

    while not player.QUIT_ACTION and player.is_alive() and not player.victory:
        room = world.tile_at(player.x, player.y)
        print(room.intro_text())
        room.modify_player(player)
        if player.is_alive() and not player.victory:
            choose_action(room, player)
        elif not player.is_alive():
            print(
                "All grows dark as your eyes close and the breath leaves your body."
            )
示例#26
0
def play():
    clear = lambda: os.system('cls')
    clear()
    print("""
    ====  Drazards Dungeon  ====
    """)
    world.parse_world_dsl()
    player = Player()
    while player.is_alive() and not player.victory:
        room = world.tile_at(player.x, player.y)
        print(room.intro_text())
        room.modify_player(player)
        if player.is_alive() and not player.victory:
            choose_action(room, player)
        elif not player.is_alive():
            print("Your journey has come to an early end!")
示例#27
0
def play():
    """
    This is the main loop of the game.

    play loops through all the actions
    """
    print("Escape from Cave Terror!")
    world.parse_world_dsl()
    player = Player()
    while player.is_alive() and not player.victory:
        room = world.tile_at(player.x, player.y)
        print(room.intro_text())
        room.modify_player(player)
        if player.is_alive() and not player.victory:
            choose_action(room, player)
        elif not player.is_alive():
            print("Your journey has come to an early end!")
示例#28
0
def play():
    os.system('cls||clear')
    input(art.qfq_banner)
    world.parse_world_dsl()
    player = Player()
    while player.is_alive() and not player.victory:
        os.system('cls||clear')
        print("#" * 30 + " THE QUEST FOR QUAT " + "#" * 30)
        room = world.tile_at(player.x, player.y)
        print(room.intro_text())
        if room.menace_text():
            print(room.menace_text())
        if room.floor_items:
            print(room.floor_text())
        room.modify_player(player)
        if player.is_alive() and not player.victory:
            choose_action(room, player)
        elif not player.is_alive():
            print("Your journey has come to an early end.")
示例#29
0
def play():
    print("Escape from Cave Terror!")
    print("version 1.1.1")
    world.parse_world_dsl()
    player = Player()
    while player.is_alive() and not player.victory:
        room = world.tile_at(player.x, player.y)
        print(room.intro_text())
        room.modify_player(player)
        if player.is_alive() and not player.victory:
            choose_action(room, player)
        elif not player.is_alive():
            print("You have died! R.I.P")

    actions = OrderedDict()
    if player.inventory:
        actions['i'] = player.print_inventory
        actions['I'] = player.print_inventory
        print("i: View inventory")
示例#30
0
def play():
    world.parse_world_dsl()
    print("You are awakening as if from a dream.")
    print("Where are you? What is this place?")
    player_name = input("You barely remember your name...type it here: ")
    time.sleep(0.5)
    print()
    print("What sort of person are you, anyway?")
    type_chosen = False
    while not type_chosen:
        try:
            for key in world.player_types.keys():
                print("(" + key + ") " + world.player_types[key])
            player_type = input("Your choice? ")
            if player_type in ['a', 'b', 'c', 'd']:
                type_chosen = True
                player_type = world.player_types[player_type]
        except (ValueError, IndexError):
            print("That's not a valid choice!")
    time.sleep(0.5)
    print("Slowly, your vision begins to come into focus...\n ")
    time.sleep(1)
    player = Player(player_name, player_type)
    dead = False
    room = world.tile_at(player.x, player.y)
    print(room.describe())

    while not dead and not player.victory:
        room = world.tile_at(player.x, player.y)
        room.modify_player(player)
        if player.health <= 0:
            dead = True
            print("xXx YOU DIED xXx")
        elif not player.victory:
            choose_action(room, player)
    if isinstance(room, world.EscapeTile):
        print("You escaped the school with cash and prizes valued at ${}!".
              format(player.loot_value()))
        update_high_scores(player_name, player.loot_value())
def lobby():
    set_font("Courier New", 20, 20)
    r = random.randint(1, 2)
    if r == 1:
        play_sound("Sounds\Dalarna.mp3")
    else:
        play_sound("Sounds\Halland.mp3")
    world.world_map = []
    world.world_dsl = world.lobby_dsl
    pyautogui.press('f11')
    time.sleep(0.1)
    pyautogui.press('f11')
    os.system("cls")
    print("Location: Camp")
    world.parse_world_dsl()
    player = Player()
    player.victory = False
    while player.is_alive() and not player.victory:
        room = world.tile_at(player.x, player.y)
        print(room.intro_text())
        print("")
        room.modify_player(player)
        if player.is_alive() and not player.victory:
            choose_action(room, player)