import pygame

SIZE = SCREEN_WIDTH, SCREEN_HEIGHT = 800, 600

WHITE = 255, 255, 255
BLACK = 0, 0, 0
BLUE = 0, 0, 255
RED = 255, 0, 0
GRASS_GREEN = 110, 220, 110

BALL_RADIUS = 8
PLAYER_RADIUS = 15
HAND_RADIUS = 5
HAND_DISTANCE = 25

FRICTION = 0.95
BALL_FRICTION = 0.99
THROW_FRICTION = 0.94
GOAL_BOUNCE_FRICTION = 0.6
THRESHOLD = 0.01

PLAYER_XY_ACCEL = .5
PLAYER_RAD_ACCEL = 0.03

GOAL_ZONE_RADIUS = 150
BORDER_WIDTH = 5
GOAL_WIDTH = 100
GOAL_THICKNESS = 10
CENTER_ZONE_RADIUS = 25

GOAL_LOW_Y = (SCREEN_HEIGHT - GOAL_WIDTH) // 2
GOAL_HIGH_Y = (SCREEN_HEIGHT + GOAL_WIDTH) // 2

GOAL1_COORDS = [(0, GOAL_LOW_Y), (GOAL_THICKNESS, GOAL_LOW_Y), (GOAL_THICKNESS, GOAL_HIGH_Y), (0, GOAL_HIGH_Y)]
GOAL2_COORDS = [(SCREEN_WIDTH, GOAL_LOW_Y), (SCREEN_WIDTH - GOAL_THICKNESS, GOAL_LOW_Y),
                (SCREEN_WIDTH - GOAL_THICKNESS, GOAL_HIGH_Y), (SCREEN_WIDTH, GOAL_HIGH_Y)]

PLAYER1_CONTROLS = pygame.K_w, pygame.K_a, pygame.K_s, pygame.K_d, pygame.K_x, pygame.K_v, pygame.K_c
PLAYER2_CONTROLS = pygame.K_UP, pygame.K_LEFT, pygame.K_DOWN, pygame.K_RIGHT, pygame.K_m, pygame.K_PERIOD, pygame.K_COMMA

def get_friction(value, friction=FRICTION, threshold=THRESHOLD):
    value *= friction
    return value