- Home /
Question by
mikeJardim-PT · Oct 24, 2012 at 07:49 PM ·
errorbce0044bce0043
Please help, syntax error woe
Please help>...
Assets/2D Mario Assets/Scripts/playerControls.js(46,1): BCE0044: expecting }, found ''.
Assets/2D Mario Assets/Scripts/playerControls.js(33,9): BCE0043: Unexpected token: }.
My code is:
var speed : float = 6.0;
var jumpSpeed : float = 8.0;
var gravity : float = 20.0;
var TransformDirection;
private var moveDirection : Vector3 = Vector3.zero;
function Update ()
{
var controller : CharacterController = GetComponent( CharacterController );
if ( controller.isGrounded )
{
moveDirection = Vector3 ( Input.GetAxis ( "Horizontal" ), 0, 0 );
moveDirection = transform.TransformDirection(moveDirection);
moveDirection *= speed;
if ( Input.GetButton ( "Jump" ) )
{
moveDirection.y = jumpSpeed + 1;
}
if ( Input.GetButtonDown ( "jump" ) + Input.GetButtonDown ( "Fire1" ))
}
else
{
moveDirection.x = Input.GetAxis ( "Horizontal" );
moveDirection.x *= speed;
}
moveDirection.y -= gravity * Time.deltaTime;
controller.Move ( moveDirection * Time.deltaTime );
}
Comment
Your error refers to line 46 and there are only 35 lines in what you showed us.
So either its the wrong file or its not the entire file. Please correct if you want help.
Answer by Landern · Jun 23, 2014 at 02:57 PM
this line:
if ( Input.GetButtonDown ( "jump" ) + Input.GetButtonDown ( "Fire1" ))
is incomplete you can do:
if ( Input.GetButtonDown ( "jump" ) + Input.GetButtonDown ( "Fire1" )) {}
or just delete.
Answer by meat5000 · Jun 23, 2014 at 02:57 PM
Your if statement with no braces
if ( Input.GetButtonDown ( "jump" ) + Input.GetButtonDown ( "Fire1" ))
Its not really doing anything. Put {} after it.
Also, I dont understand why you declare
var TransformDirection;
Leave it out, its a function of Transform so already has a definition.