In a game I'm working on, I have an advancement system that is supposed to trigger based on exponent levels:
function machinesOwnedAdvancement(machine,machineLevel) {
if (machine >= Math.pow(2,(machineLevel+5))) {
console.log(machineLevel);
machineLevel += 1;
console.log("Machine is upgraded. It is now level: " + machineLevel);
}
}
The function will be called as such:
machinesOwnedAdvancement(scribes, scribesAdvancementLevel);
Where scribes is number of machines owned, and scribesAdvancementLevel is initially = 0. The idea is that it 'should' add 1 to the advancement level. The console.log suggests it does, but when the next game tick occurs (i.e. the function is called again), the console.log(machineLevel) is still at 0.
Maybe I'm mistaken about how function arguments can be used to manipulate variables??