This question already has an answer here:
i am trying to create a background that scrolls like the one in zelda - a link to the past. in other words: i have a bigger "screen" than the camera covers, so i need to scroll over it, when moving. if the player reaches an edge of the screen, the camera is going to stop and the character moves out of the center.
my actual problem is, that i have to draw the objects in an other way than the background. i am getting the camera to track the player, but if i want to add another object like an enemy, i have to draw it with screen coordinates, which are not the same as the background coordinates. (background image is 1280x720 with a source rectangle of 640x360). so the player is usually drawn at 640/2, 360/2. but the player also is at position 600,600 of the background image. so, if there is an enemy at 200,200 and the player moves to that point i want to draw the enemy on the screen. but, of course, i cant draw it at 200,200 in the screen that displays the sorucerectangle of the texture.
so i am looking for a way to kinda get the object into the texture, that there is only one coordinate system or at least a second coordinate system where all the object are in., which is as big as the texture itsself. with such a coordinate system i could get the absolute positions of the objects and draw it like the sourcerectanlge of a texture.