Game Development Reference
In-Depth Information
Writing the TutorialCamera class
With our game type in place, we now need to write the code for our TutorialCamera
and TutorialCameraProperties classes. The properties class includes the variables
we will expose to the UDK editor. Coming back around to the archetypes we spoke
about earlier, our camera will now be made into one, which is what allows its properties
( TutorialCameraProperties.uc ) to be manipulated in the editor.
Getting ready
We'll need to launch our IDE of choice here, and create the TutorialCamera class by
creating a file called TutorialCamera.uc class in our Classes folder ( C:\UDK\July\
Development\Src\Tutorial\Classes ).
How to do it...
The first thing we'll need is a Camera class to store all of our variables and functions in. We'll
use these throughout the rest of our tutorials, and they'll hold the values for manipulating how
the camera interacts with the environment. We can do this by creating one new class.
We'll begin by creating our TutorialCamera class. As UDK's camera class already
offers much of what we'll need for our own camera, we'll just extend from theirs. We'll
also need to have access to our TutorialCameraProperties class, and we do so
by declaring a variable for it.
class TutorialCamera extends Camera;
// Reference to the camera properties
var const TutorialCameraProperties CameraProperties;
2. Immediately following that, we'll include some code which will be written to our log file
when the camera is first initialized. This allows us to verify that our camera is actually
being called.
/** Lets us know that the class is being called, for debugging
purposes */
simulated event PostBeginPlay()
'Log("Tutorial Camera up");
Search Nedrilad ::

Custom Search