hakulaku97
Well-Known Member
- Mar 13, 2019
- 1,673
- 4,340
- 471
money is type integer which mean only numbers like 1, 2 , 3 not strings which is tex. also molah is just a local variabl so to speak in context of the game itself there is no 1 to 1 connection to thhe actual conetx of the gameThat i know that 0+500 = 500 is but why is moolah rick in this case.
and getIntegerVariable is expecting are string that is why "money"
and the second say's setIntegerVariable weach means get what is stored in money and but it into num.
Because if i use this string money = "500"; the game crashes for me it seems ther is something wrong but not sure if its from the game or unity itself
without game context the function has a parameter so addMOney(200) [moolah is now 200] can be called after that moolah will be set to 500. then we call the getInter unction to revieve potential bvalue of the variable money which is in all bases 0 at the beginning. we store this value in the variable num. then we the code does num + moolah and stores it into num which is 500 in this case. then we store the value of num into the variable money. after that only display text code
so speaking this code does not make sense at all. the variable money just stores the money you have in the game
he should have coded it that way:
Code:
public void addMoney(int amountToAdd)
{
int money = getInteger("money");
money += amountToAdd
setInteger("money", money)
}
so in my case moolah is ammountToAdd the dev has just a terrible way of naming variables