-
Notifications
You must be signed in to change notification settings - Fork 1
/
run.py
50 lines (43 loc) · 1.4 KB
/
run.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
39
40
41
42
43
44
45
46
47
48
49
50
"""
Main module, runs game
"""
__author__ = 'Pawel Kalecinski, Tomasz Rzepka'
import pygame
import sys
from application import SCREEN_WIDTH, SCREEN_HEIGHT, CONFIGURATION,\
NewGame, Credits, Settings, GameMenu
pygame.init()
if __name__ == "__main__":
def _creator():
"""
function allowing state change of screen to game creation
"""
screen2 = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT), 0, 32)
game = NewGame(screen2)
game.run()
def _credits():
"""
function allowing state change of screen to credits view
"""
screen3 = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT), 0, 32)
credits_screen = Credits(screen3)
credits_screen.run()
def _settings():
"""
function allowing state change of screen to settings view
"""
screen4 = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT), 0, 32)
settings = Settings(screen4)
settings.run()
def main():
"""
main function
"""
CONFIGURATION.load()
screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT), 0, 32)
funcs = (("New Game", _creator), ("About", _credits),
("Settings", _settings), ("Exit", sys.exit))
pygame.display.set_caption("PyTank")
game_menu = GameMenu(screen, funcs)
game_menu.run()
main()