my object moves form the center to the right.on mouse click it goes back to the center. I want the object to now start moving in a random direction after that, and on mouse clicks still go back to the center.
#pragma strict
function Start () {
Debug.Log (“Start”);
}
function Update () {
Debug.Log (“Update”);
transform.position.x = transform.position.x + 0.01;
if(Input.GetMouseButton(0)){
transform.position.x = 0;
if(){
transform.position.x = transform.position.x - 0.01;
}
}