Assets/script/movement.js(43,24): BCE0044: expecting :, found '='.

like it said in the title i have a problem in my 2d script made by Kalithumos in youtube. i get Assets/script/movement.js(42,24): BCE0044: expecting :, found ‘=’ why do i have this in the line 36 i don’t have the problem. Please help me!!!

#pragma strict
var leftButton : String;
var rightButton : String;

var forward : Vector3;
var dt : double;

var leftRotation : float;
var rightRotation : float;

var suspended : float;
var moveSpeed : double;

function Start () {
leftButton = "q";
rightButton = "d" ;


forward = new Vector3(0,0,1);
dt = Time.deltaTime;

leftRotation = -0.7071069;
rightRotation = 0.7071069;

suspended = false;
moveSpeed = 3.0;
}

function Update () 
{
  if (suspended)
  {
   return;
  }
  if ( Input.GetButton(leftButton))
  {
  transform.rotation.y = leftRotation;
  transform.Translate (forward * moveSpeed * dt);
  animation.Play("Walk_002");
  }
  else if (Input.GetButtonDown);
  {
  transform.rotation.y = rightRotation;
  transform.Translate (forward * moveSpeed * dt);
  animation.Play ("Walk_002");
  }
}
 function SetSuspension(setting : boolean)
 {
      suspended = setting;
      }

Just like @Graham Dunnett said The semi-colon at the end of line 40 is your problem

@Graham Dunnett, why did you even post such an obviously correct answer as a comment? O.o Convert it and have the lad mark it correct, so those of us with OCD can see this question out of the "unanswered" section.

@Em3rgency - don't remember really. I do remember thinking the question was probably worth just closing, since I write and explain to people a million times to use the line number and read carefully what the compiler is telling them.

1 Answer

1

Remove the semi-colon at the end of line 40.

maybe but now i have 2 problem (25,13): BCE0022: Cannot convert 'boolean' to 'float'. 50,19): BCE0022: Cannot convert 'boolean' to 'float'. im sorry for asking these kind of question but please understand im a kid who is trying to learn the scripts.

You have "suspended" defined as a float on line 10, but you're using it as a boolean variable later. Check out [this site][1] for some basic Unity tutorials, I think they'll help you out. [1]: http://www.unity3dstudent.com/