pneuma-pygame/old-old/Game/main.py

47 lines
1,020 B
Python
Raw Normal View History

2023-06-14 12:15:05 +00:00
import pygame
import sys
from utils.settings import *
from utils.debug import debug
from level import Level
2023-06-14 12:15:05 +00:00
2023-06-14 12:15:05 +00:00
class Game:
def __init__(self):
2023-06-14 12:15:05 +00:00
pygame.init()
self.screen = pygame.display.set_mode((WIDTH, HEIGHT))
2023-06-14 12:15:05 +00:00
pygame.display.set_caption('Pneuma')
self.clock = pygame.time.Clock()
2023-06-14 12:15:05 +00:00
self.level = Level()
# # Sound
# main_sound = pygame.mixer.Sound('../Graphics/audio/main.ogg')
# main_sound.set_volume(0.4)
# main_sound.play(loops = -1)
2023-06-14 12:15:05 +00:00
def run(self):
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_m:
self.level.toggle_menu()
self.screen.fill(WATER_COLOR)
self.level.run()
pygame.display.update()
self.clock.tick(FPS)
2023-06-14 12:15:05 +00:00
if __name__ == '__main__':
2023-06-14 12:15:05 +00:00
game = Game()
while True:
game.run()