コード例 #1
0
        # drawing the paddle and the puck
        paddle1.draw(screen, player1_color)
        paddle2.draw(screen, player2_color)
        puck.draw(screen)

        # refresh screen.
        pygame.display.flip()
        clock.tick(const.FPS)


if __name__ == "__main__":
    global mute
    mute = False  # to keep state of mute
    init()
    while True:
        gameChoice, player1_color, player2_color, mute, player_1_name, player_2_name = air_hockey_start(
            screen, clock, width, height, mute)
        background_color = theme_screen(screen, clock, width, height, mute)
        init()
        if gameChoice == 1:
            puck.speed = const.EASY
            game_loop(const.EASY, player1_color, player2_color,
                      background_color, player_1_name, player_2_name)
        elif gameChoice == 2:
            puck.speed = const.HARD
            game_loop(const.HARD, player1_color, player2_color,
                      background_color, player_1_name, player_2_name)
        elif gameChoice == 0:
            sys.exit()