def center_camera_to_player(self):
    'Ensure the camera is centered on the player.'
    screen_center_x = (self.player_sprite.center_x - (self.camera.viewport_width / 2))
    screen_center_y = (self.player_sprite.center_y - (self.camera.viewport_height / 2))
    if (screen_center_x < 0):
        screen_center_x = 0
    if (screen_center_y < 0):
        screen_center_y = 0
    player_centered = (screen_center_x, screen_center_y)
    self.camera.move_to(player_centered)
Ensure the camera is centered on the player.
def center_camera_to_player(self):
    
    screen_center_x = (self.player_sprite.center_x - (self.camera.viewport_width / 2))
    screen_center_y = (self.player_sprite.center_y - (self.camera.viewport_height / 2))
    if (screen_center_x < 0):
        screen_center_x = 0
    if (screen_center_y < 0):
        screen_center_y = 0
    player_centered = (screen_center_x, screen_center_y)
    self.camera.move_to(player_centered)