-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fd6f27b
commit e3ea8f3
Showing
156 changed files
with
17,654 additions
and
1,563 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Website | ||
|
||
This website is built using [Docusaurus 2](https://docusaurus.io/), a modern static website generator. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Website | ||
|
||
This website is built using [Docusaurus](https://docusaurus.io/), a modern static website generator. | ||
|
||
### Installation | ||
|
||
``` | ||
$ yarn | ||
``` | ||
|
||
### Local Development | ||
|
||
``` | ||
$ yarn start | ||
``` | ||
|
||
This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server. | ||
|
||
### Build | ||
|
||
``` | ||
$ yarn build | ||
``` | ||
|
||
This command generates static content into the `build` directory and can be served using any static contents hosting service. | ||
|
||
### Deployment | ||
|
||
Using SSH: | ||
|
||
``` | ||
$ USE_SSH=true yarn deploy | ||
``` | ||
|
||
Not using SSH: | ||
|
||
``` | ||
$ GIT_USER=<Your GitHub username> yarn deploy | ||
``` | ||
|
||
If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
presets: [require.resolve("@docusaurus/core/lib/babel/preset")], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--- | ||
id: install | ||
title: Installation Guide | ||
sidebar_label: Installation | ||
--- | ||
|
||
--- | ||
|
||
You can install ``eMath.js`` via [npm](#install-via-npm) or include it in your HTML file via a [CDN](#include-using-cdn). | ||
|
||
### Install via npm: | ||
|
||
```bash | ||
npm install emath.js | ||
``` | ||
|
||
The package exports a default export named ``eMath``. Use as the following: (CJS support only in version ^2.0.0) | ||
|
||
```js | ||
import eMath from "emath.js"; | ||
``` | ||
|
||
### Include using CDN | ||
**NOTE: This will not include types** | ||
#### Development Build | ||
|
||
```html | ||
<script src="https://cdn.jsdelivr.net/gh/xShadowBlade/emath.js/dist/eMath.bundle.js"></script> | ||
``` | ||
|
||
#### Production/Minified Build | ||
|
||
```html | ||
<script src="https://cdn.jsdelivr.net/gh/xShadowBlade/emath.js/dist/eMath.min.js"></script> | ||
``` | ||
|
||
After you install, check out the [usage docs](./usage) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
--- | ||
id: intro | ||
title: Welcome to eMath.js Documentation | ||
sidebar_label: Introduction | ||
--- | ||
|
||
--- | ||
|
||
Welcome to the documentation for eMath.js - a JavaScript library for enhancing incremental game development. | ||
|
||
### Features | ||
|
||
- **Support for Node.js and HTML**: eMath.js can be used in both Node.js and HTML projects. | ||
|
||
- **Support for Typescript**: eMath.js exports type definitions to help develop your projects. | ||
|
||
- **Integration**: eMath.js integrates with break_eternity.js, providing a robust foundation for your game development projects. | ||
|
||
- **Advanced Formatting**: Enjoy advanced formatting capabilities to enhance the visual appeal of your in-game elements. | ||
|
||
- **Boosts, Currency, and Attributes Management**: Leverage eMath.js classes to effortlessly manage boosts, currency, and attributes within your game. | ||
|
||
### Getting Started | ||
|
||
To get started with eMath.js, check out the [installation guide](./install) and [basic usage examples](./usage). If you encounter any issues or have questions, feel free to explore the comprehensive documentation. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<script src="https://cdn.jsdelivr.net/gh/xShadowBlade/emath.js/dist/eMath.bundle.js"></script> | ||
<script src="./script.js"></script> | ||
</head> | ||
<body> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/* | ||
* In this example, we will create a button | ||
* that when pressed gives you coins that you can use | ||
* on an upgrade that gives you more coins on gain. | ||
*/ | ||
|
||
/* global window document eMath */ | ||
window.addEventListener("load", () => { | ||
const { E } = eMath; | ||
|
||
// Initialize currency and static currency | ||
|
||
const currency = new eMath.classes.currency(); | ||
const staticC = new eMath.classes.currencyStatic(() => currency); | ||
|
||
// Create Coins Display | ||
|
||
const coinsDisplay = document.createElement("p"); | ||
document.body.appendChild(coinsDisplay); | ||
coinsDisplay.id = "coinsDisplay"; | ||
|
||
// Function to update the coins display | ||
|
||
function updateDisplay () { | ||
document.getElementById("coinsDisplay").innerHTML = `Coins: ${currency.value.format()} (x${staticC.boost.calculate().format()})`; // Updates the display and shows the multiplier. Ex. "Coins: 2.00 (x1.0)" | ||
} | ||
updateDisplay(); | ||
|
||
// Create gain button | ||
|
||
const gainButton = document.createElement("button"); | ||
gainButton.innerHTML = "Gain Coins"; | ||
document.body.appendChild(gainButton); | ||
gainButton.addEventListener("click", () => { | ||
// Triggers when button is pressed | ||
staticC.gain(); // Gain | ||
updateDisplay(); // Updates the display for the amount of coins | ||
updateDisplayUpgrade(); | ||
}); | ||
|
||
// Upgrades | ||
|
||
staticC.addUpgrade([ | ||
{ | ||
name: "Basic Coin Boost", | ||
cost: E(10), | ||
costScaling: n => n.mul(2), | ||
maxLevel: E(1000), | ||
effect: function () { | ||
console.log(this); | ||
const level = this.getLevel(); | ||
console.log(level); | ||
|
||
staticC.boost.bSet( | ||
"boostUpg1Coins", | ||
"Basic Coin Boost", | ||
"Basic Coin Boost", | ||
n => E(n).plus(level).sub(1), | ||
1, | ||
); | ||
}, | ||
}, | ||
]); | ||
|
||
// Buy Upgrades button | ||
|
||
const buyUpgradesButton = document.createElement("button"); | ||
document.body.appendChild(buyUpgradesButton); | ||
buyUpgradesButton.id = "buyUpgradesButton"; | ||
function updateDisplayUpgrade () { | ||
document.getElementById("buyUpgradesButton").innerHTML = `Buy ${staticC.calculateUpgrade(0, 1)[0]} Upgrades for ${staticC.calculateUpgrade(0, 1)[1]} Coins`; | ||
} | ||
updateDisplayUpgrade(); | ||
buyUpgradesButton.addEventListener("click", () => { | ||
staticC.buyUpgrade(0, 100); | ||
updateDisplayUpgrade(); | ||
updateDisplay(); | ||
}); | ||
}); |
Oops, something went wrong.