Hey! My code has so many errors and Im only like a minute into the lecture. Please read over my code and establish what is wrong. Thanks in advance!
public class NumberWizard : MonoBehaviour {
// Use this for initialization
int max = 1000;
int min = 1;
int guess = 500;
void Start () {
StartGame();
}
void StartGame () {
max = max + 1;
print ("Welcome to Number Wizard");
print ("Pick a munber in your head, but don't tell me");
print ("The highest number you can pick is " + max);
print ("The lowest number you can pick is " + min);
print ("Is the number higher or lower than " + guess);
print ("Up arrow = Higher / Down arrow = Lower / Enter = Perfect");
}
// Update is called once per frame
void Update () {
if (Input.GetKeyDown(KeyCode.UpArrow)) {
min = guess;
NextGuess();
} else if (Input.GetKeyDown(KeyCode.DownArrow))
max = guess;
NextGuess();
} else if (Input.GetKeyDown(KeyCode.Return)) {
print("I won!");
StartGame();
}
}
void NextGuess () {
guess = (min + max) / 2;
print ("Higher or lower than " + guess);
print ("Up arrow = Higher / Down arrow = Lower / Enter = Perfect");
}
}