Im having some issues with collision... for some reason i cannot assign value to blocks smashed from outside Score() Ive tried doing something before its called so i can assign a score value to blocks destroyed but the if statement doesn't seem to be called at all where a variation of it in the Score() function seems to give an error about += instead of :... Any advice or input would be greatly appreciated. Im a fairly new programmer on and off over the years.
function OnCollisionEnter(collision : Collision) {
// Rotate the object so that the y-axis faces along the normal of the surface
var contact = collision.contacts[0];
var rot = Quaternion.FromToRotation(Vector3.up, contact.normal);
var pos = contact.point;
Debug.Log("testing");
if(collision.gameObject.tag == "10Block")
{
ScoreKeeping.Score +=10;
Destroy (gameObject);
}
//score();
//Debug.Log Score;
}
function score(){
if(collision.gameObject.tag == "10Block");{
ScoreKeeping.Score +=50;
Debug.Log (ScoreKeeping.Score);
}
return;
}