Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/excaliburjs/Excalibur. 🎮 Your friendly TypeScript 2D game engine for the web 🗡️ excaliburjs.com
excalibur excaliburjs game-development game-engine game-framework gamedev games html5-canvas typescript
Something went wrong. Try again.
TypeScript
12345678910111213141516171819202122232425/** * A 1 dimensional projection on an axis, used to test overlaps */
export class Projection { constructor( public min: number, public max: number ) {} public overlaps(projection: Projection): boolean { return this.max > projection.min && projection.max > this.min; }
public getOverlap(projection: Projection): number { if (this.overlaps(projection)) { if (this.max > projection.max) { return projection.max - this.min; } else { return this.max - projection.min; } } return 0; }}