-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.py
62 lines (50 loc) · 1.33 KB
/
main.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
import pygame
import menu
import credits
import gameplay
global screen_width
global screen_height
pygame.init()
pygame.display.set_caption("SPACE S.pyCE")
clock = pygame.time.Clock()
screen_width = 1000
screen_height = 500
screen = pygame.display.set_mode((screen_width, screen_height))
# declaração de variaveis de controle
run = True # execução do jogo
init = True # tela inicial
cred = False
game = False # gameplay
while run:
# tela inicial
if init:
decision = menu.make_screen_menu(screen, screen_width)
# tela de creditos
if cred:
credits.make_screen_credits(screen)
# gameplay
if game:
gameplay.make_screen_game(screen)
decision = "null"
game = cred = False
init = True
# checagem dos eventos acima
for event in pygame.event.get():
if event.type == pygame.QUIT:
run = False
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_BACKSPACE:
decision = "null"
game = cred = False
init = True
if decision == 'credits':
game = init = False
cred = True
elif decision == 'start':
init = cred = False
game = True
elif decision == 'exit':
pygame.quit()
pygame.display.flip()
clock.tick(30)
pygame.display.update()