Beispiel #1
0
def run_title():
    global fullscreen
    global screen
    running = True
    selection = 0
    options = ['play', 'help', 'exit']
    show_help = False
    help_text = 'Controls:\nZ - Take\nX - Jump\nC - Shoot\nRight and Left Arrow Keys - Move\nUp and Down Arrow Keys - Cycle Through Potions\nF11 - Fullscreen\n\nInstructions:\nTry to get through the world alive! Kill blobs for health. Blobs can also kill you! Collect items to combine with gooey blob guts to make potions. Potions are used to tip your arrows, which add effects to your arrows. It\'s your job to figure out what they do!\n\nSample Combination:\nSnail and Gooey Guts: Slowing Potion\n\nUser Interface:\nHealth is shown on the top left, your current item is shown on the bottom right, and your potions are shown on the bottom left.\nRemember: Cycle through potions with the up and down arrow keys.\n\nPress X '
    while running == True:
        screen.fill(BLACK)
        DisplaySurf.fill(BLACK)
        DisplaySurf.blit(twitter, (2, DisplaySurf.get_height() - 12))
        num = 0
        for option in options:
            if num == selection:
                Text.ShowText(option + ' ', 5, 2 + num * 12, 1, 1000, Font_1,
                              DisplaySurf)
                Bar = pygame.Surface((1, 7))
                Bar.fill((45, 58, 104))
                DisplaySurf.blit(Bar, (2, 2 + num * 12))
            else:
                Text.ShowText(option + ' ', 2, 2 + num * 12, 1, 1000, Font_1,
                              DisplaySurf)
            num += 1
        Text.ShowText('DaFluffyPotato ', 16,
                      DisplaySurf.get_height() - 10, 1, 1000, Font_0,
                      DisplaySurf)
        for event in pygame.event.get():
            if event.type == QUIT:
                pygame.quit()
                sys.exit()
            if event.type == KEYDOWN:
                if event.key == K_F11:
                    if fullscreen == False:
                        fullscreen = True
                        screen = pygame.display.set_mode(
                            (WINDOWWIDTH, WINDOWHEIGHT), pygame.FULLSCREEN)
                    else:
                        fullscreen = False
                        screen = pygame.display.set_mode(
                            (WINDOWWIDTH, WINDOWHEIGHT), 0, 32)
                if event.key == K_ESCAPE:
                    pygame.quit()
                    sys.exit()
                if show_help == False:
                    if event.key == K_UP:
                        selection -= 1
                        if selection < 0:
                            selection = 0
                    if event.key == K_DOWN:
                        selection += 1
                        if selection >= len(options):
                            selection = len(options) - 1
                if (event.key == K_RETURN) or (event.key == ord('x')):
                    if show_help == False:
                        if options[selection] == 'play':
                            running = False
                        elif options[selection] == 'help':
                            show_help = True
                        elif options[selection] == 'exit':
                            pygame.quit()
                            sys.exit()
                    else:
                        show_help = False
        screen.blit(pygame.transform.scale(DisplaySurf, (720, 480)), (0, 0))
        if show_help == True:
            screen.fill(BLACK)
            Text.ShowText(help_text, 2, 2, 1, 720, Font_1, screen)
        pygame.display.update()
        mainClock.tick(40)
Beispiel #2
0
             Moving_Left = False
         if event.key == ord('c'):
             CDown = False
         if event.key == K_F11:
             if fullscreen == False:
                 fullscreen = True
                 screen = pygame.display.set_mode(
                     (WINDOWWIDTH, WINDOWHEIGHT), pygame.FULLSCREEN)
             else:
                 fullscreen = False
                 screen = pygame.display.set_mode(
                     (WINDOWWIDTH, WINDOWHEIGHT), 0, 32)
 # Update ------------------------------------------------- #
 if Level == 6:
     DisplaySurf.blit(twitter, (2, 14))
     Text.ShowText('DaFluffyPotato ', 16, 16, 1, 1000, Font_0, DisplaySurf)
 screen.blit(pygame.transform.scale(DisplaySurf, (720, 480)), (0, 0))
 if fade == 2:
     timer = 40
     while timer > 0:
         screenshot = pygame.transform.scale(DisplaySurf, (720, 480))
         timer -= 1
         black = pygame.Surface((720, 480))
         black.set_alpha(255 - 255 / 40 * timer)
         screenshot.blit(black, (0, 0))
         screen.blit(screenshot, (0, 0))
         pygame.display.update()
         mainClock.tick(40)
 elif fade == 1:
     timer = 40
     while timer > 0: