Hey there, so I’m working on a game where as you click a button, your stats increase. I’m having a problem though, I have a code that generates a random number between 1 and 100, but I need it to be a decimal so I can turn it into a percent.
here is the code for that.
var die3:uint = Math.floor(Math.random() * 100) + 1;
The second problem I’m having is that I want to add that new percent to the current statistic when I click a button. I figured it would just be stat = current stat * 1.“new percent”. (I’m aware this isn’t real code, this is just my thought process.)
edit* here is the code I came up with, but I still need the percent to be a decimal.
stat.text = stat.text * percent.text;
I don’t know how to properly write this out though. Can somebody shed any light on the matter for me? It would be greatly appreciated.
One more problem.(I guess you could say I got 99 problems, but asking for help aint one!.. sorry, bad joke.)
Okay, I have multiple stats, but lets say I want to apply the new percentage stated above to only one stat using check boxes or something along those lines, how would this be done. I would greatly appreciate any tutorials linked to this page as I am self taught and am still learning. It’s awesome having the code written for me, but it’s even better if I am provided the opportunity to learn how it was written. Thanks!