- Home /
CAR SCRIPT
Im trying to get my car to bosst when I press space bar and then slow down again but it say that "expecting :, '=' Here i the whole script function Update() {
Move3 () ;
if (Input.GetKeyDown ("space")) {
var speed=70;
}
else; {
speed = > 50;
speed = speed -1;
}
else; {
speed = < 50;
speed = speed +2;
}
rigidbody.centerOfMass = Vector3 (0, -2, 0);
var speed = 50; var angle = 70; var gravity = 1000; var mass = 2000;
var centerOfMass : Transform;
function Move3 () {
var r = Input.GetAxis("Mouse Y") * Time.deltaTime * angle;
var z = Input.GetAxis("Vertical") * Time.deltaTime * speed;
transform.Translate(0, 0, z);
transform.Rotate(0,r,0);
}
REALLY NEED HEP!!!
Answer by pudd1nG · Jan 17, 2012 at 11:33 PM
The first issue you have is your else statements. Else statements don't need
Answer by pudd1nG · Jan 17, 2012 at 11:33 PM
The issue you have mentioned is because your else statements have semicolons after them, else statements themselves don't need any semicolons, just the elements inside it. The second thing is the speed variable. You need to rethink this variable a bit more.
var = -1;
will not take one away from $var
var--;
will take one away.
If you can post more info once these are fixed I'm sure we can help :)
Your answer
![](https://koobas.hobune.stream/wayback/20220613040443im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Car Getting Stuck? Reset Car 5 Answers
Car goes a bit left when moving 1 Answer
car script / powering wheel colliders 1 Answer
What is the end of the script underlined? 1 Answer
how to quit game after 2 second when object collide another? 1 Answer