Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified CInemon-IP/code/__pycache__/batalha_ui.cpython-312.pyc
Binary file not shown.
Binary file modified CInemon-IP/code/__pycache__/cinemon.cpython-312.pyc
Binary file not shown.
Binary file modified CInemon-IP/code/__pycache__/config.cpython-312.pyc
Binary file not shown.
Binary file modified CInemon-IP/code/__pycache__/gema.cpython-312.pyc
Binary file not shown.
Binary file modified CInemon-IP/code/__pycache__/inimigo.cpython-312.pyc
Binary file not shown.
Binary file modified CInemon-IP/code/__pycache__/jogo_base.cpython-312.pyc
Binary file not shown.
Binary file modified CInemon-IP/code/__pycache__/jogo_ui.cpython-312.pyc
Binary file not shown.
Binary file modified CInemon-IP/code/__pycache__/npc.cpython-312.pyc
Binary file not shown.
Binary file modified CInemon-IP/code/__pycache__/personagem.cpython-312.pyc
Binary file not shown.
7 changes: 5 additions & 2 deletions CInemon-IP/code/jogo_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def __init__(self):
self.pedro = None
self.gusto = None
self.pooh = None
self.fernanda = None # Novo NPC
self.npcs = []
self.gemas = []

self.definir_posicoes()
Expand Down Expand Up @@ -187,7 +187,10 @@ def definir_posicoes(self):
self.pedro = Inimigo(800, 350, 'Pedro')
self.gusto = Inimigo(300, 500, 'Gusto')
self.pooh = Inimigo(600, 600, 'pooh')
self.fernanda = NPC(400, 200, 'Fernanda') # Posição do NPC Fernanda
self.npcs = [
NPC(400, 200, 'Fernanda1', "spr_fernanda_madeiral.png"),

]
self.gemas = [
Gema(150, 150),
Gema(250, 400),
Expand Down
31 changes: 29 additions & 2 deletions CInemon-IP/code/jogo_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def __init__(self):
self.mostrar_status = False
self.mostrar_mensagem_gemas = False
self.tempo_mensagem_gemas = 0
self.npc_atual = None # Adicionado para rastrear o NPC atual em interação

def _atualizar_camera(self):
x = self.jogador.x - (LARGURA // 2) / self.zoom
Expand Down Expand Up @@ -194,6 +195,31 @@ def verificar_coleta_gemas(self):
self.mostrar_mensagem_gemas = True
self.tempo_mensagem_gemas = 180

def verificar_interacao_npc(self):
for npc in self.npcs:
distancia = math.sqrt((self.jogador.x - npc.x)**2 + (self.jogador.y - npc.y)**2)
if self.mapa_atual == 'basic.tmx' and distancia < 50: # Distância de interação
self.npc_atual = npc # Armazena o NPC atual interagido
return True
return False

def processar_dialogo_npc(self):
if not hasattr(self, 'npc_atual') or self.npc_atual is None:
return
if self.jogador.dinheiro >= 50:
self.mensagem_dialogo = [
f"{self.npc_atual.nome}: Quer gastar 50 créditos para reanimar e curar seus CInemons?",
"Pressione S para Sim ou N para Não"
]
else:
self.mensagem_dialogo = [
f"{self.npc_atual.nome}: Você não tem créditos suficientes!",
"Volte quando tiver pelo menos 50 créditos."
]
self.em_dialogo_npc = True
self.dialogo_atual = 0
self.resposta_npc = None

def mapa(self):
for evento in pygame.event.get():
if evento.type == pygame.QUIT:
Expand Down Expand Up @@ -259,8 +285,9 @@ def mapa(self):
elif self.mapa_atual == 'basic.tmx':
self.gusto.desenhar(tela, self.camera, self.zoom)
self.pooh.desenhar(tela, self.camera, self.zoom)
self.fernanda.desenhar(tela, self.camera, self.zoom) # Desenha o NPC

for npc in self.npcs: # Desenha todos os NPCs
npc.desenhar(tela, self.camera, self.zoom)

for gema in self.gemas:
gema.desenhar(tela, self.camera, self.zoom)

Expand Down
8 changes: 3 additions & 5 deletions CInemon-IP/code/npc.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,16 @@
import os

class NPC:
def __init__(self, x, y, nome):
def __init__(self, x, y, nome, sprite_file="spr_fernanda_madeiral.png"):
self.x = x
self.y = y
self.nome = nome
self.width = 40
self.height = 60
self.rect = pygame.Rect(self.x + 8, self.y + 18, 24, 36) # Hitbox ajustada como o jogador
self.rect = pygame.Rect(self.x + 8, self.y + 18, 24, 36) # Hitbox ajustada

# Carrega o sprite
try:
sprite_path = os.path.join("Desktop", "CInemon-IP", "sprites", "spr_fernanda_madeiral.png")

sprite_path = os.path.join("Desktop", "CInemon-IP", "sprites", sprite_file)
self.sprite = pygame.image.load(sprite_path).convert_alpha()
self.sprite = pygame.transform.scale(self.sprite, (self.width, self.height))
except Exception as e:
Expand Down
181 changes: 106 additions & 75 deletions CInemon-IP/data/basic.tmx

Large diffs are not rendered by default.