-
Notifications
You must be signed in to change notification settings - Fork 2
/
rpg.py
71 lines (51 loc) · 1.69 KB
/
rpg.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
# -*- coding: utf-8 -*-
from config import *
from Classes import *
from colors import *
import sys
from pygame.sprite import Sprite, RenderUpdates
FPS = 16
# mover personagem para baixo
#=======================
def main():
fundo, tela, clock = config()
musica = pygame.mixer.Sound("BGM/Firelink Shrine.wav")
grupo = RenderUpdates()
personagem = Hero(20, 290, "dante", grupo)
pygame.font.init()
frase = Text(40, 'Quem eh voce e oque faz aqui?', 'carolingia.ttf')
lx = [b for b in range(-4, 76)]
l1 = [-10]
l2 = [6]
parede = [x for x in range(-10, 16)]
iniciarConversa = [43, 0]
teclas = {K_LEFT: False, K_RIGHT: False, K_UP: False, K_DOWN: False,
K_RETURN: False, 27: False} # obs 27 = tecla 'esc'
musica.play()
fundo = fundo.convert()
pygame.display.flip()
while True:
clock.tick(FPS)
for e in pygame.event.get([KEYUP, KEYDOWN]):
valor = (e.type == KEYDOWN)
if e.key in teclas.keys():
teclas[e.key] = valor
if teclas[27]: # tecla ESC
pygame.quit()
sys.exit()
if teclas[K_LEFT]:
personagem.move("LEFT")
if teclas[K_RIGHT]:
personagem.move("RIGHT")
if teclas[K_UP]:
personagem.move("UP")
if teclas[K_DOWN]:
personagem.move("DOWN")
if personagem.px == iniciarConversa[0] and personagem.py == iniciarConversa[1]:
tela.blit(frase.frases, (200, 500))
pygame.display.flip()
#print(personagem.px, personagem.py)
grupo.clear(tela, fundo)
pygame.display.update(grupo.draw(tela))
if __name__ == '__main__':
main()