main.py
def paddle_collisions(self):
        """
        This function updates the ball's speed in the x,y directions
        based on collisions with the paddle
        """
        # change the ball's y direction if it collides with the paddle
        if arcade.check_for_collision(self.ball_sprite, self.paddle_sprite) and self.ball_sprite.center_y > self.paddle_sprite.top:
            self.ball_sprite.change_y *= -1
            self.ball_sprite.bottom = self.paddle_sprite.top

            # update magnitude of ball's speed in x direction based on paddle's x speed at contact, capping at BALL_MAX_X
            # this allows the player to impact the ball's trajectory based on how they move the paddle.
            self.ball_sprite.change_x += self.paddle_sprite.change_x
            if self.ball_sprite.change_x > BALL_MAX_X:
                self.ball_sprite.change_x = BALL_MAX_X
            elif self.ball_sprite.change_x < -BALL_MAX_X:
                self.ball_sprite.change_x = -BALL_MAX_X
        
            # lose points for each paddle contact
            if not self.game_over:
                self.score -= PADDLE_SCORE_PENALTY
        
        # reset paddle x-speed to 0
        self.paddle_sprite.change_x = 0

        This function updates the ball's speed in the x,y directions
        based on collisions with the paddle
        
This function updates the ball's speed in the x,y directions
based on collisions with the paddle
This function updates the ball ' s speed in the x y directions based on collisions with the paddle
def paddle_collisions(self):
        if arcade.check_for_collision(self.ball_sprite, self.paddle_sprite) and self.ball_sprite.center_y > self.paddle_sprite.top:
            self.ball_sprite.change_y *= -1
            self.ball_sprite.bottom = self.paddle_sprite.top
            self.ball_sprite.change_x += self.paddle_sprite.change_x
            if self.ball_sprite.change_x > BALL_MAX_X:
                self.ball_sprite.change_x = BALL_MAX_X
            elif self.ball_sprite.change_x < -BALL_MAX_X:
                self.ball_sprite.change_x = -BALL_MAX_X
            if not self.game_over:
                self.score -= PADDLE_SCORE_PENALTY
        self.paddle_sprite.change_x = 0
def paddle_collisions ( self ) : if arcade . check_for_collision ( self . ball_sprite , self . paddle_sprite ) and self . ball_sprite . center_y > self . paddle_sprite . top : self . ball_sprite . change_y *= - 1 self . ball_sprite . bottom = self . paddle_sprite . top self . ball_sprite . change_x += self . paddle_sprite . change_x if self . ball_sprite . change_x > BALL_MAX_X : self . ball_sprite . change_x = BALL_MAX_X elif self . ball_sprite . change_x < - BALL_MAX_X : self . ball_sprite . change_x = - BALL_MAX_X if not self . game_over : self . score -= PADDLE_SCORE_PENALTY self . paddle_sprite . change_x = 0
This function updates the ball's speed in the x,y directions
based on collisions with the paddle
This function updates the ball ' s speed in the x y directions based on collisions with the paddle
"""
        This function updates the ball's speed in the x,y directions
        based on collisions with the paddle
        """ # change the ball's y direction if it collides with the paddle # update magnitude of ball's speed in x direction based on paddle's x speed at contact, capping at BALL_MAX_X # this allows the player to impact the ball's trajectory based on how they move the paddle. # lose points for each paddle contact # reset paddle x-speed to 0
self