diff --git a/README.md b/README.md index 0446277..cbc7972 100644 --- a/README.md +++ b/README.md @@ -81,10 +81,10 @@ coinGame.init(); coinGame.dataManager.loadData(); // Gain coins -coins.static.gain(); +coins.gain(); // Buy (max) upgrades -coins.static.buyUpgrade("upg1Coins"); +coins.buyUpgrade("upg1Coins"); // Hotkeys coinGame.keyManager.addKey([ @@ -92,13 +92,13 @@ coinGame.keyManager.addKey([ id: "gainCoins", name: "Gain Coins", key: "g", - onDownContinuous: () => coins.static.gain(), + onDownContinuous: () => coins.gain(), }, { id: "buyUpgrades", name: "Buy Upgrades", key: "b", - onDownContinuous: () => coins.static.buyUpgrade("upg1Coins"), + onDownContinuous: () => coins.buyUpgrade("upg1Coins"), }, ]); diff --git a/documentation/docs/game/gameClass.md b/documentation/docs/game/gameClass.md index 79b52ca..83f6bae 100644 --- a/documentation/docs/game/gameClass.md +++ b/documentation/docs/game/gameClass.md @@ -48,7 +48,7 @@ myGame.keyManager.addKey([ { name: "Gain Coins", key: "g", - onDownContinuous: () => myCurrency.static.gain(), + onDownContinuous: () => myCurrency.gain(), }, ]); ``` diff --git a/documentation/docs/game/resetLayer.md b/documentation/docs/game/resetLayer.md index 6d46a5a..e1f2543 100644 --- a/documentation/docs/game/resetLayer.md +++ b/documentation/docs/game/resetLayer.md @@ -59,7 +59,7 @@ const reset1 = game.addReset(myCurrency); reset1.onReset = () => { // Gain gems on reset - gems.static.gain(); + gems.gain(); } // Call the reset diff --git a/documentation/docs/main/currency.md b/documentation/docs/main/currency.md index ebabf17..3a8f83b 100644 --- a/documentation/docs/main/currency.md +++ b/documentation/docs/main/currency.md @@ -24,10 +24,10 @@ To create a currency, do either of the following: // Another parameter - `upgrades` is optional. See the `Upgrade` class for more information. const myCurrency = myGame.addCurrency("myCurrency"); - // All the methods are in `.static`, which contains the same methods as - myCurrency.static.gain(); + // extends so it contains the same methods and properties. + myCurrency.gain(); - console.log(myCurrency.static.value); // new Decimal(1) + console.log(myCurrency.value); // new Decimal(1) ``` 2. Using without `Game` class diff --git a/documentation/docs/tutorials/coinGame/advanced.mdx b/documentation/docs/tutorials/coinGame/advanced.mdx index e1a1c5d..055befb 100644 --- a/documentation/docs/tutorials/coinGame/advanced.mdx +++ b/documentation/docs/tutorials/coinGame/advanced.mdx @@ -34,13 +34,13 @@ coinGame.keyManager.addKey([ id: "gainCoins", name: "Gain Coins", key: "g", - onDownContinuous: () => coins.static.gain(), + onDownContinuous: () => coins.gain(), }, { id: "buyUpgrades", name: "Buy Upgrades", key: "b", - onDownContinuous: () => coins.static.buyUpgrade("upg1Coins"), + onDownContinuous: () => coins.buyUpgrade("upg1Coins"), }, ]); @@ -71,13 +71,13 @@ coinGame.keyManager.addKey([ id: "gainCoins", name: "Gain Coins", key: "g", - onDownContinuous: (): void => void coins.static.gain(), + onDownContinuous: (): void => void coins.gain(), }, { id: "buyUpgrades", name: "Buy Upgrades", key: "b", - onDownContinuous: (): void => void coins.static.buyUpgrade("upg1Coins"), + onDownContinuous: (): void => void coins.buyUpgrade("upg1Coins"), }, ]); diff --git a/documentation/docs/tutorials/coinGame/code/script.js b/documentation/docs/tutorials/coinGame/code/script.js index 0bb3715..7e9c3bb 100644 --- a/documentation/docs/tutorials/coinGame/code/script.js +++ b/documentation/docs/tutorials/coinGame/code/script.js @@ -45,9 +45,9 @@ const coins = coinGame.addCurrency("coins", coinUpgrades); const gems = coinGame.addCurrency("gems"); // Add a boost to the currency -gems.static.boost.setBoost({ +gems.boost.setBoost({ id: "boostFromCoins", - value: n => n.plus(coins.static.value.div(10)), // Gain 10% of coins + value: n => n.plus(coins.value.div(10)), // Gain 10% of coins }); // Add a reset layer to the currency @@ -55,10 +55,10 @@ const prestige = coinGame.addReset(coins); prestige.onReset = () => { // Add a requirement to reset. In this case, the player needs at least 1000 coins to reset - if (coins.static.value.lt(1000)) return; + if (coins.value.lt(1000)) return; // Gain gems based on the amount of coins before reset (set by the boost) - gems.static.gain(); + gems.gain(); }; // Call the reset layer @@ -68,7 +68,7 @@ prestige.onReset = () => { // Gain coins button const gainCoins = () => { - coins.static.gain(); + coins.gain(); }; document.getElementById("gainCoins").addEventListener("click", gainCoins); @@ -80,7 +80,7 @@ document.getElementById("gainGems").addEventListener("click", gainGems); // Buy (max) upgrades button const buyUpgrades = () => { - coins.static.buyUpgrade("upg1Coins"); + coins.buyUpgrade("upg1Coins"); }; document.getElementById("buyUpgrades").addEventListener("click", buyUpgrades); @@ -90,8 +90,8 @@ const gemsDisplay = document.getElementById("gemsDisplay"); // Add a render event that executes every frame coinGame.eventManager.setEvent("render", "interval", 0, () => { - coinsDisplay.innerHTML = `Coins: ${coins.static.value.format()}`; - gemsDisplay.innerHTML = `Gems: ${gems.static.value.format()}`; + coinsDisplay.innerHTML = `Coins: ${coins.value.format()}`; + gemsDisplay.innerHTML = `Gems: ${gems.value.format()}`; }); // Advanced @@ -109,13 +109,13 @@ coinGame.keyManager.addKey([ id: "gainCoins", name: "Gain Coins", key: "g", - onDownContinuous: () => coins.static.gain(), + onDownContinuous: () => coins.gain(), }, { id: "buyUpgrades", name: "Buy Upgrades", key: "b", - onDownContinuous: () => coins.static.buyUpgrade("upg1Coins"), + onDownContinuous: () => coins.buyUpgrade("upg1Coins"), }, ]); diff --git a/documentation/docs/tutorials/coinGame/code/script.ts b/documentation/docs/tutorials/coinGame/code/script.ts index 34b031d..67db3fb 100644 --- a/documentation/docs/tutorials/coinGame/code/script.ts +++ b/documentation/docs/tutorials/coinGame/code/script.ts @@ -58,9 +58,9 @@ const coins = coinGame.addCurrency("coins", coinUpgrades); const gems = coinGame.addCurrency("gems"); // Add a boost to the currency -gems.static.boost.setBoost({ +gems.boost.setBoost({ id: "boostFromCoins", - value: n => n.plus(coins.static.value.div(10)), // Gain 10% of coins + value: n => n.plus(coins.value.div(10)), // Gain 10% of coins }); // Add a reset layer to the currency @@ -68,10 +68,10 @@ const prestige = coinGame.addReset(coins); prestige.onReset = (): void => { // Add a requirement to reset. In this case, the player needs at least 1000 coins to reset - if (coins.static.value.lt(1000)) return; + if (coins.value.lt(1000)) return; // Gain gems based on the amount of coins before reset (set by the boost) - gems.static.gain(); + gems.gain(); }; // Call the reset layer @@ -81,7 +81,7 @@ prestige.onReset = (): void => { // Gain coins button const gainCoins = (): void => { - coins.static.gain(); + coins.gain(); }; document.getElementById("gainCoins").addEventListener("click", gainCoins); @@ -93,7 +93,7 @@ document.getElementById("gainGems").addEventListener("click", gainGems); // Buy (max) upgrades button const buyUpgrades = (): void => { - coins.static.buyUpgrade("upg1Coins"); + coins.buyUpgrade("upg1Coins"); }; document.getElementById("buyUpgrades").addEventListener("click", buyUpgrades); @@ -103,8 +103,8 @@ const gemsDisplay = document.getElementById("gemsDisplay"); // Add a render event that executes every frame coinGame.eventManager.setEvent("render", "interval", 0, () => { - coinsDisplay.innerHTML = `Coins: ${coins.static.value.format()}`; - gemsDisplay.innerHTML = `Gems: ${gems.static.value.format()}`; + coinsDisplay.innerHTML = `Coins: ${coins.value.format()}`; + gemsDisplay.innerHTML = `Gems: ${gems.value.format()}`; }); // Advanced @@ -122,13 +122,13 @@ coinGame.keyManager.addKey([ id: "gainCoins", name: "Gain Coins", key: "g", - onDownContinuous: (): void => void coins.static.gain(), + onDownContinuous: (): void => void coins.gain(), }, { id: "buyUpgrades", name: "Buy Upgrades", key: "b", - onDownContinuous: (): void => void coins.static.buyUpgrade("upg1Coins"), + onDownContinuous: (): void => void coins.buyUpgrade("upg1Coins"), }, ]); diff --git a/documentation/docs/tutorials/coinGame/display.mdx b/documentation/docs/tutorials/coinGame/display.mdx index 5722424..774a515 100644 --- a/documentation/docs/tutorials/coinGame/display.mdx +++ b/documentation/docs/tutorials/coinGame/display.mdx @@ -46,7 +46,7 @@ This code sets up the body of the HTML file with a paragraph element to display // Gain coins button const gainCoins = () => { - coins.static.gain(); + coins.gain(); }; document.getElementById("gainCoins").addEventListener("click", gainCoins); @@ -58,7 +58,7 @@ document.getElementById("gainGems").addEventListener("click", gainGems); // Buy (max) upgrades button const buyUpgrades = () => { - coins.static.buyUpgrade("upg1Coins"); + coins.buyUpgrade("upg1Coins"); }; document.getElementById("buyUpgrades").addEventListener("click", buyUpgrades); @@ -68,8 +68,8 @@ const gemsDisplay = document.getElementById("gemsDisplay"); // Add a render event that executes every frame coinGame.eventManager.setEvent("render", "interval", 0, () => { - coinsDisplay.innerHTML = `Coins: ${coins.static.value.format()}`; - gemsDisplay.innerHTML = `Gems: ${gems.static.value.format()}`; + coinsDisplay.innerHTML = `Coins: ${coins.value.format()}`; + gemsDisplay.innerHTML = `Gems: ${gems.value.format()}`; }); ``` @@ -82,7 +82,7 @@ coinGame.eventManager.setEvent("render", "interval", 0, () => { // Gain coins button const gainCoins = (): void => { - coins.static.gain(); + coins.gain(); }; document.getElementById("gainCoins").addEventListener("click", gainCoins); @@ -94,7 +94,7 @@ document.getElementById("gainGems").addEventListener("click", gainGems); // Buy (max) upgrades button const buyUpgrades = (): void => { - coins.static.buyUpgrade("upg1Coins"); + coins.buyUpgrade("upg1Coins"); }; document.getElementById("buyUpgrades").addEventListener("click", buyUpgrades); @@ -104,8 +104,8 @@ const gemsDisplay = document.getElementById("gemsDisplay"); // Add a render event that executes every frame coinGame.eventManager.setEvent("render", "interval", 0, () => { - coinsDisplay.innerHTML = `Coins: ${coins.static.value.format()}`; - gemsDisplay.innerHTML = `Gems: ${gems.static.value.format()}`; + coinsDisplay.innerHTML = `Coins: ${coins.value.format()}`; + gemsDisplay.innerHTML = `Gems: ${gems.value.format()}`; }); ``` diff --git a/documentation/docs/tutorials/coinGame/reset.mdx b/documentation/docs/tutorials/coinGame/reset.mdx index db385c2..d3cd666 100644 --- a/documentation/docs/tutorials/coinGame/reset.mdx +++ b/documentation/docs/tutorials/coinGame/reset.mdx @@ -21,9 +21,9 @@ After you have set up [currency and upgrades](./currency), you can set up reset const gems = coinGame.addCurrency("gems"); // Add a boost to the currency -gems.static.boost.setBoost({ +gems.boost.setBoost({ id: "boostFromCoins", - value: n => n.plus(coins.static.value.div(10)), // Gain 10% of coins + value: n => n.plus(coins.value.div(10)), // Gain 10% of coins }); // Add a reset layer to the currency @@ -31,10 +31,10 @@ const prestige = coinGame.addReset(coins); prestige.onReset = () => { // Add a requirement to reset. In this case, the player needs at least 1000 coins to reset - if (coins.static.value.lt(1000)) return; + if (coins.value.lt(1000)) return; // Gain gems based on the amount of coins before reset (set by the boost) - gems.static.gain(); + gems.gain(); }; // Call the reset layer @@ -49,9 +49,9 @@ prestige.reset(); const gems = coinGame.addCurrency("gems"); // Add a boost to the currency -gems.static.boost.setBoost({ +gems.boost.setBoost({ id: "boostFromCoins", - value: n => n.plus(coins.static.value.div(10)), // Gain 10% of coins + value: n => n.plus(coins.value.div(10)), // Gain 10% of coins }); // Add a reset layer to the currency @@ -59,10 +59,10 @@ const prestige = coinGame.addReset(coins); prestige.onReset = (): void => { // Add a requirement to reset. In this case, the player needs at least 1000 coins to reset - if (coins.static.value.lt(1000)) return; + if (coins.value.lt(1000)) return; // Gain gems based on the amount of coins before reset (set by the boost) - gems.static.gain(); + gems.gain(); }; // Call the reset layer diff --git a/documentation/docs/usage.md b/documentation/docs/usage.md index 82b8186..9dab314 100644 --- a/documentation/docs/usage.md +++ b/documentation/docs/usage.md @@ -51,10 +51,10 @@ coinGame.init(); coinGame.dataManager.loadData(); // Gain coins -coins.static.gain(); +coins.gain(); // Buy (max) upgrades -coins.static.buyUpgrade("upg1Coins"); +coins.buyUpgrade("upg1Coins"); // Hotkeys coinGame.keyManager.addKey([ @@ -62,13 +62,13 @@ coinGame.keyManager.addKey([ id: "gainCoins", name: "Gain Coins", key: "g", - onDownContinuous: () => coins.static.gain(), + onDownContinuous: () => coins.gain(), }, { id: "buyUpgrades", name: "Buy Upgrades", key: "b", - onDownContinuous: () => coins.static.buyUpgrade("upg1Coins"), + onDownContinuous: () => coins.buyUpgrade("upg1Coins"), }, ]);