Game Development Reference
In-Depth Information
Engage Thrusters
Now we are ready to create our script. We will start by creaing the new parameters that will
be used to control our character:
1. Go to New3PSController.js , and set up the new parameters. Go to the first line
of this script and type the following highlighted code:
//Character movement speed
public var runSpeed : int = 6;
public var walkSpeed : int = 2;
private var int_moveSpeed : int;
//Animation Params
public var _animation : Animation;
public var idleAnimation : AnimationClip;
public var walkAnimation : AnimationClip;
public var runAnimation : AnimationClip;
public var shotAnimation : AnimationClip;
public var walkAnimationSpeed : float = 1.5;
public var idleAnimationSpeed : float = 1.0;
public var runAnimationSpeed : float = 2.0;
public var shotAnimationSpeed : float = 0.5;
//Camera Rotation Limit
public var minRotateY : float = -15;
public var maxRotateY : float = 60;
//Mouse Look
private var mouseLook : MouseLook_JS;
//Character Motor
private var motor : CharacterMotor;
Here, we just set up the necessary parameters for controlling the animaion of our
character, as we did in the last chapter, and set the Y-axis camera limit rotaion.
2. Next, we will add some code in the Awake() funcion. Go to the funcion and add
the following highlighted code:
// Use this for initialization
public function Awake () : void {
motor = GetComponent(CharacterMotor);
//Hide cursor
Screen.showCursor = false;
//Setup the character move speed to walk speed
int_moveSpeed = walkSpeed;
//Get MouseLook component
 
Search WWH ::




Custom Search