コード例 #1
0
def start():
    # allows user to move through hub
    app.update_console(
        'You walk into the dimension hub and gather information on your location. You find out that you are on an abandoned planet in dimension K33, but, unfortunately, you notice your home dimension is not within range. You do have a way of getting home using your portal gun, but its currently out of charge. Luckily, you notice 6 dimensions within range that each have a power crystal you need to recharge it. The only way to get home now is to find those six power crystals and make it home alive.\n\nYou will have to travel through six different universes and interact with the people and environment on each of them. You will have five lives to spare, and each mistake you make will take away one of those lives. Now, make us all proud and get back to your home.\n'
    )
    hub.run(app)
    app.output.yview_moveto(0.25)
コード例 #2
0
ファイル: runhub.py プロジェクト: Subaru-PFS/tron_tron
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument("-c", "--config", help="configuration name, used to find subdirectory in $root/config/",
                        action="store", default='')
    args = parser.parse_args()
    
    hub.init(configName=args.config)
    startAllListeners(CPL.cfg.get('hub', 'listeners', doFlush=True))
    hub.run()
コード例 #3
0
def checkParka():
    # checks if parka is in backpack
    if app.has_item("Parka"):
        pass
    else:
        app.update_console(
            "Without your parka, you scramble to get away from the cold.\n(-2 life)",
            tag="r")
        app.add_life(-2)
        hub.run(app)
コード例 #4
0
def run(a):
    # called by main
    global app
    app = a
    if (app.has_item('Parka')):
        app.update_console(
            'You step into the howling winds of the Ice World, your feet sinking into the snow. Your parka protects you from the cold.\n'
        )
        start()
    else:
        app.update_console(
            'The fierce winds ruthlessly force you immediately back to the hub, threatening hypothermia.\n',
            tag='r')
        hub.run(app)
コード例 #5
0
def run(a):
    # called by main
    global app
    app = a
    if (app.has_item('Oxygen Tank')):
        app.update_console(
            'You put on your oxygen tank and admire the vibrant blue water and magestic city.\n'
        )
        start()
    else:
        app.update_console(
            'You can\'t survive this world unless you have an oxygen tank',
            tag='r')
        hub.run(app)
コード例 #6
0
def op2_2_1_3():
    # option 2: suboption 2 suboption 1 suboption 3
    app.change_location(("atlantis2_2sad.png", "Sad Eugene"))
    if (app.has_item('Oxygen Tank')):
        app.update_console(
            'You show the burger to Mr. Krabs. He takes a bite and says: "That\'s not the secret formula! Yer fired! (-1 Life)\n',
            tag='r')
        app.add_life(-1)
        app.update_buttons([('Back', op2_2)])
    else:
        app.update_console(
            'You can\'t survive this world unless you have an oxygen tank. (-2 Lives)',
            tag='r')
        app.add_life(-2)
        hub.run(app)
コード例 #7
0
def op2():
    # option 2
    app.change_location(("atlantis2.png", "A bustling underwater metropolis"))
    if (app.has_item('Oxygen Tank')):
        app.update_console(
            'You enter the marvellous city of Atlantis and see two buildings that stand out to you: a grandiose gilded castle and a fast food restaurant. Where do you visit?\n'
        )
        app.update_buttons([('Gilded Castle', op2_1),
                            ('Fast Food Place', op2_2), ('Back', start)])
    else:
        app.update_console(
            'You can\'t survive this world unless you have an oxygen tank. (-2 Lives)',
            tag='r')
        app.add_life(-2)
        hub.run(app)
コード例 #8
0
def start():
    # starting point
    app.change_location(("atlantis.png", "Very Water-y"))
    if (app.has_item('Oxygen Tank')):
        app.update_console(
            'You can either visit the coral reef, the city of Atlantis, or the Marinara Trench. Where would you like to go?\n'
        )
        app.update_buttons([('Coral Reef', op1), ('City of Atlantis', op2),
                            ('Marinara Trench', op3),
                            ('Return to Hub', lambda: hub.run(app))])
    else:
        app.update_console(
            'You can\'t survive this world unless you have an oxygen tank. (-2 Lives)',
            tag='r')
        app.add_life(-2)
        hub.run(app)
コード例 #9
0
def op2_2_1_4():
    # option 2: suboption 2 suboption 1 suboption 4
    app.change_location(("atlantis2_2happy.png", "Happy Eugene"))
    global krabbyPatty
    if (app.has_item('Oxygen Tank')):
        app.update_console(
            'You show the burger to Mr. Krabs. He takes a bite and says: "Great job, lad! You made a perfect Krabby Patty! Here\'s a nice seashell necklace fer ya!\n',
            tag='g')
        app.add_item('Seashell Necklace')
        krabbyPatty = True
        app.update_buttons([('Back', op2)])
    else:
        app.update_console(
            'You can\'t survive this world unless you have an oxygen tank. (-2 Lives)',
            tag='r')
        app.add_life(-2)
        hub.run(app)
コード例 #10
0
def op2_1_1():
    # option 2: suboption 1 suboption 1
    global triton
    if (app.has_item('Oxygen Tank')):
        app.update_console(
            'Triton thanks you for your generous gift and returns to you his trident.'
        )
        app.remove_item('Dolphin Translator')
        app.add_item('Trident')
        triton = True
        app.update_buttons([('Back', op2)])
    else:
        app.update_console(
            'You can\'t survive this world unless you have an oxygen tank. (-2 Lives)',
            tag='r')
        app.add_life(-2)
        hub.run(app)
コード例 #11
0
def op3_1():
    # option: 3 suboption 1
    app.change_location(("atlantis3_1.png", "There it is!"))
    global shipwreck
    if (app.has_item('Oxygen Tank')):
        app.update_console(
            'You put on your deep-sea diving device, travel all the way down to the bottom of the ocean, and enter the abandoned shipwreck. Stuck between the floorboards, you find a power crystal and put it in your backpack. However, your deep-sea diving device is used up, so you must throw it away.',
            tag='g')
        app.remove_item('Deep-sea Diving Device')
        app.add_item('Blue Crystal')
        shipwreck = True
        app.update_buttons([('Back', start)])
    else:
        app.update_console(
            'You can\'t survive this world unless you have an oxygen tank. (-2 Lives)',
            tag='r')
        app.add_life(-2)
        hub.run(app)
コード例 #12
0
def start():
    # starting point
    app.change_location(("future.png", "How terribly futuristic"))
    app.update_console(
        'You enter the busy city and see what appear to be a city hall, a research department, and a hospital wing. Which area you do inspect?\n'
    )
    app.update_buttons([('City Hall', op1), ('Tech Research Department', op2),
                        ('Hospital Wing', op3),
                        ('Return to Hub', lambda: hub.run(app))])
コード例 #13
0
def start():
    # starting point
    app.change_location(
        ("dinoWorld.png", "A lush forest with an anciet spirit."))
    app.update_console(
        'To your left you see a towering stone temple, in the distance, you see a sleeping T-Rex, and to your right, you see an abandoned campsite. Which way do you turn?\n'
    )
    app.update_buttons([('Jungle Temple', op1), ('Sleeping T-Rex', op2),
                        ('Abandoned Campsite', op3),
                        ('Return to Hub', lambda: hub.run(app))])
コード例 #14
0
def op2_2_1():
    # option 2: suboption 2 suboption 1
    if (app.has_item('Oxygen Tank')):
        app.update_console(
            'Mr. Krabs hands you the Krabby Patty secret formula, but it\'s written in code! You\'re going to have to decipher it. The paper reads:'
        )
        app.update_console('Uif tfdsfu gpsnvmb jt dsbc')
        app.update_console(
            'The note also provides a hint: Caeser. What is the secret ingredient?\n'
        )
        app.update_buttons([('Parsley', op2_2_1_1), ('Squirrel', op2_2_1_2),
                            ('Seastar', op2_2_1_3), ('Crab', op2_2_1_4),
                            ('Back', op2_2)])
    else:
        app.update_console(
            'You can\'t survive this world unless you have an oxygen tank. (-2 Lives)',
            tag='r')
        app.add_life(-2)
        hub.run(app)
コード例 #15
0
def op2_2():
    # option 2: suboption 2
    global krabbyPatty
    app.change_location(("atlantis2_2happy.png", "Most call him Eugene"))
    if (app.has_item('Oxygen Tank')):
        if (not krabbyPatty):
            app.update_console(
                'A crab walking on his hind legs walks up to you and says: "Ahoy, laddy! Welcome to the Krusty Krab! Err... Unfortunately, our fry cook, Spongebob, is out for today, and our restaurant is really busy. Do you think you could make a Krabby Patty for us? I\'ll pay ya with my daughter Pearl\'s nice seashell necklace!"\n'
            )
            app.update_buttons([('Sure!', op2_2_1), ('Back', op2)])
        else:
            app.update_console('Eugene Krabs is very happy."\n')
            app.update_buttons([('Back', start)])
    else:
        app.update_console(
            'You can\'t survive this world unless you have an oxygen tank. (-2 Lives)',
            tag='r')
        app.add_life(-2)
        hub.run(app)
コード例 #16
0
def start():
    # starting point
    checkParka()
    app.change_location(("iceWorld.png", "A frozen wasteland."))
    app.update_console(
        "You see the glow of an Inuit Village, the towering outline of a mountain, and a pack of sabertooth tigers. What do you do?\n"
    )
    app.update_buttons([("Village", op1), ("Mountain", op2),
                        ("Sabertooth Tigers", op3),
                        ("Return to Hub", lambda: hub.run(app))])
コード例 #17
0
def op1():
    # option 1
    if (app.has_item('Oxygen Tank')):
        if (not shark):
            app.change_location(("atlantis1.png", "Ay caramba, a shark!"))
            app.update_console(
                'You see a shark in the coral reef. Do you want to fight it?\n'
            )
            app.update_buttons([('Fight', op1_1), ('Back', start)])
        else:
            app.change_location(
                ("atlantis1dead.png", "The mighty shark has been dethroned"))
            app.update_console(
                'There\'s nothing left in the coral reef to see\n')
    else:
        app.update_console(
            'You can\'t survive this world unless you have an oxygen tank. (-2 Lives)',
            tag='r')
        app.add_life(-2)
        hub.run(app)
コード例 #18
0
def op1_1():
    # option 1: suboption 1
    global shark
    if (app.has_item('Oxygen Tank')):
        if (app.get_items('weapon') != []):
            chance = random.randint(0, 1)
            if (chance == 0):
                app.change_location(("atlantis1dead.png",
                                     "The mighty shark has been dethroned"))
                app.update_console(
                    'You successfully kill the shark with your ' +
                    random.choice(app.get_items('weapon')) +
                    '. You get shark fin soup.\n',
                    tag='g')
                app.add_item('Shark Fin Soup')
                shark = True
            else:
                app.update_console('The shark bites you. (-1 Life)\n', tag='r')
                app.add_life(-1)
        else:
            chance = random.randint(0, 9)
            if (chance == 9):
                app.change_location(("atlantis1dead.png",
                                     "The mighty shark has been dethroned"))
                app.update_console(
                    'You successfully punch the shark to death. You get shark fin soup.\n',
                    tag='g')
                app.add_item('Shark Fin Soup')
                shark = True
            else:
                app.update_console('The shark bites you. (-1 Life)\n', tag='r')
                app.add_life(-1)
                app.update_buttons([('Back', op1)])
    else:
        app.update_console(
            'You can\'t survive this world unless you have an oxygen tank. (-2 Lives)',
            tag='r')
        app.add_life(-2)
        hub.run(app)
コード例 #19
0
def op3():
    # option 3
    app.change_location(("atlantis3.png", "Woah, that's deep"))
    global shipwreck
    if (app.has_item('Oxygen Tank')):
        if (not shipwreck):
            app.update_console(
                'You see a group of undersea scientists surrounding the very deep part of the ocean. "We know that there\'s a power crystal down there in an abandoned shipwreck, but we have no way to get it! We need some sort of deep-sea diving device," one says. You decide you want to go get the power crystal yourself.\n'
            )
            if (app.has_item('Deep-sea Diving Device')):
                app.update_buttons([('Use Deep-sea Diving Device', op3_1),
                                    ('Back', start)])
            else:
                app.update_buttons([('Back', start)])
        else:
            app.update_console('There is nothing left in the trench.')
            app.update_buttons([('Back', start)])
    else:
        app.update_console(
            'You can\'t survive this world unless you have an oxygen tank. (-2 Lives)',
            tag='r')
        app.add_life(-2)
        hub.run(app)
コード例 #20
0
def op2_1():
    # option 2: suboption 1
    global triton
    app.change_location(("atlantis2_1.png", "King Triton, ruler of the seas"))
    if (app.has_item('Oxygen Tank')):
        if (not triton):
            app.update_console(
                'You travel through the diamond-encrusted doorway and find a merman sitting on a throne with a shiny crown placed neatly on his head. You walk up to the merman and he tells you to kneel before him. He tells you his name is King Triton and that he is in need of a dolphin translator to speak with the wildlife. He offers a grand prize of his trident if you succed in bringing it to him.\n'
            )
            if (app.has_item('Dolphin Translator')):
                app.update_buttons([('Give Dolphin Translator', op2_1_1),
                                    ('Back', op2)])
            else:
                app.update_buttons([('Back', op2)])
        else:
            app.update_console(
                'King Triton once again thanks you for his gift\n')
            app.update_buttons([('Back', op2)])
    else:
        app.update_console(
            'You can\'t survive this world unless you have an oxygen tank. (-2 Lives)',
            tag='r')
        app.add_life(-2)
        hub.run(app)
コード例 #21
0
def start():
    # starting point
    global entered
    app.change_location(
        ("warWorld.png", "A grim landscape in the midst of war."))
    if not entered:
        app.update_console(
            "Shortly after stepping foot in the trench, a military officer notices you and approaches you:\n\"What are you doing here, private? Get back to the front lines, where you're supposed to be!\""
        )
        app.update_console(
            "Hastily, you follow orders, trying to avoid trouble, and make your way to the front lines."
        )
        app.update_console("You find a rifle along the way.", tag="g")
        app.add_item("Rifle")
        entered = True
        op1()
    else:
        app.update_console(
            "You see the front lines ahead of you, the dugout behind you, and a faint outline of a city far back. Where do you go?\n"
        )
        app.update_buttons([("Front Lines", op1), ("Military Dugout", op2),
                            ("City", op3),
                            ("Return to Hub", lambda: hub.run(app))])
コード例 #22
0
def start():
    # starting point
    app.change_location(("postApocWorld.png","A dusty dystopia"))
    app.update_console('Within your field of view, you can see a massive metal dome, a group of off-road vehicles, and a gang of survivors. Which area do you visit first?\n')
    app.update_buttons([('Thunderdome', op1), ('Off-road Vehicles', op2), ('Gang of Survivors', op3), ('Return to Hub', lambda: hub.run(app))])