first I wanna say that my english is very bad so I hope you can understand me.
I’ve made a script for coin collecting but now I want that the gamer can see his score.
I search everywhere for scripts but it is al for coin collecting + score,
this is my script:
static var Coin = 0;
function OnControllerColliderHit(hit : ControllerColliderHit)
{
if((hit.collider.gameObject.tag == “coin”))
{
//print(“Coins found”);
//destroy the coin
Destroy(hit.gameObject);
//add Coin to inventory
Coin += 1;
print(“You now have “+ Coin +” coins” );
}
}
what do I need to get the score on screen?
please help
public GameObject guiTPrefab;//Public var to load a GuiText prefab into on inspector
void start(){
score = Instantiate(guiTPrefab, gameObject.transform.position, Quaternion.identity) as GameObject;
}
void updateScore(){
score .guiText.text = Coin;
}
I know its in c# but it should be easy enough for you to convert that over to java and then just call updateScore after you change coin’s value