forked from x4nth055/pythoncode-tutorials
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
37 lines (28 loc) · 740 Bytes
/
main.py
File metadata and controls
37 lines (28 loc) · 740 Bytes
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 pygame, sys
from settings import WIDTH, HEIGHT
from table import Table
pygame.init()
screen = pygame.display.set_mode((WIDTH, HEIGHT))
pygame.display.set_caption("Ping Pong")
class Pong:
def __init__(self, screen):
self.screen = screen
self.FPS = pygame.time.Clock()
def draw(self):
pygame.display.flip()
def main(self):
# start menu here
table = Table(self.screen) # pass to table the player_option saved to table.game_mode
while True:
self.screen.fill("black")
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
sys.exit()
table.player_move()
table.update()
self.draw()
self.FPS.tick(30)
if __name__ == "__main__":
play = Pong(screen)
play.main()