Hello Mates greetings from Mexico

This is my code:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class NumberWizard : MonoBehaviour
{
int max = 1001;
int min = 1;
int guess = 500;

// Start is called before the first frame update
void Start()

{
   



    Debug.Log("Hello Bro / Sis, Wellcome to my game");
    Debug.Log("Choose a number please");
    Debug.Log("The Highest number is: " + max);
    Debug.Log("The Lowest number is: " + min);
    Debug.Log("I guess your number is: " + guess);
    Debug.Log("If your number is higher put the Up arrow");
    Debug.Log("If your number is higher put the Down arrow");
    Debug.Log("If I guessed the number put Enter");
}

// Update is called once per frame
void Update()
{

    //Detect when the up arrow key is pressed down
    if (Input.GetKeyDown(KeyCode.UpArrow))
    {
        Debug.Log("Ho, Your number is Higher");
        min = guess;
        guess = (min + max) / 2;
        Debug.Log("What about " + guess + "?");
    }

   else if (Input.GetKeyDown(KeyCode.DownArrow))
    {
        Debug.Log("Ho, Your number is Lower");
        max = guess;
        guess = (min + max) / 2;
        Debug.Log("What about " + guess + "?");
    }

    else if (Input.GetKeyDown(KeyCode.Return))
    {
        Debug.Log("Thanks for Playing :D");
    }
}

}

1 Like

Privacy & Terms