Exemplo n.º 1
0
def updateBullet(aiSettings, screen, ship, bullets, aliens, explosionSound, wowSound, stats, sb):
    bullets.update()
    # get rid of the unused bullet
    for bullet in bullets.copy():
        if bullet.rect.bottom <= 0:
            bullets.remove(bullet)
    # check for collision with bullet
    collision = pygame.sprite.groupcollide(bullets, aliens, True, True)
    for hit in collision:
        explosionSound.play()
        dead = Dead(screen, hit)
        dead.drawDead()
        stats.score += 10
        sb.prepScore()
        pygame.display.flip()

    # create new fleet when we finish destroy every alien
    if len(aliens) == 0:
        bullets.empty()
        wowSound.play()
        createFleet(aiSettings, screen, ship, aliens)
        aiSettings.scaleSpeed()

    # update high score if we make a new one
    hScore = 0
    # get the high score from the file
    with open('highscore.txt') as fileObject:
        hScore = fileObject.read()
    # save high score
    if stats.score > int(hScore):
        # rewrite the high score
        with open('highscore.txt', 'w') as fileObject:
            fileObject.write(str(stats.score))
        sb.prepHScore()
Exemplo n.º 2
0
    def upstairs_to_main_floor(self):
        print("""
        You and your friends are pretty creeped out at this point. You look around,
        meet everyone's eyes and motion your head to go down the stairs. Your friends
        nod, and you start to creep back down the way you came. As your last friend
        is about halway down the staircase, you hear one final creak and know that something
        is wrong. You feel the boards begin to creak beneath you. The wooden stairs
        begin to spinter and crack revealing that there is much more than just one floor
        that you will fall. You think that if you jump you can make it before the
        stairs collapse. However, you see your friend Lydia, will never make the jump.
        Do you jump and risk it or do you save Lydia?
        """)

        choice = input("> ")

        if "jump" in choice:
            print("""
            You manage to jump out of the way just in time, landing cleanly on your feet.
            Lydia, however, was not so lucky. You call her name down the cavernous black
            hole where the staircase used to be. You can't see anything and you hear
            nothing in response. What do you do? \n
            Do you cut your losses and leave the house? \n
            Or do you risk it all to save Lydia? \n
            """)

            choice = input("> ")

            if "leave" in choice:
                from dead import Dead
                Dead().dead("""You are too stunned from surviving the fall that you
                have no time to greive for your lost friend. You leave the house bruised,
                but you are alive. Time passes and you have never gone back to the house,
                out of fear, and also guilt. You are much older now, and you hear urban legends
                from the younger generation speaking of a young woman, badly crooked,
                wandering the house seeking her lost friends.""")
            else:
                from basement import Basement
                Basement().explore_basement()

        elif "Lydia" in choice or "save" in choice or "lydia":
            from dead import Dead
            Dead().dead("""
            You, and a few others, fall with Lydia to the cavern below. You land
            hard on your side. As you get up you find that you are badly injured,
            but you are able to walk. Upon investigation however, you find that some
            of your friends are not as lucky. \n
            As you investigate your surroundings you see no way out. It is as if this
            pit was here for this purpose. You touch the wall to find that it is carved
            from jagged rock. Lydia, who is the only climber among you, would have been
            able to scale out of there but here injuries are too extreme. You scream
            for help, but you know that there is no one around for miles. After several
            failed attempts you sit with your back against a wall. All you can do
            now is wait.
            """)
        else:
            print("Try typing 'Lydia' or 'jump'.")
            UpstairsToMainFloor().upstairs_to_main_floor()
Exemplo n.º 3
0
def check_bullet_alien_collisions(ai_settings, screen, stats, sb, ship, aliens,
                                  bullets, abullets, ralien, audio, death,
                                  bunkers):
    if pygame.sprite.spritecollideany(ship, abullets):
        if ship.deadc == 10:
            ship.dead = True
    if pygame.sprite.groupcollide(bullets, bunkers, True, False) or \
        pygame.sprite.groupcollide(abullets, bunkers, True, False):
        '''ignore'''
    collisions = pygame.sprite.spritecollideany(ralien, bullets)
    if collisions:
        bullets.remove(collisions)
        ralien.dead()
        stats.score += 200
        sb.prep_score()
    collisions = pygame.sprite.groupcollide(bullets, aliens, True, True)
    if collisions:
        ai_settings.alien_tracker -= 1
        for alien in collisions.values():
            ali = alien.pop()
            death.add(Dead(screen, ali.rect))
            stats.score += ali.worth
            sb.prep_score()
        check_high_score(stats, sb)
        if ai_settings.speed_buffer > 0:
            ai_settings.speed_buffer -= 1
        else:
            ai_settings.increase_speed()
            ai_settings.speed_buffer = 2
    if len(aliens) == 0:
        bullets.empty()
        ai_settings.reset()
        stats.level += 1
        sb.prep_level()
        create_fleet(ai_settings, screen, aliens)
Exemplo n.º 4
0
    def living_room(self):
        print("""
        You lead your friends into the living room. The entire room is covered with
        a thin layer of dust except for the grand piano which somehow, despite its
        degree of dilapitation, is seemingly spotless. \n
        Your can feel the mood in the room start to shift, but your friends shake
        it off among some nervous laughter. \n
        You are drawn to the piano. You don't know how to play, but you get a sudden
        urge to push your fingers down on the ivory keys. \n
        Do you dare play? Or will you explore another room? \n
        """)

        choice = input("> ")

        if "yes" in choice or "play" in choice:
            from dead import Dead
            print("""
            You press one finger down on a key. The piano is badly out of tune,
            but you can't resist playing another key, and then another. \n
            Soon you are sitting on the bench playing your heart out to a tune that
            both pains and excites you. \n
            The more you keep playing the less the piano sounds out of tune, and
            the more it sounds like sweet music. \n
            You play until your fingers are raw, and you can feel hunger growing
            in your belly. \n
            You play your way to the final cresendo, fingers cascading down the
            keys almost too fast to be visible. \n
            Once the final note has been played you breath a sigh of releif.
            Your masterpiece is complete. \n
            You turn to see your friends but instead you are in an area restored
            to its former grandeur. \n
            An audience of ghostly figures applauds you. \n
            'Play another!' they shriek. \n
            You turn back to the piano. \n
            """)

            Dead().dead("""You are caught in a never ending loop of piano playing. \n
            You don't know how much time has passed, but eventually you are ushered
            off the piano bench and onto a seat in the audience. \n
            You don't understand, wasn't your playing enjoyable. \n
            A sad woman nearby seems to read your mind when she says 'Don't worry,
            we will just wait here until another player arrives. \n
            """)

        elif "explore" in choice or "room" in choice:
            from explore_main_floor import ExploreMainFloor
            ExploreMainFloor().explore_main_floor()
        else:
            print("I don't understand. Try typing 'yes' or 'no'.")
            LivingRoom().living_room()
def check_bullet_alien_collisions(ai_settings, screen, stats, sb, ship, aliens, bullets, abullets,
                                  ralien, audio, death, bunkers):
    """Respond to bullet-alien collisions"""
    # Remove any bullets and aliens that have collided.
    if pygame.sprite.spritecollideany(ship, abullets):
        if ship.deadc == 10:
            ship.dead = True
    if pygame.sprite.groupcollide(bullets, bunkers, True, False) or \
            pygame.sprite.groupcollide(abullets, bunkers, True, False):
        audio.exploa.play(audio.explob)
    collisions = pygame.sprite.spritecollideany(ralien, bullets)
    if collisions:
        bullets.remove(collisions)
        ralien.dead()
        stats.score += 200
        sb.prep_score()
        audio.exploa.play(audio.explob)
    collisions = pygame.sprite.groupcollide(bullets, aliens, True, True)
    if collisions:
        ai_settings.alien_tracker -= 1
        audio.exploa.play(audio.explob)
        for alien in collisions.values():
            ali = alien.pop()
            death.add(Dead(screen, ali.rect))
            audio.exploa.play(audio.explob)
            stats.score += ali.worth
            sb.prep_score()
        check_high_score(stats, sb)
        if ai_settings.speed_buffer > 0:
            ai_settings.speed_buffer -= 1
        else:
            ai_settings.increase_speed()
            ai_settings.speed_buffer = 2
    if len(aliens) == 0:
        # If the entire fleet is destroyed, start a new level.
        bullets.empty()
        ai_settings.reset()

        # Increase level.
        stats.level += 1
        sb.prep_level()

        create_fleet(ai_settings, screen, aliens)
Exemplo n.º 6
0
    def hallway(self):
        print("""
        Maybe you are feeling bold, or perhaps you are feeling a bit rash, but
        you decide to follow the voice that was coming from the hallway. You make
        your way forward, apprehensive of what you might find. \n
        There is a mirror at the end of the hall, only visible by the moonlight
        coming through one of the windows. In the mirror you see the reflection of
        a little girl. The era of her clothing looks like the era of the house, and
        similarly, in the same degree of disrepair. \n
        You walk closer to the mirror, directly in front of it, and address the child.
        You ask her what she is doing in the mirror, and why she told you to avoid
        the other room. \n
        The girl begins "A powerful deamon resides in that room. It trapped me in this
        mirror long ago, and it is one of the main reasons why this place is cursed.
        The deamon changes its appearence everytime you encounter it. It can look like
        a stranger or someone you know. This makes it particularly fearsome." \n
        You aren't sure what to say, or really, if you believe what you are seeing.
        The girl inturrupts your thoughts. "Help me," she pleads "something has
        to be done about this presence. Then I will finally be able to get out of this
        prison." The girl says the last part with a frown. \n
        Part of you is hesitant, but the other part wants to help this poor child.
        What do you do? \n
        Help the girl, or leave the house now?
        """)

        choice = input('> ')

        if "help" in choice or "girl" in choice:
            from dead import Dead
            print("""
            You decide that you should help this girl. You ask what you can do.
            She tells you that you need to remove the mirror from the wall. She reminds
            you to be careful, that this will only work if the mirror is intact.
            "Move it forward in front of you like a shield. Be mindful never to look
            at the deamon. Let my voice be your guide and I will take care of the rest." \n
            You pull the mirror off the wall. Just before you turn the mirror away from
            you, the girl flashes a smile. The mirror feels cumbersome in your hands as you
            move towards the illuminated room. When you reach the threshold of the room
            the already ajar door drifts open, inviting you in. \n
            You see nothing but the wooden panel of the back of the mirror, but you
            can feel the warmth of the fire on the fronts of your fingers. A voice that
            defies age, gender, or accent speaks "So it has finally come to this". Your
            grip tightens on the mirror. \n
            You hear someone stand up from a chair. Face still behind the mirror, you
            look off to the side and observe the shadows cast by the fire. You see
            a shape move toward you that is impossibly large. At first glance it resembles
            a human figure, the next you aren't even sure how you thought it looked
            human in the first place. \n
            That is the last thing you remember before you hear shrill, shrieking sounds
            that make you want to put your hands to your ears. You hold tighter to
            the mirror. Your fingertips feel heat, then they start to burn and sear.
            You grip the mirror through blinding pain. \n
            Almost as soon as it began it is over. You don't understand what transpired.
            You removed a hand from the mirror to inspect the damage. As you release your
            grip you see smoke rising from your singed hand. "Turn the mirror around, touch
            the glass and I can heal you the girl says". \n
            With some pain your turn the mirror to face you and put both palms on the glass.
            A light starts emitting from where your hands make contact and you can see
            your wounds healing, like you are watching the damange that was done in
            rewind. Your hands heal completely. When you try to pull them away they are
            stuck to the glass. You look up to see the little girl is sporting a
            sinister grin. \n
            You are actively working to pull your hands away, but bit by bit you are
            losing sensation in your arms. This moves through your torso, to your legs,
            and eventually, your head. You feel drowsy, like you are in a dream. \n
            You see your hands pull away and flex. You did not do this. You look to the
            mirror and the little girl has vanished.
            """)

            Dead().dead("""
            Your body stretches, takes in a deep breath, and sighs. "Ahhh!" you hear
            your own voice say. "It feels good to be back in flesh!" You try to scream
            but nothing happens. "Well, thank you for that! I have been stuck in that mirror
            for centuries. That deamon trapped me there years ago. Thanks for freeing me!
            Now, let's join your friends shall we?"
            """)

        elif "leave" in choice:
            from upstairs_to_main_floor import UpstairsToMainFloor
            UpstairsToMainFloor().upstairs_to_main_floor()

        else:
            print(f"I don't understand {choice}. Try typing 'leave' or 'help'.")
            Hallway().hallway()
Exemplo n.º 7
0
    def kitchen(self):
        print("""
        You enter the kitchen and are surprised to find it extraordinarily clean in
        an organized chaos kind of way. \n
        It seems like every piece of cookware is out of the cabinets and again
        you ask yourself why this stuff hasn't been stolen a long time ago.
        It is vintage but quality cookware from an era you can't recognize.
        You wonder how much a set like this must cost today. \n
        As you explore more of the kitchen, you turn around the kitchen island to
        find a small table with two chairs propped against a wall. On the table is
        an exotic dish. A type of cuisine you have never seen before. The smell
        emitted from it is delicious. Your mouth waters and you hear your friend,
        Tom come up behind you. 'If you don't take a bite then I will' he says. \n
        Do you take the first bite or will you let Tom taste the delicacy before you?
        """)

        choice = input("> ")

        if "Tom" in choice or "tom" in choice:
            from dead import Dead
            print("""
            Tom takes a hesitant first bite, but as he chews and swallows, you can
            see he enjoys it. He groans with delight as he forks a second, and then
            a third. His eyes get wide and soon he has wolfed down the entire dish.
            He picks up the plate and licks it clean. \n
            'That was so GOOD!' Tom yells. 'I HAVE TO HAVE MORE!'. Tom frantically
            searches through the kitchen to find any morsel of what he just ate.
            You see his eyes grow desperate and wild. 'PLEASE, I NEED MORE!' he
            shouts again. \n
            You walk over to comfort him or snap him out of whatever he is experiencing.
            You put a hand on Tom's shoulder, but before you can think of what to
            say, he graps your arm and sniffs deeply. 'Oh, THAT'S IT!' he screams.
            You try to yank your arm away, but Tom has too firm a hold. Tom takes
            a bite out of your arm and you are blinded with pain. You shout out to
            your remaining friends, but they have fled. \n
            You are soon overpowered by Tom who is wasting no time whittling you
            away bite by bite.
            """)

            Dead().dead(
                """You start to lose vision and everything goes black. The last
            thing you feel is the far away sensation of Tom biting into your neck."""
            )

        elif "me" in choice or "I do" in choice:
            from dead import Dead
            print("""
            You try to hide your nerves with a smile as you pick up the fork near
            the plate. You pry off the smallest portion possible, put it in your
            mouth and chew. You notice a slight off flavor, but also slightly familiar
            flavor to the meat. At first you are repulsed by it, but as you begin
            to chew it tastes more delactable and savory. \n
            Before you are aware of what is happening, the plate is clean. You feel
            a hunger start to boil in your stomach. You ignore it at first, but it
            grows from a dull annoyance to a crippling gurgle. \n
            You frantically search for anything edible. You tear through the kitchen,
            throwing pots and pans around, short of tearing your hair out. You turn
            and see your friends. Tom who is closest to you stares wide-eyed. \n
            You sniff the air. Something smells sweet. You follow your nose closer
            to the smell until you realize that it is coming from Tom. Not only is
            it coming from him, it IS him. \n
            You try to hide the fact that your mouth is watering. You do a poor job
            of this as you lick your lips. \n
            'Tom' you say 'when did you start smelling so... delicious'? Tom puts up
            his arms in defense as you lunge at him. You start taking bites from his
            legs as he squirms. He goes still when you go for his neck. \n
            """)

            Dead().dead(
                """You wipe your mouth when you are satiated. Knowing that you
            can't go home you decide it best to sit and wait for the next group of silly
            teenagers to come through. \n
            """)

        else:
            print(f"""
            I don't understand {choice}. Try typing 'me' or 'Tom'.
            """)
            Kitchen().kitchen()
Exemplo n.º 8
0
    def upstairs_room(self):
        print("""
        You can't resist the pull of the mysterious room. You creep up the stairs
        doing your best to do so quietly. Even so, the stairs complain with every step
        you take. You look behind your right shoulder, and stretch out your hand
        perpendicular to the ground. A guesture that your friends understand means
        hang back. You feel a palpable sigh of relief from some of the people in the
        group as you turn back to continue on alone. \n
        You take hesitant steps on the floor runner, sending dust spurting up with
        each foot fall. You feel your heart beat increase as you near the door.
        The warmth coming from the doorway is warm, somehow both comforting and unnerving. \n
        You take a deep breath as you splay your fingers out to gently push the door
        the rest of the way open. \n
        The view in front of you is... almost normal? The room is well lighted,
        with a fireplace blazing. The walls and floors are clean, a stark juxtoposition
        from the rest of the house you have explored. The walls are adorned with
        giant oil paintings. Each depciting what you assume to be a scene from some
        religious text. \n
        You hear a creak, and you nearly stumble backwards when you see a rocking chair
        sitting in front of the fire moving on its axis backward. How could you have missed
        the chair? Surely you would have known something else was in the room with you?
        The chair was there when you walked in the room right? Right? \n
        You gulp, and attempt to go back the way you came. When a voice from the
        chair states "I am really tired of you kids coming into my home and disturbing
        my peace. This is breaking and entering you know. I have a mind to call the
        authorities on you." \n
        You try to stammer a reply, but before you can formulate that first word,
        the stranger speaks again "Tell you what, I haven't entertained visitors
        in a long time, and I am very lonely. Play me at a game of
        chess, or a hand of cards, and I won't call the police." \n
        Which do you play? \n
        """)

        choice = input('> ')

        if "chess" in choice:
            from dead import Dead
            print(f"""
            Confidence suddenly on your side, you say "{choice}" in a flat voice.
            From the side of the chair you see a silouetted hand guesture you forward. \n
            You approach from the right hand side. Sitting in the rocking chair,
            you see a frail old woman. She has a wool blanket resting over her legs,
            and is rocking gently back and forth on feet that you cannot see.
            She is wearing a neat, white, bun on the top of her head, and earrings
            so grand, and so large, you are surprised she isn't toppling over.
            Despite her frailty she sits with an incredibly straight back. You
            try not to think that she might be stronger than she would appear. \n
            Without words she looks at you and nods at the board in front of her.
            Already set up, immaculately clean. The pieces gleam in the flickering fire.
            You sit in the armchair opposite the old woman. You convince yourself
            the armchair was always there. The room itself, feels bigger somehow,
            but after looking around it appears that nothing has changed. \n
            The woman makes the first move with a shaky hand. You follow up,
            first moving pawns to free up other pieces on the board. After the woman
            moves her rook across the board to take one of your knights you notice
            her hands are significantly more stable. You move a piece to set up
            taking her rook and you see that your hands are losing composure. Nerves maybe?
            Maybe it was a trick of the fire, but the woman's hair looks far darker
            than you first noticed. \n
            You start to feel tired, at first a bit drowsy, but soon it is hard to
            keep your eyes open. You are hardly aware that you are playing the game,
            moving pieces less and less carefully. \n
            "Checkmate", you hear, nearly startled out of sleep. You look at the
            board and see that indeed it is checkmate. A checkmate that you should
            have been able to avoid. You send your gaze to the old woman. However
            she isn't old anymore. The hair on her head is thick and healthy, hands
            strong and certain in their movement. \n
            You look down at your hands, frail, shakey, full of veins and skin
            like paper. You touch your face to find the elastic has gone out of it,
            and you feel sagging flesh. Running your hands through your hair you
            find it is thin and brittle. \n
            The woman hops up from her seat "That was a lovely game" she says.
            "I doubt we will play again, sorry". She walks out of the room.
            """)
            Dead().dead(
                """You try to get up and follow her, but you find that you are too weak.
            All you can do is rock back and forth in your chair and warm your legs by the fire."""
            )

        elif "cards" in choice:
            from dead import Dead
            print(f"""
            Confidence suddenly on your side, you say "{choice}" in a flat voice.
            From the side of the chair you see a silouetted hand guesture you forward. \n
            You approach from the left hand side. You are surpised to come upon a
            handsome man. He is nimbly shuffling a deck of cards, shamelessly showing
            of tricks only a trained hand could know. He places the deck down, l
            ooks you in the eye, and smiles. \n
            "Why did you come here?" the man asks in such a way that you aren't sure
            if he is angry or amused. He laughs, breaking some of the tension.
            "No, no, don't tell me. The reason doesn't matter does it?
            You have found yourself in a predictable, almost laughable situation.
            You have no idea what's about to happen, and I can see the fear in your eyes.
            Despite all this time, I still feel a tiny pang of empathy when
            one of you falls victim to a teenage sterotype and ends up here."
            The man gestures around the room, pleased with himself. \n
            "It's almost too easy. However, I am bored of the song and dance of
            mystery and intrigue regarding your fate." The man leans back in
            the chair, placing his hands behind his head. He continues "This is
            what is going to happen, you will play a hand of cards with me. I don't
            care the game, pick anything you want. Even if I haven't heard of it.
            It doesn't matter if you win or lose, I think we both know that you won't
            be leaving this room." \n
            The man pushes the deck of cards toward you. "Shuffle the cards and
            deal any game you wish."
            """)
            Dead().dead("""
            You take a deep breath blinking back tears. You tremble as you take
            the cards into your hands and ask the man to cut the deck. He obliges
            with grace. "Do you know go fish?" You say feebly. The man smiles and
            nods as you begin dealing out each card.
            """)

        else:
            print("""
            Not sure what you are getting at. Try typing 'cards' or 'chess'.
            """)
            UpstairsRoom().upstairs_room()
Exemplo n.º 9
0
    def explore_basement(self):
        print("""
        You investigate the main floor to find the only closed door. You think it
        might be a broom closet, but you open it anyway. You find a winding, dusty,
        staircase leading to the basement. There is no light, but you find an electrical
        wire snaking its way on the wall. You can't find an outlet, but you assume
        that there will be a switch at the bottom of the stairs. \n
        With your right hand on the railing, you lead the way down to the basement
        in hopes of finding what you are searching for. \n
        You were right about the light switch. You flick it on, and for a breif
        moment light illuminates the room before the very old bulb shatters. \n
        You aren't sure if you saw a figure in the short time that the lights
        were on, or if it was just your imagination. \n
        Since this is the age of technology, everyone in your party gets out their
        cellphones to illuminate the room. The room is still shrouded in shadow,
        but it is just bright enough to make out some of the objects scattered about. \n
        It looks like a storage room, or an old mueseum for turn of the century gadgets,
        made obsolete by newer inventions and cast aside. You see a butter churn,
        a loom, and an ornately carved chair that looks very uncomfortable to sit
        upon. None of these objects prove any use to you. \n
        After everyone has had time for their eyes to adjust, your friend Amy
        points at your feet and exclaims "You're standing on a trap door!". Confused,
        and a bit flustered, you look down at your shoes to see a trapdoor that even
        in this house, looks ancient. You don't need to touch it to know that it is
        extremely heavy, and you can feel a light draft on your ankles if you pay
        attention. \n
        You step aside, bend down, and try your hand at swinging the massive door open.
        You grip your hands around the circular lever. Just as you are starting to
        put your might into swinging the trap door open, your friend Brian interrupts. \n
        "Hey! Everyone! Check this out!" Brian is standing next to a wobbly shelf.
        At first glance you don't see what the big deal is, but after everyone aims
        their phones at the shelf, Brian pushes it aside to reveal a door.
        The door is red, or rather was painted red a long time ago. Most of the color
        has been scraped off. It looks like a very similar make to the trapdoor on the
        floor. "I think I can hear something moving on the other side!" Brian tells you.\n
        Which door do you go through? The trapdoor or the red door?
        """)

        choice = input("> ")

        if "red" in choice:
            from dead import Dead
            print("""
            You stand up from your squat and make your way to the red door. You give
            Brian a nod as you grab the donut shaped knob and pull towards yourself.
            It's heavy, but you manage to get it open on your own. You hear a click
            as the door settles all the way open, as far back on its hinges as it can go.
            You smell the scent of earth and mildew. Before you is a long, dark tunnel.
            You take a few steps into the tunnel, strain your ears and find that Brian
            was right, there IS something moving in the distance. It sounds like
            footfalls, but the cadence is unfamiliar, and you also hear a constant
            sound like something is being dragged. \n
            You tenatively make a few steps forward, as if you are unsure if the
            ground will support you. After a few steps you find comfort in the earth
            pushing back at you and you guesture your friends to follow you deeper into
            the tunnel. \n
            Keeping your right hand on the wall you walk, following the sound as it gets
            more and more defined. The tunnel gradually widens to a large room with
            several eroding pillars. You know the sound is coming from this room, but for
            whatever reason it is hard to triangulate. \n
            You hear an odd thud on the ground... then another. The third time you hear
            it, you turn around to see three of your friends on the ground. Their mouths
            are wide, screaming a silent scream and their eyes stare off into the distance.
            Brian is amongst the three fallen. You bend down to touch him and feel a
            slimy substance on his skin. He is cold to the touch. You turn your head
            to come over Brians mouth, and feel his neck for a pulse... nothing. \n
            As you stand up to talk with the rest of your friends about an escape you hear
            the sound that you now identify as a fallen friend. You hear that sound again,
            as you turn, and once more before your eyes can adjust.
            """)

            Dead().dead("""
            You look around and see now that everyone you were with is dead on the floor.
            You hear walking and dragging sound, so very close now. You close your
            eyes and wait. \n
            """)

        elif "trap" in choice:
            from dead import Dead
            print("""
            You look at Amy, and together you heave the trapdoor open. You have
            Just enough time to move out of the way as the door crashing on the
            ground where you just were. A coolness escapes from the chamber envelops
            you all and the group lets out a shudder. \n
            You look down and all you can see is darkness, with a rope ladder leading
            the way down, eventually disappearing as the light has no more to travel. \n
            You start making your way down. The ladder squeaks under your weight, but
            after pushing yourself into it you determine that it should hold. Step by
            step, you make your way down until your foot rests softly on the dirt floor. \n
            One after the other your friends continue down in the same fashion. Now, it
            is just Amy reamaining at the top of the entrance. \n
            You call her name, and ask her to come down. She seems nervous, and
            understandably so. After some convincing, Amy makes decends about halway
            down the ladder when you notice something is wrong. \n
            Like in a movie or a text based adventure game, you hear the sound of the
            ropes fraying, and beginning to snap strands. You call Amy's name but she
            seems to be paralyzed. You know that if you try and climb the ladder the
            ropes with snap faster with you on it. You call her name again and she has
            just enough time to give you a terrified look over her shoulder and the
            ladder breaks. \n
            You can only watch as the the ladder falls to the ground with Amy to follow.
            You rush over to where Amy lay. She has blood running out of one ear
            and she shows no signs of movement. You check her pulse and find that she,
            in one sense of the phrase, is no longer with you. \n
            As much as you would like to mourn, you have bigger concerns. As far as you
            know, the ladder was the only way out of the pit. There is no cell phone
            reception down here for you to call for help. However, after some inspection
            you find that there seems to be channels of paths branching off from the
            main chamber you find yourself in. The group decided that you should split up,
            and should anyone find an exit they will come back and rescue everyone else.
            You and two friends take the left most tunnel, and start to walk. Still using
            your phones to light the way, you walk for a several hours. \n
            You notice that the walls are occasionally adorned with simple paintings.
            Most depicting people travelling in the direction that you are walking.
            How ironic. \n
            You hear a beeping noise and one of your friends informs you that their
            phone is almost out of battery. After a few minutes, it turns off completely,
            and you try not to notice that it is a bit darker. And hour later. the same thing
            happens to your other friend. You gulp and lead the way carrying the only light
            you have. After a while that too, blinks out. \n
            Your only option is to keep a hand on the wall and continue wandering
            blindly forward.
            """)

            Dead().dead("""
            You're not sure how much time has passed, or how you lost your friends
            along the way. Steps becoming harder now, you focus on moving one foot in
            front of the other, until you cannot propel yourself forward. You tell
            yourself it would be okay to sit and rest. You'll get up at any moment and
            keep walking. Any moment.
            """)

        else:
            print(f"""
            I don't understand {choice}. Try typing 'trapdoor' or 'red door'.
            """)
            Basement().explore_basement()
Exemplo n.º 10
0
# 导入模块
import pygame
import sys
import ybc_box as box
import game_function as gf
from Player import Player
from Setting import Setting
from dead import Dead
from Logger import Logger

sets = Setting()
player = Player()
dead = Dead()
log = Logger('Logging.log')

while True:
    try:
        # 重置岩浆河位置
        dead.f_set_dead(sets)
        # 主循环
        while True:
            if sets.xh == '正常' or sets.xh == '调试' or True:
                if sets.level > 7 and sets.xh == '正常':
                    break
                # 使用for循环遍历当前事件列表
                for event in pygame.event.get():
                    # 判断【事件类型】是不是【按下键盘事件】
                    if event.type == pygame.KEYDOWN:
                        # 判断【事件按键】是不是【上移键】
                        if event.key == pygame.K_UP:
                            gf.up_check(sets, player)