@arcade2d/utils
v0.1.1
Published
Provides game-related utilities like random number generation, efficient lists structures, etc.
Downloads
7
Readme
@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.