- Home /
BCE0043: Unexpected token: }.
private var canWallJump : boolean=false;
private var canWallJumpTime : float=0;
private var canWallJumpDir : Vector3 = Vector3.zero;
private var lastDirection : Vector3;
function OnCollisionEnter(hit : Collision) {
if(controller.isGrounded == false){
for (var contact : ContactPoint in collision.contacts) {
if(hit.collider.gameObject.tag == "Wall"){
canWallJump = true;
canWallJumpTime = Time.time;
canWallJumpDir = Vector3.Scale(Vector3(-1,0,-1), lastDirection);
}
}
}
}
function Update()
{
if(Time.time - canWallJumpTime > 0.25) canWallJump = false;
if(Input.GetButtonDown ("Jump") ("canWallJump"))
}
// calculate movement and apply it to the controller
if(Vector2(movement.x, movement.z).magnitude > 0.001) lastDirection = movement;
}
I want to create a Parkour game with Wall jumps and I tried this script But if I save the script there comes this error: BCE0043: Unexpected token: }. Can you help me?
Answer by HarshadK · Aug 18, 2014 at 02:13 PM
Your Update loop should be:
function Update()
{
if(Time.time - canWallJumpTime > 0.25) canWallJump = false;
if(Input.GetButtonDown ("Jump") ("canWallJump"))
// calculate movement and apply it to the controller
if(Vector2(movement.x, movement.z).magnitude > 0.001) lastDirection = movement;
}
There was a closing bracket after second if loop which closed the Update loop and the remaining lines of code were orphan.
Thanks for the fast answer :)
But there are 6 errors now:
BCE0005: $$anonymous$$ identifier:'movement'.
BCE0005: $$anonymous$$ identifier:'movement'.
BCE0005: $$anonymous$$ identifier:'movement'.
BCE0077: It is not possible to invoke an expression of type 'boolean'.
BCE0005: $$anonymous$$ identifier:'collision'.
BCE0005: $$anonymous$$ identifier:'controller'.
Hope you can help me again.
you haven't defined movement
anywhere in the posted code...
and this line
if(Input.GetButtonDown ("Jump") ("canWallJump"))
should be more like
if(Input.GetButtonDown ("Jump"))
{
canWallJump = true;
}
it's not clear what logic you want to execute if jump is pressed, but maybe you're going to tell some other function that the character can wall jump... just a guess on my part.
ALSO
you haven't defined controller
or collision
- maybe your cut & paste missed something...
FINALLY, when posting errors, please post the CO$$anonymous$$PLETE error including line numbers. you'll be amazed how useful they can be for us
to help you.