You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current formula for making the cost more expensive is very flawed currently.
Factors of the Formula are the cost of the upgrade, the amount of the upgrade that the player has, and the amount that the player is buying.
Demo Version of Cost Formula:
( Note: This exact code is not planned to be inside the game. )
// All of this is supposed to be inside a buyUpgrade() function
... {constamount=upgrade.amount;constcost=upgrade.cost;constbuy=buy_btn.buy;/* First Demo Method */functionchangeCostViaFormula(){lettotalCost=buy*(cost+Math.floor(cost*((amount*10)/100)));returntotalCost;}/* Second Demo Method */functionchangeCostViaFormulaForLoop(){lettotalCost=0;for(leti=0;i<=buy;i++){constiterate=Math.floor(cost+(cost*((amount*10)/100)));totalCost+=iterate;}returntotalCost;}// Examplesconstamount=1;constcost=100;constbuy=2;returnconsole.debug(changeCostViaFormula());// Returns a cost of 220returnconsole.debug(changeCostViaFormulaForLoop());// Should return a cost of 220constamount=3;constcost=450;constbuy=5;returnconsole.debug(changeCostViaFormula());// Returns a cost of 2925returnconsole.debug(changeCostViaFormulaForLoop());// Should return a cost of 2925}
The text was updated successfully, but these errors were encountered:
The current formula for making the cost more expensive is very flawed currently.
Factors of the Formula are the cost of the upgrade, the amount of the upgrade that the player has, and the amount that the player is buying.
Demo Version of Cost Formula:
( Note: This exact code is not planned to be inside the game. )
The text was updated successfully, but these errors were encountered: