UnrealScript Game Programming Cookbook

(Chris Devlin) #1
Chapter 3

87


  1. The final change we need to make is in the TuorialGame class. Be sure to
    change the following code in your defaultproperties, so that your game
    uses your new controller:
    PlayerControllerClass=class'Tutorial.TutorialPlayerControll
    erTDC'

  2. Compile the project and take a look!


How it works...


We wanted to hardcode our values again. Much of what we saw was similar to the code
found in the side-scrolling camera. We also made use of another custom player controller
as well, which is only marginally different from that of the side-scroller's.


Just as we did with the third person camera, we hid the first person weapon mesh and
continued to expose the third person weapon and pawn meshes to the camera.


We also had to override the GetBaseAimRotation function in our pawn class and
GetAdjustedAimFor function in our player controller. These changes tell the game
to use the direction the pawn is facing for firing shots, and not the camera's direction.
We've also locked our pawn so that it cannot look up or down when firing shots.


Other than the player controller though, the code is very similar to what we had in
our side-scrolling camera class, except for the hardcoded values declared in our
defaultproperties block, which are now adjusted to work for a top-down view.

Free download pdf