Making a clicker game: Amount awarded per click not increasing based on how many increasers purchased.
I have a few global variables set up.
global.ramen_1 = 1
This part says how many ramen makers I have, or what my cursor level is, if you purchase another one it goes to 2, then 3 etc...
global.ramen_1_bonus = (global.ramen_1 * 2)
This is the formula that I want to work. If I own 10 ramen makers. Every time I click the ramen picture it is going to increase based on the value of global.ramen_1 times by two. So in theory the more I buy, the higher it should go up when I click it.
I made the ramen image and clicking on it does the following code.
//Increases the amount of money by clicking the ramen
global.money += global.ramen_1_bonus
I have the object that you click that does this code which subtracts from the amount of money you have, but increases the amount of ramen makers you have. And for the time being I just have a static price, nothing that increases yet.
if (global.money >= 10) {
global.money -= 10;
global.ramen_1 += 1;
}
This works perfectly, ramen_1 goes up by one, the money goes down by ten when you have enough.
BUT
After I have 2 ramen makers or global.ramen_1 = 2
. The formula does not work.
When I click on the ramen bowl, my money doesn't go up 4 like it's supposed to, it still only goes up by two. Why not?