예제 #1
0
        pygame.draw.circle (window, Colour.BLUE, b.rect.center, b.rect.width / 2)
        
    scores_surfaces = [players [0].getScoreSurface (), players [1].getScoreSurface ()]
    scores_rects = [scores_surfaces [0].get_rect (), scores_surfaces [1].get_rect ()]
    scores_rects [0].topright = (WINDOWSIZE [0] / 2 - 50, Wall.SIZE)
    scores_rects [1].topleft = scores_rects [1].topleft = (WINDOWSIZE [0] / 2 + 50, Wall.SIZE)
    for i in range (2):
        window.blit (scores_surfaces [i], scores_rects [i])
    pygame.display.update ()




# Create game objects
clock = pygame.time.Clock ()
walls = Wall.createList ()
players = [Player (25, Player.SIZE, 2, 270), Player (775, Player.SIZE, 2, 90)]
balls = [Ball (Ball.SIZE, Ball.SPEED, [])]

if Sound.isOn:
    pygame.mixer.music.set_volume (0.6)
    pygame.mixer.music.play ()

keepGoing = True
while keepGoing:
    for event in pygame.event.get ():
        if event.type == QUIT:
            keepGoing = False

        # Set  players' directions
        elif event.type == KEYDOWN: