2023-06-14 12:15:05 +00:00
|
|
|
import pygame
|
|
|
|
import sys
|
|
|
|
|
|
|
|
from utils.settings import *
|
|
|
|
from utils.debug import debug
|
|
|
|
|
2023-07-11 00:25:44 +00:00
|
|
|
from level import Level
|
2023-06-14 12:15:05 +00:00
|
|
|
|
2023-09-27 18:03:37 +00:00
|
|
|
|
2023-06-14 12:15:05 +00:00
|
|
|
class Game:
|
|
|
|
|
|
|
|
def __init__(self):
|
2023-09-27 18:03:37 +00:00
|
|
|
|
2023-06-14 12:15:05 +00:00
|
|
|
pygame.init()
|
2023-09-27 18:03:37 +00:00
|
|
|
|
|
|
|
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-09-27 18:03:37 +00:00
|
|
|
|
2023-06-14 12:15:05 +00:00
|
|
|
self.level = Level()
|
|
|
|
|
2023-07-11 00:25:44 +00:00
|
|
|
# # 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):
|
2023-07-11 00:25:44 +00:00
|
|
|
|
2023-09-27 18:03:37 +00:00
|
|
|
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
|
|
|
|
2023-07-11 00:25:44 +00:00
|
|
|
|
2023-09-27 18:03:37 +00:00
|
|
|
if __name__ == '__main__':
|
2023-07-11 00:25:44 +00:00
|
|
|
|
2023-06-14 12:15:05 +00:00
|
|
|
game = Game()
|
2023-07-11 00:25:44 +00:00
|
|
|
while True:
|
|
|
|
game.run()
|