the script I have is not working when I'm pretty sure it should be but when I try to play it, it says Assets/SCRIPTS/character script.js(20,1): BCE0044: expecting }, found 'else'.
someone please help, its very frustrating while still trying to learn coding..
#pragma strict
var rotationSpeed : float = 10;
var walkSpeed : float = 7;
var gravity : float = 50;
private var yRot : float;
function Update () {
var Controller : CharacterController = GetComponent(CharacterController);
var vertical : Vector3 = transform.TransformDirection(Vector3.forward);
var horizontal : Vector3 = transform.TransformDirection(Vector3.right);
if
(Input.GetAxis("Vertical")) (Input.GetAxis("Horizontal"));
{
animation.CrossFade("Run", 0.2);
Controller.Move((vertical * (walkSpeed * Input.GetAxis("Vertical"))) * Time.deltaTime);
Controller.Move((horizontal * (walkSpeed * Input.GetAxis("Horizontal"))) * Time.deltaTime);
}
else
{
animation.CrossFade("Idle", 0.2);
}
if
(Input.GetAxis("Mouse X")){
yRot += 10 * Input.GetAxis("Mouse X");
}
{
transform.rotation = Quaternion.Euler(0, yRot, 0);
}
the 'else' is on line 20...
↧