UnrealScript Game Programming Cookbook

(Chris Devlin) #1

Scripting a Camera System


78

if( Pawn == None )
{
GotoState('Dead');
}
else
{
GetAxes(Pawn.Rotation,X,Y,Z);

/** The only change for the side scrolling camera to
this function. Update acceleration - pawn can only
move forward and back now */
NewAccel.Y=-1*PlayerInput.aStrafe*DeltaTime*
100*PlayerInput.MoveForwardSpeed;

/** Set to 0 to not allow movement on the X or Z axes
*/
NewAccel.X=0;
NewAccel.Z=0;

if(IsLocalPlayerController())
{
AdjustPlayerWalkingMoveAccel(NewAccel);
}

DoubleClickMove=PlayerInput.CheckForDoubleClickMove
( DeltaTime/WorldInfo.TimeDilation );

/** Update rotation. */
OldRotation = Rotation;
UpdateRotation( DeltaTime );
bDoubleJump=false;

if( bPressedJump&&Pawn.CannotJumpNow())
{
bSaveJump=true;
bPressedJump=false;
}
else
{
bSaveJump=false;
}

if( Role < ROLE_Authority ) // then save this move and
replicate it
{
Free download pdf