Hello everyone .
Plz check the code here for some reason mono is not reading the if statement line 22, and i couldnt figure it out.
the problem is in this line ==> if (Input.GetKeyDown(KeyCode.Y)
Here is the code .
using UnityEngine;
using System.Collections;public class Numberwizard : MonoBehaviour {
int min = 1 ;
int max = 1001 ;
int guess = 500 ;
// Use this for initialization
void Start () {
NumberWizard();
}// Update is called once per frame
void Update () {if (Input.GetKeyDown (KeyCode.Return)) {
/*print ("the number is " + guess "); print ("I won "); print ("=========================================="); print ("Do you want to restart?"); print ("'Y'for yes and 'N' for no");*/ if (Input.GetKeyDown(KeyCode.Y)){
print("ok");
}
}else if (Input.GetKeyDown (KeyCode.UpArrow)) {
print ("Your number is higher than " + guess ); min = guess; guess = (min + max) / 2; } else if (Input.GetKeyDown (KeyCode.DownArrow)) { print ("the number is lower than " + guess + "); max = guess; guess = (max + min) / 2; } }
void NumberWizard(){
print ("Welcome to number wizard "); print ("Try to guess the number "); print ("guess a number between 1 and 1000 "); print ("is your guess higher than 500 or lower ?");
}
}