- Home /
Scored based on time.
I have a game set up were the timer is at 60 seconds and you get 5 points for shooting the targets. What i would like to do is make it so that when the counter goes to 30 seconds the players score is reduced by 10 points and then this happens again when the timer goes below 15 seconds so on.
This is my script that adds the score.
function OnCollisionEnter(collision : Collision) { if (collision.collider.tag == "ammo") { Debug.Log("Score!"); ScoreScript.Counter += 5; } }
This is my timer script.
var Counter : float;
function Start () {
}
function Update() { Counter -= Time.deltaTime;
if (Counter <=0)
{
Application.LoadLevel ("GameOver");
}
}
function OnGUI () { GUI.Label (Rect (Screen.width / 6 - 50, Screen.height / 6-50, 100, 100), "Time Remaining: " + Counter); }
This is my scorescript that puts the score on screen.
static var Counter : int = 0;
function Update () { guiText.text = "Score: " + Counter; }
Any help would be useful :).
Please format your code. If you don't know how, watch the tutorial video on the right
Your answer
Follow this Question
Related Questions
How to increase score by one per second when you are holding an object 2 Answers
Add time score to my game 1 Answer
Change score based on time remaining. 1 Answer
How can I make a particle effect turn on with a keystroke and last for a set duration? 1 Answer
C#: Q about creating Score system using GUItext and Time 1 Answer