I am trying to find a way so when the variable “canmove” is greater than one the game object will move. I would like to use the variables in order to make the object move. I would like some help understanding how to use variables and wait tools for the object to move. Thank you for your help!
public class move : MonoBehaviour {
public float speed = 10f;
public float canmove = 1f;
void Start () {
canmove = 0
yield return new WaitForSeconds (40);
canmove = 1
}
void Update () {
if (canmove < 0) {
transform.Translate (new Vector3 (“speed”, 0, 0));
}
}
}
The two main issues with variables your code had was that you put the wrong sign, it should have been > instead of <, and that you put quotation marks around speed? Quotation marks are ONLY for strings. After looking at your other questions this seems to be a recurring mistake, you really gotta focus on your syntax.