What is a camera ?

What is the concept of camera in a 2d game ?

Camera in 2D games is used for limiting the view of the scene, for example in side-scrolling games.

How can I limit the view ?

Depends on the game & tools used. We need more details :smiley:

Basically the concept of the camera is a rectangular area that is centered on a certain point, or even nothing at all. Points such as a player, enemy, or whatever you want to imagine. So, a camera is basically an area that creates an offset from its location and applies it to a Graphics context. If you’re new to Java you’ll most likely have a graphics context name Graphics g, g1, g2, and so forth. If you go here https://docs.oracle.com/javase/7/docs/api/java/awt/Graphics.html, press control+f and type in “translate” you’ll find the translate method in the Graphics Class. This is essentially used to move the whole graphics context, to whatever the offset is. Essentially, you’re just moving everything that is being drawn in that graphics context to whatever the offset of your camera is.

Hope this helped ;D