-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path__main__.py
More file actions
37 lines (29 loc) · 1.28 KB
/
Copy path__main__.py
File metadata and controls
37 lines (29 loc) · 1.28 KB
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
import ball as b
import gameFunctions as gF
import os
import pygame
import settings as s
import titleScreen as tS
import scoreboard as sb
class Main:
def __init__(self):
# Provides consistent window positioning. These settings center pygame window for my computer.
os.environ['SDL_VIDEO_WINDOW_POS'] = '60, 35'
pygame.init()
# Sets up game window and local variables.
self.settings = s.Settings()
self.screen = pygame.display.set_mode((self.settings.get_screen_width(),
self.settings.get_screen_height()))
pygame.display.set_caption(self.settings.get_game_title())
title_sequence = tS.Title(self.screen, self.settings)
self.ball = b.Ball(self.screen, self.settings)
self.paddles = gF.GameFunctions.create_paddles_list(self.ball, self.screen, self.settings)
self.scoreboard = sb.ScoreBoard(self.ball, self.paddles, self.screen, self.settings, title_sequence)
def play(self):
while True:
gF.GameFunctions.update_screen(self.ball, self.paddles, self.scoreboard, self.screen, self.settings)
gF.GameFunctions.check_events(self.settings)
pygame.display.flip()
if __name__ == '__main__':
game = Main()
game.play()