Hi,
I'm creating a very basic 2D platformer. I have already the basic move functions working. But now i'm trying to make a score script. The idea is that if you hit a red square that you get 1 point. I added a box collider to it that is triggered and i already have the +1 point working, the only problem now is that when i hit the red square, every red square in the scene dissapaers. Every red square is tagged 'score'
This is a part of my move around script:
static var score : int = 0;
static var AmtScoreHits : int = 0;
function OnTriggerEnter(hit : Collider)
{
if(hit.gameObject.tag == "score")
{
score = score+1;
AmtScoreHits = AmtScoreHits +1;
}
}
And this is the script atached to the red square, the score object:
function Update()
{
if(MoveAround.AmtScoreHits == 1)
{
Destroy(gameObject);
}
}
And sorry if they're a lot of spelling mistakes but i come from Belgium ;)