Пример #1
0
def run_game():
    pygame.init()

    screen_size = (1200, 750)
    screen = pygame.display.set_mode(screen_size)
    screen_rect = screen.get_rect()
    pygame.display.set_caption("Mystery House")
    text_box = pygame.image.load('./images/text_box.png')
    clock = pygame.time.Clock()
    intro = Scene(screen)
    driving = DrivingScene(screen, text_box)
    foyer = Foyer(screen, text_box)
    library = Library(screen, text_box)
    bedroom = Bedroom(screen, text_box)
    kitchen = Kitchen(screen, text_box)
    final = Final(screen, text_box)
    pygame.mixer.init()
    pygame.mixer.music.load('./music/old city theme.ogg')
    pygame.mixer.music.play(-1)
    entry = TextBox(rect=(680, 700, 200, 30))
    foyer = Foyer(screen, text_box)

    # pass_intro = True
    # drivingtext1 = True
    # drivingtext2 = False
    # foyertext2 = False
    # foyertext1 = True

    while 1:
        events = pygame.event.get()
        for event in events:
            if event.type == pygame.QUIT:
                sys.exit()
            entry.get_event(event)

            intro.enter()
        if intro.check_scene():
            driving.enter()
            # if drivingtext1:
            # print 1
            # text_generator(screen, clock, "You're driving with your best friend, heading home after a day of hiking.", (100,460))
            # # text_generator(screen, clock, "Rain is beating hard on the roof of your car, the wipers swishing fast.", (100,490))
            # # text_generator(screen, clock, "Your GPS takes you to some backroads, empty of light and other cars.", (100,520))
            # # text_generator(screen, clock, "Suddenly, you and your friend jolt in your seats! You've hit something!", (100, 550))
            # drivingtext1 = False
            # pygame.time.delay(1000)
            # pygame.display.update()
            # elif drivingtext2:
            #     driving.enter()
            #     text_generator(screen, clock, "What do you do? Enter a number:", (100,460))
            #     text_generator(screen, clock, "1. Get out of the car and check it out.", (100,490))
            #     text_generator(screen, clock, "2. Stay in the car.", (100,520))
            #     text_generator(screen, clock, "3. Quit Game. This is too scary.", (100, 550))
            #     pygame.time.delay(2000)
            #     pygame.time.wait(2)
            input_box(entry, screen)
            driving.next_scene(entry.check_user_input("1"))
            # drivingtext2 = True
            # clock.tick(30)
        if driving.check_scene():
            foyer.enter()
            if moving_scene['library']:
                library.enter()
                input_box(entry, screen)
            if moving_scene['bedroom']:
                bedroom.enter()
                input_box(entry, screen)
            if moving_scene['kitchen']:
                kitchen.enter()
                input_box(entry, screen)
        if compare_list(player_list, master_list):
            final.enter()
        pygame.display.flip()
        clock.tick(30)
Пример #2
0
def run_game():
    pygame.init()

    screen_size = (1200, 750)
    screen = pygame.display.set_mode(screen_size)
    screen_rect = screen.get_rect()
    pygame.display.set_caption("Mystery House")
    text_box = pygame.image.load('./images/text_box.png')
    clock = pygame.time.Clock()
    intro = Scene(screen)
    driving = DrivingScene(screen, text_box)
    foyer = Foyer(screen, text_box)
    library = Library(screen, text_box)
    bedroom = Bedroom(screen, text_box)
    kitchen = Kitchen(screen, text_box)
    final = Final(screen, text_box)
    pygame.mixer.init()
    pygame.mixer.music.load('./music/old city theme.ogg')
    pygame.mixer.music.play(-1)
    entry = TextBox(rect=(680, 700, 200, 30))
    message = (ScrollText(
        screen,
        "You're driving with your best friend, heading home after a day of hiking.",
        400, pygame.Color(255, 255, 0)), )
    fps = 25
    foyer = Foyer(screen, text_box)

    while 1:
        clock.tick(fps)
        events = pygame.event.get()
        for event in events:
            if event.type == pygame.QUIT:
                sys.exit()
            entry.get_event(event)

        intro.enter()
        if intro.check_scene():
            driving.enter()
            for thing in message:
                thing.update()

            # driving.text_generator("You're driving with your best friend, heading home after a day of hiking.", (100, 300))
            # driving.text_generator("Rain is beating hard on the roof of your car, the wipers swishing fast.", (100,400))
            # driving.text_generator("Your GPS takes you to some backroads, empty of light and other cars.", (100,500))
            # driving.text_generator("Suddenly, you and your friend jolt in your seats! You've hit something!", (100, 600))
            #     #tells main loop to stop entering drivingtext1

            #call function again to draw over drivingtext1

            # driving.text_generator("What do you do? Enter a number:", (100,460))
            # driving.text_generator("1. Get out of the car and check it out.", (100,490))
            # driving.text_generator("2. Stay in the car.", (100,520))
            # driving.text_generator("3. Quit Game. This is too scary.", (100, 550))

            # pygame.time.wait(2)
        if driving.check_scene():
            foyer.enter()

        if driving.check_scene():
            foyer.enter()

        if foyer.check_scene():
            library.enter()
            input_box(entry)

        pygame.display.flip()
Пример #3
0
def run_game():
    pygame.init()

    screen_size = (1200, 750)
    screen = pygame.display.set_mode(screen_size)
    screen_rect = screen.get_rect()
    pygame.display.set_caption("Mystery House")
    text_box = pygame.image.load('./images/text_box.png')
    clock = pygame.time.Clock()
    intro = Scene(screen)
    driving = DrivingScene(screen, text_box)
    foyer = Foyer(screen, text_box)
    library = Library(screen, text_box)
    bedroom = Bedroom(screen, text_box)
    kitchen = Kitchen(screen, text_box)
    final = Final(screen, text_box)
    ##### NEW CLASS FOR DISPLAY TEXTBOX ########
    Text3 = A_textbox(screen)
    pygame.mixer.init()
    pygame.mixer.music.load('./music/old city theme.ogg')
    pygame.mixer.music.play(-1)
    entry = TextBox(rect=(680, 700, 200, 30))
    foyer = Foyer(screen, text_box)

    ##### driving/foyer/etc text1 set true to display only once in its lifetime in the main loop iterations######
    drivingtext1 = True

    while 1:
        events = pygame.event.get()
        for event in events:
            if event.type == pygame.QUIT:
                sys.exit()
            entry.get_event(event)

        intro.enter()
        if intro.check_scene():
            print "pass intro"
            driving.enter()
            # print 1

            ######## DISPLAY TEXT FOR DRIVING SCENE#######
            if drivingtext1:

                Text3 = A_textbox(screen)
                Text3.text_generator(driving_script[0:4])
                # tells main loop to stop entering drivingtext1
                drivingtext1 = False

                #call function again to draw over drivingtext1
                driving.enter()

                ####set drivingtext2 = true to begin next set of strings#######
                drivingtext2 = True
                pygame.time.delay(1000)
                ###calling the text generator function with script####
                Text3.text_generator(driving_script[4:8])
                #this delays the text on the screen so reader can read it
                pygame.time.delay(3000)
                pygame.time.wait(2)

            input_box(entry, screen)
            driving.next_scene(entry.check_user_input("1"))
        if driving.check_scene():
            foyer.enter()
            if moving_scene['library']:
                library.enter()
            if moving_scene['bedroom']:
                print 2
                bedroom.enter()
            if moving_scene['kitchen']:
                print 3
                kitchen.enter()

        pygame.display.flip()
        clock.tick(30)
Пример #4
0
def run_game():
    pygame.init()

    screen_size = (1200, 750)
    screen = pygame.display.set_mode(screen_size)
    screen_rect = screen.get_rect()
    pygame.display.set_caption("Mystery House")
    text_box = pygame.image.load('./images/text_box.png').convert_alpha()
    clock = pygame.time.Clock()
    intro = Scene(screen)
    driving = DrivingScene(screen, text_box)
    foyer = Foyer(screen, text_box)
    library = Library(screen, text_box)
    bedroom = Bedroom(screen, text_box)
    kitchen = Kitchen(screen, text_box)
    final = Final(screen, text_box)
    library_puzzle = Library_puzzle()
    ##### NEW CLASS FOR DISPLAY TEXTBOX ########
    Text3 = A_textbox(screen)
    pygame.mixer.init()
    pygame.mixer.music.load('./music/old city theme.ogg')
    pygame.mixer.music.play(-1)
    entry = TextBox(rect=(680, 700, 200, 30))
    foyer = Foyer(screen, text_box)
    master_list = ['note1', 'note2', 'watch', 'picture', 'phone', 'locket']
    player_list = []

#
# def compare_list(player_list, master_list):
#     if player_list == master_list:
#         return True
#     else:
#         return False

##### driving/foyer/etc text1 set true to display only once in its lifetime in the main loop iterations######
    drivingtext1 = True
    drivingtext3 = True
    foyertext1 = True
    foyertext3 = True
    foyertext5 = True
    librarytext1 = True
    kitchentext1 = True
    bedroomtext1 = True
    finaltext1 = True

    while 1:
        events = pygame.event.get()
        for event in events:
            if event.type == pygame.QUIT:
                sys.exit()
            entry.get_event(event)


        intro.enter()
        if intro.check_scene():
            print "pass intro"
            driving.enter()
            # print 1

            ######## DISPLAY TEXT FOR DRIVING SCENE#######
            if drivingtext1:
                Text3 = A_textbox(screen)
                Text3.text_generator(driving_script[0:4])
                # tells main loop to stop entering drivingtext1
                drivingtext1 = False

                #call function again to draw over drivingtext1
                driving.enter()

                ####set drivingtext2 = true to begin next set of strings#######
                drivingtext2 = True
                pygame.time.delay(1000)
                ###calling the text generator function with script####
                Text3.text_generator(driving_script[4:8])
                #this delays the text on the screen so reader can read it

                driving.enter()

                if drivingtext3:
                    Text3.text_generator(driving_script[8:11])
                    #this delays the text on the screen so reader can read it
                    pygame.time.delay(3000)
                    pygame.time.wait(2)
                    drivingtext3 = False

            input_box(entry, screen)
            driving.next_scene(entry.check_user_input("1"))

        if driving.check_scene():
            foyer.enter()
            #####displaying foyer text#####
            if foyertext1:
                Text3.text_generator(foyer_script[0:4])
                foyertext1 = False

                foyer.enter()

                foyertext2 = True
                pygame.time.delay(1000)
                Text3.text_generator(foyer_script[4:8])
                pygame.time.delay(3000)
                pygame.time.wait(2)
                foyertext2 = False

            foyer.enter()

            if foyertext3:
                Text3.text_generator(foyer_script[8:12])
                foyertext3 = False

                foyer.enter()

                foyertext4 = True
                pygame.time.delay(1000)
                Text3.text_generator(foyer_script[12:16])
                pygame.time.delay(3000)
                pygame.time.wait(2)
                foyertext4 = False

            foyer.enter()

            if foyertext5:
                Text3.text_generator(foyer_script[16:20])
                pygame.time.delay(3000)
                pygame.time.wait(2)
                foyertext5 = False


            if moving_scene['library']:
                library.enter()


                #####displaying foyer text#####
                if librarytext1:
                    Text3.text_generator(bw_library[0:4])
                    librarytext1 = False

                    library.enter()

                    librarytext2 = True
                    pygame.time.delay(1000)

                    Text3.text_generator(bw_library[4:8])

                    pygame.time.delay(4000)
                    pygame.time.wait(2)

                if library.puzzle1_active:
                    library_puzzle.display_text(puzzletext5)
                    library_puzzle.puzzle1(entry.get_user_input(),puzzletext6, puzzletext7)

                    input_box(entry, screen)


            if moving_scene['bedroom']:
                bedroom.enter()

                if bedroomtext1:
                    Text3.text_generator(oldman_bedroom[0:4])
                    bedroomtext1 = False

                    bedroom.enter()

                    bedroomtext2 = True
                    pygame.time.delay(1000)
                    Text3.text_generator(oldman_bedroom[4:8])
                    pygame.time.delay(3000)
                    pygame.time.wait(2)
                    kitchentext2 = False

                input_box(entry, screen)


            if moving_scene['kitchen']:
                print 3
                kitchen.enter()

                if kitchentext1:
                    Text3.text_generator(gothteen_kitchen[0:4])
                    kitchentext1 = False

                    kitchen.enter()

                    kitchentext2 = True
                    pygame.time.delay(1000)
                    Text3.text_generator(gothteen_kitchen[4:8])
                    pygame.time.delay(3000)
                    pygame.time.wait(2)
                    kitchentext2 = False
                input_box(entry, screen)

        #
        if compare_list(master_list, player_list):
            final.enter()
            if finaltext1:
                Text3.text_generator(final[0:4])
                finaltext1 = False

                final.enter()

                finaltext2 = True
                pygame.time.delay(1000)
                Text3.text_generator(final[4:8])
                pygame.time.delay(3000)
                pygame.time.wait(2)
                finaltext2 = False

        pygame.display.flip()
        clock.tick(30)




        pygame.display.flip()
        clock.tick(30)
Пример #5
0
def run_game():
    pygame.init()

    screen_size = (1200, 750)
    screen = pygame.display.set_mode(screen_size)
    screen_rect = screen.get_rect()
    pygame.display.set_caption("Mystery House")
    text_box = pygame.image.load('./images/text_box.png')
    final_text_box = pygame.image.load('./images/final_text_box.png')
    intro = Scene(screen)
    driving = DrivingScene(screen, text_box)
    foyer = Foyer(screen, text_box)
    library = Library(screen, text_box)
    bedroom = Bedroom(screen, text_box)
    kitchen = Kitchen(screen, text_box)
    final = Final(screen, final_text_box)
    pygame.mixer.init()
    pygame.mixer.music.load('./music/old city theme.ogg')
    pygame.mixer.music.play(-1)
    entry = TextBox(rect=(680, 700, 200, 30))

    while 1:
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                sys.exit()
            entry.get_event(event)

        intro.enter()
        if intro.check_scene():
            driving.enter()
            input_box(entry, screen)
            friend_name = get_user_input(entry)

            if drivingtext1:
                driving_a.text_generator(
                    "You're driving with your best friend, heading home after a day of hiking.",
                    (100, 460))
                driving_b.text_generator(
                    "Rain is beating hard on the roof of your car, the wipers swishing fast.",
                    (100, 490))
                driving_c.text_generator(
                    "Your GPS takes you to some backroads, empty of light and other cars.",
                    (100, 520))
                driving_d.text_generator(
                    "Suddenly, you and your friend jolt in your seats! You've hit something!",
                    (100, 550))
                #tells main loop to stop entering drivingtext1
                drivingtext1 = False

                #call function again to draw over drivingtext1
                driving.enter()

                drivingtext2 = True

                pygame.time.delay(1000)

                driving_a.text_generator("What do you do? Enter a number:",
                                         (100, 460))
                driving_b.text_generator(
                    "1. Get out of the car and check it out.", (100, 490))
                driving_c.text_generator("2. Stay in the car.", (100, 520))
                driving_d.text_generator("3. Quit Game. This is too scary.",
                                         (100, 550))

                pygame.time.delay(2000)

            # if user_input == 1:
            #     if drivingtext3:
            #         driving_a.text_generator("You leave your car, but see nothing What did you hit?", (100,460))
            #         driving_b.text_generator("When you go back inside the car, it won't start.", (100,490))
            #         driving_c.text_generator("Nothing you true works. Your and your friend try you phones.", (100,520))
            #         driving_d.text_generator("No signal. You see a huge house not too far off, its lights on.", (100, 550))
            #
            #         drivingtext3 = False
            #
            #         driving.enter()
            #
            #         drivingtext4 = True
            #         pygame.time.delay(2000)
            #
            #         driving_a.text_generator("What do you do next? Enter a number:", (100,460))
            #         driving_b.text_generator("1. Go the mansion for help.", (100,490))
            #         driving_d.text_generator("2. Stay in the car.", (100, 550))
            #         driving_d.text_generator("3. Quit game. This is too scary.", (100, 550))
            #
            #         pygame.time.delay(2000)

            # if user_input == 2:
            #
            #     if drivingtext4:
            #         driving_a.text_generator("Your friend says,'That sounded awful.' We should check it out.", (100,460))
            #         driving_b.text_generator("You both leave the car, but see nothing. What did you hit?", (100,490))
            #         driving_c.text_generator("When you back inside, the car won't start. Nothing you try works.", (100,520))
            #         driving_d.text_generator("You try your cell phones. No signal. You see a huge house ahead, its lights on.", (100, 550))
            #
            # if user_input == 3:
            #     sys.exit()
            #
            #     drivingtext4 = False
            #
            #     driving.enter()
            #
            #     drivingtext5 = True
            #     pygame.time.delay(2000)
            #
            #     driving_a.text_generator("What do you do next? Enter a number:", (100,460))
            #     driving_b.text_generator("1. Go the mansion for help.", (100,490))
            #     driving_c.text_generator("2. Quit game. This is too scary.", (100, 550))
            #
            #     pygame.time.delay(2000)
            #
            #         # if user_input == 1 #not sure what do here, call the driving.check_scene() function?
            # if user_input == 3:
            #             sys.exit()
            #

            # driving. text_generator("")
            # pygame.time.delay(60)
            pygame.time.wait(2)

        if driving.check_scene():
            foyer.enter()
            if foyertext1:
                driving_a.text_generator(
                    "You enter the house with your friend and ring the bell. No answer.",
                    (100, 460))
                driving_b.text_generator(
                    "Your friend shrugs and pushes the door. You both enter and see three",
                    (100, 490))
                driving_c.text_generator(
                    "people standing in the foyer: an elderly man, a woman in a red dress and heels,",
                    (100, 520))
                driving_d.text_generator("and a teenage boy in goth makeup.",
                                         (100, 550))
                #tells main loop to stop entering foyertext1
                foyertext1 = False

                #call function again to draw over foyertext1
                foyer.enter()

                foyertext2 = True

                pygame.time.delay(1000)

                driving_a.text_generator("What do you do? Enter a number:",
                                         (100, 460))
                driving_b.text_generator("1. Talk to the elderly man",
                                         (100, 490))
                driving_c.text_generator("2. Talk to the beautiful woman.",
                                         (100, 520))
                driving_d.text_generator("3. Talk to the gothic teenager.",
                                         (100, 550))

                pygame.time.delay(2000)

                # if user_input == 1:
                #     if foyertext3:
                #         driving_a.text_generator("'Well, hello there! Welcome to my home. I'm Sir Rupert Wilkinson,''", (100,460))
                #         driving_b.text_generator("the old man says. 'What brings you here on such a rainy night as this?'", (100,490))
                #         driving_a.text_generator("You tell him how your car broke down and need to use a phone.", (100,460))
                #         driving_b.text_generator("'That's terrible! Of course you can use my phone, of course!''", (100,490))
                #
                #         foyertext3 = False
                #
                #         foyer.enter()
                #
                #         foyertext4 = True
                #
                #         pygame.time.delay(2000)
                #
                #         driving_a.text_generator("Suddenly the lights flicker off and on! Your friend screams!", (100,460))
                #         driving_b.text_generator("You find your frined splayed on the floor in an X, unconsious.", (100,490))
                #         driving_a.text_generator("You check your friend's pulse. Nothing. You heartbeat spikes.", (100,460))
                #         driving_b.text_generator("You panic and run for the door but it's locked! You turn around.", (100,490))
                #
                #
#         pygame.time.delay(2000)

# foyer.enter()
#
# if foyertext5:
#     driving_a.text_generator("Sir Wilkinson says,'Now, now. No running away! I'm afraid one", (100,460))
#     driving_b.text_generator("of use killed your dear friend. Let's play a game, shall we?'", (100,490))
#     driving_c.text_generator("'If you can figure out which one of is the killer, we will let you go.'", (100,520))
#     driving_d.text_generator("'However, make the wrong guess and you will die too'", (100, 550))
#     driving_e.text_generator("'Now, which room shall you enter to look for clues?'")
#
#     foyertext5 = False
#
#     foyer.enter()
#
#     foyertext6 = True
#     pygame.time.delay(2000)
#
#     driving_a.text_generator("Which room will you go to? Enter a number.", (100,460))
#     driving_b.text_generator("1. Enter the library", (100,490))
#     driving_c.text_generator("2. Enter the kitchen", (100,520))
#     driving_d.text_generator("3 Enter the master bedroom", (100, 550))
#
#     pygame.time.delay(2000)

        if foyer.check_scene():
            final.enter()

        pygame.display.flip()