To use the script you need to use the GUIText Component.. Ill update this post soon for the steps on how to use this script. For the meantime, you can copy and paste the script .
Hoooray!!
//time variables
static var startTime : float = 180.0;
var timer: GameObject;
var intTime;
function Start()
{
// Measuring 1 – 60
accelerationTimer = Time.time;
}
function Update()
{
if (startTime > 0 )
{
timeTaken = startTime -= Time.deltaTime;
}
//time
if (timeTaken <= 0.0)
{
Debug.Log (“game over stop time!”);
startTime = 60.0; //time to read the quest
Application.LoadLevel(“gameOvertiktak”); //new gme overtime here
}
timer.guiText.text = FormatTime (timeTaken);
}
function FormatTime (time)
{
intTime = time;
var minutes : int = Mathf.FloorToInt(intTime / 60);
//var minutes : int = intTime / 60;
var seconds : int = intTime % 60;
var fraction : int = time * 10;
fraction = fraction % 10;
timeText = minutes.ToString () + “:”;
timeText = timeText + seconds.ToString ();
timeText += “:” + fraction.ToString ();
return timeText;
}




July 10th, 2011 at 8:50 am
thanks for sharing kht na d ko gets ung codes. someday maiintndhan ko rn yan
[Reply]
October 1st, 2011 at 1:09 am
how to user the timer scripts??step by step? pls. sir
[Reply]