if(Input.GetButtonDown("up")){
//transform.position.currentPos.y = transform.position.currentPos.y+1;
currentPos.y = currentPos.y+1;
Debug.Log("currentPos"+ currentPos);
Debug.Log("startPos" +startPos);
if (currentPos.y != StartPos) {
Debug.Log("after currentPos.y!= startPos condional "+currentPos);
transform.position.y = transform.position.y+1;
currentPos= this.transform.position;
}
else if(currentPos == startPos){
Debug.Log("yes");
currentPos= this.transform.position;
}
}
I want to not allow my player to move up ones if the location they are moving to is the location of where startPos is.
Javascript
↧