I am making a side-Scroller game. I want the camera to not follow the player everywhere. How is that done?

Im making a side scroller. the player always seems to stay in the center of the screen. is there a way so that the camera does not follow the player all the time, but follows him when he is near the end of the screen?