npm.io
0.1.1 • Published 4 years ago

@arcade2d/utils

Licence
MIT
Version
0.1.1
Deps
0
Size
15 kB
Vulns
0
Weekly
0

@arcade2d/utils

Coverage Latest Release

Repository · Website

Game related utilities.

Installation

$ yarn add @arcade2d/utils

Examples

Efficient Mapped Lists
const list = new MappedList<number, string>();

list.add(123, 'abc');
list.add(456, 'def');

for (const { key, value } of list) {
  console.log(key, value);
}
Random Value Generation
const random = new RandomValueProvider();

console.log(random.generate()); // Value between 0 and <1.
console.log(random.inRectangle(10, 20, 100, 150)); // [x, y] tuple between the specified rectangle.