Hi, I need help creating a score system on a unity FPS game that I am creating.
The problem is that I want the different targets to be worth a different amount of points but at the same time I want the amount of points you get from hitting the target dependant on where on the target you hit, like if you hit the target in the middle you get more points. I think this will be done with box colliders but I’m not sure. I then want the score system at the end of the game to convert the time remaining into points which can be added to the points from hitting the targets in game.
Any ideas how this could be done? I’ve attempted many times here’s what I have.
static var score: int = 0;
function OnCollisionEnter(hit : Collision){
if (hit.gameObject.tag == “target1” || “target2” || “target3”){ //if targets 01, 04, 07 are hit, they will add amount “X” to the score system.
Debug.Log (“Congrats Hit add to score!”); score+=100; //GUIScore.text = score.ToString(); //shows score.
GameObject.Destroy(hit.gameobject); //destroys game object upon being hit. }
It was but this anwser box wouldn’t let me edit it properly.
static var score: int = 0;
function OnCollisionEnter(hit : Collision){
if (hit.gameObject.tag == “target1” || “target2” || “target3”){ //if targets 01, 04, 07 are hit, they will add amount “X” to the score system.
Debug.Log (“Congrats Hit add to score!”);
score+=100; //GUIScore.text = score.ToString(); //shows score. GameObject.Destroy(hit.gameobject); //destroys game object upon being hit. }
Thanks alot, it was a great answer except now - it immediately deletes the targets 2 and 3 on screen as soon as the player plays the game - meaning they already have some score. Is the a way I can make the score vslue appear on the screen so the player knows there actual score?