Game Development Reference
Creating a side-scrolling camera
Side-scrolling games have been a hit for decades, and some of gaming's largest franchises
have taken advantage of it. While we don't often see games using UDK take advantage of
the side-scrolling perspective, one high profile title published by Epic, Shadow Complex
certainly did, although with a bit more of a pulled back, Metroidvania style about it. For
those not familiar with the term Metroidvania, it is a 2D side-scroller style of game with
an emphasis on a non-linear, exploratory action-adventure structure; it inherits its name
from the Metroid and Castlevaniaseries.
We'll be hardcoding our values again. Much of what you'll see next is similar to the code
found in the third person camera code.
We'll also have to make a few changes to the PlayerController class for a number of
reasons. Specifically, we want our pawn to only be able to move forward and back, thereby
removing the ability to strafe left and right. Moreover, our system requires that the right side
of the screen is always considered forward.
For this purpose, we will want to create a new player controller class, called
Just as we did with the third person camera, we'll want the first person weapon mesh
to remain hidden, and continue to expose the third person weapon and pawn meshes
to the camera.
We're going to make a whole new player controller class for this tutorial, as we need
to add a new function to it. Create a new class called TutorialPlayerControllerSSC
(side-scrolling camera) and have it extend from the PlayerController class:
class TutorialPlayerControllerSSC extends PlayerController;
How to do it...
With our new TutoriaPlayerControlerSSC class made, we can begin filling it with the
functions we need:
For now, add this code, which you should already be familiar with by now, as it
appears in our TutorialPlayerController.uc class:
/** Lets us know that the class is being called, for
debugging purposes */
simulated event PostBeginPlay()