slanted-gamedev-toolz
v1.0.23
Published
A slanted mix of tools for your brilliant ideas in game design.
Downloads
15
Maintainers
Readme
SlantedGameToolz
A collection of functions for use in games.
- dice
- weighted dice
- percentage
Install
$ yarn install
rollDice
A fair dice roll.
Usage
import { rollDice } from "slanted-gamedev-toolz";
const diceSides = 6
const diceRollOutcome = rollDice(diceSides);
Parameters
| Parameter | Description | | --------- | ------------------------------- | | diceSides | the amount of sides on the dice |
Return Value
| Type | Description | | ------ | --------------------------- | | number | the result of the dice roll |
rollLowWeightedDice
An unfair fair dice roll that is more likely to roll low.
Usage
import { rollLowWeightedDice } from "slanted-gamedev-toolz";
const diceSides = 6
const diceRollOutcome = rollLowWeightedDice(diceSides);
Parameters
| Parameter | Description | | --------- | ------------------------------- | | diceSides | the amount of sides on the dice |
Return Value
| Type | Description | | ------ | --------------------------- | | number | the result of the dice roll |
rollHighWeightedDice
An unfair fair dice roll that is more likely to roll high.
Usage
import { rollHighWeightedDice } from "slanted-gamedev-toolz";
const diceSides = 6
const diceRollOutcome = rollHighWeightedDice(diceSides);
Parameters
| Parameter | Description | | --------- | ------------------------------- | | diceSides | the amount of sides on the dice |
Return Value
| Type | Description | | ------ | --------------------------- | | number | the result of the dice roll |