Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

craters.js

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

craters.js - npm Package Compare versions

Comparing version 1.2.1 to 1.2.2

CHANGELOG.md

9

craters/craters.js
// Craters.js micro game framework
// This module contains the core craters.js framework fundamentals
// it loads modules and exports them
import * as Vector from './math/vector.js'
import * as Maths from './math/math.js'
import * as Maths from './maths/common.js'
import {

@@ -39,3 +39,3 @@ Canvas,

static version() {
return '1.2.0'
return '1.2.2'
}

@@ -53,4 +53,3 @@ }

Sound,
Maths,
Vector
Maths
}

@@ -0,18 +1,11 @@

import * as Maths from './maths/common.js'
// Game
class Game {
constructor(container, width, height, fps, debug) {
constructor() {
this.entities = []
this.state = {
container: container,
size: {
x: 512,
y: 512
},
gravity: {
x: 0,
y: 0
},
friction: {
x: 0,
y: 0
}
size: new Maths.Vector(1024, 512),
gravity: new Maths.Vector(0, 0),
friction: new Maths.Vector(0, 0)
}

@@ -23,3 +16,3 @@ }

// used for adding entities
this.entities.push(obj)
return this.entities.push(obj)
}

@@ -29,9 +22,10 @@

// used to remove entities
this.entities.splice(index, 1)
return this.entities.splice(index, 1)
}
update() {
update(elapsed, fps) {
// Loop through all bodies and update one at a time
this.entities.forEach((body) => {
body.update()
body.state.loop = this.state.loop;
switch (body.type) {

@@ -42,11 +36,11 @@ case 'dynamic':

body.state.vel.y += body.state.accel.y + (body.state.gravity.y + this.state.gravity.y)
body.state.pos.x += body.state.vel.x
body.state.pos.y += body.state.vel.y
body.state.pos.x += (body.state.vel.x * (1 / ((body.state.loop.delta + body.state.loop.nframe) / 2)))
body.state.pos.y += (body.state.vel.y * (1 / ((body.state.loop.delta + body.state.loop.nframe) / 2)))
var fx = body.state.friction.x,
nx = body.state.vel.x + fx,
x = body.state.vel.x - fx,
fy = body.state.friction.y,
ny = body.state.vel.y + fy,
y = body.state.vel.y - fy;
var fx = body.state.friction.x
var nx = body.state.vel.x + fx
var x = body.state.vel.x - fx
var fy = body.state.friction.y
var ny = body.state.vel.y + fy
var y = body.state.vel.y - fy

@@ -56,3 +50,3 @@ body.state.vel.x = (

(x > 0) ? x : 0
);
)

@@ -62,7 +56,7 @@ body.state.vel.y = (

(y > 0) ? y : 0
);
)
break;
break
case 'kinematic':
// there's no force of gravity applied onto kinematic bodies
case 'static':
// there's no force of gravity applied onto static bodies
body.state.vel.x += body.state.accel.x

@@ -77,2 +71,4 @@ body.state.vel.y += body.state.accel.y

}
body.update()
})

@@ -89,22 +85,11 @@ }

// Entity
class Entity extends Game {
constructor() {
super()
this.state.size = {
x: 10,
y: 10
}
this.state.pos = {
x: 0,
y: 0
}
this.state.vel = {
x: 0,
y: 0
}
this.state.accel = {
x: 0,
y: 0
}
this.state.radius = 10
this.state.size = new Maths.Vector(20, 20)
this.state.pos = new Maths.Vector(0, 0)
this.state.vel = new Maths.Vector(0, 0)
this.state.accel = new Maths.Vector(0, 0)
this.state.radius = 20
this.state.angle = 0

@@ -115,2 +100,3 @@ this.type = 'dynamic'

// Sprite
class Sprite extends Entity {

@@ -121,14 +107,5 @@ constructor(scope, args) {

this.scope = scope
this.state.pos = args.pos || {
x: 0,
y: 0
}
this.state.crop = {
x: 0,
y: 0
}
this.state.size = args.size || {
x: 0,
y: 0
}
this.state.pos = args.pos || new Maths.Vector(0, 0)
this.state.crop = new Maths.Vector(0, 0)
this.state.size = args.size || new Maths.Vector(0, 0)

@@ -135,0 +112,0 @@ this.state.frames = args.frames || []

@@ -10,2 +10,3 @@ // Game Loop Module

tframe: (1000 / tframe),
nframe: tframe,
before: window.performance.now()

@@ -17,3 +18,3 @@ }

loop.startLoop = window.requestAnimationFrame(loop.main)
loop.fps = Math.round(((1000 / (window.performance.now() - loop.before) * 100) / 100))
loop.delta = Math.round(((1000 / (window.performance.now() - loop.before) * 100) / 100))

@@ -27,7 +28,9 @@ if (window.performance.now() < loop.before + loop.tframe) return

}
// update scope
scope.state.loop = loop;
// Update the game state
scope.update(loop.elapsed, loop.fps)
scope.update(loop.elapsed, loop.delta)
// Render the next frame
scope.render(loop.elapsed, loop.fps)
scope.render(loop.elapsed, loop.delta)
loop.elapsed++

@@ -80,3 +83,4 @@ }

canvas.clear = (w, x, y, z) => {
canvas.clear = (v, w, x, y, z) => {
v = v || null
w = w || 0

@@ -86,3 +90,12 @@ x = x || 0

z = z || canvas.height
canvas.context.clearRect(w, x, y, z)
if (v) { // clear with color if true
canvas.context.save();
canvas.context.fillStyle = v;
canvas.context.fillRect(w, x, y, z)
canvas.context.fill();
canvas.context.restore();
} else {
canvas.context.clearRect(w, x, y, z)
};
}

@@ -89,0 +102,0 @@

var Craters = (function (exports) {
'use strict';
const degToRad = function(angle) {
return angle * Math.PI / 180;
};
const radToDeg = function(angle) {
return angle * 180 / Math.PI;
};
const distance = function(x1, y1, x2, y2) {
return Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
};
const map = function(value, low1, high1, low2, high2) {
return low2 + (high2 - low2) * (value - low1) / (high1 - low1);
};
const boundary = function(value, min, max) {
return Math.min(Math.max(value, min), max)
};
/**
* Generic Vector class
*
*
* @example
* import vector, {Vector} from 'Vector';
*
* Instantiate new objects in the following ways
* 1. use vector convenience function like so: vector(x, y);
* 2. use Vector object directly like: new Vector(x, y);
*
* Methods on a newly created vector, such as .add or .subtract
* modify the x and y properties on that vector, changing them forever
* i.e.
* let vec1 = vector(0, 0);
* let vec2 = vector(10, 20);
* vec1.add(vec2);
*
* Results in vec1.x = 10 and vec1.y = 20. vec2 is unmodified
*
* To perform an operation on two vectors and return a new vector,
* without modifying the input vectors, use the methods on {Vector}
* i.e.
* let vec1 = vector(0, 0);
* let vec2 = vector(10, 20);
* let vec3 = Vector.add(vec1, vec2);
*
* Results in vec1 and vec2 remining unmodified,
* and vec3.x = 10 and vec3.y = 20
*
*/
// import {radToDeg} from './math';
/**
* Base Vector constructor
* @constructor
* @param {number} x - x coordinate
* @param {number} y - y coordinate
*/
const Vector = function(x, y) {
this.x = x || 0;
this.y = y || 0;
};
/**
* Prototype object for all Vectors
*/
Vector.prototype = {
/**
* Return a copy of a vector
* @method
* @return {Vector} a new vector object
*/
clone: function() {
return new Vector(this.x, this.y);
},
/**
* Generic Setter
* @method
* @param {string} prop - property to set
* @param {*} val - value to set
* @return {This} for chaining
*/
set: function(prop, val) {
if (prop === 'x') {
this.x = val;
} else if (prop === 'y') {
this.y = val;
}
return this;
},
/**
* Add another vector to this vector, modifying internal
* properties
* @method
* @param {Vector} vec - vector to add
* @return {This} for chaining
*/
add: function() {
let args = arguments;
let x, y;
if (args.length === 1) {
let vec = args[0];
if (typeof vec === 'object') {
x = vec.x;
y = vec.y;
}
} else if (args.length === 2) {
if (typeof args[0] === 'number' && typeof args[1] === 'number') {
x = args[0];
y = args[1];
}
}
this.x += x;
this.y += y;
return this;
},
/**
* Subtract another vector from this vector
* @method
* @param {Vector} vec - vector to subtract
* @return {This} for chaining
*/
subtract: function(vec) {
this.x -= vec.x;
this.y -= vec.y;
return this;
},
/**
* Multiply another vector by this vector or scalar
* modifies internal properties
* @param {Vector|number} vec - either Vector object or single scalar
* @return {This} for chaining
*/
multiply: function(vec) {
if (typeof vec === 'object') {
this.x *= vec.x;
this.y *= vec.y;
} else if (typeof vec === 'number') {
this.x *= vec;
this.y *= vec;
}
return this;
},
/**
* Gives the magnitude (length, essentially) of the vector
* @method
* @return {number} magnitude of the vector
*/
magnitude: function() {
return Math.sqrt(this.x * this.x + this.y * this.y);
},
/**
* Magnitude squared - useful when trying to save on computation
* @method
* @return {number} mag squared
*/
magnitudeSq: function() {
return this.x * this.x + this.y * this.y;
},
/**
* Negate both x and y values (essentially rotate vector 180 degrees)
* @method
* @return {Vector} for method chaining
*/
negate: function() {
this.x = -this.x;
this.y = -this.y;
return this;
},
/**
* Translate to specified x and y points
* @param {number} x - amount to move in the x
* @param {number} y - amount to move in the y
* @return {This} for chaining
*/
// translate:
// function(x, y) {
// this.x += x;
// this.y += y;
// return this;
// },
/**
* Rotate vector around specified point of rotation
* Note: Will rotate around origin
* @param {number} angle - amount of rotation in radians
* @return {This} for chaining
*/
rotate: function(angle) {
let sin = Math.sin(angle);
let cos = Math.cos(angle);
let x = (this.x * cos) - (this.y * sin);
let y = (this.x * sin) + (this.y * cos);
this.x = x;
this.y = y;
return this;
},
/**
* Dot product between two vectors
* Does NOT modify internal state
* @param {Vector} vec - the vector to dot with
* @return {number} dot product
*/
dot: function(vec) {
return this.x * vec.x + this.y * vec.y;
},
/**
* Cross product between two vectors
* Does NOT modify internal state
* @method
* @param {Vector} vec - the vec to cross with
* @return {number} cross product
*/
cross: function(vec) {
return this.x * vec.y - this.y * vec.x;
},
/**
* Return angle between two vectors in radians
* @param {Vector} vec - vector to find angle to
* @return {number} theta - radians between two vectors
*/
angleTo: function(vec) {
let a = this.magnitude();
let b = vec.magnitude();
let d = this.dot(vec);
let theta = Math.acos(d / (a * b));
return theta;
},
/**
* Return angle from 0 of this vector
* @method
* @param {string} [mode] - if mode = 'DEGREES', return value will be in
* degrees, otherwise radians
* @return {number} angle in degrees or radians (depending on mode)
*
*/
getAngle: function(mode) {
if (mode === 'DEGREES') {
return radToDeg(Math.atan(this.y / this.x));
}
let a = Math.atan2(this.y, this.x);
//return a;
return a < 0 ? Math.PI * 2 + a : a;
},
/**
* Convert to a unit vector
* i.e. change length of vector to 1
* @method
* @return {This} for chaining
*/
normalize: function() {
let mag = this.magnitude();
this.x /= mag;
this.y /= mag;
return this;
},
/**
* Create normal vector based on current vector
* Modifies internal state!
* @param {string} side - specify 'left' or 'right' normal
* @return {This} for chaining
*/
perp: function(side) {
if (side === 'right') {
let tmp = this.x;
this.x = this.y;
this.y = -tmp;
} else {
let tmp = this.x;
this.x = -this.y;
this.y = tmp;
}
return this;
},
/**
* Calculate euclidian distance between two vectors
* @param {Vector} vec - vector to find distance to
* @return {number} euclidean distance
*/
distanceTo: function(vec) {
return Math.sqrt((vec.x - this.x) * (vec.x - this.x) + (vec.y - this.y) * (vec.y - this.y));
},
/**
* Scalar Projection of A onto B assuming B is NOT a unit vector
* @param {Vector} vec - the vector to project onto
* @return {number} component of A on B
*/
scalarProject: function(vec) {
return this.dot(vec) / vec.magnitude();
},
/**
* Calculate Scalar projection of A onto B assuming that B is a unit vector
* This is more efficient assuming we already have a unit vector
* @param {Vector} vec - the unit vector to project onto
* @return {number} component of A on B
*/
scalarProjectUnit: function(vec) {
return this.dot(vec);
},
/**
* Vector Projection of A onto B assuming B is NOT a unit vector
* @param {Vector} vec - vector to project onto
* @return {This} for chaining
*/
vectorProject: function(vec) {
let scalarComp = this.dot(vec) / vec.magnitudeSq();
this.x = vec.x * scalarComp;
this.y = vec.y * scalarComp;
return this;
},
/**
* Vector Projection of A onto B assuming B IS a unit vector
* @param {Vector} vec - vector to project onto
* @return {This} for chaining
*/
vectorProjectUnit: function(vec) {
let scalarComp = this.dot(vec);
this.x = vec.x * scalarComp;
this.y = vec.y * scalarComp;
return this;
}
};
Vector.prototype.translate = Vector.prototype.add;
// ---------- Static Methods -----------//
/**
* @static
* @param {Vector} v1 - first Vector obj
* @param {Vector} v2 - second Vector obj
* @return {Vector}
*
* Adds two vectors, and returns a new one
*/
Vector.add = function(v1, v2) {
return new Vector(v1.x + v2.x, v1.y + v2.y);
};
Vector.subtract = function(v1, v2) {
return new Vector(v1.x - v2.x, v1.y - v2.y);
};
Vector.multiply = function(v1, v2) {
if (typeof v1 === 'number' && typeof v2 === 'number') {
return v1 * v2;
}
if (typeof v1 === 'object' && typeof v2 === 'number') {
return new Vector(v1.x * v2, v1.y * v2);
}
if (typeof v2 === 'object' && typeof v1 === 'number') {
return new Vector(v1 * v2.x, v1 * v2.y);
}
return new Vector(v1.x * v2.x, v1.y * v2.y);
};
Vector.dot = function(v1, v2) {
return v1.x * v2.x + v1.y * v2.y;
};
Vector.angleBetween = function(v1, v2) {
let a = v1.magnitude();
let b = v2.magnitude();
let d = v1.dot(v2);
let theta = Math.acos(d / (a * b));
return theta;
};
Vector.perp = function(v1, side) {
switch (side) {
case 'right':
return new Vector(v1.y, -v1.x);
default:
return new Vector(-v1.y, v1.x);
}
};
Vector.negate = function(v) {
return new Vector(-v.x, -v.y);
};
var common = /*#__PURE__*/Object.freeze({
Vector: Vector,
boundary: boundary,
degToRad: degToRad,
radToDeg: radToDeg,
distance: distance,
map: map
});
// Game Loop Module

@@ -13,2 +426,3 @@ // This module contains the game loop, which handles

tframe: (1000 / tframe),
nframe: tframe,
before: window.performance.now()

@@ -20,3 +434,3 @@ };

loop.startLoop = window.requestAnimationFrame(loop.main);
loop.fps = Math.round(((1000 / (window.performance.now() - loop.before) * 100) / 100));
loop.delta = Math.round(((1000 / (window.performance.now() - loop.before) * 100) / 100));

@@ -30,7 +444,9 @@ if (window.performance.now() < loop.before + loop.tframe) return

};
// update scope
scope.state.loop = loop;
// Update the game state
scope.update(loop.elapsed, loop.fps);
scope.update(loop.elapsed, loop.delta);
// Render the next frame
scope.render(loop.elapsed, loop.fps);
scope.render(loop.elapsed, loop.delta);
loop.elapsed++;

@@ -83,3 +499,4 @@ };

canvas.clear = (w, x, y, z) => {
canvas.clear = (v, w, x, y, z) => {
v = v || null;
w = w || 0;

@@ -89,5 +506,13 @@ x = x || 0;

z = z || canvas.height;
canvas.context.clearRect(w, x, y, z);
};
if (v) { // clear with color if true
canvas.context.save();
canvas.context.fillStyle = v;
canvas.context.fillRect(w, x, y, z);
canvas.context.fill();
canvas.context.restore();
} else {
canvas.context.clearRect(w, x, y, z);
} };
canvas.camera = (x, y) => {

@@ -102,15 +527,10 @@ canvas.context.setTransform(1, 0, 0, 1, 0, 0); // reset the transform matrix

// Game
class Game {
constructor(container, width, height, fps, debug) {
constructor() {
this.entities = [];
this.state = {
container: container,
size: {
x: 512,
y: 512
},
gravity: {
x: 0,
y: 0
}
size: new Vector(1024, 512),
gravity: new Vector(0, 0),
friction: new Vector(0, 0)
};

@@ -121,3 +541,3 @@ }

// used for adding entities
this.entities.push(obj);
return this.entities.push(obj)
}

@@ -127,9 +547,10 @@

// used to remove entities
this.entities.splice(index, 1);
return this.entities.splice(index, 1)
}
update() {
update(elapsed, fps) {
// Loop through all bodies and update one at a time
this.entities.forEach((body) => {
body.update();
body.state.loop = this.state.loop;
switch (body.type) {

@@ -140,8 +561,25 @@ case 'dynamic':

body.state.vel.y += body.state.accel.y + (body.state.gravity.y + this.state.gravity.y);
body.state.pos.x += body.state.vel.x;
body.state.pos.y += body.state.vel.y;
body.state.pos.x += (body.state.vel.x * (1 / ((body.state.loop.delta + body.state.loop.nframe) / 2)));
body.state.pos.y += (body.state.vel.y * (1 / ((body.state.loop.delta + body.state.loop.nframe) / 2)));
break
case 'kinematic':
// there's no force of gravity applied onto kinematic bodies
var fx = body.state.friction.x;
var nx = body.state.vel.x + fx;
var x = body.state.vel.x - fx;
var fy = body.state.friction.y;
var ny = body.state.vel.y + fy;
var y = body.state.vel.y - fy;
body.state.vel.x = (
(nx < 0) ? nx :
(x > 0) ? x : 0
);
body.state.vel.y = (
(ny < 0) ? ny :
(y > 0) ? y : 0
);
break;
case 'static':
// there's no force of gravity applied onto static bodies
body.state.vel.x += body.state.accel.x;

@@ -156,2 +594,4 @@ body.state.vel.y += body.state.accel.y;

}
body.update();
});

@@ -168,22 +608,11 @@ }

// Entity
class Entity extends Game {
constructor() {
super();
this.state.size = {
x: 10,
y: 10
};
this.state.pos = {
x: 0,
y: 0
};
this.state.vel = {
x: 0,
y: 0
};
this.state.accel = {
x: 0,
y: 0
};
this.state.radius = 10;
this.state.size = new Vector(20, 20);
this.state.pos = new Vector(0, 0);
this.state.vel = new Vector(0, 0);
this.state.accel = new Vector(0, 0);
this.state.radius = 20;
this.state.angle = 0;

@@ -194,2 +623,3 @@ this.type = 'dynamic';

// Sprite
class Sprite extends Entity {

@@ -200,14 +630,5 @@ constructor(scope, args) {

this.scope = scope;
this.state.pos = args.pos || {
x: 0,
y: 0
};
this.state.crop = {
x: 0,
y: 0
};
this.state.size = args.size || {
x: 0,
y: 0
};
this.state.pos = args.pos || new Vector(0, 0);
this.state.crop = new Vector(0, 0);
this.state.size = args.size || new Vector(0, 0);

@@ -386,8 +807,2 @@ this.state.frames = args.frames || [];

const boundary = function numberboundary(min, max) {
return Math.min(Math.max(this, min), max)
};
// Expose methods
Number.prototype.boundary = boundary;
if (typeof window === 'undefined' && global) {

@@ -410,3 +825,3 @@ global.window = {

static version() {
return '1.2.0'
return '1.2.2'
}

@@ -421,2 +836,3 @@ }

exports.Loop = Loop;
exports.Maths = common;
exports.Sound = Sound;

@@ -423,0 +839,0 @@ exports.Sprite = Sprite;

@@ -1,1 +0,1 @@

!function(t){var e={};function n(s){if(e[s])return e[s].exports;var i=e[s]={i:s,l:!1,exports:{}};return t[s].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=t,n.c=e,n.d=function(t,e,s){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:s})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var s=Object.create(null);if(n.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(s,i,function(e){return t[e]}.bind(null,i));return s},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=1)}([function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){(function(t,e){!function(n){"use strict";class s{constructor(t,e,n,s,i){this.entities=[],this.state={container:t,size:{x:512,y:512},gravity:{x:0,y:0}}}addObject(t){this.entities.push(t)}removeObject(t){this.entities.splice(t,1)}update(){this.entities.forEach(t=>{switch(t.update(),t.type){case"dynamic":t.state.vel.x+=t.state.accel.x+(t.state.gravity.x+this.state.gravity.x),t.state.vel.y+=t.state.accel.y+(t.state.gravity.y+this.state.gravity.y),t.state.pos.x+=t.state.vel.x,t.state.pos.y+=t.state.vel.y;break;case"kinematic":t.state.vel.x+=t.state.accel.x,t.state.vel.y+=t.state.accel.y,t.state.pos.x+=t.state.vel.x,t.state.pos.y+=t.state.vel.y}})}render(){this.entities.forEach(t=>{t.render()})}}class i extends s{constructor(){super(),this.state.size={x:10,y:10},this.state.pos={x:0,y:0},this.state.vel={x:0,y:0},this.state.accel={x:0,y:0},this.state.radius=10,this.state.angle=0,this.type="dynamic"}}Number.prototype.boundary=function(t,e){return Math.min(Math.max(this,t),e)},"undefined"==typeof window&&t&&(t.window={performance:{now:function(t){if(!t)return Date.now();var e=Date.now(t);return Math.round(1e3*e[0]+e[1]/1e6)}},requestAnimationFrame:function(t){e(()=>t(this.performance.now()))}});n.Canvas=class{constructor(t,e,n){n=document.querySelector(n||"body");var s=document.createElement("canvas"),i=s.getContext("2d"),r=window.devicePixelRatio/["webkitBackingStorePixelRatio","mozBackingStorePixelRatio","msBackingStorePixelRatio","oBackingStorePixelRatio","backingStorePixelRatio"].reduce(function(t,e){return Object.prototype.hasOwnProperty.call(i,e)?i[e]:1});return s.width=Math.round(t*r),s.height=Math.round(e*r),s.style.width=t+"px",s.style.height=e+"px",i.setTransform(r,0,0,r,0,0),n.insertBefore(s,n.firstChild),s.context=s.getContext("2d"),s.resize=(t,e)=>{s.style.width=e.x+"px",s.style.height=e.y+"px",s.width=Math.round(e.x*r),s.height=Math.round(e.y*r),i.setTransform(r,0,0,r,0,0),t.state.size.x=e.x,t.state.size.y=e.y},s.clear=(t,e,n,i)=>{t=t||0,e=e||0,n=n||s.width,i=i||s.height,s.context.clearRect(t,e,n,i)},s.camera=(t,e)=>{s.context.setTransform(1,0,0,1,0,0),s.context.translate(-t,-e)},s}},n.Craters=class{static version(){return"1.2.0"}},n.Entity=i,n.Game=s,n.Loader=class{constructor(){this.rescache={}}load(t,e){var n=this;t instanceof Array?t.forEach(function(t){n.rescache[t]=!1,n.fetch(t,e)}):(n.rescache[t]=!1,n.fetch(t,e))}fetch(t,e){var n=this;if(n.rescache[t])return n.rescache[t];var s=new Image;s.onload=function(){n.rescache[t]=s,n.ready(e)},s.src=t}ready(t){if("function"==typeof t){var e=!0;for(var n in this.rescache)Object.prototype.hasOwnProperty.call(this.rescache,n)&&!this.rescache[n]&&(e=!1);e&&t()}}},n.Loop=class{constructor(t,e){var n={elapsed:0,tframe:1e3/e,before:window.performance.now(),main:function(){n.startLoop=window.requestAnimationFrame(n.main),n.fps=Math.round(1e3/(window.performance.now()-n.before)*100/100),window.performance.now()<n.before+n.tframe||(n.before=window.performance.now(),n.stopLoop=()=>{window.cancelAnimationFrame(n.startLoop)},t.update(n.elapsed,n.fps),t.render(n.elapsed,n.fps),n.elapsed++)}};return n.main(),n}},n.Sound=class{constructor(){this.sounds={},this.instances=[],this.defaultVolume=1}load(t,e,n){if(this.sounds[t]=new Audio(e),"function"!=typeof n)return new Promise((e,n)=>{this.sounds[t].addEventListener("canplaythrough",e),this.sounds[t].addEventListener("error",n)});this.sounds[t].addEventListener("canplaythrough",n)}remove(t){void 0!==this.sounds&&delete this.sounds[t]}unlock(t,e,n,s){var i=this,r=["touchstart","touchend","mousedown","keydown"],o=function o(){r.forEach(function(t){document.body.removeEventListener(t,o)}),i.play(t,e,n,s)};r.forEach(function(t){document.body.addEventListener(t,o,!1)})}play(t,e,n,s){if(s=s||!1,void 0===this.sounds[t])return console.error("Can't find sound called '"+t+"'."),!1;var i=this.sounds[t].cloneNode(!0);return i.volume="number"==typeof n?n:this.defaultVolume,i.loop=s,i.play(),this.instances.push(i),i.addEventListener("ended",()=>{var t=this.instances.indexOf(i);-1!==t&&this.instances.splice(t,1)}),"function"==typeof e?(i.addEventListener("ended",e),!0):new Promise((t,e)=>i.addEventListener("ended",t))}stopAll(){var t=this.instances.slice();for(var e of t)e.pause(),e.dispatchEvent(new Event("ended"))}},n.Sprite=class extends i{constructor(t,e){super(),this.scope=t,this.state.pos=e.pos||{x:0,y:0},this.state.crop={x:0,y:0},this.state.size=e.size||{x:0,y:0},this.state.frames=e.frames||[],this.state.angle=e.angle||0,this.state.image=e.image||new Image,this.state.delay=e.delay||5,this.state.tick=e.tick||0,this.state.orientation=e.orientation||"horizontal"}update(){super.update(),this.state.tick<=0&&("vertical"===this.orientation?(this.state.crop.y=this.state.frames.shift(),this.state.frames.push(this.state.crop.y)):(this.state.crop.x=this.state.frames.shift(),this.state.frames.push(this.state.crop.x)),this.state.tick=this.state.delay),this.state.tick--}render(){super.render(),this.scope.context.save(),this.scope.context.translate(this.state.crop.x+this.state.size.x/2,this.state.crop.y+this.state.size.y/2),this.scope.context.rotate(this.state.angle*(Math.PI/180)),this.scope.context.translate(-(this.state.crop.x+this.state.size.x/2),-(this.state.crop.y+this.state.size.y/2)),this.scope.context.drawImage(this.state.image,this.state.crop.x*this.state.size.x,this.state.crop.y*this.state.size.y,this.state.size.x,this.state.size.y,this.state.pos.x,this.state.pos.y,this.state.size.x,this.state.size.y),this.scope.context.restore()}}}({})}).call(this,n(0),n(2).setImmediate)},function(t,e,n){(function(t){var s=void 0!==t&&t||"undefined"!=typeof self&&self||window,i=Function.prototype.apply;function r(t,e){this._id=t,this._clearFn=e}e.setTimeout=function(){return new r(i.call(setTimeout,s,arguments),clearTimeout)},e.setInterval=function(){return new r(i.call(setInterval,s,arguments),clearInterval)},e.clearTimeout=e.clearInterval=function(t){t&&t.close()},r.prototype.unref=r.prototype.ref=function(){},r.prototype.close=function(){this._clearFn.call(s,this._id)},e.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},e.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},e._unrefActive=e.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout(function(){t._onTimeout&&t._onTimeout()},e))},n(3),e.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,e.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(this,n(0))},function(t,e,n){(function(t,e){!function(t,n){"use strict";if(!t.setImmediate){var s,i,r,o,a,c=1,u={},l=!1,h=t.document,d=Object.getPrototypeOf&&Object.getPrototypeOf(t);d=d&&d.setTimeout?d:t,"[object process]"==={}.toString.call(t.process)?s=function(t){e.nextTick(function(){p(t)})}:!function(){if(t.postMessage&&!t.importScripts){var e=!0,n=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=n,e}}()?t.MessageChannel?((r=new MessageChannel).port1.onmessage=function(t){p(t.data)},s=function(t){r.port2.postMessage(t)}):h&&"onreadystatechange"in h.createElement("script")?(i=h.documentElement,s=function(t){var e=h.createElement("script");e.onreadystatechange=function(){p(t),e.onreadystatechange=null,i.removeChild(e),e=null},i.appendChild(e)}):s=function(t){setTimeout(p,0,t)}:(o="setImmediate$"+Math.random()+"$",a=function(e){e.source===t&&"string"==typeof e.data&&0===e.data.indexOf(o)&&p(+e.data.slice(o.length))},t.addEventListener?t.addEventListener("message",a,!1):t.attachEvent("onmessage",a),s=function(e){t.postMessage(o+e,"*")}),d.setImmediate=function(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),n=0;n<e.length;n++)e[n]=arguments[n+1];var i={callback:t,args:e};return u[c]=i,s(c),c++},d.clearImmediate=f}function f(t){delete u[t]}function p(t){if(l)setTimeout(p,0,t);else{var e=u[t];if(e){l=!0;try{!function(t){var e=t.callback,s=t.args;switch(s.length){case 0:e();break;case 1:e(s[0]);break;case 2:e(s[0],s[1]);break;case 3:e(s[0],s[1],s[2]);break;default:e.apply(n,s)}}(e)}finally{f(t),l=!1}}}}}("undefined"==typeof self?void 0===t?this:t:self)}).call(this,n(0),n(4))},function(t,e){var n,s,i=t.exports={};function r(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function a(t){if(n===setTimeout)return setTimeout(t,0);if((n===r||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:r}catch(t){n=r}try{s="function"==typeof clearTimeout?clearTimeout:o}catch(t){s=o}}();var c,u=[],l=!1,h=-1;function d(){l&&c&&(l=!1,c.length?u=c.concat(u):h=-1,u.length&&f())}function f(){if(!l){var t=a(d);l=!0;for(var e=u.length;e;){for(c=u,u=[];++h<e;)c&&c[h].run();h=-1,e=u.length}c=null,l=!1,function(t){if(s===clearTimeout)return clearTimeout(t);if((s===o||!s)&&clearTimeout)return s=clearTimeout,clearTimeout(t);try{s(t)}catch(e){try{return s.call(null,t)}catch(e){return s.call(this,t)}}}(t)}}function p(t,e){this.fun=t,this.array=e}function m(){}i.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];u.push(new p(t,e)),1!==u.length||l||a(f)},p.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=m,i.addListener=m,i.once=m,i.off=m,i.removeListener=m,i.removeAllListeners=m,i.emit=m,i.prependListener=m,i.prependOnceListener=m,i.listeners=function(t){return[]},i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}}]);
!function(t){var e={};function n(i){if(e[i])return e[i].exports;var s=e[i]={i:i,l:!1,exports:{}};return t[i].call(s.exports,s,s.exports,n),s.l=!0,s.exports}n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var s in t)n.d(i,s,function(e){return t[e]}.bind(null,s));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=1)}([function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){(function(t,e){!function(n){"use strict";const i=function(t){return 180*t/Math.PI},s=function(t,e){this.x=t||0,this.y=e||0};s.prototype={clone:function(){return new s(this.x,this.y)},set:function(t,e){return"x"===t?this.x=e:"y"===t&&(this.y=e),this},add:function(){let t,e,n=arguments;if(1===n.length){let i=n[0];"object"==typeof i&&(t=i.x,e=i.y)}else 2===n.length&&"number"==typeof n[0]&&"number"==typeof n[1]&&(t=n[0],e=n[1]);return this.x+=t,this.y+=e,this},subtract:function(t){return this.x-=t.x,this.y-=t.y,this},multiply:function(t){return"object"==typeof t?(this.x*=t.x,this.y*=t.y):"number"==typeof t&&(this.x*=t,this.y*=t),this},magnitude:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},magnitudeSq:function(){return this.x*this.x+this.y*this.y},negate:function(){return this.x=-this.x,this.y=-this.y,this},rotate:function(t){let e=Math.sin(t),n=Math.cos(t),i=this.x*n-this.y*e,s=this.x*e+this.y*n;return this.x=i,this.y=s,this},dot:function(t){return this.x*t.x+this.y*t.y},cross:function(t){return this.x*t.y-this.y*t.x},angleTo:function(t){let e=this.magnitude(),n=t.magnitude(),i=this.dot(t);return Math.acos(i/(e*n))},getAngle:function(t){if("DEGREES"===t)return i(Math.atan(this.y/this.x));let e=Math.atan2(this.y,this.x);return e<0?2*Math.PI+e:e},normalize:function(){let t=this.magnitude();return this.x/=t,this.y/=t,this},perp:function(t){if("right"===t){let t=this.x;this.x=this.y,this.y=-t}else{let t=this.x;this.x=-this.y,this.y=t}return this},distanceTo:function(t){return Math.sqrt((t.x-this.x)*(t.x-this.x)+(t.y-this.y)*(t.y-this.y))},scalarProject:function(t){return this.dot(t)/t.magnitude()},scalarProjectUnit:function(t){return this.dot(t)},vectorProject:function(t){let e=this.dot(t)/t.magnitudeSq();return this.x=t.x*e,this.y=t.y*e,this},vectorProjectUnit:function(t){let e=this.dot(t);return this.x=t.x*e,this.y=t.y*e,this}},s.prototype.translate=s.prototype.add,s.add=function(t,e){return new s(t.x+e.x,t.y+e.y)},s.subtract=function(t,e){return new s(t.x-e.x,t.y-e.y)},s.multiply=function(t,e){return"number"==typeof t&&"number"==typeof e?t*e:"object"==typeof t&&"number"==typeof e?new s(t.x*e,t.y*e):"object"==typeof e&&"number"==typeof t?new s(t*e.x,t*e.y):new s(t.x*e.x,t.y*e.y)},s.dot=function(t,e){return t.x*e.x+t.y*e.y},s.angleBetween=function(t,e){let n=t.magnitude(),i=e.magnitude(),s=t.dot(e);return Math.acos(s/(n*i))},s.perp=function(t,e){switch(e){case"right":return new s(t.y,-t.x);default:return new s(-t.y,t.x)}},s.negate=function(t){return new s(-t.x,-t.y)};var r=Object.freeze({Vector:s,boundary:function(t,e,n){return Math.min(Math.max(t,e),n)},degToRad:function(t){return t*Math.PI/180},radToDeg:i,distance:function(t,e,n,i){return Math.sqrt((n-t)*(n-t)+(i-e)*(i-e))},map:function(t,e,n,i,s){return i+(s-i)*(t-e)/(n-e)}});class o{constructor(){this.entities=[],this.state={size:new s(1024,512),gravity:new s(0,0),friction:new s(0,0)}}addObject(t){return this.entities.push(t)}removeObject(t){return this.entities.splice(t,1)}update(t,e){this.entities.forEach(t=>{switch(t.state.loop=this.state.loop,t.type){case"dynamic":t.state.vel.x+=t.state.accel.x+(t.state.gravity.x+this.state.gravity.x),t.state.vel.y+=t.state.accel.y+(t.state.gravity.y+this.state.gravity.y),t.state.pos.x+=t.state.vel.x*(1/((t.state.loop.delta+t.state.loop.nframe)/2)),t.state.pos.y+=t.state.vel.y*(1/((t.state.loop.delta+t.state.loop.nframe)/2));var e=t.state.friction.x,n=t.state.vel.x+e,i=t.state.vel.x-e,s=t.state.friction.y,r=t.state.vel.y+s,o=t.state.vel.y-s;t.state.vel.x=n<0?n:i>0?i:0,t.state.vel.y=r<0?r:o>0?o:0;break;case"static":t.state.vel.x+=t.state.accel.x,t.state.vel.y+=t.state.accel.y,t.state.pos.x+=t.state.vel.x,t.state.pos.y+=t.state.vel.y}t.update()})}render(){this.entities.forEach(t=>{t.render()})}}class a extends o{constructor(){super(),this.state.size=new s(20,20),this.state.pos=new s(0,0),this.state.vel=new s(0,0),this.state.accel=new s(0,0),this.state.radius=20,this.state.angle=0,this.type="dynamic"}}"undefined"==typeof window&&t&&(t.window={performance:{now:function(t){if(!t)return Date.now();var e=Date.now(t);return Math.round(1e3*e[0]+e[1]/1e6)}},requestAnimationFrame:function(t){e(()=>t(this.performance.now()))}});n.Canvas=class{constructor(t,e,n){n=document.querySelector(n||"body");var i=document.createElement("canvas"),s=i.getContext("2d"),r=window.devicePixelRatio/["webkitBackingStorePixelRatio","mozBackingStorePixelRatio","msBackingStorePixelRatio","oBackingStorePixelRatio","backingStorePixelRatio"].reduce(function(t,e){return Object.prototype.hasOwnProperty.call(s,e)?s[e]:1});return i.width=Math.round(t*r),i.height=Math.round(e*r),i.style.width=t+"px",i.style.height=e+"px",s.setTransform(r,0,0,r,0,0),n.insertBefore(i,n.firstChild),i.context=i.getContext("2d"),i.resize=(t,e)=>{i.style.width=e.x+"px",i.style.height=e.y+"px",i.width=Math.round(e.x*r),i.height=Math.round(e.y*r),s.setTransform(r,0,0,r,0,0),t.state.size.x=e.x,t.state.size.y=e.y},i.clear=(t,e,n,s,r)=>{t=t||null,e=e||0,n=n||0,s=s||i.width,r=r||i.height,t?(i.context.save(),i.context.fillStyle=t,i.context.fillRect(e,n,s,r),i.context.fill(),i.context.restore()):i.context.clearRect(e,n,s,r)},i.camera=(t,e)=>{i.context.setTransform(1,0,0,1,0,0),i.context.translate(-t,-e)},i}},n.Craters=class{static version(){return"1.2.2"}},n.Entity=a,n.Game=o,n.Loader=class{constructor(){this.rescache={}}load(t,e){var n=this;t instanceof Array?t.forEach(function(t){n.rescache[t]=!1,n.fetch(t,e)}):(n.rescache[t]=!1,n.fetch(t,e))}fetch(t,e){var n=this;if(n.rescache[t])return n.rescache[t];var i=new Image;i.onload=function(){n.rescache[t]=i,n.ready(e)},i.src=t}ready(t){if("function"==typeof t){var e=!0;for(var n in this.rescache)Object.prototype.hasOwnProperty.call(this.rescache,n)&&!this.rescache[n]&&(e=!1);e&&t()}}},n.Loop=class{constructor(t,e){var n={elapsed:0,tframe:1e3/e,nframe:e,before:window.performance.now(),main:function(){n.startLoop=window.requestAnimationFrame(n.main),n.delta=Math.round(1e3/(window.performance.now()-n.before)*100/100),window.performance.now()<n.before+n.tframe||(n.before=window.performance.now(),n.stopLoop=()=>{window.cancelAnimationFrame(n.startLoop)},t.state.loop=n,t.update(n.elapsed,n.delta),t.render(n.elapsed,n.delta),n.elapsed++)}};return n.main(),n}},n.Maths=r,n.Sound=class{constructor(){this.sounds={},this.instances=[],this.defaultVolume=1}load(t,e,n){if(this.sounds[t]=new Audio(e),"function"!=typeof n)return new Promise((e,n)=>{this.sounds[t].addEventListener("canplaythrough",e),this.sounds[t].addEventListener("error",n)});this.sounds[t].addEventListener("canplaythrough",n)}remove(t){void 0!==this.sounds&&delete this.sounds[t]}unlock(t,e,n,i){var s=this,r=["touchstart","touchend","mousedown","keydown"],o=function o(){r.forEach(function(t){document.body.removeEventListener(t,o)}),s.play(t,e,n,i)};r.forEach(function(t){document.body.addEventListener(t,o,!1)})}play(t,e,n,i){if(i=i||!1,void 0===this.sounds[t])return console.error("Can't find sound called '"+t+"'."),!1;var s=this.sounds[t].cloneNode(!0);return s.volume="number"==typeof n?n:this.defaultVolume,s.loop=i,s.play(),this.instances.push(s),s.addEventListener("ended",()=>{var t=this.instances.indexOf(s);-1!==t&&this.instances.splice(t,1)}),"function"==typeof e?(s.addEventListener("ended",e),!0):new Promise((t,e)=>s.addEventListener("ended",t))}stopAll(){var t=this.instances.slice();for(var e of t)e.pause(),e.dispatchEvent(new Event("ended"))}},n.Sprite=class extends a{constructor(t,e){super(),this.scope=t,this.state.pos=e.pos||new s(0,0),this.state.crop=new s(0,0),this.state.size=e.size||new s(0,0),this.state.frames=e.frames||[],this.state.angle=e.angle||0,this.state.image=e.image||new Image,this.state.delay=e.delay||5,this.state.tick=e.tick||0,this.state.orientation=e.orientation||"horizontal"}update(){super.update(),this.state.tick<=0&&("vertical"===this.orientation?(this.state.crop.y=this.state.frames.shift(),this.state.frames.push(this.state.crop.y)):(this.state.crop.x=this.state.frames.shift(),this.state.frames.push(this.state.crop.x)),this.state.tick=this.state.delay),this.state.tick--}render(){super.render(),this.scope.context.save(),this.scope.context.translate(this.state.crop.x+this.state.size.x/2,this.state.crop.y+this.state.size.y/2),this.scope.context.rotate(this.state.angle*(Math.PI/180)),this.scope.context.translate(-(this.state.crop.x+this.state.size.x/2),-(this.state.crop.y+this.state.size.y/2)),this.scope.context.drawImage(this.state.image,this.state.crop.x*this.state.size.x,this.state.crop.y*this.state.size.y,this.state.size.x,this.state.size.y,this.state.pos.x,this.state.pos.y,this.state.size.x,this.state.size.y),this.scope.context.restore()}}}({})}).call(this,n(0),n(2).setImmediate)},function(t,e,n){(function(t){var i=void 0!==t&&t||"undefined"!=typeof self&&self||window,s=Function.prototype.apply;function r(t,e){this._id=t,this._clearFn=e}e.setTimeout=function(){return new r(s.call(setTimeout,i,arguments),clearTimeout)},e.setInterval=function(){return new r(s.call(setInterval,i,arguments),clearInterval)},e.clearTimeout=e.clearInterval=function(t){t&&t.close()},r.prototype.unref=r.prototype.ref=function(){},r.prototype.close=function(){this._clearFn.call(i,this._id)},e.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},e.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},e._unrefActive=e.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout(function(){t._onTimeout&&t._onTimeout()},e))},n(3),e.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,e.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(this,n(0))},function(t,e,n){(function(t,e){!function(t,n){"use strict";if(!t.setImmediate){var i,s,r,o,a,c=1,u={},h=!1,l=t.document,f=Object.getPrototypeOf&&Object.getPrototypeOf(t);f=f&&f.setTimeout?f:t,"[object process]"==={}.toString.call(t.process)?i=function(t){e.nextTick(function(){p(t)})}:!function(){if(t.postMessage&&!t.importScripts){var e=!0,n=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=n,e}}()?t.MessageChannel?((r=new MessageChannel).port1.onmessage=function(t){p(t.data)},i=function(t){r.port2.postMessage(t)}):l&&"onreadystatechange"in l.createElement("script")?(s=l.documentElement,i=function(t){var e=l.createElement("script");e.onreadystatechange=function(){p(t),e.onreadystatechange=null,s.removeChild(e),e=null},s.appendChild(e)}):i=function(t){setTimeout(p,0,t)}:(o="setImmediate$"+Math.random()+"$",a=function(e){e.source===t&&"string"==typeof e.data&&0===e.data.indexOf(o)&&p(+e.data.slice(o.length))},t.addEventListener?t.addEventListener("message",a,!1):t.attachEvent("onmessage",a),i=function(e){t.postMessage(o+e,"*")}),f.setImmediate=function(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),n=0;n<e.length;n++)e[n]=arguments[n+1];var s={callback:t,args:e};return u[c]=s,i(c),c++},f.clearImmediate=d}function d(t){delete u[t]}function p(t){if(h)setTimeout(p,0,t);else{var e=u[t];if(e){h=!0;try{!function(t){var e=t.callback,i=t.args;switch(i.length){case 0:e();break;case 1:e(i[0]);break;case 2:e(i[0],i[1]);break;case 3:e(i[0],i[1],i[2]);break;default:e.apply(n,i)}}(e)}finally{d(t),h=!1}}}}}("undefined"==typeof self?void 0===t?this:t:self)}).call(this,n(0),n(4))},function(t,e){var n,i,s=t.exports={};function r(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function a(t){if(n===setTimeout)return setTimeout(t,0);if((n===r||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:r}catch(t){n=r}try{i="function"==typeof clearTimeout?clearTimeout:o}catch(t){i=o}}();var c,u=[],h=!1,l=-1;function f(){h&&c&&(h=!1,c.length?u=c.concat(u):l=-1,u.length&&d())}function d(){if(!h){var t=a(f);h=!0;for(var e=u.length;e;){for(c=u,u=[];++l<e;)c&&c[l].run();l=-1,e=u.length}c=null,h=!1,function(t){if(i===clearTimeout)return clearTimeout(t);if((i===o||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(t);try{i(t)}catch(e){try{return i.call(null,t)}catch(e){return i.call(this,t)}}}(t)}}function p(t,e){this.fun=t,this.array=e}function y(){}s.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];u.push(new p(t,e)),1!==u.length||h||a(d)},p.prototype.run=function(){this.fun.apply(null,this.array)},s.title="browser",s.browser=!0,s.env={},s.argv=[],s.version="",s.versions={},s.on=y,s.addListener=y,s.once=y,s.off=y,s.removeListener=y,s.removeAllListeners=y,s.emit=y,s.prependListener=y,s.prependOnceListener=y,s.listeners=function(t){return[]},s.binding=function(t){throw new Error("process.binding is not supported")},s.cwd=function(){return"/"},s.chdir=function(t){throw new Error("process.chdir is not supported")},s.umask=function(){return 0}}]);
{
"name": "craters.js",
"version": "1.2.1",
"version": "1.2.2",
"description": "A Compact Game Engine that helps you build fast, modern HTML5 Games",

@@ -39,4 +39,5 @@ "main": "./index.js",

"chai": "^4.2.0",
"esm": "^3.2.25"
"esm": "^3.2.25",
"sat-js": "^0.8.0"
}
}

@@ -14,3 +14,3 @@ # Craters.js

#### Features ✨
- The Changelog outlines more features [Read changelog](changelog.md)
- The Changelog outlines more features [Read changelog](CHANGELOG.md)
- ES modules

@@ -17,0 +17,0 @@ * reduces bundle size you only import what you need

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc