I am creating a simple ambient/explorer platformer. Because I want the player to only be able to see a new area once they have reached it, I decided to split up the world in rooms.
To not make things like pushing boxes from room to room overly complicated, this camera behavior is implemented by simply adding or subtracting the screen width/height to/from the camera when the player is out of the screen bounds.
Or, in pseudocode:
if(player.x < camera.x)
camera.x -= screen.width;
if(player.x > camera.y + screen.width)
camera.x += screen.width;
if(player.y < camera.y)
camera.y -= screen.height;
if(player.y > camera.y + screen.height)
camera.y += screen.height;
However, I also want to implement a slight parallax effect. For this I obviously need to move the camera around a little. So I need rooms that are slightly bigger than the screen size, and to make the camera follow the player until the player is at one of the sides of the room.
How do I create a smooth camera movement for this?