-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.py
More file actions
43 lines (39 loc) · 1.19 KB
/
main.py
File metadata and controls
43 lines (39 loc) · 1.19 KB
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
import pygame
from menu import Menu
from levels.fase01 import Fase1
from levels.fase02 import Fase2
from levels.fase03 import Fase3
from fim import Fim
from models.cutscene import Cutscene
from settings import LARGURA, ALTURA
import gerenciador_estados
# Inicializa a tela
pygame.init()
tela = pygame.display.set_mode((LARGURA, ALTURA))
pygame.display.set_caption("Wormhole")
pygame.display.set_icon(pygame.image.load("assets/portal_icon.png"))
clock = pygame.time.Clock()
# Carrega a trilha sonora
pygame.mixer.init()
pygame.mixer.music.load("assets/sounds/menu_sound.mp3")
pygame.mixer.music.set_volume(0.75)
pygame.mixer.music.play(-1)
# Estados do jogo
gerenciador_estados.estados = {
"menu": Menu(LARGURA, ALTURA),
"cutscene": Cutscene(LARGURA, ALTURA),
"fase1": Fase1(LARGURA, ALTURA),
"fase2": Fase2(LARGURA, ALTURA),
"fase3": Fase3(LARGURA, ALTURA),
"fim": Fim(LARGURA, ALTURA),
}
rodando = True
while rodando:
# Executa o estado atual
resultado = gerenciador_estados.estados[gerenciador_estados.estado_atual].executar(tela)
if resultado=="sair":
rodando = False
else:
gerenciador_estados.estado_atual = resultado
clock.tick(60)
pygame.quit()