well you can constantly check for the character pos on X-axis, and create two states for the camera, one for the action that follows the character, and one for stop, on those 2 states, constantly check the character x position, if it reach a certain pos then go to another state (which is stop), but when the character x position are less or more than that certain pos (depends on the left side of the edge or the right side), go back to the following state...