Hello,
Today i finished the lecture and when i start the game it adds another line that says:
“Higher or lower than 501”
This is the whole code:
using UnityEngine;
using System.Collections;
public class NumberWizards : MonoBehaviour {
// Use this for initialization
int max = 1000;
int min = 1;
int guess = 500;
void Start () {
StartGame();
NextGuess();
}
void StartGame () {
max = max + 1;
print ("Welcome to Number Wizard!");
print ("Pick a number in your head but don't tell me homie");
print ("The highest number you can pick is " +(max-1));
print ("The lowest number you can pick is " +min);
print ("Is the number higher or lower then ?" +guess);
print (" Up arrow = higher,Down = lower, return = equals ");
}
// Update is called once per frame
void Update () {
if (Input.GetKeyDown(KeyCode.UpArrow)){
// print("Up arrow pressed");
min = guess;
NextGuess();
}
else if (Input.GetKeyDown(KeyCode.DownArrow)){
// print ("Down arrrow pressed");
max = guess;
NextGuess();
}
else if (Input.GetKeyDown(KeyCode.Return)){
print ("I won!");
}
}
void NextGuess () {
guess = (max + min) / 2;
print (“Higher or lower than " +guess);
print (” Up arrow = higher,Down = lower, return = equals ");
}
}
and i didn’t even press a key, what is the problam?
Many thanks for the helpers :3
