コード例 #1
0
def regras():
    flag = True
    while True:
        if (flag == False):
            break
        else:
            for event in pygame.event.get():
                pos = pygame.mouse.get_pos()
                pressed1, pressed2, pressed3 = pygame.mouse.get_pressed()
                btn0 = botoesMenu(BLACK, 300, 500, 372 / 2, 149 / 2)
                txtFase3 = pygame.image.load(
                    globals.get_path() +
                    '\\View\\fase1\\txtFase1.png').convert_alpha()
                screen.fill(PELE)
                novo_txtFase3 = pygame.transform.scale(
                    txtFase3, (int(1363 / 2), int(541 / 2)))
                screen.blit(novo_txtFase3, (60, 150))
                screen.blit(botao_continuar('btnContinuar'), (300, 500))
                pygame.display.update()
                if event.type == QUIT:
                    pygame.quit()
                    exit()
                elif btn0.collidepoint(pos) and pressed1:
                    click.play()
                    flag = False
                    break
コード例 #2
0
 def ler_mapa(self, caminho):
     path = globals.get_path()
     arquivo_mapa = open(path + "\\" + caminho + '.txt', 'r')
     linha = arquivo_mapa.read()
     arquivo_mapa.close()
     linha = linha.split('\n')
     mapa_lido = []
     for row in linha:
         mapa_lido.append(list(row))
     return mapa_lido
コード例 #3
0
def final():
    flag = True
    win = pygame.mixer.Sound(globals.get_path() +
                             '\\Sound\\fase_concluida.wav')
    win.play()
    while True:
        if (flag == False):
            break
        else:
            for event in pygame.event.get():
                font = pygame.font.Font(pygame.font.match_font("Arial"), 100)
                pos = pygame.mouse.get_pos()
                pressed1, pressed2, pressed3 = pygame.mouse.get_pressed()
                btn10 = botoes_menu(BLACK, 300, 600, 372 / 2, 149 / 2)
                txtFase3 = pygame.image.load(
                    globals.get_path() +
                    '\\View\\menu\\txtParabens.png').convert_alpha()
                txtFase4 = pygame.image.load(
                    globals.get_path() +
                    '\\View\\menu\\txtPontuacao.png').convert_alpha()
                btn11 = botoes_menu(BLACK, 300, 500, 372 / 2, 149 / 2)
                Pontos = font.render(textponto, True, (255, 255, 255))
                screen.blit(background, (0, 0))
                novo_txtFase3 = pygame.transform.scale(
                    txtFase3, (int(655 / 1.5), int(354 / 1.5)))
                screen.blit(novo_txtFase3, (200, 20))
                screen.blit(txtFase4, (130, 200))
                screen.blit(Pontos, (300, 300))
                screen.blit(dimensao_botao('btnSair'), (300, 600))
                screen.blit(dimensao_botao('btnMenu'), (300, 500))
                pygame.display.update()
                if event.type == QUIT:
                    pygame.quit()
                    exit()
                elif btn11.collidepoint(pos) and pressed1:
                    flag = False
                    break
                elif btn10.collidepoint(pos) and pressed1:
                    pygame.quit()
                    exit()
コード例 #4
0
def contatos():
    screen.fill((0, 0, 0))
    btn6 = botoes_menu(BLACK, 300, 500, 372 / 2, 149 / 2)
    screen.blit(background, (0, 0))
    screen.blit(dimensao_botao('btnVoltar'), (300, 500))
    aut = pygame.image.load(globals.get_path() +
                            '\\View\\menu\\contatos.png').convert_alpha()
    novo_aut = pygame.transform.scale(aut, (int(940 / 2), int(620 / 2)))
    screen.blit(novo_aut, (150, 100))
    if btn6.collidepoint(pos) and pressed1:
        click.play()
        screen.fill((0, 0, 0))
        pygame.display.flip()
        menu()
        pygame.display.flip()
        return 1
    else:
        return 0
コード例 #5
0
def placar():
    placar = pygame.image.load(globals.get_path() +
                               '\\View\\menu\\txtPlacar.png').convert_alpha()
    novo_placar = pygame.transform.scale(placar, (int(406 / 2), int(264 / 2)))
    screen.fill((0, 0, 0))
    btn6 = botoes_menu(BLACK, 300, 500, 372 / 2, 149 / 2)
    screen.blit(background, (0, 0))
    screen.blit(novo_placar, (290, 50))
    screen.blit(dimensao_botao('btnVoltar'), (300, 500))
    pygame.draw.rect(screen, BLACK, (100, 155, 600, 325))
    printar_placar()
    if btn6.collidepoint(pos) and pressed1:
        click.play()
        screen.fill((0, 0, 0))
        pygame.display.flip()
        menu()
        pygame.display.flip()
        return 3
    else:
        return 0
コード例 #6
0
def titulo():
    titulo = pygame.image.load(globals.get_path() +
                               '\\View\\menu\\titulo.png').convert_alpha()
    novo_titulo = pygame.transform.scale(titulo, (int(726 / 2), int(217 / 2)))
    screen.blit(novo_titulo, (210, 50))
コード例 #7
0
def dimensao_botao(botao):
    btn = pygame.image.load(globals.get_path() + '\\View\\menu\\' + botao +
                            '.png').convert_alpha()
    novo_botao = pygame.transform.scale(btn, (int(372 / 2), int(149 / 2)))
    return novo_botao
コード例 #8
0
def jogar():
    texto = []
    screen.fill((0, 0, 0))
    btn1 = botoes_menu(BLACK, 300, 400, 372 / 2, 149 / 2)
    screen.blit(background, (0, 0))
    screen.blit(dimensao_botao('btnJogar'), (300, 400))
    tituloJ = pygame.image.load(
        globals.get_path() + '\\View\\menu\\txtSeuNome.png').convert_alpha()
    novo_tituoj = pygame.transform.scale(tituloJ,
                                         (int(1036 / 2), int(264 / 2)))
    screen.blit(novo_tituoj, (180, 50))
    flag = True
    while True:
        if (flag == False):
            screen.fill((0, 0, 0))
            menu()
            pygame.display.flip()
            return 0
        else:
            pygame.draw.rect(screen, (255, 255, 255), (250, 200, 300, 30))
            for event in pygame.event.get():
                pos = pygame.mouse.get_pos()
                pressed1, pressed2, pressed3 = pygame.mouse.get_pressed()
                btn6 = botoes_menu(BLACK, 300, 500, 372 / 2, 149 / 2)
                if len(texto) != 0:
                    btn1 = botoes_menu(BLACK, 300, 400, 372 / 2, 149 / 2)
                screen.blit(background, (0, 0))
                if len(texto) != 0:
                    screen.blit(dimensao_botao('btnJogar'), (300, 400))
                tituloJ = pygame.image.load(
                    globals.get_path() +
                    '\\View\\menu\\txtSeuNome.png').convert_alpha()
                novo_tituoj = pygame.transform.scale(
                    tituloJ, (int(1036 / 2), int(264 / 2)))
                screen.blit(novo_tituoj, (180, 50))
                screen.blit(dimensao_botao('btnVoltar'), (300, 500))
                if event.type == pygame.KEYDOWN:
                    valor = event.key
                    if len(texto) < 27:
                        if 97 <= valor <= 122:
                            texto.append(chr(valor))
                        elif 49 <= valor <= 57:
                            texto.append(chr(valor))
                        elif valor == 32:
                            texto.append(" ")
                    if valor == 8:
                        if len(texto) > 0:
                            texto.pop()
                elif event.type == QUIT:
                    pygame.quit()
                    exit()
                elif len(texto) != 0:
                    if btn1.collidepoint(pos) and pressed1:
                        return usuario.usuario(globals.convert(texto))
                elif btn6.collidepoint(pos) and pressed1:
                    click.play()
                    screen.fill((0, 0, 0))
                    pygame.display.flip()
                    flag = False
                    break

            font = pygame.font.Font(pygame.font.match_font("Arial"), 24)
            pygame.draw.rect(screen, (255, 255, 255), (250, 200, 300, 30))
            text = globals.convert(texto)
            newSurface = font.render(text, True, (0, 0, 0))
            screen.blit(newSurface, (250, 200))
            pygame.display.update()
コード例 #9
0
WHITE = (255, 255, 255)

tempo_fase = 0
now = datetime.now()
horas = now.hour
minu = now.minute
sec = now.second
horas = horas * 3600
minu = minu * 60

time_inicio = minu + sec + horas
print(time_inicio)
dislpay = pygame.display.set_mode((screen_largura, screen_altura))
pygame.display.set_caption('COLORANDO')
screen = pygame.display.get_surface()
oldbackground = pygame.image.load(globals.get_path() +
                                  "\\View\\menu\\rainbow.gif")
background = pygame.transform.scale(oldbackground,
                                    (int(400 * 2), int(400 * 2)))
pygame.font.init()
font = pygame.font.get_default_font()

# Tamanho do texto e fonte
text_botaomenu = pygame.font.SysFont(font, 40)
text_titulo = pygame.font.SysFont(font, 100)

screen.blit(background, (0, 0))

centralizado = screen_largura / 2

pygame.mixer.init()
コード例 #10
0
def torneira():
    titulo = pygame.image.load(globals.get_path() +
                               '\\View\\fase1\\torneira.png').convert_alpha()
    novo_titulo = pygame.transform.scale(titulo, (int(650), int(500)))
    screen.blit(novo_titulo, (-200, 0))
コード例 #11
0
def botao_continuar(botao):
    btn = pygame.image.load(globals.get_path() + '\\View\\corrida\\' + botao +
                            '.png').convert_alpha()
    novo_botao = pygame.transform.scale(btn, (int(372 / 2), int(149 / 2)))
    return novo_botao
コード例 #12
0
def btnConfirmar():
    titulo = pygame.image.load(
        globals.get_path() +
        '\\View\\fase1\\btnConfirmar.png').convert_alpha()
    novo_titulo = pygame.transform.scale(titulo, (int(115), int(215)))
    screen.blit(novo_titulo, (500, 495))
コード例 #13
0
def instrucao():
    titulo = pygame.image.load(
        globals.get_path() +
        '\\View\\fase1\\txtCorFormada.png').convert_alpha()
    screen.blit(titulo, (50, 40))
コード例 #14
0
def balde():
    titulo = pygame.image.load(globals.get_path() +
                               '\\View\\fase1\\balde.png').convert_alpha()
    novo_titulo = pygame.transform.scale(titulo, (int(500), int(700)))
    screen.blit(novo_titulo, (2, 0))
コード例 #15
0
AMARELO = (255, 255, 0)
COR1 = (153, 0, 153)
PELE = (251, 230, 226)
CorSelecionada = (0, 255, 0)
global cor1
cor1 = (0, 0, 0)

cont = 1

fase = 0

pygame.init()

pygame.mixer.init()

fundo = pygame.mixer.music.load(globals.get_path() + '\\Sound\\gameplay.mpeg')

click = pygame.mixer.Sound(globals.get_path() + '\\Sound\\click.wav')

pygame.mixer.music.play()

screen = pygame.display.set_mode((800, 700))
# carregando fonte
font = pygame.font.SysFont(None, 55)

pygame.display.set_caption('COLORANDO')

# preenchendo o fundo com preto
screen.fill(PELE)

コード例 #16
0
 def criar_imgs(self, nome):
     return pygame.image.load(globals.get_path() + '\\View\\' + nome +
                              '.png').convert_alpha()