-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmostraCards.py
executable file
·206 lines (178 loc) · 10 KB
/
mostraCards.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
import pygame , os , sys
from pygame.locals import*
pygame.init()
def mostrandoCartas():
# Definindo o tamanho da tela e o nome que aparecerá na barra de título
tela = pygame.display.set_mode((900,700))
pygame.display.set_caption('Super Trunfo')
background = pygame.image.load('imagens/fundo.png')
texto = pygame.font.Font("dc_o.ttf", 25)
textoOP = pygame.font.Font("dc_o.ttf", 35)
# Pega o total de cartas do baralho
fontesAtributos = pygame.font.Font("dc_o.1.ttf", 35)
textoEntrar = fontesAtributos.render('Pressione F2 para escolher a opcao',True,(255,255,255))
arq = open("cartas.txt","r")
obtercartas = arq.read()
obtercartas = obtercartas.split()
arq.close()
numdecartas = int(len(obtercartas)/8)
asCartas = [[]]
for i in range(0,numdecartas):
carta = i * 8
asCartas[i] = [ obtercartas[carta] , obtercartas[carta + 1] ,obtercartas[carta + 2] ,obtercartas[carta + 3] , obtercartas[carta + 4] , obtercartas[carta + 5] , obtercartas[carta + 6] , obtercartas[carta + 7] ]
asCartas.append(asCartas[i])
asCartas.pop(numdecartas)
fontesAtributos = pygame.font.Font("dc_o.1.ttf", 35)
contador = 1
while contador < len(asCartas):
for event in pygame.event.get():
if event.type == QUIT:
exit()
if event.type==pygame.KEYDOWN:
teclado = pygame.key.get_pressed()
if teclado[K_F2]:
print("huhu")
return
if contador == 1:
tela.blit(background,(0,0))
imagemCarta = pygame.image.load('imagens/carta.png')
numeroDaOpcao = textoOP.render(str(contador),True,(255,255,255))
if os.path.exists('imagens/'+asCartas[contador][0]+'.png') == True:
imagem = pygame.image.load('imagens/'+asCartas[contador][0]+'.png')
else:
imagem = pygame.image.load("imagens/SEMFOTO.png").convert_alpha()
nome = texto.render((asCartas[contador][0].replace("_"," ")+""), True, (255,255,255))
destreza = fontesAtributos.render((asCartas[contador][1]+""), True, (255,255,255))
zampakutou = fontesAtributos.render((asCartas[contador][2]+""), True,(255,255,255))
poderEspiritual = fontesAtributos.render((asCartas[contador][3]+""), True, (255,255,255))
conhecimento = fontesAtributos.render((asCartas[contador][4]+""), True, (255,255,255))
percEspiritual = fontesAtributos.render((asCartas[contador][5]+""), True, (255,255,255))
tipo = fontesAtributos.render((asCartas[contador][6]+""), True, (255,255,255))
tela.blit(imagemCarta,(450 ,20))
pygame.draw.circle(tela,(0,0,0),(470,30),50)
tela.blit(nome,(450,60))
tela.blit(destreza,(600,135))
tela.blit(zampakutou,(600,185))
tela.blit(poderEspiritual,(600,230))
tela.blit(conhecimento,(600,275))
tela.blit(percEspiritual,(600,320))
tela.blit(tipo,(600,365))
tela.blit(imagem,(600,20))
pygame.draw.rect(tela,(0,0,0),(100,500,620,35))
tela.blit(numeroDaOpcao,(465,15))
tela.blit(textoEntrar,(100,500))
for event in pygame.event.get():
if event.type == QUIT:
exit()
if event.type==pygame.KEYDOWN:
teclado = pygame.key.get_pressed()
if teclado[K_F2]:
print("aewww")
return
pygame.display.flip()
pygame.time.wait(3000)
if contador != (len(asCartas)-1): #Contador Condição
tela.blit(background,(0,0))
imagemCarta = pygame.image.load('imagens/carta.png')
numeroDaOpcao = textoOP.render(str(contador),True,(255,255,255))
numeroDaOpcao2 = textoOP.render(str(contador+1),True,(255,255,255))
if os.path.exists('imagens/'+asCartas[contador][0]+'.png') == True:
imagem = pygame.image.load('imagens/'+asCartas[contador][0]+'.png')
else:
imagem = pygame.image.load("imagens/SEMFOTO.png").convert_alpha()
nome = texto.render((asCartas[contador][0].replace("_"," ")+""), True, (255,255,255))
destreza = fontesAtributos.render((asCartas[contador][1]+""), True, (255,255,255))
zampakutou = fontesAtributos.render((asCartas[contador][2]+""), True,(255,255,255))
poderEspiritual = fontesAtributos.render((asCartas[contador][3]+""), True, (255,255,255))
conhecimento = fontesAtributos.render((asCartas[contador][4]+""), True, (255,255,255))
percEspiritual = fontesAtributos.render((asCartas[contador][5]+""), True, (255,255,255))
tipo = fontesAtributos.render((asCartas[contador][6]+""), True, (255,255,255))
tela.blit(imagemCarta,(0 ,20))
tela.blit(imagemCarta,(450 ,20))
pygame.draw.circle(tela,(0,0,0),(30,30),50)
pygame.draw.rect(tela,(0,0,0),(100,500,620,35))
tela.blit(nome,(10,60))
tela.blit(destreza,(150,135))
tela.blit(zampakutou,(150,185))
tela.blit(poderEspiritual,(150,230))
tela.blit(conhecimento,(150,275))
tela.blit(percEspiritual,(150,320))
tela.blit(tipo,(150,365))
tela.blit(imagem,(150,20))
tela.blit(numeroDaOpcao,(25,15))
tela.blit(textoEntrar,(100,500))
if os.path.exists('imagens/'+asCartas[contador+1][0]+'.png') == True:
imagem2= pygame.image.load('imagens/'+asCartas[contador+1][0]+'.png')
else:
imagem2 = pygame.image.load("imagens/SEMFOTO.png").convert_alpha()
nome2 = texto.render((asCartas[contador+1][0].replace("_"," ")+""), True, (255,255,255))
destreza2 = fontesAtributos.render((asCartas[contador+1][1]+""), True, (255,255,255))
zampakutou2 = fontesAtributos.render((asCartas[contador+1][2]+""), True,(255,255,255))
poderEspiritual2 = fontesAtributos.render((asCartas[contador+1][3]+""), True, (255,255,255))
conhecimento2 = fontesAtributos.render((asCartas[contador+1][4]+""), True, (255,255,255))
percEspiritual2 = fontesAtributos.render((asCartas[contador+1][5]+""), True, (255,255,255))
tipo2= fontesAtributos.render((asCartas[contador+1][6]+""), True, (255,255,255))
pygame.draw.circle(tela,(0,0,0),(495,30),50)
tela.blit(nome2,(500,60))
tela.blit(destreza2,(600,135))
tela.blit(zampakutou2,(600,185))
tela.blit(poderEspiritual2,(600,230))
tela.blit(conhecimento2,(600,275))
tela.blit(percEspiritual2,(600,320))
tela.blit(tipo2,(600,365))
tela.blit(numeroDaOpcao2,(465,15))
tela.blit(imagem2,(610,20))
for event in pygame.event.get():
if event.type == QUIT:
exit()
if event.type==pygame.KEYDOWN:
teclado = pygame.key.get_pressed()
if teclado[K_F2]:
return
pygame.display.flip()
pygame.time.wait(3000)
else: #contador
tela.blit(background,(0,0))
imagemCarta = pygame.image.load('imagens/carta.png')
numeroDaOpcao = textoOP.render(str(contador),True,(255,255,255))
if os.path.exists('imagens/'+asCartas[contador][0]+'.png') == True:
imagem = pygame.image.load('imagens/'+asCartas[contador][0]+'.png')
else:
imagem = pygame.image.load("imagens/SEMFOTO.png").convert_alpha()
nome = texto.render((asCartas[contador][0].replace("_"," ")+""), True, (255,255,255))
destreza = fontesAtributos.render((asCartas[contador][1]+""), True, (255,255,255))
zampakutou = fontesAtributos.render((asCartas[contador][2]+""), True,(255,255,255))
poderEspiritual = fontesAtributos.render((asCartas[contador][3]+""), True, (255,255,255))
conhecimento = fontesAtributos.render((asCartas[contador][4]+""), True, (255,255,255))
percEspiritual = fontesAtributos.render((asCartas[contador][5]+""), True, (255,255,255))
tipo = fontesAtributos.render((asCartas[contador][6]+""), True, (255,255,255))
tela.blit(imagemCarta,(0 ,20))
tela.blit(nome,(10,60))
tela.blit(destreza,(150,135))
tela.blit(zampakutou,(150,185))
tela.blit(poderEspiritual,(150,230))
tela.blit(conhecimento,(150,275))
tela.blit(percEspiritual,(150,320))
tela.blit(tipo,(150,365))
tela.blit(imagem,(150,20))
pygame.draw.rect(tela,(0,0,0),(100,500,620,35))
tela.blit(textoEntrar,(100,500))
for event in pygame.event.get():
if event.type == QUIT:
exit()
if event.type==pygame.KEYDOWN:
teclado = pygame.key.get_pressed()
if teclado[K_F2]:
print("bum")
return
pygame.display.flip()
pygame.time.wait(3000)
for event in pygame.event.get():
if event.type == QUIT:
exit()
if event.type==pygame.KEYDOWN:
teclado = pygame.key.get_pressed()
if teclado[K_F2]:
print("xaaaa")
return
contador +=1