So the player will always be in importantEntities and so what I'm imagining is that if the player gets close to the left or right side of the screen, the camera/viewport will move. It will only move as far as the levelBounds though. If multiple importantEntities are passed in, then the camera should try to keep both in view as best as possible.
This may include zooming out and stuff. There should also probably be some sort of smoothing factor so if an entity is added, the camera doesn't just SNAP to include both entities.
Maybe this doesn't need to be an object. Probably just a function. What I'm imagining is something that looks like:
newViewport = adjustViewport(prevViewport, levelBounds, importantEntities);
So the player will always be in importantEntities and so what I'm imagining is that if the player gets close to the left or right side of the screen, the camera/viewport will move. It will only move as far as the levelBounds though. If multiple importantEntities are passed in, then the camera should try to keep both in view as best as possible.
This may include zooming out and stuff. There should also probably be some sort of smoothing factor so if an entity is added, the camera doesn't just SNAP to include both entities.