One of the most troubling things to code is a scrolling background. Hopefully, this walk-through demo should help you grasp the main aspects creating a player-centric scrolling map with other objects on the map that can move around (or not!). Hit see inside and follow the code and comments for the sprites from left to right. And please don't pick on the silly NPC, it's not meant to be used in a game but just to demonstrate moving on the map without blatantly walking through the barriers.