The question is answered, right answer was accepted
coding help! BCE0044: expecting ), found '{'.
Hello, I have being coding a script for PlayerStates to my controller has animations when it moves and i have been copying MRxTeaBag from youtubes script and i get errors that he doesn't Assets/scripts/Player.js(18,17): BCE0044: expecting ), found '{'. Assets/scripts/Player.js(30,1): BCE0044: expecting EOF, found 'else'. also what does EOF mean? I will show screenshots of my code:
idk know if they are read able but my code is:
var PlayerState : float;
var PlayerAnimSec : GameObject;
function Update ()
{
PlayerStateController();
PlayerAnims();
}
function PlayerStateController()
{
if ((Input.GetAxis("Vertical") !=0 || Input.GetAxis("Horizontal") !=0))
{
if (Input.GetButton("Sprint")
{
PlayerState = 2;
}
else
{
PlayerState = 1;
}
}
else
{
PlayerState = 0;
}
}
function PlayerAnims()
{
if (PlayerState == 0)
{
PlayerAnimSec.animation.CrossFade("Idle Animation", 0.4);
}
else if (PlayerState == 1 )
{
PlayerAnimSec.animation.CrossFade("Walking Animation", 0.4);
}
else if (PlayerState == 2 )
{
PlayerAnimSec.animation.CrossFade("Sprint Animation", 0.4);
}
}
@AeonIxion has it, below. As an aside, "EOF" is "end of file".
THAN$$anonymous$$S guys so much it really helped and worked a charm :D i hope the rest of my coding goes ok :]
Answer by AeonIxion · Nov 18, 2013 at 07:35 PM
You forgot a ' )' on line 18.
Change
if (Input.GetButton("Sprint")
to
if (Input.GetButton("Sprint"))
Answer by JoeMGomes · Nov 18, 2013 at 07:42 PM
Change, in the line 18:
if (Input.GetButton("Sprint")
to
if (Input.GetButton("Sprint"))
Im doing a soccer ball physics script and i get the same error
BCE0044: expecting (, found 'StartPass'.
Here is my code
if (inTrigger) {
if (Input.Get$$anonymous$$ey($$anonymous$$eyCode.Joystick1Button1) && !isPassing) {
function StartPass(Pass.transform.position);
}
}
var isPassing : boolean = false;
var timeSoFar : float = 0;
var timeToPass : float = 3; // how long you want the pass to take.
var startPosition : Vector3 = Vector3.zero;
var finalPosition : Vector3 = Vector3.zero;
function StartPass( finalPos : Vector3 ) {
var startPosition = Soccer.transform.position;
var finalPosition = finalPos;
var timeSoFar = 0;
var isPassing = true;
}
function Update () {
if ( isPassing ) {
var percent = timeSoFar / timeToPass;
Soccer.transform.position = Vector3.Lerp( startPosition, finalPosition, percent );
timeSoFar += Time.deltaTime;
if ( timeSoFar >= timeToPass ) {
isPassing = false;
}
}
}
Follow this Question
Related Questions
Can someone help me make a simple jump script? 6 Answers
; Expected HELP 0 Answers