- Home /
Question by
johsle · Oct 18, 2014 at 09:12 PM ·
javascriptscorescoring
Scoring System
I am trying to add a score system to my 2.5d space shooter, i have a score system in place, i just have to link it to actually scoring when i hit the enemy ship. The script has been implemented in mainCamera and is working, just need that connection:)
var score1 : GUIText; var oneTime; var KeepScore : float; var myScore : int = 0; var myCurScore : int = 0;
function Update () { score1.text = "Score: " + myScore;
if (myScore < myCurScore)
{
myScore++;
}
if(Input.GetKeyDown("b"))
{
myCurScore += 100;
}
}
Comment
Answer by Sethhalocat · Oct 19, 2014 at 03:06 AM
Change if(Input.GetKeyDown("b")) to this if(Input.GetKeyDown(KeyCode.b){ myCurScore += 100; }
yeah, that gives me score, but i need the link between collisions and scoring, have looked and looked but cant find one that i can apply to my already finished game, - the scoring system
Your answer
![](https://koobas.hobune.stream/wayback/20220613165357im_/https://answers.unity.com/themes/thub/images/avi.jpg)