<reponame>PAStephenson/Pong
import pygame


class Paddle():
    """Class to manage paddles."""

    def __init__(self, game, colour):
        """Creates a paddle object."""
        super().__init__()
        self.settings = game.settings
        self.screen = game.screen

        self.colour = colour

        # Creates Paddle rect.
        self.rect = pygame.Rect(0, 0, self.settings.paddle_width,
                self.settings.paddle_height)

        # Movement flag
        self.is_moving_up = False
        self.is_moving_down = False

    def update_position(self):
        """Update paddle position."""
        if self.is_moving_up and self.rect.top > 0:
            self.rect.y -= self.settings.paddle_speed
        if self.is_moving_down and self.rect.bottom < self.settings.screen_height:
            self.rect.y += self.settings.paddle_speed

    def draw_paddle(self):
        """Draw the paddle to the screen."""
        pygame.draw.rect(self.screen, self.colour, self.rect)

import pygame


class Paddle():
    """Class to manage paddles."""

    def __init__(self, game, colour):
        """Creates a paddle object."""
        super().__init__()
        self.settings = game.settings
        self.screen = game.screen

        self.colour = colour

        # Creates Paddle rect.
        self.rect = pygame.Rect(0, 0, self.settings.paddle_width,
                self.settings.paddle_height)

        # Movement flag
        self.is_moving_up = False
        self.is_moving_down = False

    def update_position(self):
        """Update paddle position."""
        if self.is_moving_up and self.rect.top > 0:
            self.rect.y -= self.settings.paddle_speed
        if self.is_moving_down and self.rect.bottom < self.settings.screen_height:
            self.rect.y += self.settings.paddle_speed

    def draw_paddle(self):
        """Draw the paddle to the screen."""
        pygame.draw.rect(self.screen, self.colour, self.rect)
Class to manage paddles. Creates a paddle object. # Creates Paddle rect. # Movement flag Update paddle position. Draw the paddle to the screen.