Hopefully the attached helps. You want to show or hide the sprite based on if it should be on screen or not. When it is on screen its location is relative to what part of the background you have moved to.