As of late 2021, we are in the process of updating Stencylpedia and fixing up outdated & broken content. Thanks for your patience!
by Jon (Updated on 2015-10-20)
- Example: Making the Camera Follow the Player
- Moving the Camera
- Off Screen Actors Become Inactive
In this article, we introduce the concept of the camera and describe how you can make games scroll using the camera.
Although some games exist entirely on a single screen, many extend beyond that. For example, think about a game similar to Super Mario Bros. Levels extend beyond a single screen.
In games like these, when the player walks to the right, the game “scrolls” to the right.
How does this “scrolling” work? In simple terms, scrolling is the act of changing what part of the scene is visible.
One can draw a connection to something we’re familiar with - peering through the viewfinder (or screen) of a camera to compose a photograph.
The “camera” in our engine is the exact same concept - it’s the “thing” that controls what part of the scene is visible.
Note: In fact, the “camera” is an actor! It’s an invisible, non-physical actor, but like any kind of actor, it has a position and it can be moved around.
Example: Making the Camera Follow the Player
In many games, the camera follows the player, so that the player is always on screen.