mirror of
https://github.com/EDeev/pixel_gamble.git
synced 2026-06-15 11:01:03 +03:00
39 lines
1 KiB
Python
39 lines
1 KiB
Python
import sys
|
|
|
|
from data import *
|
|
from level import Level
|
|
|
|
|
|
class Game:
|
|
def __init__(self):
|
|
pygame.init()
|
|
self.screen = pygame.display.set_mode((WIDTH, HEIGTH))
|
|
pygame.display.set_caption('Pixel Gamble')
|
|
self.clock = pygame.time.Clock()
|
|
|
|
self.level = Level()
|
|
|
|
main_sound = pygame.mixer.Sound('../data/audio/main.wav')
|
|
main_sound.set_volume(0.5)
|
|
main_sound.play(loops=-1)
|
|
|
|
def run(self):
|
|
while True:
|
|
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_ESCAPE:
|
|
pygame.quit()
|
|
sys.exit()
|
|
|
|
self.screen.fill('black')
|
|
self.level.run()
|
|
pygame.display.update()
|
|
self.clock.tick(FPS)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
game = Game()
|
|
game.run()
|