From Making Games With Python and Pygame:
myRect.left The int value of the X-coordinate of the left side of the rectangle.
myRect.right The int value of the X-coordinate of the right side of the rectangle.
myRect.top The int value of the Y-coordinate of the top side of the rectangle.
myRect.bottom The int value of the Y-coordinate of the bottom side.
Because all of these attributes return integers, that's probably why your code isn't working.
Also, if your goal with ballSnapLeft()
is to move the ball to a position away from the player, ballRect.right = playerRect.left - distance
would only change the X coordinate of the rect. To make the ball also move in the Y coordinate you could do something like
def ballSnapTop():
ballRect.top = playerRect.bottom - distance