Hey everyone,
Im an artist trying to code and basically I’m crap,
Im trying to get a simple score mechanism where when the player collides with an object it updates the score. I’ve been around the forum trying to find ways other people have done it and most seem to have two scripts one for the score controller and one for the object getting hit. I have no idea how to link them and how to get the hit script to update the scorecontroller script, I would need to update it say 50 times for all different types of score hits.
here are my two scripts:
ScoreController:
var score : int = 0;
function OnGUI () {
GUILayout.BeginArea ( Rect ( 10, 10, Screen.width / 4, Screen.height / 4 ) );
GUILayout.Box ( score.ToString () );
GUILayout.EndArea ();
}
which displays the score on screen and
Hit :
function OnTriggerEnter( hit : Collider)
{
if(hit.gameObject.tag ==“Player”)
{
Destroy(gameObject);
}
}
which all it does is destroy the object on collision
any help would be awesome