- Home /
BCE0044: expecting ':' found ';'
I'm a student trying to make a 2 player pong game for my final. I have a two scripts for movement and they are both getting the same error at the same place. I don't know how to resolve the error because of my limited knowledge of javascript. Can someone please help?
Below is one of my scripts. The error is after the last parenthesis. It says it expects ':' but i don't know why and when i put one there i just get more errors.
var PlayerSpeed : float;
function Update () { if (Input.GetButtonDown ("Keycode.W")) or (Input.GetButtonDown ("Keycode.S"));{ transform.Translate(Input.GetAxisRaw("Horizontal") Time.deltaTime PlayerSpeed, 0, Input.GetAxisRaw("Vertical") Time.deltaTime PlayerSpeed); } }
Answer by Maarten · Dec 03, 2010 at 09:33 PM
You should learn the basics of coding, i've changed your code: (Didnt test). Use || instead or OR in an if statement. Also, make sure you end your if statement with an ).
var PlayerSpeed : float;
function Update () { if (Input.GetButtonDown ("Keycode.W") || Input.GetButtonDown ("Keycode.S")) { transform.Translate(Input.GetAxisRaw("Horizontal") Time.deltaTime PlayerSpeed, 0, Input.GetAxisRaw("Vertical") Time.deltaTime PlayerSpeed); } }
Thanks for fixing the code highlighting. Could you tell me how you did that?
Thanks you very much skovacs! I have gotten it to run without errors. Now I just have some other aesthetic changes to make!
After a IF statement, don't use ";" if(...){} You did this: if(...);{}
Your answer
Follow this Question
Related Questions
I need help with an error 1 Answer
script not working 2 Answers
Script error. Please Help! 4 Answers
ShopScript.Js(49,17): BCE0044 expecting :, found GUI. 1 Answer