Hello. I know this is a common problem and I have looked at the doc and other posts but I am having a problem.
In this script I am defining a variable for the score multiplier in my game. This script is called “Stats” and is the “Player” game object.
var Mul = 1;
function OnTriggerEnter (other : Collider) {
if (other.gameObject.CompareTag ("Mul")) {
Destroy (other.gameObject);
Mul += 1;
}
}
In this script I am defining the variable for the game’s score (the score added will be 100 multiplied by whatever the current Mul value is). This script is called “Projectile” and is in the “Projectile” game object.
static var Score = 0;
var Stats.Mul = 1;
function OnTriggerEnter (other : Collider) {
if (other.gameObject.CompareTag ("Enemy")) {
Destroy (gameObject);
Destroy (other.gameObject);
Score += 100*Mul;
}
}
I keep getting an error about an unexpected token referencing the “.” in the second line of the “projectile” script. How can I fix this? Thank you.