0.1.1 • Published 2 years ago
@arcade2d/utils v0.1.1
@arcade2d/utils
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.