extracted function that keeps mario in middle of screen if he gets too far right