Example #1
0
def perdeu():
    pygame.font.init()
    pygame.mixer.init()
    funcao.carregaraudio('derrota/audios/derrota.ogg').play()
    font = pygame.font.get_default_font()
    fonte = pygame.font.SysFont(font, 60)
    texto = 'VOCÊ PERDEU!'
    clicoumenu = clicouexit = 1
    while True:

        clock = pygame.time.Clock()
        clock.tick(30)
        text = fonte.render(texto, 1, (0, 0, 0))
        textRect = text.get_rect()
        textRect.center = (472, 450)
        tela = pygame.display.set_mode((945, 600))
        funcao.mostrartela(tela,
                           funcao.carregarimagem(f'derrota/imagens/fundo.png'),
                           0, 0)
        tela.blit(text, textRect)
        if clicoumenu % 2 != 0:
            funcao.mostrartela(tela, enderecos.botaomenu, 750, 60)
        else:
            enderecos.sommenu.play()
            funcao.mostrartela(tela, enderecos.botaomenupressionado, 755, 63)
            pygame.display.update()
            import telainicial
            telainicial.telainicial()

        if clicouexit % 2 != 0:
            funcao.mostrartela(tela, enderecos.botaoexit, 750, 145)
        else:
            funcao.mostrartela(tela, enderecos.botaoexitpressionado, 755, 148)
            pygame.display.update()
            quit()

        pygame.display.update()

        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                pygame.quit()
                quit()
            elif event.type == pygame.MOUSEBUTTONDOWN:
                if event.button == 1:
                    x = pygame.mouse.get_pos()[0]
                    y = pygame.mouse.get_pos()[1]
                    if funcao.clicoubotao(x, y, 897, 767, 127, 72):
                        clicoumenu = 2
                        pygame.mixer.stop()
                    if funcao.clicoubotao(x, y, 897, 767, 215, 158):
                        enderecos.sommenu.play()
                        clicouexit = 2
Example #2
0
def roleta():
    pygame.font.init()
    pygame.mixer.init()
    funcao.carregaraudio('roleta/audios/fundo.ogg').play()
    font = pygame.font.get_default_font()
    fonte = pygame.font.SysFont(font, 60)
    texto = 'ADIVINHE O NOME DA FRUTA:'
    tempo = 0
    while True:
        tempo += 0.1
        clock = pygame.time.Clock()
        clock.tick(30)
        text = fonte.render(texto, 1, (255, 255, 255))
        textRect = text.get_rect()
        textRect.center = (472, 100)
        tela = pygame.display.set_mode((945, 600))
        fruta = funcao.sortearfruta()
        funcao.mostrartela(tela,
                           funcao.carregarimagem(f'roleta/imagens/fundo.png'),
                           0, 0)
        tela.blit(text, textRect)
        funcao.mostrartela(
            tela, funcao.carregarimagem(f'roleta/imagens/{fruta}.png'), 265,
            120)
        pygame.display.update()
        if tempo > 7.3:
            funcao.mostrartela(tela,
                               funcao.carregarimagem(f'frutas/{fruta}.png'),
                               265, 120)
            sleep(0.5)
            print(fruta)
            return fruta.upper()

        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                pygame.quit()
                quit()
            elif event.type == pygame.MOUSEBUTTONDOWN:
                if event.button == 1:
                    x = pygame.mouse.get_pos()[0]
                    y = pygame.mouse.get_pos()[1]
Example #3
0
from funcao import carregaraudio, carregarimagem

#IMAGENS TELA INICIAL---------------------------------------------------------------------------------------------------
imagemfundoinicial = carregarimagem('imagens/fundo/fundoinicial.png')
logogame = carregarimagem('imagens/jogodoalfabeto.png')
botaoexitinicial = carregarimagem('imagens/botoes/exit.png')
botaoplay = carregarimagem('imagens/botoes/play.png')
botaoexitpressionadoinicial = carregarimagem(
    'imagens/botoes/exitpressionado.png')
botaoplaypressionado = carregarimagem('imagens/botoes/playpressionado.png')

#AUDIOS TELA INICIAL----------------------------------------------------------------------------------------------------
musicafundoinicial = carregaraudio('audios/fundo/musicafundoinicial.ogg')
somplay = carregaraudio('audios/botoes/botao.ogg')

#IMAGENS DENTRO DO GAME-------------------------------------------------------------------------------------------------
imagemfundojogo = carregarimagem('jogo/imagens/fundo/fundojogo.png')
botaoexit = carregarimagem('jogo/imagens/botoes/exit.png')
botaoexitpressionado = carregarimagem(
    'jogo/imagens/botoes/exitpressionado.png')
botaomenu = carregarimagem('jogo/imagens/botoes/menu.png')
botaomenupressionado = carregarimagem(
    'jogo/imagens/botoes/menupressionado.png')
botaocredito = carregarimagem('jogo/imagens/botoes/credito.png')
botaocreditopressionado = carregarimagem(
    'jogo/imagens/botoes/creditopressionado.png')

#AUDIOS DENTRO DO GAME--------------------------------------------------------------------------------------------------
musicafundojogo = carregaraudio('jogo/audios/fundo/musicafundojogo.ogg')
sommenu = carregaraudio('audios/botoes/botao.ogg')
somcredito = carregaraudio('audios/botoes/botao.ogg')