Adding vertical camera scrolling to follow the player.

While moving downward, the camera will follow the player as soon as they drop below the halfway point on the window.
Moving upward, it will lock when the player reaches 25% of window height above the midpoint, which gives a smoother experience than a simple always-on character lock.