using UnityEngine;
public class PlayerMovement : MonoBehaviour {
public Rigidbody rb;
public float forwardForce = 2000f;
public float sidwaysForce = 500f
// Update is called once per frame
void FixedUpdate () {
rb.AddForce (0, 0, forwardForce * Time.deltaTime);
if (Input.GetKey("d")){
rb.AddForce (sidwaysForce * Time.deltaTime, 0, 0);
}
if (Input.GetKey("a")){
rb.AddForce (-sidwaysForce * Time.deltaTime, 0, 0);
}
}
}
this is my code for a simple game and it is giving me a LOT of errors in the compiler. can anyone ecplane to me why?
Error messages are written to help you, you know? Simply saying you get “a LOT” of them is no help whatsoever if you don’t tell us what they are. They’re not some random mumbo-jumbo… they point out the line number where the error occurs, a description of the problem and, very often, what you need to do to fix it. When asking for help with an error, you must always, ALWAYS include the error message itself - then, if you don’t understand what it means, at least someone else can explain it to you.
Fortunately in this case the problem is very apparent - you’re msising a closing semicolon at the end of line 5. It should read:
public float sidwaysForce = 500f;