Number Wizard Viking Style!

My raven themed number wizard, revisiting the 2D Unity Course ready for the upcoming Games Jam, so I wanted be a bit more creative this time round!

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

public class NumberWizard : MonoBehaviour
{
    // Set Maximum Guess
    int max = 1000;
    // Set Minimum Guess
    int min = 1;
    // Set Inital Guess
    int guess = 500;

    // Start is called before the first frame update
    void Start() // Runs one on scene start
    {
        Debug.Log("Welcome to Valhalla brave warrior...");
        Debug.Log("Where you will soon join the eternal feast, but first a challenge!");
        Debug.Log("The raven to my right, Muninn, is going to ask you for a number.");
        Debug.Log("The raven to my left, Huginn, is then going to guess your number.");
        Debug.Log("If Huginn guesses your number correctly you may join the feast!");
        Debug.Log("If not he must continue to guess and you must wait to quench your thirst and quell your hunger!");
        Debug.Log("The highest number you may pick is: " + max);
        Debug.Log("And the lowest number you may choose is: " + min);
        Debug.Log("CAW! Huginn thinks your number is " + guess);
        Debug.Log("Tell me Muninn...was Huginn's guess correct? Or is your number higher or lower than " + guess + "?");
        Debug.Log("Push Up = Higher, Push Down = Lower, Enter = Correct");
        max = max + 1;
    }

    // Update is called once per frame
    void Update() // Runs each frame (framrate depends on PC performance)
    {
        // Higher
        if (Input.GetKeyDown(KeyCode.UpArrow))
        {
            Debug.Log("Huginn...our warriors number is higher than your guess...");
            min = guess;
            guess = (max + min) / 2;
            Debug.Log("CAW! Huginn thinks your number is " + guess);
            Debug.Log("Tell me Muninn...was Huginn's guess correct? Or is your number higher or lower than " + guess + "?");
            Debug.Log("Push Up = Higher, Push Down = Lower, Enter = Correct");
        }
        // Lower
        else if (Input.GetKeyDown(KeyCode.DownArrow))
        {
            Debug.Log("Huginn...our warriors number is lower than your guess...");
            max = guess;
            guess = (max + min) / 2;
            Debug.Log("CAW! Huginn thinks your number is " + guess);
            Debug.Log("Tell me Muninn...was Huginn's guess correct? Or is your number higher or lower than " + guess + "?");
            Debug.Log("Push Up = Higher, Push Down = Lower, Enter = Correct");
        }
        // Correct
        else if ((Input.GetKeyDown(KeyCode.KeypadEnter)) || Input.GetKeyDown(KeyCode.Return))
        {
            Debug.Log("CAW! CAW! Huginn correctly guessed your number warrior!");
            Debug.Log("My ravens thank you for undertaking their challenge!");
            Debug.Log("Come! Join the feast!");
        }        
    }
}
3 Likes

Do you have a team for the game jam?

Hey Kevin - I don’t yet no.

1 Like

You should check out the different groups on Facebook and see if anyone is looking for a team.

Privacy & Terms