I am trying to model acceleration, and I have a separate script for it so that once it reaches a speed (200) it cancels the acceleration. However, I have no idea why it is giving me this error? Please help, im fairly new.
public class Movement : MonoBehaviour {
public float movespeed = 10f;
public class Accleration {}
void Update () {
if (Input.GetKey (KeyCode.W))
transform.Translate (Vector3.down * movespeed * Time.deltaTime);
if (movespeed > 200)
Acceleration.enabled = false;
}
}
public class Acceleration : MonoBehaviour {
public class Movement {}
public float movespeed = 10f;
void Update () {
movespeed -= Time.deltaTime;
}
}
↧