added screen-edge detection for player