Similarly to my last post, I am trying to make a 2d camera in processing. So far, I have the camera “look” where the character points towards the mouse, but I can’t find anything to help me with camera movement in 2d. Are there any guidelines I can use?
As you know other than in P3D there is no camera in 2D.
Turning the player to the mouse is not really a camera operation by the way, it’s more a rotation (and would be the same in 3D).
It depends on what exactly you want to do.
For example when you have a map the player is running on and the map is bigger than the screen, you want to place the camera over the area of the map that contains the player.
Since you don’t have a camera, it’s called viewport: you move the map to a negative value and thus the map moves left (when your player runs right). It looks like a camera would go right. In this scenario the Player is always in the middle of the screen. Except when you reach the end of the map then movement of the map stops and the player can go to the end of the map/screen.
So in order to do this, I would find some camera values depending on where the player is determining the field of view and translate the rest of the graphics to said values?