Camera for a 2d platform game

How can I have a level that shows when the player moves?
Idk how to properly eplain in English :frowning:
e.g. A level like in Mario

Multiple ways to do it. All of them require CameraX and CameraY number variables, or at least a PVector that contains them.

One way would be to manually do -CameraX and -CameraY to every single position value of every draw you are doing that’s supposed to be in game world.
Another would be to do translate(-CameraX, -CameraY) before drawing your game world so that it would move the canvas to the side, making the camera being there.

The reason for minus before the numbers is to that it doesn’t go in the opposite direction - by adding 10 to camera, it does -10 to the position of things, making them move left, so things that are too far on the right get moved into the camera view.