Ok so, I have the source code (See below) and I am trying to make a coins function inside of my score class. and every time my score reaches an interval of 500 i want the coins to go up by one. I have a formula however unity replies with an error, The formula is (currentScore / 500 = currentCoins), and the error is (Assets/Score.js(24,28): BCE0049: Expression ‘currentScore / 500’ cannot be assigned to. How can i change this code so that my lives will work how i want it too.
static var currentScore : int = 0;
static var highScore : int;
var isPaused : boolean = false;
var currentCoins : int;
var coinValue : int = 1;
function Start ()
{
currentScore = 0;
}
function OnGUI ()
{
GUI.Label (new Rect(5, 10, 100, 200), "Score: " + currentScore);
GUI.Label (new Rect(5, 25, 100, 200), "High Score:" + highScore);
GUI.Label (new Rect(475, 10, 200, 200),"Current Version: BETA 0.0.7");
GUI.Label (new Rect(5, 40, 100, 200), "Coins:" + currentCoins);
}
function Update()
{
currentScore / 500 = currentCoins;
if(currentScore > highScore)
{
highScore = currentScore;
}
if(Input.GetButtonDown ("Pause"))
{
Pause();
}if(currentScore)
{
currentCoins+coinValue;
}
}
What is this line purpose : if(currentScore) { currentCoins+coinValue; }
– Adre76Thank You everyone soooooo much, it works just the way I want it to now, but I couldn't have down it without everyones help, it turned out to be a simple mistake although after reading through everyones responses I took a little bit from each and combined them into a working system. :-) Thank You again! -Zedock-
– Zedockjust ignore that, that was going to be an if statement however im not using it anymore
– Zedock