varspeed : float = 5f; varjumpDelay : boolean; vardoubleJump : int = 0; functionupdate() { if(Input.GetKeyDown(KeyCode.Space) && jumpDelay == false) { Jump(); } } functionJump() { if(doubleJump <= 1) { rigidbody.velocity.y = 175; jumpTimer(); } } functionjumpTimer() { if(Input.GetKeyDown(KeyCode.Space)) { doubleJump ++; } if (doublejump > 1) { doubleJump = 0; jumpDelay = true; transform.position += new Vector3(speed * Time.deltaTime, 0.0f, 0.0f); jumpDelay = false; } } This is the jump script im using. It has compiling errors but im not sure what the issue is. Ive recently integrated transform.position += newVector3(speed * Time.deltaTime, 0.0f, 0.0f); into the script and am pretty sure my syntax is incorrect, if anyone could help me out i would appreciate it.
Code (JavaScript): varspeed : float = 5f; varjumpDelay : boolean; vardoubleJump : int = 0; function update() { if(Input.GetKeyDown(KeyCode.Space) && jumpDelay == false) { Jump(); } } function Jump() { if(doubleJump <= 1) { rigidbody.velocity.y = 175; jumpTimer(); } } function jumpTimer() { if(Input.GetKeyDown(KeyCode.Space)) { doubleJump ++; } if (doublejump > 1) { doubleJump = 0; jumpDelay = true; transform.position += new Vector3(speed * Time.deltaTime, 0.0f, 0.0f); jumpDelay = false; } } Try to insert the code in a "code" block. Also, indentations are a must to make it readable. In the original code, there was no space between the word "function" and the name of the function, is that how it is in your code?
Sorry haha yeah i just copy pasted i didnt realize there was a better way to post your code. Sorry about that lol. Code (JavaScript): var jumpDelay : boolean; var doubleJump : int = 0; function update() { if(Input.GetKeyDown(KeyCode.Space) && jumpDelay == false) { Jump(); } } function Jump() { if(doubleJump <= 1) { rigidbody.velocity.y = 175; jumpTimer(); } } function jumpTimer() { if(Input.GetKeyDown(KeyCode.Space)) { doubleJump ++; } if (doublejump > 1) { doubleJump = 0; jumpDelay = true; transform.position += new Vector3(speed * Time.deltaTime, 0.0f, 0.0f); jumpDelay = false; } }