- Home /
Movement not working
var pointA : true;
var pointB : false;
var pointC : false;
var pointB : false;
function makefalse(){
pointA : false;
pointB : false;
pointC : false;
pointD : false;
}
function Update () {
if (Input.GetKey(moveLeft)) {
if(pointD == true){
Transform.position Vector3(1, -3, 0);
makefalse();
pointC = true;
}
if(pointC == true){
Transform.position Vector3(-3, -3, 0);
makefalse();
pointB = true;
}
if(pointB == true){
Transform.position Vector3(-7, -3, 0);
makefalse();
pointA = true;
}
} else if (Input.GetKey(moveRight)) {
if (Input.GetKey(moveLeft)) {
if(pointA == true){
Transform.position Vector3(-3, -3, 0);
makefalse();
pointB = true;
}
if(pointB == true){
Transform.position Vector3(1, -3, 0);
makefalse();
pointC = true;
}
if(pointC == true){
Transform.position Vector3(5, -3, 0);
makefalse();
pointD = true;
}
} else {
}
Why is this not working this is the error i get Assets/Scripts/PlayerControls.js(13,14): BCE0043: Unexpected token: true.
Comment
Answer by hamcav · Mar 12, 2014 at 01:13 PM
You have no variable "pointD" :D
You have declared pointB multiple times. Just change your 4th line of code into pointD and that should be it
true i already fixed that i came even further but im having new trouble var pointA : boolean = true; var pointB : boolean = false; var pointC : boolean = false; var pointD : boolean = false;
function $$anonymous$$akefalse(){
pointA = false;
pointB = false;
pointC = false;
pointD = false;
}
function Update () {
if (Input.Get$$anonymous$$ey(moveLeft)) {
//Debug.Log("dit ziet ie");
if(pointD == true){
transform.position = Vector3(1, -3, 0);
Debug.Log("vector3 doesn't work");
$$anonymous$$akefalse();
Debug.Log("makefalse");
pointC = true;
Debug.Log("maketrue");
}
else if(pointC == true){
transform.position = Vector3(-3, -3, 0);
$$anonymous$$akefalse();
pointB = true;
}
else if(pointB == true){
transform.position = Vector3(-7, -3, 0);
$$anonymous$$akefalse();
pointA = true;
}
else {}
} else if (Input.Get$$anonymous$$ey(moveRight)) {
//Debug.Log("dit ook");
if (Input.Get$$anonymous$$ey(moveLeft)) {
if(pointA == true){
transform.position = Vector3(-3, -3, 0);
$$anonymous$$akefalse();
pointB = true;
}
else if(pointB == true){
transform.position = Vector3(1, -3, 0);
$$anonymous$$akefalse();
pointC = true;
}
else if(pointC == true){
transform.position = Vector3(5, -3, 0);
$$anonymous$$akefalse();
pointD = true;
}
else{}
} else {
}
however no errors yet;)
Your answer
![](https://koobas.hobune.stream/wayback/20220613140046im_/https://answers.unity.com/themes/thub/images/avi.jpg)