Unity progress

I've been having some more fun with Unity trying out different things. Learning to mess with materials and textures.

I was able to get a 100 day unity pro license thanks to watching the Microsoft jump start on game engines. They went over three engines, GameMaker by YoYo games, Construct 2 by Scirra. Unity was the other one and it blew the other two out of the water. Everyone was impressed by the power of Unity. We made a game with water, trees, mountains, and a T Rex that we could have eat hamburgers. If he ate three hamburgers it would be too much and he died.

Construct2 is pretty cool and easy to build web based games. It outputs html and seemed simple to get 2D games up and running. Game maker is the same way and it even has built in tutorials for windows 8 in it so you can make a windows 8 game that uses toast notifications or live tiles easily.

It really got the juices flowing though with all that was possible and I can see why people use Unity to make prototypes of their games, because it is so quick and easy to get a playable form up and running.

Here is code for a simple dice game of guess the numbers. Attach this script to a GUI Text game object.

using UnityEngine;
using System.Collections;

public class DiceGame : MonoBehaviour {
    public string inputValue = "1";
    void OnGUI()    {
        GUI.Label(new Rect(10, 10, 100, 20), "Input: ");
        inputValue = GUI.TextField(new Rect(120, 10, 50, 20), inputValue, 25);
        if (GUI.Button(new Rect(100, 50, 50, 30), "Play")){
            Debug.Log("Throwing dice...");
            Debug.Log("FInding random between 1 to 6...");
            int diceResult = Random.Range(1, 7);
            Debug.Log("Result: " + diceResult);
            if (diceResult == int.Parse(inputValue))
            {
                guiText.text = "DICE RESULT: " + diceResult.ToString() + "\r\nYOU WIN!";
            }
            else
            {
                guiText.text = "DICE RESULT: " + diceResult.ToString() + "\r\nYOU LOSE!";
            }
        }
    }
}

Comments

Popular Posts