1.0.1 • Published 4 years ago

game-engine-util v1.0.1

Weekly downloads
-
License
GNU
Repository
github
Last release
4 years ago

Game Engine Util

This is a simple library containing math functions and stuff you'd need for making nice game engines.

Documention

Everything in src/exports.js is well and self documented. If you want to see the functions and how to use them, look in there.

Motivation

Making these functions yourself is a pain in the ass which is why I just made the ones I made available for everyone.

Getting started

const util = require("game-engine-util");

const vec = new util.Vector2d(10.32, 47.47);
const vec2 = new util.Vector2d(0.32, 21);

util.getDistance2d(vec.x, vec.y, vec2.x, vec2.y); // 28.295952007310163

const line = new util.Line(vec, vec2);
const square = new util.Square(5, 40, 100, 100);

util.GetLineAndPolyCollision(line, square); // { bool: true, intersections: Vector2d { x: 7.497937287495278, y: 40 } }