예제 #1
0
    def cria_figura():
        aleatorio = random.randint(0, 10)

        if 0 <= aleatorio <= 3:
            figura = pygame.image.load(Path.get_path() + "/Imagem/Tiro/tiro1.png").convert_alpha()
        elif 4 <= aleatorio <= 6:
            figura = pygame.image.load(Path.get_path() + "/Imagem/Tiro/tiro2.png").convert_alpha()
        else:
            figura = pygame.image.load(Path.get_path() + "/Imagem/Tiro/tiro3.png").convert_alpha()

        return figura
예제 #2
0
 def test_move_NaveFuga(self):
     nave = FabricaNaveFuga.FabricaNaveFuga(FabricaNaveFuga, Path.get_path() + "Imagem/Nave/NaveFuga.png", "figteste", "somteste")
     val1 = nave
     resultado = nave
     resultado.posicao["y"] += 3
     resultado.posicao["x"] += 3
     resultado = resultado.cria_area()
     self.assertEqual(resultado, val1.move())
예제 #3
0
    def imprime_instrucao():
        titulo = " - Nave maluca -Instrução"

        tela = pygame.display.set_mode((Metricas.largura, Metricas.altura), 0, 32)
        pygame.display.set_caption(titulo)
        imagem = pygame.image.load(Path.get_path() + "/Imagem/Tela/tela_espaco5.jpg").convert_alpha()

        tela.blit(imagem, (0, 0))

        return tela
예제 #4
0
    def test_build_imagem_explosao_NavePeao_esquerda(self):
        nave = FabricaNavePeao.FabricaNavePeao(FabricaNaveGrupo, Path.get_path() + "Imagem/Nave/NaveFuga.png", "figteste", "somteste")
        val1 = nave
        val1.posicao["direcao"] = "ESQUERDA"
        val1.posicao["x"] = 1
        val1.posicao["y"] = 1

        resultado = val1
        resultado.posicao["x"] -= 1
        resultado.cria_area()

        self.assertEqual(resultado,val1.build_imagem_explosao())
예제 #5
0
    def test_build_imagem_explosao_NavePeao_trocaDireita(self):
        nave = FabricaNavePeao.FabricaNavePeao(FabricaNaveGrupo, Path.get_path() + "Imagem/Nave/NaveFuga.png", "figteste", "somteste")
        val1 = nave
        val1.posicao["direcao"] = "DIREITA"
        val1.posicao["x"] = Metricas.lim_largura
        val1.posicao["y"] = 1

        resultado = val1
        val1.posicao["direcao"] = "ESQUERDA"
        resultado.posicao["y"] += 1
        resultado.cria_area()

        self.assertEqual(resultado,val1.build_imagem_explosao())
예제 #6
0
    def test_move_NaveGrupo_direita(self):
        nave = FabricaNaveGrupo.FabricaNaveGrupo(FabricaNaveGrupo, Path.get_path() + "Imagem/Nave/NaveFuga.png", "figteste", "somteste")
        val1 = nave
        val1.posicao["direcao"] = "DIREITA"
        val1.posicao["x"] = 1
        val1.posicao["y"] = 1

        resultado = val1
        resultado.posicao["x"] += 1
        resultado.posicao["y"] += 1
        resultado.cria_area()

        self.assertEqual(resultado, val1.move())
예제 #7
0
 def __init__(self):
     self.dano = 0
     self.nave_fabrica = FabricaNave.FabricaNave('nome', Path.get_path() + '/Imagem/X Wing.png',
                                                 Path.get_path() + '/Imagem/Item/Clone0.png',
                                                 Path.get_path() + '/Som/MusicNave.wav')      # tipo : FabricaNaves
     self.imagem_nave = Path.get_path() + '/Imagem/X Wing.png'                                # endereco imagem
     self.imagem_explosao = Path.get_path() + '/Imagem/Item/Clone0.png'
     self.som = Path.get_path() + '/Som/MusicNave.wav'
예제 #8
0
    def imprime_texto_fim():

        tela = pygame.display.set_mode((Metricas.largura, Metricas.altura), 0, 32)
        titulo = " - Nave  - Game over"
        pygame.display.set_caption(titulo)
        caminho = Path.get_path() + "/Imagem/Tela/tela_menu5.jpg"
        imagem = pygame.image.load(caminho).convert()
        tela.blit(imagem, (0, 0))
        font_name = pygame.font.get_default_font()
        game_font = pygame.font.SysFont(font_name, 70)

        text = game_font.render("GAME OVER", True, (255, 0, 0))
        tela.blit(text, (510, 175))

        return tela
예제 #9
0
    def imprime_tela_inicial():

        titulo = " - Nave maluca - Let's Play"
        tela = pygame.display.set_mode((Metricas.largura, Metricas.altura), 0, 32)
        pygame.display.set_caption(titulo)
        caminho = Path.get_path() + "/Imagem/Tela/tela_espaco2.jpg"
        imagem = pygame.image.load(caminho).convert()

        tela.blit(imagem, (0, 0))

        font_name = pygame.font.get_default_font()
        game_font = pygame.font.SysFont(font_name, 25)
        text = game_font.render("Pontuação: "+"0000", True, (255, 100, 255))
        tela.blit(text, (20, 10))

        return tela
예제 #10
0
    def start_tela_menu():

        titulo = " - Nave maluca - Menu"

        tela = pygame.display.set_mode((Metricas.largura, Metricas.altura), 0, 32)
        pygame.display.set_caption(titulo)
        caminho = Path.get_path() + "/Imagem/Tela/tela_espaco2.jpg"
        imagem = pygame.image.load(caminho).convert()

        tela.blit(imagem, (0, 0))

        pygame.display.update()

        tela.blit(imagem, (10, 10))

        pygame.display.update()

        return tela
예제 #11
0
 def build_imagem_explosao(self):
     self.nave_product.imagem_explosao = Path.get_path() + "/Imagem/Nave/Boss.png"
 def buildimagem_nave(self):
     self.nave_product.imagem_nave = Path.get_path() + "Imagem/Nave/NavePersegue.png"
예제 #13
0
 def __init__(self):
     super(FabricaVida, self).__init__('Vida', Path.get_path() + "Imagem/Item/Vida.png", 100, 20)
예제 #14
0
 def build_imagem_nave(self):
     self.nave_product.imagem_nave = Path.get_path() + "/Imagem/Nave/Peao.png"
예제 #15
0
 def buildimagem_nave(self):
     self.nave_product.imagem_nave = Path.get_path() + 'Imagem/Nave/NaveBoss.png'
예제 #16
0
 def __init__(self):
     super(FabricaRestaura, self).__init__('Restaura', Path.get_path() + "Imagem/Item/Restaura.png", 100, 30)
 def build_som():
     super(NaveBuilder).nave_product.som = Path.get_path() + "Som/MusicNave.wav"
예제 #18
0
 def __init__(self):
     super(FabricaClone2, self).__init__(Path.get_path() + "Imagem/Item/Clone2.png")
 def build_imagem_explosao(self):
     self.nave_product.imagem_explosao = Path.get_path() + "Imagem/Nave/NaveExplode.png"
예제 #20
0
 def test_som(self):
     val = Path.get_path() + "Som/MusicNave.wav"
     pygame.mixer.init(frequency=22050, size=-16, channels=2, buffer=4096)
     resultado = pygame.mixer.Sound(val)
     self.assertEqual(resultado, FabricaNave.cria_som(val))
 def build_imagem_nave(self):
     self.nave_product.imagem_nave = Path.get_path(
     ) + '/Imagem/Nave/TieFighter_archigraphs.png'
예제 #22
0
 def __init__(self):
     super(FabricaMunicao1, self).__init__(Path.get_path() + "Imagem/Item/Municao1.png", 200, 5)
 def build_imagem_nave():
     super(NaveBuilder).nave_product.imagem_nave = Path.get_path() + 'Imagem/Nave/TieFighter_archigraphs.png'
 def build_som(self):
     self.nave_product.som = Path.get_path() + "Som/MusicNave.wav"
 def build_imagem_explosao():
     super(NaveBuilder).nave_product.imagem_explosao = Path.get_path() + "Imagem/Nave/NaveExplode.png"