Пример #1
0
def cria_listas(switch_white, x, y, largura, altura, gap, base):
    # Imagens
    if switch_white:
        easy = pygame.image.load('Images/text/easy_b.png')
        medium = pygame.image.load('Images/text/medium_b.png')
        hard = pygame.image.load('Images/text/hard_b.png')
        leave = pygame.image.load('Images/text/leave_b.png')
        right = pygame.image.load('Images/text/right_b.png')
        left = pygame.image.load('Images/text/left_b.png')
    else:
        easy = pygame.image.load('Images/text/easy_w.png')
        medium = pygame.image.load('Images/text/medium_w.png')
        hard = pygame.image.load('Images/text/hard_w.png')
        leave = pygame.image.load('Images/text/leave_w.png')
        right = pygame.image.load('Images/text/right_w.png')
        left = pygame.image.load('Images/text/left_w.png')

    # Coordenadas calculadas
    y1 = Print.calcula_inicio(1, y, altura, gap)
    y2 = Print.calcula_inicio(2, y, altura, gap)

    x1 = Print.calcula_inicio(1, x, largura, gap)
    x2 = Print.calcula_inicio(2, x, largura, gap)

    lista = [[(x, y), base, easy], [(x1, y), base, medium],
             [(x2, y), base, hard], [(x, y1), base, left],
             [(x2, y1), base, right], [(x1, y2), base, leave]]

    return lista
Пример #2
0
def cria_lista(switch_white, x, y, altura, largura, gap, base):
    # Imagens
    if switch_white:
        start = pygame.image.load('Images/text/start_b.png')
        options = pygame.image.load('Images/text/options_b.png')
        colours = pygame.image.load('Images/text/colours_b.png')
        gravar = pygame.image.load('Images/text/save_b.png')
        best = pygame.image.load('Images/text/best_b.png')
        leave = pygame.image.load('Images/text/leave_b.png')
    else:
        start = pygame.image.load('Images/text/start_w.png')
        options = pygame.image.load('Images/text/options_w.png')
        colours = pygame.image.load('Images/text/colours_w.png')
        gravar = pygame.image.load('Images/text/save_w.png')
        best = pygame.image.load('Images/text/best_w.png')
        leave = pygame.image.load('Images/text/leave_w.png')

    # Coordenadas calculadas
    x1 = Print.calcula_inicio(1, x, largura, gap)
    x2 = Print.calcula_inicio(2, x, largura, gap)
    y1 = Print.calcula_inicio(1, y, altura, gap)
    y2 = Print.calcula_inicio(2, y, altura, gap)

    lista = [[(x, y), base, start],
             [(x, y1), base, options],
             [(x1, y1), base, colours],
             [(x, y2), base, gravar],
             [(x1, y2), base, best],
             [(x2, y2), base, leave]]

    return lista
Пример #3
0
def imprime_texto(screen, switch_white, dificuldade, x, y, largura, altura,
                  base, gap):
    if switch_white:
        colour = GREY
    else:
        colour = WHITHE

    y1 = Print.calcula_inicio(1, y, altura, gap)
    x1 = Print.calcula_inicio(1, x, largura, gap)

    # Adiciona o numero
    my_font = pygame.font.SysFont("monospace", 65)
    text = str(dificuldade)
    label = my_font.render(text, 1, colour)
    centro = label.get_rect(center=(x1 + (largura / 2), y1 + (altura / 2)))

    screen.blit(base, (x1, y1))
    screen.blit(label, centro)
Пример #4
0
def lista_crescente(lista_basic, x, y, altura, gap, base, switch_white):
    # Coordenadas calculadas
    y1 = Print.calcula_inicio(1, y, altura, gap)
    y2 = Print.calcula_inicio(2, y, altura, gap)
    y3 = Print.calcula_inicio(3, y, altura, gap)

    if switch_white:
        helps = pygame.image.load('Images/text/help_b.png')
        fix = pygame.image.load('Images/text/fix_b.png')
        wrong = pygame.image.load('Images/text/wrong_b.png')
    else:
        helps = pygame.image.load('Images/text/help_w.png')
        fix = pygame.image.load('Images/text/fix_w.png')
        wrong = pygame.image.load('Images/text/wrong_w.png')

    lista_basic.append([(x, y1), base, helps])
    lista_basic.append([(x, y2), base, fix])
    lista_basic.append([(x, y3), base, wrong])
Пример #5
0
def final(screen, botoes, ecra, result, tempo, game_over, base, alternativo,
          switch_white, cor_letras):
    # Coordenadas iniciais
    x = 340
    y = 100
    largura = 200
    altura = 100
    gap = 50

    # Imagens
    if switch_white:
        continuem = pygame.image.load('Images/text/continue_b.png')
        leave = pygame.image.load('Images/text/leave_b.png')
    else:
        continuem = pygame.image.load('Images/text/continue_w.png')
        leave = pygame.image.load('Images/text/leave_w.png')

    # Coordenadas calculadas
    y1 = Print.calcula_inicio(1, y, altura, gap)
    y2 = Print.calcula_inicio(2, y, altura, gap)
    y3 = Print.calcula_inicio(3, y, altura, gap)

    string = [[y, result], [y1, format_tempo(tempo)]]

    lista = [[(x, y2), base, continuem], [(x, y3), base, leave]]

    Print.deteta_rato(lista, botoes, alternativo, altura, largura)

    if botoes[0]:
        ecra = 1
        botoes[0] = False

    if botoes[1]:
        game_over = True
        botoes[1] = False

    print_string(screen, string, altura, cor_letras)
    Print.desenha_botoes(screen, lista)

    return ecra, game_over
Пример #6
0
def cria_listas(y, x, altura, largura, gap, switch_white, botoes,
                small_alternativo, small_base, base, soma_peq):
    # Coordenadas calculadas
    y1 = Print.calcula_inicio(1, y, altura, gap)
    y2 = Print.calcula_inicio(2, y, altura, gap)
    y3 = Print.calcula_inicio(3, y, altura, gap)
    y4 = Print.calcula_inicio(4, y, altura, gap)

    x1 = Print.calcula_inicio(1, x, largura, gap)
    x2 = Print.calcula_inicio(2, x, largura, gap)

    # Imagens
    if switch_white:
        skill = pygame.image.load('Images/text/skill_b.png')
        back = pygame.image.load('Images/text/back_b.png')
        yes = pygame.image.load('Images/text/small/yes_b.png')
        no = pygame.image.load('Images/text/small/no_b.png')
    else:
        skill = pygame.image.load('Images/text/skill_w.png')
        back = pygame.image.load('Images/text//back_w.png')
        yes = pygame.image.load('Images/text/small/yes_w.png')
        no = pygame.image.load('Images/text/small/no_w.png')

    cor = inicia_cor(botoes, small_alternativo, small_base)

    lista_basic = [[(x, y), base, skill], [(x, y4), base, back]]

    lista_spec = [[(x1, y1 + soma_peq), cor[0][0], yes],
                  [(x1, y2 + soma_peq), cor[1][0], yes],
                  [(x1, y3 + soma_peq), cor[2][0], yes],
                  [(x2, y1 + soma_peq), cor[0][1], no],
                  [(x2, y2 + soma_peq), cor[1][1], no],
                  [(x2, y3 + soma_peq), cor[2][1], no]]

    return lista_basic, lista_spec
Пример #7
0
def botoes_jogo(screen, botoes, selecionados, wrong, helps, fix, base,
                alternativo, switch_white):
    # Imagens
    if switch_white:
        helpm = pygame.image.load('Images/text/small/help_b.png')
        fixm = pygame.image.load('Images/text/small/fix_b.png')
        wrongm = pygame.image.load('Images/text/small/wrong_b.png')
        finishm = pygame.image.load('Images/text/small/finish_b.png')
    else:
        helpm = pygame.image.load('Images/text/small/help_w.png')
        fixm = pygame.image.load('Images/text/small/fix_w.png')
        wrongm = pygame.image.load('Images/text/small/wrong_w.png')
        finishm = pygame.image.load('Images/text/small/finish_w.png')

    # Coordenadas iniciais
    largura = 150
    altura = 75
    gap = 20
    y = 770
    x = 110

    # Coordenadas calculadas
    x1 = Print.calcula_inicio(1, x, largura, gap)
    x2 = Print.calcula_inicio(2, x, largura, gap)
    x3 = Print.calcula_inicio(3, x, largura, gap)

    lista = [[(x3, y), base, finishm, 3]]

    if wrong:
        lista.append([(x, y), base, wrongm, 0])
    if fix:
        lista.append([(x1, y), base, fixm, 1])
    if selecionados and helps:
        lista.append([(x2, y), base, helpm, 2])

    deteta_rato_spec(lista, botoes, alternativo, altura, largura)
    desenha_botoes(screen, lista)
Пример #8
0
def inicio(screen, botoes, base, alternativo, number, img, switch_white):
    # Coordenadas iniciais
    altura = 75
    largura = 150
    gap = 50
    x = 60
    y = 100

    # Imagens
    if switch_white:
        back = pygame.image.load('Images/text/back_b.png')
    else:
        back = pygame.image.load('Images/text/back_w.png')

    # Coordenadas calculadas
    y1 = Print.calcula_inicio(1, y, altura, gap)
    y2 = Print.calcula_inicio(2, y, altura, gap)
    y3 = Print.calcula_inicio(3, y, altura, gap)

    x1 = Print.calcula_inicio(1, x, largura, gap)
    x2 = Print.calcula_inicio(2, x, largura, gap)
    x3 = Print.calcula_inicio(3, x, largura, gap)

    # Botao Leave
    mouse = pygame.mouse.get_pos()
    click = pygame.mouse.get_pressed()
    lista = [(x, y3), base, back]
    if lista[0][0] <= mouse[0] <= lista[0][0] + 200:
        if lista[0][1] <= mouse[1] <= lista[0][1] + 100:
            lista[1] = alternativo
            if click[0]:
                botoes[10] = True

    black = pygame.image.load('Images/colours/small/small_black.png')
    blue = pygame.image.load('Images/colours/small/small_blue.png')
    green = pygame.image.load('Images/colours/small/small_green.png')
    light_blue = pygame.image.load('Images/colours/small/small_light_blue.png')
    orange = pygame.image.load('Images/colours/small/small_orange.png')
    pink = pygame.image.load('Images/colours/small/small_pink.png')
    purple = pygame.image.load('Images/colours/small/small_purple.png')
    red = pygame.image.load('Images/colours/small/small_red.png')
    white = pygame.image.load('Images/colours/small/small_white.png')
    yellow = pygame.image.load('Images/colours/small/small_yellow.png')

    cores = [[(x, y + 25), black, False], [(x1, y + 25), blue, False],
             [(x2, y + 25), green, False], [(x3, y + 25), light_blue, False],
             [(x, y1 + 25), orange, False], [(x1, y1 + 25), pink, False],
             [(x2, y1 + 25), purple, False], [(x3, y1 + 25), red, False],
             [(x1, y2 + 25), white, False], [(x2, y2 + 25), yellow, False]]
    cores[number][2] = True

    deteta_rato(cores, botoes, altura, largura)

    desenha_cores(screen, cores, img)
    screen.blit(lista[1], lista[0])
    screen.blit(lista[2], lista[0])
Пример #9
0
def imprime_texto(switch_white, dificuldade, screen, x, y, largura, altura,
                  gap):
    # Imprime texto
    x1 = Print.calcula_inicio(1, x, largura, gap)

    if switch_white:
        colour = GREY
    else:
        colour = WHITHE

    my_font = pygame.font.SysFont("monospace", 65)
    text = str(dificuldade)
    label = my_font.render(text, 1, colour)
    centro = label.get_rect(center=(x1 + (largura / 2), y + (altura / 2)))
    screen.blit(label, centro)
Пример #10
0
def create_lista(x, y, gap, altura, largura, switch_white, base, small_base,
                 small_alternativo, small_third, small_fourth, alternativo):
    # Cria a lista de imagens para imprimir

    # Imagens
    if switch_white:
        first = pygame.image.load('Images/text/first_b.png')
        second = pygame.image.load('Images/text/second_b.png')
        third = pygame.image.load('Images/text/third_b.png')
        fourth = pygame.image.load('Images/text/fourth_b.png')
        white = pygame.image.load('Images/text/white_b.png')
        black = pygame.image.load('Images/text/dark_b.png')
        back = pygame.image.load('Images/text/back_w.png')
    else:
        first = pygame.image.load('Images/text/first_w.png')
        second = pygame.image.load('Images/text/second_w.png')
        third = pygame.image.load('Images/text/third_w.png')
        fourth = pygame.image.load('Images/text/fourth_w.png')
        white = pygame.image.load('Images/text/white_w.png')
        black = pygame.image.load('Images/text/dark_w.png')
        back = pygame.image.load('Images/text/back_w.png')

    # Coordenadas calculadas
    y1 = Print.calcula_inicio(1, y, altura, gap)
    y2 = Print.calcula_inicio(2, y, altura, gap)
    y3 = Print.calcula_inicio(3, y, altura, gap)
    y4 = Print.calcula_inicio(4, y, altura, gap)
    x1 = Print.calcula_inicio(1, x, largura, gap)
    x2 = Print.calcula_inicio(2, x, largura, gap)

    lista = [[(x, y), base, first], [(x, y1), base, second],
             [(x, y2), base, third], [(x, y3), base, fourth],
             [(x, y4), base, white], [(x1, y4), base, black],
             [(x2, y4), base, back]]

    if switch_white:
        lista[4][1] = alternativo
    else:
        lista[5][1] = alternativo

    cores = [[(x1, y + 25), small_base], [(x1, y1 + 25), small_alternativo],
             [(x1, y2 + 25), small_third], [(x1, y3 + 25), small_fourth]]

    return lista, cores