Catagories

Animation (1) Camera (1) Camera Script (2) GUI (2) Lerpz (1) Moving Objects (1) Platform (1) Script (1) Sied Scrolling (1) Third Person (1) Unity (1)
Showing posts with label Camera Script. Show all posts
Showing posts with label Camera Script. Show all posts

Thursday, 13 January 2011

Lesson 13/1/11: Example GUI Script

Example GUI Script:


var icon : Texture2D;

function OnGUI () {

// Make a background box
GUI.Box (Rect (Screen.width/2-150,Screen.height/2-75,300,200), "MAIN MENU");

GUI.Box (Rect (Screen.width/2-120,Screen.height/2-50,35,35), GUIContent(icon));

if (GUI.Button (Rect (Screen.width/2-80,Screen.height/2-50, 200, 35), "START GAME")) {
print ("Game Started");
}

GUI.Box (Rect (Screen.width/2-120,Screen.height/2-10,35,35), GUIContent(icon));

if (GUI.Button (Rect (Screen.width/2-80,Screen.height/2-10, 200, 35), "ACHIEVEMENTS")) {
print ("Achievements Started");
}

GUI.Box (Rect (Screen.width/2-120,Screen.height/2+30,35,35), GUIContent(icon));

if (GUI.Button (Rect (Screen.width/2-80,Screen.height/2+30, 200, 35), "SETTINGS")) {
print ("Settings Started");
}

GUI.Box (Rect (Screen.width/2-120,Screen.height/2+70,35,35), GUIContent(icon));

if (GUI.Button (Rect (Screen.width/2-80,Screen.height/2+70, 200, 35), "CREDITS")) {
print ("Credits Started");
}

}

Friday, 10 December 2010

Side Scrolling Camera

Script for simple side scrolling camera. Attach the script to your main camera.

var Target : Transform;

function Update () {
transform.position = Target.position + Vector3(0, 0, -3);

}