-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathprincipal.py
81 lines (64 loc) · 2 KB
/
principal.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
# coding: utf-8
import pygame
import sys
from data import *
import cPickle
pygame.init()
pygame.font.init()
pygame.display.set_caption('Magic Land')
# Screen e clock
screen = pygame.display.set_mode((Screen.width, Screen.height))
clock = pygame.time.Clock()
# Fase e movimento
fase = '1'
fase = cPickle.load(file('resources/fases/cPickle' + fase + '.dat'))
draw = Draw(screen, fase)
# Desenvolvedor
desenvolvedor = Desenvolvedor(screen, clock, fase)
# Interacao com NPC e portas
interacao = Interacao(screen, clock, fase)
# GUI quests
gui_quest = guiQuest(screen, clock, fase)
move = 0
while True:
draw.move()
# desenvolvedor
# desenvolvedor.visualizaColisao()
desenvolvedor.dados()
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
sys.exit()
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_w:
move = 1
fase.player.direcao = 1
if event.key == pygame.K_s:
move = 2
fase.player.direcao = 2
if event.key == pygame.K_a:
move = 3
fase.player.direcao = 3
if event.key == pygame.K_d:
move = 4
fase.player.direcao = 4
if event.key == pygame.K_q:
gui_quest.main()
move = 0
if event.key == pygame.K_SPACE:
if interacao.verificaColisao():
move = 0
if event.key == pygame.K_F10:
pygame.display.toggle_fullscreen()
if event.type == pygame.KEYUP:
if event.key == pygame.K_w and move == 1:
move = 0
if event.key == pygame.K_s and move == 2:
move = 0
if event.key == pygame.K_a and move == 3:
move = 0
if event.key == pygame.K_d and move == 4:
move = 0
draw.movimentaPersonagem(move)
pygame.display.update()
clock.tick(30)