My greeting!

/*using System.Collections;
*using System.Collections.Generic;*/
using UnityEngine;

public class NumWiz : MonoBehaviour
{
    int max;
    int min;
    int guess;

    // Start is called before the first frame update
    void Start()
    { 
        max = 1001;
        min = 1;
        guess = 500;
        Debug.Log(" Welcome!, I'm Numa Wizzy ,yo!\n Pick a number. DON'T TELL me\n");
        Debug.Log("Highest number you can pick is:- "+max+"\n");
        Debug.Log("Lowest number you can pick is :- "+min+"\n");
        Debug.Log("Tell me if your guess is higher or lower than my guess..\t"
                  + guess
                  + "\n Push UP/W = Higher, Push DOWN/S = Lower,  Push ENTER/RETURN = Correct.");
    }

    // Update is called once per frame
    void Update()
    {
          //Detect when the up arrow key is pressed down
        if (Input.GetKeyDown(KeyCode.UpArrow) || Input.GetKeyDown(KeyCode.W))
        {
            min = guess;
            guess = (min+max) / 2 ;
            Debug.Log("Is my guess correct...\t"+guess);
        }
        //Detect when the down arrow or S key is pressed down
        else if (Input.GetKeyDown(KeyCode.DownArrow) || Input.GetKeyDown(KeyCode.S))
        {
            max = guess;
            guess = (min+max) / 2 ;
            Debug.Log("Is my guess correct...\t"+guess);
        }
        //Detect when the enter key is pressed down
        else if (Input.GetKeyDown(KeyCode.Return))
        {
            Debug.Log("Yeah!! I guessed it.");
        }
    }
}

note: I have done the remaster version of this course I’m building skills to see how old version of unity relates to new version.

Privacy & Terms