modified movePlayer to not allow player to go outside the screen