-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
38 lines (30 loc) · 1.08 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
import pygame
import os
from states.title import Title
from states.game_state_manager import GameStateManager
class Game():
def __init__(self):
pygame.init()
self.SCREEN_WIDTH = 1000
self.SCREEN_HEIGHT = 600
self.screen = pygame.display.set_mode((self.SCREEN_WIDTH, self.SCREEN_HEIGHT))
self.game_state_manager = GameStateManager('title')
self.title = Title(self.screen, self.game_state_manager)
self.states = {
'title': self.title,
}
def run(self):
pygame.display.set_caption("Wumpus World")
icon = pygame.image.load(os.path.join('assets', 'board', 'img', 'GameIcon1.png'))
pygame.display.set_icon(icon)
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
quit()
self.states[self.game_state_manager.get_state()].run()
pygame.display.flip()
self.clock.tick(self.FPS)
if __name__ == "__main__":
g = Game()
g.run()