Exemplo n.º 1
0
def death_screen_level_5(screen, WIDTH, HEIGHT, groups, old_player,
                         counter_old, level, destroyer_1,
                         old_enemy_group_array):
    all_sprites = groups[0]
    bullet_group = groups[1]
    enemy_group = groups[2]
    enemy_eyes_group = groups[3]
    enemy_bullet_group = groups[4]
    hpbar_group = groups[5]
    destroyer_group = groups[6]
    clock = pygame.time.Clock()
    title_group = pygame.sprite.Group()
    player = Ship_Explosion((old_player.rect.x, old_player.rect.y),
                            (title_group, title_group))
    first_destroyer = destroyer_1
    enemy1 = old_enemy_group_array[0]
    enemy2 = old_enemy_group_array[1]
    enemy3 = old_enemy_group_array[2]
    enemy4 = old_enemy_group_array[3]
    enemy5 = old_enemy_group_array[4]
    darker_screen = load_image('Darker_screen.png')
    dead_title = load_image('Dead_title.png')
    restart = Restart_Button((20, 520), (all_sprites, all_sprites), level)
    quit_button = Quit_Button((650, 520), (all_sprites, all_sprites))
    running = True
    counter = counter_old
    while running:
        if counter == 37 + counter_old:
            player.kill()
            player = Null_thingy((old_player.rect.x, old_player.rect.y),
                                 (title_group, title_group))
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                return 'QUIT'
            elif event.type == pygame.MOUSEBUTTONDOWN:
                if quit_button.rect.collidepoint(event.pos):
                    return 'level_menu'
                if restart.rect.collidepoint(event.pos):
                    return level
        screen.fill((0, 0, 0))
        title_group.draw(screen)
        destroyer_group.draw(screen)
        enemy_group.draw(screen)
        enemy_eyes_group.draw(screen)
        destroyer_group.update(counter)
        enemy1.update(player, first_destroyer.xy, bullet_group)
        enemy2.update(player, first_destroyer.xy, bullet_group)
        enemy3.update(player, first_destroyer.xy, bullet_group)
        enemy4.update(player, first_destroyer.xy, bullet_group)
        enemy5.update(player, first_destroyer.xy, bullet_group)
        all_sprites.draw(screen)
        all_sprites.update()
        hpbar_group.draw(screen)
        if counter % 2 == 0:
            title_group.update()
        screen.blit(darker_screen, (0, 0))
        screen.blit(dead_title, (0, 0))
        pygame.display.flip()
        counter += 1
        clock.tick(50)
Exemplo n.º 2
0
def victory_screen(screen, WIDTH, HEIGHT, level):
    all_sprites = pygame.sprite.Group()
    clock = pygame.time.Clock()
    running = True
    counter = 0
    quit_button = Quit_Button((650, 520), (all_sprites, all_sprites))
    victory_fon = load_image('Victory_fon.png')
    while running:
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                return 'QUIT'
            elif event.type == pygame.MOUSEBUTTONDOWN:
                if quit_button.rect.collidepoint(event.pos):
                    return 'level_menu'
        screen.fill((0, 0, 0))
        screen.blit(victory_fon, (0, 0))
        all_sprites.draw(screen)
        all_sprites.update()
        pygame.display.flip()
        counter += 1
        clock.tick(50)