Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IMPLEMENTACAO LONGA E COMPLICADA DOS MORADORES #4

Merged
merged 1 commit into from
Nov 14, 2022
Merged
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 __pycache__/blueprint.cpython-310.pyc
Binary file not shown.
Binary file modified __pycache__/celulas.cpython-310.pyc
Binary file not shown.
Binary file modified __pycache__/dwellers.cpython-310.pyc
Binary file not shown.
Binary file modified __pycache__/funcoes.cpython-310.pyc
Binary file not shown.
Binary file modified __pycache__/menu.cpython-310.pyc
Binary file not shown.
Binary file modified __pycache__/testedados.cpython-310.pyc
Binary file not shown.
15 changes: 9 additions & 6 deletions blueprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,13 @@ def iniciar_generico(lista, dados): #enviar apenas dados do menu ou todo
ide = 1

while parar == False:


a = ((ide-1) // 21) #representa o i na matriz
b = (ide-1) % 21 #representa o j na matriz
b = b * 51 #o j na matriz representa a largura
a = a * 93 #o i na matriz representa a altura
lista[ide-1].coordenadas = b, a

if (ide >=1 and ide <= 7) or (ide >=22 and ide <= 26):
lista[ide-1].bloqueada = True
else:
Expand All @@ -50,11 +56,7 @@ def iniciar_generico(lista, dados): #enviar apenas dados do menu ou todo
lista[ide-1].consumo = 0
lista[ide-1].pretendente = "nenhuma"

a = ((ide-1) // 21) #representa o i na matriz
b = (ide-1) % 21 #representa o j na matriz
b = b * 51 #o j na matriz representa a largura
a = a * 93 #o i na matriz representa a altura
lista[ide-1].coordenadas = b, a
#as coordenadas ficavam aqui

if ide in aleatorios and lista[ide-1].bloqueada == False: lista[ide-1].pedra = True
else: lista[ide-1].pedra = False
Expand Down Expand Up @@ -125,3 +127,4 @@ def iniciar_generico(lista, dados): #enviar apenas dados do menu ou todo
lista[contagem].imagem()
print(vars(lista[contagem])) #teste
contagem += 1

3 changes: 3 additions & 0 deletions celulas.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ def __init__(self, id, bloqueada, coordenadas, vazio, tipo, situacao, consumo, p
self.obj = None

self.sala = None
self.morador = None
#se ja produziu oq ela faz

#vizinhos? ajudaria a demarcar os pretendentes
#direções de passagem
#indicar que esta fundido
Expand Down
Binary file removed cenario/cozinha1_1-2.png
Binary file not shown.
Binary file removed cenario/cozinha1_2-2.png
Binary file not shown.
Binary file added cenario/cozinha2_1-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added cenario/cozinha2_2-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
135 changes: 120 additions & 15 deletions dwellers.py
Original file line number Diff line number Diff line change
@@ -1,30 +1,135 @@
from random import seed
from random import randint
from funcoes import empregar_Dw_Cl

class moradores:
class morador:
def __init__(self):
self.id = None
self.sexo = None
self.nome = None
self.sobrenome = None
self.nomecompleto = None
self.xp = None
self.nivel = None
self.vida = None
self.radiacao = None

self.xp = 0 #quando vc clica no personagem ele sobe de nivel
self.nivel = 1
self.vida = 100
self.radiacao = 0
self.trabalho = None
self.celula = None #eles nao precisam de coordenada, e so tem um padrao acima das da celula

self.crianca = None
self.cabelo = None
self.rosto = None
self.gravida = None

self.forca = 1 #pra agua
self.agilidade = 1 #pra comida
self.resistencia = 1 #eletricidade
self.carisma = 1 #radio e quarto
self.inteligencia = 1 #pro laboratorio #SIGLA: CIFRA


def Mnome(self, sexo):
seed()

randint(1,20)
nomeM = ["erick","emanuel","jorge","joao","vitor","marcos","daniel","luan","edson","leandro","alexandre","carlos","samuel","assis"#14
"franklin","henrique","gabriel","juliano","diogo","josafa","junior"]


def Msobrenome(self, sexo):
seed()

randint(1,20)

def Mnomecompleto(self):
self.nomecompleto = (self.nome," ",self.sobrenome)




def atribuir(dweller):

CIFRA = [0,0,0,0,0]
for _ in range(13):
pos = randint(0,4)
CIFRA[pos] += 1

dweller.forca += CIFRA[2]
dweller.agilidade += CIFRA[4]
dweller.resistencia += CIFRA[3]
dweller.carisma += CIFRA[0]
dweller.inteligencia += CIFRA[1]



def inicializar(celulas):

novo_fila = morador()
#aumentar total
#colocar nas primeiras celulas

novo_fila.id = 2
novo_fila.sexo = "M"
novo_fila.nome = novo_fila.Mnome(novo_fila.sexo)
novo_fila.sobrenome = novo_fila.Msobrenome(novo_fila.sexo)

novo_fila.Mnomecompleto()
atribuir(novo_fila)
empregar_Dw_Cl(novo_fila,celulas[21])

novo_fila.id = 3
novo_fila.sexo = "F"
novo_fila.nome = novo_fila.Mnome(novo_fila.sexo)
novo_fila.sobrenome = novo_fila.Msobrenome(novo_fila.sexo)

novo_fila.Mnomecompleto()
atribuir(novo_fila)
empregar_Dw_Cl(novo_fila,celulas[22])

novo_fila.id = 4
novo_fila.sexo = "M"
novo_fila.nome = novo_fila.Mnome(novo_fila.sexo)
novo_fila.sobrenome = novo_fila.Msobrenome(novo_fila.sexo)

novo_fila.Mnomecompleto()
atribuir(novo_fila)
empregar_Dw_Cl(novo_fila,celulas[23])

novo_fila.id = 5
novo_fila.sexo = "F"
novo_fila.nome = novo_fila.Mnome(novo_fila.sexo)
novo_fila.sobrenome = novo_fila.Msobrenome(novo_fila.sexo)

novo_fila.Mnomecompleto()
atribuir(novo_fila)
empregar_Dw_Cl(novo_fila,celulas[24])

novo_fila.id = 6
novo_fila.sexo = "F"
novo_fila.nome = novo_fila.Mnome(novo_fila.sexo)
novo_fila.sobrenome = novo_fila.Msobrenome(novo_fila.sexo)

novo_fila.Mnomecompleto()
atribuir(novo_fila)
empregar_Dw_Cl(novo_fila,celulas[25])

lista = []

self.forca = None #pra agua
self.agilidade = None #pra comida
self.resistencia = None #eletricidade
self.carisma = None #radio e quarto
self.inteligencia = None #pro laboratorio #SIGLA: CIFRA
dono = morador()

dono.id = 1
dono.sexo = "M"
dono.nome = "erick"
dono.sobrenome = "brito"
dono.Mnomecompleto()
dono.xp = 500
dono.nivel = 6

dono.carisma = 7
dono.inteligencia = 6
dono.forca = 4
dono.resistencia = 3
dono.agilidade = 5

def nome(numAleatorio, sexo):
seed()

nomeM = ["erick","emanuel","jorge","joao","vitor","marcos","daniel","luan","edson","leandro","alexandre","carlos","samuel","assis" #14
"franklin","henrique","gabriel","juliano","diogo","josafa","junior"]
lista.append(dono) #agora a lista de moradores no main tem 1 pessoa, atualizar isso la
65 changes: 46 additions & 19 deletions funcoes.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ def animacao(jogo, lista, flipar):
jogo.janela.blit(jogo.fundo, (0,0))
jogo.janela.blit(jogo.iconesistema, (0,0))

teste = pygame.image.load(path.join('personagens', 'teste.png'))

if jogo.modo == "construir":
contorno1 = pygame.image.load(path.join('sistema', 'constrorno1.png'))
contorno2 = pygame.image.load(path.join('sistema', 'constrorno2.png'))
Expand All @@ -28,26 +30,17 @@ def animacao(jogo, lista, flipar):
if lista[contagem].obj != None:
jogo.janela.blit(lista[contagem].obj,lista[contagem].coordenadas)


if lista[contagem].morador != None:
jogo.janela.blit(teste, lista[contagem].coordenadas)



if jogo.modo == "construir":
if jogo.construirtipo == "elevador":
if lista[contagem].pretendente == "total" or lista[contagem].pretendente == "vertical":
jogo.janela.blit(contorno1,lista[contagem].coordenadas)

#------- n sei

# elif jogo.construirtipo == "treinamento":
# b = (contagem) % 21

# if lista[contagem].pretendente == "total":
# ctg = contagem
# if lista[ctg-1].vazio and not lista[ctg-1].pedra and lista[ctg-2].vazio and not lista[ctg-2].pedra and b > 1:
# jogo.janela.blit(contorno3,lista[contagem-2].coordenadas)

# elif lista[ctg+1].vazio and not lista[ctg+1].pedra and lista[ctg+2].vazio and not lista[ctg+2].pedra and b < 19:
# jogo.janela.blit(contorno3,lista[contagem].coordenadas)
# #-------- n sei


else:
b = (contagem) % 21
if lista[contagem].pretendente == "total":
Expand All @@ -64,13 +57,10 @@ def animacao(jogo, lista, flipar):
#jogo.sobresalas.testduplas.append(ctg+1)

contagem += 1
hud(jogo)
HUD(jogo)
if flipar == True: pygame.display.flip()


def hud(jogo):
pass

def minerar(jogo, celula):

confirmacao = pygame.image.load(path.join('sistema', 'removerpedra.png'))
Expand Down Expand Up @@ -194,6 +184,7 @@ def erguer(lista, pos_vetor, jogo, fundir):
if jogo.construirtipo == "quarto":
jogo.dinheiro -= jogo.sobresalas.preco[0][1]
x = 1
jogo.lotacao += 2
elif jogo.construirtipo == "cozinha":
jogo.dinheiro -= jogo.sobresalas.preco[0][2]
x = 2
Expand Down Expand Up @@ -408,3 +399,39 @@ def fusao(jogo, lista, pos_vetor, fundir):
lista[pos_vetor+5].obj = None


def empregar_Dw_Cl(dweller,celula):
dweller.celula = celula
celula.morador = dweller



def HUD(jogo):

icones = pygame.image.load(path.join('sistema', 'HUD.png'))
jogo.janela.blit(icones,(0,651))

#fundo = pygame.Surface(1071,701)

#ja que o limite e 1000, o minimo pode diminuir inves
energia_4pontas = ELESTE, ESUL, ELARGURA, EALTURA = 180 , 669, (jogo.energia // 10), 13
agua_4pontas = ALESTE, ASUL, ALARGURA, AALTURA = 360 , 669, (jogo.agua // 10), 13
comida_4pontas = CLESTE, CSUL, CLARGURA, CALTURA = 540 , 669, (jogo.comida // 10), 13

if jogo.agua >= (jogo.moradores * jogo.sobresalas.minimo): cor = 0, 255, 0
else: cor = 255, 0, 0
pygame.draw.rect(jogo.janela,cor,agua_4pontas)


if jogo.comida >= (jogo.moradores * jogo.sobresalas.minimo): cor = 0, 255, 0
else: cor = 255, 0, 0
pygame.draw.rect(jogo.janela,cor,comida_4pontas)

if jogo.energia >= jogo.sobresalas.consumo: cor = 0, 255, 0
else: cor = 255, 0, 0
pygame.draw.rect(jogo.janela,cor,energia_4pontas)

branco = 255, 255, 255
texto(jogo.dinheiro,branco,720,665)
frase = str(jogo.moradores) + "/" + str(jogo.lotacao)
texto(frase,branco,885,665)

Loading