UnrealScript Game Programming Cookbook

(Chris Devlin) #1
Chapter 3

79

ReplicateMove(DeltaTime, NewAccel, DoubleClickMove,
OldRotation - Rotation);
}
else
{
ProcessMove(DeltaTime, NewAccel, DoubleClickMove,
OldRotation - Rotation);
}
bPressedJump=bSaveJump;
}
}
}


  1. All that's left now is our default property, where we set the camera we'll be using,
    in this case, our side-scrolling camera:
    defaultproperties
    {
    CameraClass = Class'SideScrollingCam'
    }


With our player controller configured, we can now move on to the actual camera itself.


  1. Make a new class called SideScrollingCamand, and have it extend from Camera:


class SideScrollingCam extends Camera;


  1. The rest of our code will be nearly identical to that found in our other camera classes.
    I did change the socket that the camera is based off of, however. Previously, we were
    using the WeaponSocket socket, which is where the pawn grips the weapon. This
    time I prefer to use the pawn's HeadShotGoreSocket, as I feel it gives me a better
    perspective of the world.
    /* socket not found, use the other way of updating vectors /
    if (Pawn.Mesh.GetSocketWorldLocationAndRotation
    ('HeadShotGoreSocket', OutVT.POV.Location,
    OutVT.POV.Rotation) == false)

  2. We don't want to see our pawn's first person weapon again, now that we're using
    a perspective outside of the pawn's eyes, so let's hide that as well. Place this code
    just above where you placed the code for step 7:
    /* Hide the pawn's third person weapaon /
    if(Pawn.Weapon != none)
    {
    Pawn.Weapon.SetHidden(true);
    }

Free download pdf