{"version":3,"sources":["jsdelivr-header.js","/npm/@ksplat/reflex@1.4.0/Reflex.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,ACuCA,SAAS,eAAe,GACvB,IAAI,EAAM,EAAE,SAAS,IACrB,OAAqB,GAAd,EAAI,OAAc,IAAM,EAAM,CACtC,CAEA,SAAS,SAAS,EAAG,EAAG,GACvB,MAAO,IAAM,eAAe,GAAK,eAAe,GAAK,eAAe,EACrE,CAIA,SAAS,UAAU,GAClB,IAAI,EAAU,CACb,UAAW,UACX,aAAc,UACd,KAAM,UACN,WAAY,UACZ,MAAO,UACP,MAAO,UACP,OAAQ,UACR,MAAO,UACP,eAAgB,UAChB,KAAM,UACN,WAAY,UACZ,MAAO,UACP,UAAW,UACX,UAAW,UACX,WAAY,UACZ,UAAW,UACX,MAAO,UACP,eAAgB,UAChB,SAAU,UACV,QAAS,UACT,KAAM,UACN,SAAU,UACV,SAAU,UACV,cAAe,UACf,SAAU,UACV,UAAW,UACX,UAAW,UACX,YAAa,UACb,eAAgB,UAChB,WAAY,UACZ,WAAY,UACZ,QAAS,UACT,WAAY,UACZ,aAAc,UACd,cAAe,UACf,cAAe,UACf,cAAe,UACf,WAAY,UACZ,SAAU,UACV,YAAa,UACb,QAAS,UACT,WAAY,UACZ,UAAW,UACX,YAAa,UACb,YAAa,UACb,QAAS,UACT,UAAW,UACX,WAAY,UACZ,KAAM,UACN,UAAW,UACX,KAAM,UACN,MAAO,UACP,YAAa,UACb,SAAU,UACV,QAAS,UACT,aAAc,UACd,OAAQ,UACR,MAAO,UACP,MAAO,UACP,SAAU,UACV,cAAe,UACf,UAAW,UACX,aAAc,UACd,UAAW,UACX,WAAY,UACZ,UAAW,UACX,qBAAsB,UACtB,UAAW,UACX,WAAY,UACZ,UAAW,UACX,YAAa,UACb,cAAe,UACf,aAAc,UACd,eAAgB,UAChB,eAAgB,UAChB,YAAa,UACb,KAAM,UACN,UAAW,UACX,MAAO,UACP,QAAS,UACT,OA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AAK,WAAY,CAAI,IAGf,UAAU,cAAc,KAAK,aACrC,CAMA,MAAA,GACK,KAAK,SAAW,KAAK,eACxB,KAAK,QAAU,UAAU,cAAc,KAAK,cAC5C,KAAK,WAAY,EACb,KAAK,QACR,QAAQ,IACP,kBAAkB,KAAK,QAAQ,KAAK,OAAO,KAAK,QAAQ,KAAK,OAE9D,QAAQ,IACP,mBAAmB,KAAK,QAAQ,KAAK,OAAO,KAAK,QAAQ,KAAK,QAIlE,EAeD,IAAI,QAAU,CACb,UAAW,UACX,WAAY,YAST,OAAS,CACZ,YAAa,aAUV,GAAK,CACR,KAAM,KACN,OAAQ,QAUL,IAAM,CACT,OAAQ,OACR,UAAW,WAUR,MAAQ,CACX,MAAO,MACP,eAAgB,gBAUb,SAAW,CACd,QAAS,SASN,KAAO,CACV,YAAa,aASV,KAAO,CACV,QAAS,gBAKD,OAAQ,QAAS,OAAQ,KAAM,MAAO,SAAU,IAAK,GAAI","file":"/npm/@ksplat/reflex@1.4.0/Reflex.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/@ksplat/reflex@1.4.0/Reflex.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","/*\n\nReflex\n\nSince April 6, 2021\n\nMIT License\n\nCopyright (c) 2021 Bleart Emini\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n*/\n\n// dependiences\n/*\n\n\n    None!\n        Everything in Reflex is from Reflex!\n        No need to add an additional script tag!\n\n\n*/\n\n//#region Global Utils\n\n// https://stackoverflow.com/questions/5623838/rgb-to-hex-and-hex-to-rgb\n\nfunction componentToHex(c) {\n\tvar hex = c.toString(16);\n\treturn hex.length == 1 ? '0' + hex : hex;\n}\n\nfunction rgbToHex(r, g, b) {\n\treturn '#' + componentToHex(r) + componentToHex(g) + componentToHex(b);\n}\n\n// https://stackoverflow.com/questions/1573053/javascript-function-to-convert-color-names-to-hex-codes/24390910\n\nfunction nameTohex(colour) {\n\tvar colours = {\n\t\taliceblue: '#f0f8ff',\n\t\tantiquewhite: '#faebd7',\n\t\taqua: '#00ffff',\n\t\taquamarine: '#7fffd4',\n\t\tazure: '#f0ffff',\n\t\tbeige: '#f5f5dc',\n\t\tbisque: '#ffe4c4',\n\t\tblack: '#000000',\n\t\tblanchedalmond: '#ffebcd',\n\t\tblue: '#0000ff',\n\t\tblueviolet: '#8a2be2',\n\t\tbrown: '#a52a2a',\n\t\tburlywood: '#deb887',\n\t\tcadetblue: '#5f9ea0',\n\t\tchartreuse: '#7fff00',\n\t\tchocolate: '#d2691e',\n\t\tcoral: '#ff7f50',\n\t\tcornflowerblue: '#6495ed',\n\t\tcornsilk: '#fff8dc',\n\t\tcrimson: '#dc143c',\n\t\tcyan: '#00ffff',\n\t\tdarkblue: '#00008b',\n\t\tdarkcyan: '#008b8b',\n\t\tdarkgoldenrod: '#b8860b',\n\t\tdarkgray: '#a9a9a9',\n\t\tdarkgreen: '#006400',\n\t\tdarkkhaki: '#bdb76b',\n\t\tdarkmagenta: '#8b008b',\n\t\tdarkolivegreen: '#556b2f',\n\t\tdarkorange: '#ff8c00',\n\t\tdarkorchid: '#9932cc',\n\t\tdarkred: '#8b0000',\n\t\tdarksalmon: '#e9967a',\n\t\tdarkseagreen: '#8fbc8f',\n\t\tdarkslateblue: '#483d8b',\n\t\tdarkslategray: '#2f4f4f',\n\t\tdarkturquoise: '#00ced1',\n\t\tdarkviolet: '#9400d3',\n\t\tdeeppink: '#ff1493',\n\t\tdeepskyblue: '#00bfff',\n\t\tdimgray: '#696969',\n\t\tdodgerblue: '#1e90ff',\n\t\tfirebrick: '#b22222',\n\t\tfloralwhite: '#fffaf0',\n\t\tforestgreen: '#228b22',\n\t\tfuchsia: '#ff00ff',\n\t\tgainsboro: '#dcdcdc',\n\t\tghostwhite: '#f8f8ff',\n\t\tgold: '#ffd700',\n\t\tgoldenrod: '#daa520',\n\t\tgray: '#808080',\n\t\tgreen: '#008000',\n\t\tgreenyellow: '#adff2f',\n\t\thoneydew: '#f0fff0',\n\t\thotpink: '#ff69b4',\n\t\t'indianred ': '#cd5c5c',\n\t\tindigo: '#4b0082',\n\t\tivory: '#fffff0',\n\t\tkhaki: '#f0e68c',\n\t\tlavender: '#e6e6fa',\n\t\tlavenderblush: '#fff0f5',\n\t\tlawngreen: '#7cfc00',\n\t\tlemonchiffon: '#fffacd',\n\t\tlightblue: '#add8e6',\n\t\tlightcoral: '#f08080',\n\t\tlightcyan: '#e0ffff',\n\t\tlightgoldenrodyellow: '#fafad2',\n\t\tlightgrey: '#d3d3d3',\n\t\tlightgreen: '#90ee90',\n\t\tlightpink: '#ffb6c1',\n\t\tlightsalmon: '#ffa07a',\n\t\tlightseagreen: '#20b2aa',\n\t\tlightskyblue: '#87cefa',\n\t\tlightslategray: '#778899',\n\t\tlightsteelblue: '#b0c4de',\n\t\tlightyellow: '#ffffe0',\n\t\tlime: '#00ff00',\n\t\tlimegreen: '#32cd32',\n\t\tlinen: '#faf0e6',\n\t\tmagenta: '#ff00ff',\n\t\tmaroon: '#800000',\n\t\tmediumaquamarine: '#66cdaa',\n\t\tmediumblue: '#0000cd',\n\t\tmediumorchid: '#ba55d3',\n\t\tmediumpurple: '#9370d8',\n\t\tmediumseagreen: '#3cb371',\n\t\tmediumslateblue: '#7b68ee',\n\t\tmediumspringgreen: '#00fa9a',\n\t\tmediumturquoise: '#48d1cc',\n\t\tmediumvioletred: '#c71585',\n\t\tmidnightblue: '#191970',\n\t\tmintcream: '#f5fffa',\n\t\tmistyrose: '#ffe4e1',\n\t\tmoccasin: '#ffe4b5',\n\t\tnavajowhite: '#ffdead',\n\t\tnavy: '#000080',\n\t\toldlace: '#fdf5e6',\n\t\tolive: '#808000',\n\t\tolivedrab: '#6b8e23',\n\t\torange: '#ffa500',\n\t\torangered: '#ff4500',\n\t\torchid: '#da70d6',\n\t\tpalegoldenrod: '#eee8aa',\n\t\tpalegreen: '#98fb98',\n\t\tpaleturquoise: '#afeeee',\n\t\tpalevioletred: '#d87093',\n\t\tpapayawhip: '#ffefd5',\n\t\tpeachpuff: '#ffdab9',\n\t\tperu: '#cd853f',\n\t\tpink: '#ffc0cb',\n\t\tplum: '#dda0dd',\n\t\tpowderblue: '#b0e0e6',\n\t\tpurple: '#800080',\n\t\trebeccapurple: '#663399',\n\t\tred: '#ff0000',\n\t\trosybrown: '#bc8f8f',\n\t\troyalblue: '#4169e1',\n\t\tsaddlebrown: '#8b4513',\n\t\tsalmon: '#fa8072',\n\t\tsandybrown: '#f4a460',\n\t\tseagreen: '#2e8b57',\n\t\tseashell: '#fff5ee',\n\t\tsienna: '#a0522d',\n\t\tsilver: '#c0c0c0',\n\t\tskyblue: '#87ceeb',\n\t\tslateblue: '#6a5acd',\n\t\tslategray: '#708090',\n\t\tsnow: '#fffafa',\n\t\tspringgreen: '#00ff7f',\n\t\tsteelblue: '#4682b4',\n\t\ttan: '#d2b48c',\n\t\tteal: '#008080',\n\t\tthistle: '#d8bfd8',\n\t\ttomato: '#ff6347',\n\t\tturquoise: '#40e0d0',\n\t\tviolet: '#ee82ee',\n\t\twheat: '#f5deb3',\n\t\twhite: '#ffffff',\n\t\twhitesmoke: '#f5f5f5',\n\t\tyellow: '#ffff00',\n\t\tyellowgreen: '#9acd32',\n\t};\n\n\tif (typeof colours[colour.toLowerCase()] != 'undefined')\n\t\treturn colours[colour.toLowerCase()];\n\n\treturn false;\n}\n\nfunction randomInt(min, max) {\n\treturn Math.floor(Math.random() * (max - min + 1) + min);\n}\n\n// https://stackoverflow.com/questions/8188548/splitting-a-js-array-into-n-arrays\n\nfunction chunkify(a, n, balanced) {\n\tif (n < 2) return [a];\n\n\tvar len = a.length,\n\t\tout = [],\n\t\ti = 0,\n\t\tsize;\n\n\tif (len % n === 0) {\n\t\tsize = Math.floor(len / n);\n\t\twhile (i < len) {\n\t\t\tout.push(a.slice(i, (i += size)));\n\t\t}\n\t} else if (balanced) {\n\t\twhile (i < len) {\n\t\t\tsize = Math.ceil((len - i) / n--);\n\t\t\tout.push(a.slice(i, (i += size)));\n\t\t}\n\t} else {\n\t\tn--;\n\t\tsize = Math.floor(len / n);\n\t\tif (len % size === 0) size--;\n\t\twhile (i < size * n) {\n\t\t\tout.push(a.slice(i, (i += size)));\n\t\t}\n\t\tout.push(a.slice(size * n));\n\t}\n\n\treturn out;\n}\n\n//#endregion\n\n// global ReflexConfig\n\nlet ReflexConfig = {};\n\n// global entitys\n\nlet Entitys = {\n\t_RigidBody: [],\n\t_StaticLight: [],\n\t_Background: [],\n\t_ProximitySound: [],\n\t_Shadow: [],\n\t_Particles: [],\n\t_Text: [],\n\t_Button: [],\n};\n\n/**\n * Reflex\n *\n * Since April 6, 2021\n *\n * MIT License\n *\n * Copyright (c) 2021 Bleart Emini\n *\n * @description A simple Javascript game engine.\n * @author Bleart Emini\n * @license MIT\n * @since April 6, 2021, 1.0.0-beta\n * @version 1.3.1\n */\n\n/**\n * @class Reflex\n * @classdesc Main Reflex Class\n */\n\nclass Reflex {\n\t/**\n\t *\n\t * @param {Object} config Config Object.\n\t * @param {Function} config.loop Main loop. Must be a animationFrame loop.\n\t * @param {Boolean} [config.debug=false] If enabled, Reflex will console log anything it needs to. Errors will be thrown regardless. Optional, off by default.\n\t * @description Creates a new instance of Relfex.\n\t * @memberof Reflex\n\t */\n\n\tconstructor(config) {\n\t\tthis.config = config;\n\t\tReflexConfig = this.config;\n\n\t\tthis.stack = {\n\t\t\tstarted: false,\n\t\t};\n\n\t\t/**@type {HTMLElement} */\n\t\tthis.canvas = document.querySelector('canvas');\n\n\t\t/**@type {CanvasRenderingContext2D} */\n\t\tthis.ctx = this.canvas.getContext('2d');\n\n\t\t/**@type {Function} */\n\t\tthis.loop = this.config.loop;\n\n\t\t/**@type {Number} */\n\t\tthis.width = this.canvas.width;\n\n\t\t/**@type {Number} */\n\t\tthis.height = this.canvas.height;\n\n\t\t/**@type {Boolean} */\n\t\tthis.debug = this.config.debug || false;\n\n\t\tthis.fps = {\n\t\t\tsampleSize: 60,\n\t\t\tvalue: 0,\n\t\t\t_sample_: [],\n\t\t\t_index_: 0,\n\t\t\t_lastTick_: false,\n\t\t\ttick: function () {\n\t\t\t\t// if is first tick, just set tick timestamp and return\n\t\t\t\tif (!this._lastTick_) {\n\t\t\t\t\tthis._lastTick_ = performance.now();\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\t// calculate necessary values to obtain current tick FPS\n\t\t\t\tlet now = performance.now();\n\t\t\t\tlet delta = (now - this._lastTick_) / 1000;\n\t\t\t\tlet fps = 1 / delta;\n\t\t\t\t// add to fps samples, current tick fps value\n\t\t\t\tthis._sample_[this._index_] = Math.round(fps);\n\n\t\t\t\t// iterate samples to obtain the average\n\t\t\t\tlet average = 0;\n\t\t\t\tfor (let i = 0; i < this._sample_.length; i++)\n\t\t\t\t\taverage += this._sample_[i];\n\n\t\t\t\taverage = Math.round(average / this._sample_.length);\n\n\t\t\t\t// set new FPS\n\t\t\t\tthis.value = average;\n\t\t\t\t// store current timestamp\n\t\t\t\tthis._lastTick_ = now;\n\t\t\t\t// increase sample index counter, and reset it\n\t\t\t\t// to 0 if exceded maximum sampleSize limit\n\t\t\t\tthis._index_++;\n\t\t\t\tif (this._index_ === this.sampleSize) this._index_ = 0;\n\t\t\t\treturn this.value;\n\t\t\t},\n\t\t};\n\n\t\tif (typeof this.loop != 'function') throw 'Loop is not a function';\n\t}\n\n\t/**\n\t * @description Starts Reflex and loop\n\t */\n\n\tstart() {\n\t\tthis.loop();\n\t\tthis.stack.started = true;\n\t\tthis.startMsg = `\n        \n        \n             ____    _____   _____   _       _____  ___  _\n            /  __\\\\  /  __/  /    /  / \\\\     /  __/  \\\\  \\\\//\n            |  \\\\/|  |  \\\\    |  __\\\\  | |     |  \\\\     \\\\  / \n            |    /  |  /_   | |     | |_/\\\\  |  /_    /  \\\\ \n            \\\\_/\\\\_\\\\  \\\\____\\\\  \\\\_/     \\\\____/  \\\\____\\\\  /__/\\\\\n                                      \n                                      \n                                 By\n\n                              ksplatdev\n\n                             Twt: @ksplat_\n                           Disc: ksplat#9147\n                           \n                             MIT License\n                     Copyright (c) 2021 Bleart Emini\n\n\n            Github: https://github.com/ksplatdev/Reflex\n\n            Docs: https://ksplatdev.github.io/Reflex/\n\n            Download: https://github.com/ksplatdev/Reflex/releases/latest\n\n        \n        `;\n\n\t\tconsole.log(this.startMsg);\n\t}\n\n\t/**\n\t * @description Clears the current frame\n\t */\n\n\tclear() {\n\t\tthis.ctx.clearRect(0, 0, this.width, this.height);\n\t}\n\n\t/**\n\t * @description Removes/Deletes an Entity\n\t * @param {RigidBody|Background|ProximitySound|Shadow|Particles|Text|StaticLight} entity A RigidBody | Background | ProximitySound | Shadow | Particles | Text | StaticLight\n\t */\n\n\tremove(entity) {\n\t\tentity.draw = () => {};\n\t\tlet entIndex = Entitys[`_${entity.type}`].indexOf(entity.id);\n\t\tEntitys[`_${entity.type}`].splice(entIndex, 1);\n\t}\n\n\t//#region Class Utils\n\n\t/**\n\t *\n\t * @param {String} colour Color name\n\t * @returns Hex Color\n\t * @description Converts HTML color names to hex\n\t * @private\n\t */\n\n\tnameTohex(colour) {\n\t\tvar colours = {\n\t\t\taliceblue: '#f0f8ff',\n\t\t\tantiquewhite: '#faebd7',\n\t\t\taqua: '#00ffff',\n\t\t\taquamarine: '#7fffd4',\n\t\t\tazure: '#f0ffff',\n\t\t\tbeige: '#f5f5dc',\n\t\t\tbisque: '#ffe4c4',\n\t\t\tblack: '#000000',\n\t\t\tblanchedalmond: '#ffebcd',\n\t\t\tblue: '#0000ff',\n\t\t\tblueviolet: '#8a2be2',\n\t\t\tbrown: '#a52a2a',\n\t\t\tburlywood: '#deb887',\n\t\t\tcadetblue: '#5f9ea0',\n\t\t\tchartreuse: '#7fff00',\n\t\t\tchocolate: '#d2691e',\n\t\t\tcoral: '#ff7f50',\n\t\t\tcornflowerblue: '#6495ed',\n\t\t\tcornsilk: '#fff8dc',\n\t\t\tcrimson: '#dc143c',\n\t\t\tcyan: '#00ffff',\n\t\t\tdarkblue: '#00008b',\n\t\t\tdarkcyan: '#008b8b',\n\t\t\tdarkgoldenrod: '#b8860b',\n\t\t\tdarkgray: '#a9a9a9',\n\t\t\tdarkgreen: '#006400',\n\t\t\tdarkkhaki: '#bdb76b',\n\t\t\tdarkmagenta: '#8b008b',\n\t\t\tdarkolivegreen: '#556b2f',\n\t\t\tdarkorange: '#ff8c00',\n\t\t\tdarkorchid: '#9932cc',\n\t\t\tdarkred: '#8b0000',\n\t\t\tdarksalmon: '#e9967a',\n\t\t\tdarkseagreen: '#8fbc8f',\n\t\t\tdarkslateblue: '#483d8b',\n\t\t\tdarkslategray: '#2f4f4f',\n\t\t\tdarkturquoise: '#00ced1',\n\t\t\tdarkviolet: '#9400d3',\n\t\t\tdeeppink: '#ff1493',\n\t\t\tdeepskyblue: '#00bfff',\n\t\t\tdimgray: '#696969',\n\t\t\tdodgerblue: '#1e90ff',\n\t\t\tfirebrick: '#b22222',\n\t\t\tfloralwhite: '#fffaf0',\n\t\t\tforestgreen: '#228b22',\n\t\t\tfuchsia: '#ff00ff',\n\t\t\tgainsboro: '#dcdcdc',\n\t\t\tghostwhite: '#f8f8ff',\n\t\t\tgold: '#ffd700',\n\t\t\tgoldenrod: '#daa520',\n\t\t\tgray: '#808080',\n\t\t\tgreen: '#008000',\n\t\t\tgreenyellow: '#adff2f',\n\t\t\thoneydew: '#f0fff0',\n\t\t\thotpink: '#ff69b4',\n\t\t\t'indianred ': '#cd5c5c',\n\t\t\tindigo: '#4b0082',\n\t\t\tivory: '#fffff0',\n\t\t\tkhaki: '#f0e68c',\n\t\t\tlavender: '#e6e6fa',\n\t\t\tlavenderblush: '#fff0f5',\n\t\t\tlawngreen: '#7cfc00',\n\t\t\tlemonchiffon: '#fffacd',\n\t\t\tlightblue: '#add8e6',\n\t\t\tlightcoral: '#f08080',\n\t\t\tlightcyan: '#e0ffff',\n\t\t\tlightgoldenrodyellow: '#fafad2',\n\t\t\tlightgrey: '#d3d3d3',\n\t\t\tlightgreen: '#90ee90',\n\t\t\tlightpink: '#ffb6c1',\n\t\t\tlightsalmon: '#ffa07a',\n\t\t\tlightseagreen: '#20b2aa',\n\t\t\tlightskyblue: '#87cefa',\n\t\t\tlightslategray: '#778899',\n\t\t\tlightsteelblue: '#b0c4de',\n\t\t\tlightyellow: '#ffffe0',\n\t\t\tlime: '#00ff00',\n\t\t\tlimegreen: '#32cd32',\n\t\t\tlinen: '#faf0e6',\n\t\t\tmagenta: '#ff00ff',\n\t\t\tmaroon: '#800000',\n\t\t\tmediumaquamarine: '#66cdaa',\n\t\t\tmediumblue: '#0000cd',\n\t\t\tmediumorchid: '#ba55d3',\n\t\t\tmediumpurple: '#9370d8',\n\t\t\tmediumseagreen: '#3cb371',\n\t\t\tmediumslateblue: '#7b68ee',\n\t\t\tmediumspringgreen: '#00fa9a',\n\t\t\tmediumturquoise: '#48d1cc',\n\t\t\tmediumvioletred: '#c71585',\n\t\t\tmidnightblue: '#191970',\n\t\t\tmintcream: '#f5fffa',\n\t\t\tmistyrose: '#ffe4e1',\n\t\t\tmoccasin: '#ffe4b5',\n\t\t\tnavajowhite: '#ffdead',\n\t\t\tnavy: '#000080',\n\t\t\toldlace: '#fdf5e6',\n\t\t\tolive: '#808000',\n\t\t\tolivedrab: '#6b8e23',\n\t\t\torange: '#ffa500',\n\t\t\torangered: '#ff4500',\n\t\t\torchid: '#da70d6',\n\t\t\tpalegoldenrod: '#eee8aa',\n\t\t\tpalegreen: '#98fb98',\n\t\t\tpaleturquoise: '#afeeee',\n\t\t\tpalevioletred: '#d87093',\n\t\t\tpapayawhip: '#ffefd5',\n\t\t\tpeachpuff: '#ffdab9',\n\t\t\tperu: '#cd853f',\n\t\t\tpink: '#ffc0cb',\n\t\t\tplum: '#dda0dd',\n\t\t\tpowderblue: '#b0e0e6',\n\t\t\tpurple: '#800080',\n\t\t\trebeccapurple: '#663399',\n\t\t\tred: '#ff0000',\n\t\t\trosybrown: '#bc8f8f',\n\t\t\troyalblue: '#4169e1',\n\t\t\tsaddlebrown: '#8b4513',\n\t\t\tsalmon: '#fa8072',\n\t\t\tsandybrown: '#f4a460',\n\t\t\tseagreen: '#2e8b57',\n\t\t\tseashell: '#fff5ee',\n\t\t\tsienna: '#a0522d',\n\t\t\tsilver: '#c0c0c0',\n\t\t\tskyblue: '#87ceeb',\n\t\t\tslateblue: '#6a5acd',\n\t\t\tslategray: '#708090',\n\t\t\tsnow: '#fffafa',\n\t\t\tspringgreen: '#00ff7f',\n\t\t\tsteelblue: '#4682b4',\n\t\t\ttan: '#d2b48c',\n\t\t\tteal: '#008080',\n\t\t\tthistle: '#d8bfd8',\n\t\t\ttomato: '#ff6347',\n\t\t\tturquoise: '#40e0d0',\n\t\t\tviolet: '#ee82ee',\n\t\t\twheat: '#f5deb3',\n\t\t\twhite: '#ffffff',\n\t\t\twhitesmoke: '#f5f5f5',\n\t\t\tyellow: '#ffff00',\n\t\t\tyellowgreen: '#9acd32',\n\t\t};\n\n\t\tif (typeof colours[colour.toLowerCase()] != 'undefined')\n\t\t\treturn colours[colour.toLowerCase()];\n\n\t\treturn false;\n\t}\n\n\t//#endregion\n}\n\n//#region All Objects\n\n/**\n * @class RigidBody\n * @classdesc Creates a Rigid Body\n */\n\nclass RigidBody extends Reflex {\n\t/**\n\t * @description Creates an instance of Rigid Body.\n\t * @param {Number} x X pos\n\t * @param {Number} y Y pos\n\t * @param {Number} w Width\n\t * @param {Number} h Height\n\t * @param {Number} [r] Radius, required for roundrect, circle\n\t * @param {String} shape Shape of object, rect, circle, roundrect, or sprite\n\t * @param {String} [color] Color for rect, circle, or roundrect\n\t * @param {String} [imgPath] Img path for sprite, optional\n\t *\n\t * @param {Object} [options={}] Option object, holds many different options, optional\n\t * @param {Object} [options.movement={}] Movement object, holds movements options\n\t * @param {Boolean} [options.movement.canvasBounds=false] Keep player from leaving the canvas, defaults to false\n\t * @param {String} [options.movement.type=\"TopDown\"] W A S D UP DOWN LEFT RIGHT\n\t * @param {String} [options.movement.type=\"Jump\"] W SPACE UP\n\t * @param {String} [options.movement.type=\"LeftRight\"] A D LEFT RIGHT\n\t * @param {String} [options.movement.type=\"UpDown\"] W D\n\t * @param {Number} [options.movement.speed=2.5] Speed of Rigid Body, only used if acceleration is not present\n\t * @param {Number} [options.movement.acceleration=0.02] Acceleration of Rigid Body\n\t * @param {Number} [options.movement.maxSpeed=4] Max speed of Rigid Body, Only needed if acceleration is present\n\t *\n\t * @memberof RigidBody\n\t */\n\n\tconstructor(x, y, w, h, r, shape, color, imgPath, options) {\n\t\tsuper(ReflexConfig);\n\t\tthis.type = 'RigidBody';\n\t\tthis.id = randomInt(1, 100000);\n\n\t\tthis.x = x;\n\t\tthis.y = y;\n\t\tthis.w = w;\n\t\tthis.h = h;\n\t\tthis.shape = shape;\n\n\t\tthis.selfAttached = false;\n\t\tthis.othersAttached = [];\n\t\tthis.hasShadow = false;\n\t\tthis.selfShadow = undefined;\n\t\tthis.hasLight = false;\n\t\tthis.selfLight = undefined;\n\n\t\tthis.r = r || undefined;\n\n\t\tthis.color = color || undefined;\n\n\t\tthis.imgPath = imgPath || undefined;\n\n\t\tthis.options = options || undefined;\n\n\t\t// set for now\n\t\tthis.centerX = this.x;\n\t\tthis.centerY = this.y;\n\n\t\t// fix centerX and centerY\n\t\tif (\n\t\t\tthis.shape == 'rect' ||\n\t\t\tthis.shape == 'roundrect' ||\n\t\t\tthis.shape == 'sprite'\n\t\t) {\n\t\t\tthis.centerX = this.x + this.w / 2;\n\t\t\tthis.centerY = this.y + this.h / 2;\n\t\t}\n\t\tif (this.shape == 'circle') {\n\t\t\tthis.centerX = this.x + this.r / 2;\n\t\t\tthis.centerY = this.y + this.r / 2;\n\t\t}\n\n\t\tthis.controller = {\n\t\t\tup: false,\n\t\t\tdown: false,\n\t\t\tleft: false,\n\t\t\tright: false,\n\t\t};\n\n\t\tif (this.options != undefined) {\n\t\t\tthis.vel = 0 || this.options.movement.speed;\n\t\t\tthis.friction = 0 || this.options.movement.friction;\n\t\t\tthis.acceleration = this.options.movement.acceleration;\n\t\t\tthis.maxSpeed = this.options.movement.maxSpeed;\n\t\t\tthis.canvasBounds = this.options.movement.canvasBounds;\n\t\t\tif (this.acceleration != undefined && this.maxSpeed == undefined)\n\t\t\t\tthrow 'acceleration is defined while maxSpeed is undefined';\n\n\t\t\twindow.addEventListener('keydown', (e) => {\n\t\t\t\tthis.keyListener(e);\n\t\t\t});\n\t\t\twindow.addEventListener('keyup', (e) => {\n\t\t\t\tthis.keyListener(e);\n\t\t\t});\n\t\t}\n\n\t\t// create one imgObj if shape is sprite instead of creating a million and recieving the flash effect\n\n\t\tif (this.shape == 'sprite') {\n\t\t\tthis.imgObj = new Image();\n\t\t}\n\n\t\t// for RigidBody.on event listener\n\t\tthis.isMoving = false;\n\n\t\tEntitys._RigidBody.push(this);\n\t}\n\n\t/**\n\t * @description Draws sprite to canvas\n\t */\n\n\tdraw() {\n\t\t// fix centerX and centerY\n\t\tif (\n\t\t\tthis.shape == 'rect' ||\n\t\t\tthis.shape == 'roundrect' ||\n\t\t\tthis.shape == 'sprite'\n\t\t) {\n\t\t\tthis.centerX = this.x + this.w / 2;\n\t\t\tthis.centerY = this.y + this.h / 2;\n\t\t}\n\t\tif (this.shape == 'circle') {\n\t\t\tthis.centerX = this.x + this.r / 2;\n\t\t\tthis.centerY = this.y + this.r / 2;\n\t\t}\n\n\t\t// set light pos\n\n\t\tif (this.hasLight) {\n\t\t\tthis.selfLight.x = this.centerX;\n\t\t\tthis.selfLight.y = this.centerY;\n\t\t}\n\n\t\tswitch (this.shape) {\n\t\t\tcase 'rect':\n\t\t\t\tthis.ctx.fillStyle = this.color;\n\t\t\t\tthis.ctx.fillRect(this.x, this.y, this.w, this.h);\n\t\t\t\tbreak;\n\n\t\t\tcase 'roundrect':\n\t\t\t\tif (this.w < 2 * this.r) this.r = this.w / 2;\n\t\t\t\tif (this.h < 2 * this.r) this.r = this.h / 2;\n\t\t\t\tthis.ctx.beginPath();\n\t\t\t\tthis.ctx.moveTo(this.x + this.r, this.y);\n\t\t\t\tthis.ctx.arcTo(\n\t\t\t\t\tthis.x + this.w,\n\t\t\t\t\tthis.y,\n\t\t\t\t\tthis.x + this.w,\n\t\t\t\t\tthis.y + this.h,\n\t\t\t\t\tthis.r\n\t\t\t\t);\n\t\t\t\tthis.ctx.arcTo(\n\t\t\t\t\tthis.x + this.w,\n\t\t\t\t\tthis.y + this.h,\n\t\t\t\t\tthis.x,\n\t\t\t\t\tthis.y + this.h,\n\t\t\t\t\tthis.r\n\t\t\t\t);\n\t\t\t\tthis.ctx.arcTo(this.x, this.y + this.h, this.x, this.y, this.r);\n\t\t\t\tthis.ctx.arcTo(this.x, this.y, this.x + this.w, this.y, this.r);\n\t\t\t\tthis.ctx.closePath();\n\t\t\t\tthis.ctx.fillStyle = this.color;\n\t\t\t\tthis.ctx.fill();\n\t\t\t\tbreak;\n\n\t\t\tcase 'circle':\n\t\t\t\tthis.ctx.beginPath();\n\t\t\t\tthis.ctx.arc(this.x, this.y, this.r, 0, 2 * Math.PI, false);\n\t\t\t\tthis.ctx.fillStyle = this.color;\n\t\t\t\tthis.ctx.fill();\n\t\t\t\tbreak;\n\n\t\t\tcase 'sprite':\n\t\t\t\tthis.imgObj.src = this.imgPath;\n\t\t\t\tthis.ctx.drawImage(this.imgObj, this.x, this.y, this.w, this.h);\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\tthrow `${this.shape} is not a rect, roundrect, circle, or sprite.`;\n\t\t\t\tbreak;\n\t\t}\n\n\t\t// attached objects\n\n\t\tthis.othersAttached.forEach((obj) => {\n\t\t\tobj.x = this.x + obj.diffX;\n\t\t\tobj.y = this.y + obj.diffY;\n\t\t});\n\n\t\t// acceleration\n\n\t\tif (this.acceleration != undefined && this.maxSpeed != undefined) {\n\t\t\tif (\n\t\t\t\tthis.controller.up ||\n\t\t\t\tthis.controller.down ||\n\t\t\t\tthis.controller.left ||\n\t\t\t\tthis.controller.right\n\t\t\t) {\n\t\t\t\t// accelerate\n\t\t\t\tif (this.vel < this.maxSpeed) {\n\t\t\t\t\tthis.vel += this.acceleration;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthis.vel = 0;\n\t\t\t}\n\t\t}\n\n\t\t// for RigidBody.on event listener\n\n\t\tif (\n\t\t\t!this.controller.up &&\n\t\t\t!this.controller.down &&\n\t\t\t!this.controller.left &&\n\t\t\t!this.controller.right\n\t\t) {\n\t\t\tthis.isMoving = false;\n\t\t}\n\n\t\t// movement\n\n\t\t//#region movement\n\n\t\tif (\n\t\t\tthis.controller.up &&\n\t\t\t(this.options.movement.type == 'TopDown' ||\n\t\t\t\tthis.options.movement.type == 'Jump' ||\n\t\t\t\tthis.options.movement.type == 'UpDown')\n\t\t) {\n\t\t\tif (this.canvasBounds) {\n\t\t\t\tif (\n\t\t\t\t\tthis.shape == 'rect' ||\n\t\t\t\t\tthis.shape == 'roundrect' ||\n\t\t\t\t\tthis.shape == 'sprite'\n\t\t\t\t) {\n\t\t\t\t\tif (this.y > 0) {\n\t\t\t\t\t\tthis.y -= this.vel;\n\t\t\t\t\t\tthis.isMoving = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (this.shape == 'circle') {\n\t\t\t\t\tif (this.y > 0 + this.r) {\n\t\t\t\t\t\tthis.y -= this.vel;\n\t\t\t\t\t\tthis.isMoving = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthis.y -= this.vel;\n\t\t\t\tthis.isMoving = true;\n\t\t\t}\n\t\t}\n\n\t\tif (\n\t\t\tthis.controller.down &&\n\t\t\t(this.options.movement.type == 'TopDown' ||\n\t\t\t\tthis.options.movement.type == 'UpDown')\n\t\t) {\n\t\t\tif (this.canvasBounds) {\n\t\t\t\tif (\n\t\t\t\t\tthis.shape == 'rect' ||\n\t\t\t\t\tthis.shape == 'roundrect' ||\n\t\t\t\t\tthis.shape == 'sprite'\n\t\t\t\t) {\n\t\t\t\t\tif (this.y < this.canvas.height - this.h) {\n\t\t\t\t\t\tthis.y += this.vel;\n\t\t\t\t\t\tthis.isMoving = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (this.shape == 'circle') {\n\t\t\t\t\tif (this.y < this.canvas.height - this.r) {\n\t\t\t\t\t\tthis.y += this.vel;\n\t\t\t\t\t\tthis.isMoving = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthis.y += this.vel;\n\t\t\t\tthis.isMoving = true;\n\t\t\t}\n\t\t}\n\n\t\tif (\n\t\t\tthis.controller.left &&\n\t\t\t(this.options.movement.type == 'TopDown' ||\n\t\t\t\tthis.options.movement.type == 'LeftRight')\n\t\t) {\n\t\t\tif (this.canvasBounds) {\n\t\t\t\tif (\n\t\t\t\t\tthis.shape == 'rect' ||\n\t\t\t\t\tthis.shape == 'roundrect' ||\n\t\t\t\t\tthis.shape == 'sprite'\n\t\t\t\t) {\n\t\t\t\t\tif (this.x > 0) {\n\t\t\t\t\t\tthis.x -= this.vel;\n\t\t\t\t\t\tthis.isMoving = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (this.shape == 'circle') {\n\t\t\t\t\tif (this.x > 0 + this.r) {\n\t\t\t\t\t\tthis.x -= this.vel;\n\t\t\t\t\t\tthis.isMoving = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthis.x -= this.vel;\n\t\t\t\tthis.isMoving = true;\n\t\t\t}\n\t\t}\n\n\t\tif (\n\t\t\tthis.controller.right &&\n\t\t\t(this.options.movement.type == 'TopDown' ||\n\t\t\t\tthis.options.movement.type == 'LeftRight')\n\t\t) {\n\t\t\tif (this.canvasBounds) {\n\t\t\t\tif (\n\t\t\t\t\tthis.shape == 'rect' ||\n\t\t\t\t\tthis.shape == 'roundrect' ||\n\t\t\t\t\tthis.shape == 'sprite'\n\t\t\t\t) {\n\t\t\t\t\tif (this.x < this.canvas.width - this.w) {\n\t\t\t\t\t\tthis.x += this.vel;\n\t\t\t\t\t\tthis.isMoving = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (this.shape == 'circle') {\n\t\t\t\t\tif (this.x < this.canvas.width - this.r) {\n\t\t\t\t\t\tthis.x += this.vel;\n\t\t\t\t\t\tthis.isMoving = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthis.x += this.vel;\n\t\t\t\tthis.isMoving = true;\n\t\t\t}\n\t\t}\n\n\t\t//#endregion\n\t}\n\n\t/**\n\t * @description Listens for key presses\n\t */\n\n\tkeyListener(event) {\n\t\tlet key_state = event.type == 'keydown' ? true : false;\n\n\t\tswitch (event.keyCode) {\n\t\t\tcase 37: // left arrow\n\t\t\t\tthis.controller.left = key_state;\n\t\t\t\tbreak;\n\n\t\t\tcase 38: // up arrow\n\t\t\t\tthis.controller.up = key_state;\n\t\t\t\tbreak;\n\n\t\t\tcase 39: // right arrow\n\t\t\t\tthis.controller.right = key_state;\n\t\t\t\tbreak;\n\n\t\t\tcase 40: // down arrow\n\t\t\t\tthis.controller.down = key_state;\n\t\t\t\tbreak;\n\n\t\t\tcase 65: // a\n\t\t\t\tthis.controller.left = key_state;\n\t\t\t\tbreak;\n\n\t\t\tcase 87: // w\n\t\t\t\tthis.controller.up = key_state;\n\t\t\t\tbreak;\n\n\t\t\tcase 68: // d\n\t\t\t\tthis.controller.right = key_state;\n\t\t\t\tbreak;\n\n\t\t\tcase 83: // s\n\t\t\t\tthis.controller.down = key_state;\n\t\t\t\tbreak;\n\n\t\t\tcase 32: // space\n\t\t\t\tif (this.options.movement.type == 'Jump') {\n\t\t\t\t\tthis.controller.up = key_state;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\t/**\n\t *\n\t * @param {String} axis The axis of the force being applied. \"x\" or \"y\".\n\t * @param {Number} force The force being applied. Negative number is left for axis = x, up for axis = y. Positive number is right for axis = x, down for axis = y.\n\t * @description Adds a force to an axis.\n\t */\n\n\taddForce(axis, force) {\n\t\tif (typeof force != 'number') {\n\t\t\tthrow `Force if not typeof number. Force is typeof ${typeof force}`;\n\t\t}\n\t\tif (typeof axis == 'string') {\n\t\t\tif (axis == 'x') {\n\t\t\t\tif (Math.sign(force) == 1) {\n\t\t\t\t\tthis.x += force;\n\t\t\t\t} else if (Math.sign(force) == -1) {\n\t\t\t\t\tthis.x -= force;\n\t\t\t\t} else {\n\t\t\t\t\tthrow `Force cannot be 0`;\n\t\t\t\t}\n\t\t\t} else if (axis == 'y') {\n\t\t\t\tif (Math.sign(force) == 1) {\n\t\t\t\t\tthis.y += force;\n\t\t\t\t} else if (Math.sign(force) == -1) {\n\t\t\t\t\tthis.y -= force;\n\t\t\t\t} else {\n\t\t\t\t\tthrow `Force cannot be 0`;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthrow `Cannot add force to axis of ${axis}`;\n\t\t\t}\n\t\t} else {\n\t\t\tthrow `Axis is not type of string. Axis is typeof ${typeof axis}`;\n\t\t}\n\t}\n\n\t/**\n\t *\n\t * @param {RigidBody} rigidbody A RigidBody to be attached\n\t * @description Attaches a rigidbody to another rigid body\n\t */\n\n\tattach(rigidbody) {\n\t\tlet obj = rigidbody;\n\t\tif (!obj.selfAttached) {\n\t\t\tobj.selfAttached = true;\n\n\t\t\t// set difference x and y\n\n\t\t\tif (this.x > obj.x) {\n\t\t\t\tobj.diffX = this.x - obj.x;\n\t\t\t}\n\n\t\t\tif (this.x < obj.x) {\n\t\t\t\tobj.diffX = obj.x - this.x;\n\t\t\t}\n\n\t\t\tif (this.y > obj.y) {\n\t\t\t\tobj.diffY = this.y - obj.y;\n\t\t\t}\n\n\t\t\tif (this.y < obj.y) {\n\t\t\t\tobj.diffY = obj.y - this.y;\n\t\t\t}\n\n\t\t\tthis.othersAttached.push(obj);\n\t\t} else {\n\t\t\tthrow `Rigid Body is already attached to another ${rigidbody.type}`;\n\t\t}\n\t}\n\n\t/**\n\t *\n\t * @param {RigidBody} rigidbody A RigidBody\n\t * @description Detaches a RigidBody\n\t */\n\n\tdetach(rigidbody) {\n\t\tif (rigidbody.selfAttached) {\n\t\t\trigidbody.selfAttached = false;\n\t\t\tlet index = this.othersAttached.indexOf(rigidbody);\n\t\t\tthis.othersAttached.splice(index);\n\t\t}\n\t}\n\n\t/**\n\t * @description RigidBody Event listener\n\t * @param {String} event The event to listen for, valid events: move, colorChange, or imageChange\n\t * @param {Function} callback A callback function with no parameters\n\t */\n\n\ton(event, callback) {\n\t\t// throw errors\n\t\t// typeof\n\t\tif (typeof event != 'string')\n\t\t\tthrow `RigidBody.on event is not typeof string and is typeof ${typeof event} instead`;\n\t\telse event = event.toLowerCase();\n\t\tif (typeof callback != 'function')\n\t\t\tthrow `RigidBody.on callback is not typeof function and is typeof ${typeof callback} instead`;\n\n\t\t// color change and image change vars\n\t\tlet color = this.color;\n\t\tlet imgSrc = this.imgPath;\n\n\t\tlet int = setInterval(() => {\n\t\t\tif (event == 'move') {\n\t\t\t\tif (this.isMoving) {\n\t\t\t\t\tcallback();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (event == 'colorChange') {\n\t\t\t\tif (color != this.color) {\n\t\t\t\t\tcallback();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (event == 'imageChange') {\n\t\t\t\tif (imgSrc != this.imgPath) {\n\t\t\t\t\tcallback();\n\t\t\t\t}\n\t\t\t}\n\t\t}, 20);\n\t}\n\n\tget getCenterX() {\n\t\tif (\n\t\t\tthis.shape == 'rect' ||\n\t\t\tthis.shape == 'roundrect' ||\n\t\t\tthis.shape == 'sprite'\n\t\t) {\n\t\t\treturn this.x + this.w / 2;\n\t\t}\n\t\tif (this.shape == 'circle') {\n\t\t\treturn this.x + this.r / 2;\n\t\t}\n\t}\n\n\tget getCenterY() {\n\t\tif (\n\t\t\tthis.shape == 'rect' ||\n\t\t\tthis.shape == 'roundrect' ||\n\t\t\tthis.shape == 'sprite'\n\t\t) {\n\t\t\treturn this.y + this.h / 2;\n\t\t}\n\t\tif (this.shape == 'circle') {\n\t\t\treturn this.y + this.h / 2;\n\t\t}\n\t}\n}\n\n//#region Presets\n\n// end presets\n//#endregion\n\n// end object classes\n//#endregion\n\n//#region Misc\n\n/**\n * @class Background\n * @classdesc Creates a background\n */\n\nclass Background extends Reflex {\n\t/**\n\t * @description Creates a background\n\t * @param {Number} x X pos\n\t * @param {Number} y Y pos\n\t * @param {Number} w Width\n\t * @param {Number} h Height\n\t * @param {String} imgPath imgPath, file or link\n\t *\n\t * @memberof Background\n\t */\n\n\tconstructor(x, y, w, h, imgPath) {\n\t\tsuper(ReflexConfig);\n\t\tthis.type = 'Background';\n\t\tthis.id = randomInt(1, 100000);\n\n\t\tthis.x = x;\n\t\tthis.y = y;\n\t\tthis.w = w;\n\t\tthis.h = h;\n\t\tthis.imgPath = imgPath;\n\t\tthis.imgObj = new Image();\n\n\t\tthis.isWobbling = false;\n\n\t\tEntitys._Background.push(this);\n\t}\n\n\t/**\n\t * @description Draws Background\n\t */\n\n\tdraw() {\n\t\tthis.imgObj.src = this.imgPath;\n\t\tthis.ctx.drawImage(this.imgObj, this.x, this.y, this.w, this.h);\n\t}\n\n\t/**\n\t * @description Adds a force to an axis.\n\t * @param {String} axis The axis of the force being applied. \"x\" or \"y\".\n\t * @param {Number} force The force being applied. Negative number is left for axis = x, up for axis = y. Positive number is right for axis = x, down for axis = y.\n\t */\n\n\taddForce(axis, force) {\n\t\tif (typeof force != 'number')\n\t\t\tthrow `Force if not typeof number. Force is typeof ${typeof force}`;\n\t\tif (typeof axis == 'string') {\n\t\t\tif (axis == 'x') {\n\t\t\t\tif (Math.sign(force) == 1) {\n\t\t\t\t\tthis.x += force;\n\t\t\t\t} else if (Math.sign(force) == -1) {\n\t\t\t\t\tthis.x -= force;\n\t\t\t\t} else {\n\t\t\t\t\tthrow `Force cannot be 0`;\n\t\t\t\t}\n\t\t\t} else if (axis == 'y') {\n\t\t\t\tif (Math.sign(force) == 1) {\n\t\t\t\t\tthis.y += force;\n\t\t\t\t} else if (Math.sign(force) == -1) {\n\t\t\t\t\tthis.y -= force;\n\t\t\t\t} else {\n\t\t\t\t\tthrow `Force cannot be 0`;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthrow `Cannot add force to axis of ${axis}`;\n\t\t\t}\n\t\t} else {\n\t\t\tthrow `Axis is not type of string. Axis is typeof ${typeof axis}`;\n\t\t}\n\t}\n\n\t/**\n\t * @description Wobbles the background\n\t * @param {Number} intenstiy Speed of movement\n\t * @param {Number} ms Interval in milliseconds\n\t */\n\n\twobble(intenstiy, ms) {\n\t\tthis.isWobbling = true;\n\n\t\tif (this.debug) console.log('Started background wobble');\n\n\t\tlet int = setInterval(() => {\n\t\t\tlet random = Math.floor(Math.random() * (6 - 1 + 1) + 1);\n\t\t\tif (random >= 4) {\n\t\t\t\tthis.x += intenstiy;\n\t\t\t\tthis.y -= intenstiy;\n\t\t\t} else {\n\t\t\t\tthis.y += intenstiy;\n\t\t\t\tthis.x -= intenstiy;\n\t\t\t}\n\n\t\t\tif (!this.isWobbling) {\n\t\t\t\tclearInterval(int);\n\t\t\t}\n\t\t}, ms);\n\t}\n\n\t/**\n\t * @description Stops the current wobble if there is one\n\t */\n\n\tstopWobble() {\n\t\tthis.isWobbling = false;\n\t\tif (this.debug) console.log('Stopped background wobble');\n\t}\n}\n\n/**\n * @class SpriteSheet\n * @classdesc Creates a SpriteSheet\n */\n\nclass SpriteSheet extends Reflex {\n\tconstructor(rows, column, imgW, imgH, singleW, singleH) {\n\t\tsuper(ReflexConfig);\n\t\tthis.type = 'SpriteSheet'; // instead of contructor.name as minified files can cause problems\n\t\tthis.id = randomInt(1, 100000);\n\n\t\tthis.rows = rows;\n\t\tthis.column = column;\n\n\t\tthis.singleW = singleW;\n\t\tthis.singleH = singleH;\n\n\t\tthis.w = imgW;\n\t\tthis.h = imgH;\n\n\t\tthis.sX = 0;\n\t\tthis.sY = 0;\n\t}\n\n\t/**\n\t * @description Draws frame\n\t * @param {Object} frame Frame object\n\t * @param {Number} frame.column What column to select the image from, starts at 0\n\t * @param {Number} frame.row What row to select the image from, starts at 0\n\t */\n\n\tdraw(frame) {\n\t\tvar imgObj = new Image();\n\t\timgObj.src = this.imgPath;\n\t\tthis.ctx.drawImage(imgObj, this.x, this.y, this.w, this.h);\n\t}\n}\n\n//#region Sound\n\n/**\n * @class Sound\n * @classdesc Creates a Sound\n */\n\nclass Sound extends Reflex {\n\t/**\n\t * @description Creates a sound\n\t * @param {Object} options Option object\n\t * @param {String} options.src A file path or link to the audio src\n\t * @param {Boolean} [options.autoplay=false] Autoplay sound, off by default\n\t * @param {Boolean} [options.destroyAfter=false] Remove audio element after playing\n\t * @param {Boolean} [options.loop=false] Loop sound, off by default\n\t * @param {Boolean} [options.volume=1] Volume of sound, 0-1, 1 by default\n\t * @param {Function} [options.onPlay] An on play event, optional\n\t * @param {Function} [options.onPause] An on pause event, optional\n\t * @param {Function} [options.onVolumeChange] An on volume change event, optional\n\t * @param {Function} [options.onEnd] An on end event, optional\n\t * @param {Function} [options.onAppend] A custom event, fires once audio is appened\n\t * @param {Function} [options.onDestroy] A custom event, fires if destoryAfter is true and once it ended and removed\n\t *\n\t * @memberof Sound\n\t */\n\n\tconstructor(options) {\n\t\tsuper(ReflexConfig);\n\t\tthis.type = 'Sound';\n\t\tthis.id = randomInt(1, 100000);\n\n\t\tthis.options = options;\n\t\tthis.src = this.options.src;\n\n\t\t// optional params\n\t\tthis.autoplay = this.options.autoplay || false;\n\t\tthis.destroyAfter = this.options.destroyAfter || false;\n\t\tthis.loop = this.options.loop || false;\n\t\tthis.volume = this.options.volume || 1;\n\n\t\tthis.onPlay = this.options.onPlay || function () {};\n\t\tthis.onPause = this.options.onPause || function () {};\n\t\tthis.onVolumeChange = this.options.onVolumeChange || function () {};\n\t\tthis.onEnd = this.options.onEnd || function () {};\n\n\t\tthis.onAppend = this.options.onAppend || function () {};\n\t\tthis.onDestroy = this.options.onDestroy || function () {};\n\n\t\t// throw typeof errors\n\t\tif (typeof this.options != 'object')\n\t\t\tthrow `options must be a typeof object`;\n\t\tif (typeof this.src != 'string') throw `src must be a string`;\n\t\tif (typeof this.autoplay != 'boolean')\n\t\t\tthrow `autoplay must be typeof boolean`;\n\t\tif (typeof this.onPlay != 'function')\n\t\t\tthrow `onPlay must be typeof function`;\n\t\tif (typeof this.onPause != 'function')\n\t\t\tthrow `onPause must be typeof function`;\n\t\tif (typeof this.onVolumeChange != 'function')\n\t\t\tthrow `onVolumeChange must be typeof function`;\n\t\tif (typeof this.onEnd != 'function')\n\t\t\tthrow `onEnd must be typeof function`;\n\t\tif (typeof this.onDestroy != 'function')\n\t\t\tthrow `onDestroy must be typeof function`;\n\t\tif (typeof this.volume != 'number')\n\t\t\tthrow `volume must be typeof number`;\n\n\t\t// Main Sound Functionality\n\n\t\tthis.element = document.createElement('audio');\n\n\t\t// main attr\n\t\tthis.element.volume = this.volume;\n\t\tthis.element.autoplay = this.autoplay;\n\t\tthis.element.loop = this.loop;\n\t\tthis.element.src = this.src;\n\n\t\t// events\n\t\tthis.element.onerror = (err) => {\n\t\t\tthrow err;\n\t\t};\n\t\tthis.element.onwaiting = () => {\n\t\t\tif (this.debug)\n\t\t\t\tconsole.warn(\n\t\t\t\t\t`Audio waited/buffered, ignore if u seeked or ended the audio`\n\t\t\t\t);\n\t\t};\n\n\t\tthis.element.onplay = this.onPlay;\n\t\tthis.element.onpause = this.onPause;\n\t\tthis.element.onvolumechange = this.onVolumeChange;\n\t\tthis.element.onended = this.onEnd;\n\n\t\t// destroyAfter\n\n\t\tif (this.destroyAfter) {\n\t\t\tthis.element.addEventListener('ended', () => {\n\t\t\t\tthis.element.onDestroy();\n\t\t\t\tthis.element.remove();\n\t\t\t});\n\t\t}\n\n\t\t// custom events\n\n\t\tthis.element.onAppend = this.onAppend;\n\t\tthis.element.onDestroy = this.onDestroy;\n\n\t\tdocument.body.appendChild(this.element);\n\t\tthis.onAppend();\n\t}\n\n\t/**\n\t * @description Plays the sound\n\t */\n\n\tplay() {\n\t\tthis.element.play();\n\t}\n\n\t/**\n\t * @description Plays another sound after the first has ended\n\t * @param {Sound} sound An instance of a sound\n\t */\n\n\tplayAfter(sound) {\n\t\tthis.element.addEventListener('ended', () => {\n\t\t\tsound.play();\n\t\t});\n\t}\n\n\t/**\n\t * @description Pauses the sound\n\t */\n\n\tpause() {\n\t\tthis.element.pause();\n\t}\n\n\t/**\n\t * @description Changes the volume of the Sound\n\t * @param {Number} volume Number between 0-1\n\t */\n\n\tchangeVolume(volume) {\n\t\tthis.element.volume = volume;\n\t}\n\n\t/**\n\t * @description Ends the current audio\n\t */\n\n\tend() {\n\t\tthis.element.currentTime = this.element.duration + 1;\n\t}\n\n\t/**\n\t * @description Removes the audio element\n\t */\n\n\tremove() {\n\t\tthis.element.remove();\n\t}\n\n\t/**\n\t * @description Seeks the audio\n\t * @param {Number} time 0 - Sound Duration\n\t */\n\n\tseek(time) {\n\t\tthis.element.currentTime = time;\n\t}\n}\n\n/**\n * @class ProximitySound\n * @classdesc Creates a ProximitySound\n */\n\nclass ProximitySound extends Reflex {\n\t/**\n\t * @description Creates a ProximitySound\n\t * @param {Number} x X pos\n\t * @param {Number} y Y pos\n\t * @param {Sound} sound An instance of the Sound Class\n\t * @param {Object} options A object that holds all configuration for ProximitySound\n\t * @param {Number} [options.volume=1] Volume when entered, default is 1\n\t * @param {Number} [options.debugCirlce=false] Show the circle/area where it is activated\n\t * @param {Number} options.radius Radius of hearing the ProximitySound\n\t * @param {Object[]} affects An array of RigidBodies that get affected by Proximity Sound\n\t *\n\t * @memberof ProximitySound\n\t */\n\n\tconstructor(x, y, sound, options, affects) {\n\t\tsuper(ReflexConfig);\n\t\tthis.type = 'ProximitySound';\n\t\tthis.id = randomInt(1, 100000);\n\n\t\tthis.x = x;\n\t\tthis.y = y;\n\t\tthis.color = 'rgba(0, 0, 0, 0)';\n\n\t\tthis.sound = sound;\n\t\tthis.options = options;\n\t\tthis.affects = affects;\n\t\tthis.volume = this.options.volume || 1;\n\t\tthis.showDebugCircle = this.options.debugCirlce || false;\n\n\t\tif (this.showDebugCircle) {\n\t\t\tthis.color = 'rgba(0, 0, 0, 0.1)';\n\t\t}\n\n\t\tthis.r = this.options.radius;\n\n\t\tthis.sound.changeVolume(0);\n\n\t\t// throw typeof errors\n\t\tif (typeof this.options != 'object') throw `options is not an object`;\n\t\tif (!Array.isArray(this.affects)) throw `affects is not an array`;\n\n\t\tEntitys._ProximitySound.push(this);\n\t}\n\n\t/**\n\t * @description Draws the ProximitySound\n\t */\n\n\tdraw() {\n\t\tthis.ctx.beginPath();\n\t\tthis.ctx.arc(this.x, this.y, this.r, 0, 2 * Math.PI, false);\n\t\tthis.ctx.fillStyle = this.color;\n\t\tthis.ctx.fill();\n\t\tthis.affects.forEach((obj) => {\n\t\t\tlet a = this.x - obj.centerX;\n\t\t\tlet b = this.y - obj.centerY;\n\t\t\tlet DistToMid = Math.sqrt(a * a + b * b);\n\n\t\t\tif (DistToMid >= this.r) {\n\t\t\t\tthis.sound.changeVolume(0);\n\t\t\t\tthis.sound.pause();\n\t\t\t}\n\t\t\tif (DistToMid <= this.r) {\n\t\t\t\tthis.sound.changeVolume(this.volume);\n\t\t\t\tthis.sound.play();\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * @description Attachs a ProximitySound to a RigidBody\n\t * @param {RigidBody} RigidBody A RigidBody\n\t */\n\n\tattachTo(RigidBody) {}\n\n\t/**\n\t * @description Detachs a ProximitySound from a RigidBody\n\t * @param {RigidBody} RigidBody A RigidBody\n\t */\n\n\tdetach(RigidBody) {}\n}\n\n// end sound\n//#endregion\n\n// end misc\n//#endregion\n\n//#region GFX & Others\n\n/**\n * @class Shadow\n * @classdesc Creates a basic circle shadow\n */\n\nclass Shadow extends Reflex {\n\t/**\n\t * @description Creates a shadow that can appendTo a RigidBody\n\t * @param {Number} alpha Alpha value between 0-1\n\t * @param {Number} radius Radius of shadow\n\t * @param {Number} [offsetX=0] offset x pos, optional\n\t * @param {Number} [offsetY=0] offset y pos, optional\n\t */\n\n\tconstructor(alpha, radius, offsetX, offsetY) {\n\t\tsuper(ReflexConfig);\n\t\tthis.type = 'Shadow';\n\t\tthis.id = randomInt(1, 100000);\n\n\t\tthis.alpha = alpha;\n\t\tthis.r = radius;\n\t\tthis.color = `rgba(0, 0, 0, ${alpha})`;\n\n\t\tthis.offsetX = offsetX || 0;\n\t\tthis.offsetY = offsetY || 0;\n\n\t\tthis.isAppened = false;\n\t\tthis.appenedTo = undefined;\n\n\t\tEntitys._Shadow.push(this);\n\t}\n\n\tdraw() {\n\t\tif (this.isAppened) {\n\t\t\tthis.ctx.beginPath();\n\t\t\tthis.ctx.arc(\n\t\t\t\tthis.appenedTo.centerX + this.offsetX,\n\t\t\t\tthis.appenedTo.centerY + this.offsetY,\n\t\t\t\tthis.r,\n\t\t\t\t0,\n\t\t\t\t2 * Math.PI,\n\t\t\t\tfalse\n\t\t\t);\n\t\t\tthis.ctx.fillStyle = this.color;\n\t\t\tthis.ctx.fill();\n\t\t}\n\t}\n\n\t/**\n\t * @description Appends shadow to a RigidBody\n\t * @param {RigidBody} rigidbody A RigidBody\n\t */\n\n\tappendTo(rigidbody) {\n\t\tif (rigidbody.type != 'RigidBody')\n\t\t\tthrow `Cannot append shadow to ${rigidbody.type}`;\n\t\trigidbody.hasShadow = true;\n\t\trigidbody.selfShadow = this;\n\t\tthis.isAppened = true;\n\t\tthis.appenedTo = rigidbody;\n\t}\n\n\t/**\n\t * @description Removes shadow from a RigidBody\n\t * @param {RigidBody} rigidbody A RigidBody\n\t */\n\n\tremoveFrom(rigidbody) {\n\t\tif (rigidbody.type != 'RigidBody')\n\t\t\tthrow `Cannot remove shadow from ${rigidbody.type}`;\n\t\tif (!rigidbody.hasShadow)\n\t\t\tthrow `Cannot remove shadow, ${rigidbody} does not have a shadow to remove`;\n\t\trigidbody.selfShadow = undefined;\n\t\trigidbody.hasShadow = false;\n\t\tthis.isAppened = false;\n\t\tthis.appenedTo = undefined;\n\t\tthis.color = `rgba(0, 0, 0, 0)`;\n\t}\n}\n\n/**\n * @class Particles\n * @classdesc Creates Particles\n */\n\nclass Particles extends Reflex {\n\t/**\n\t * @description Creates Particles\n\t * @param {String} shape RigidBody Shape, rect, roundrect, circle, or sprite\n\t * @param {String} graphic Hex Color or imgPath/link\n\t *\n\t * @param {Object} options An object with many options\n\t * @param {Number} options.amount Amount of particles to create\n\t * @param {Number} options.minX Min X Pos spreading\n\t * @param {Number} options.maxX Max X Pos spreading\n\t * @param {Number} options.minY Min Y Pos spreading\n\t * @param {Number} options.maxY MAX Y Pos spreading\n\t *\n\t * @param {Number} [w] Width of rect, roundrect or sprite, optional for circle shape\n\t * @param {Number} [h] Height of rect, roundrect or sprite, optional for circle shape\n\t * @param {NUmber} [r] Radius of roundrect or cirlce, optional for rect and sprite shape\n\t *\n\t * @memberof Particles\n\t */\n\n\tconstructor(shape, graphic, options, w, h, r) {\n\t\tsuper(ReflexConfig);\n\t\tthis.type = 'Particles';\n\t\tthis.id = randomInt(1, 100000);\n\n\t\tthis.shape = shape.toLowerCase();\n\t\tthis.graphic = graphic;\n\t\tthis.options = options;\n\n\t\tthis.minX = this.options.minX;\n\t\tthis.maxX = this.options.maxX;\n\t\tthis.minY = this.options.minY;\n\t\tthis.maxY = this.options.maxY;\n\n\t\tthis.randomX = randomInt(this.minX, this.maxX);\n\t\tthis.randomY = randomInt(this.minY, this.maxY);\n\n\t\tthis.w = w;\n\t\tthis.h = h;\n\t\tthis.r = r;\n\n\t\tthis.amount = this.options.amount;\n\n\t\tthis.list = [];\n\t\tthis.isEmitting = false;\n\t\tthis.isWobbling = false;\n\t\tthis.isPreset = false;\n\t\tthis.currentPreset = '';\n\n\t\t// push particles to list\n\t\tthis.create();\n\n\t\tEntitys._Particles.push(this);\n\t}\n\n\t/**\n\t * @description Creates and pushes particles to Particles.list, runs automatically\n\t */\n\n\tcreate() {\n\t\tswitch (this.shape) {\n\t\t\tcase 'rect':\n\t\t\t\tfor (let i = 0; i < this.amount; i++) {\n\t\t\t\t\tthis.randomX = randomInt(this.minX, this.maxX);\n\t\t\t\t\tthis.randomY = randomInt(this.minY, this.maxY);\n\t\t\t\t\tlet p = new RigidBody(\n\t\t\t\t\t\tthis.randomX,\n\t\t\t\t\t\tthis.randomY,\n\t\t\t\t\t\tthis.w,\n\t\t\t\t\t\tthis.h,\n\t\t\t\t\t\t0,\n\t\t\t\t\t\t'rect',\n\t\t\t\t\t\tthis.graphic\n\t\t\t\t\t);\n\t\t\t\t\tp.type = 'ParticleChild';\n\t\t\t\t\tthis.list.push(p);\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase 'roundrect':\n\t\t\t\tfor (let i = 0; i < this.amount; i++) {\n\t\t\t\t\tthis.randomX = randomInt(this.minX, this.maxX);\n\t\t\t\t\tthis.randomY = randomInt(this.minY, this.maxY);\n\t\t\t\t\tlet p = new RigidBody(\n\t\t\t\t\t\tthis.randomX,\n\t\t\t\t\t\tthis.randomY,\n\t\t\t\t\t\tthis.w,\n\t\t\t\t\t\tthis.h,\n\t\t\t\t\t\tthis.r,\n\t\t\t\t\t\t'roundrect',\n\t\t\t\t\t\tthis.graphic\n\t\t\t\t\t);\n\t\t\t\t\tp.type = 'ParticleChild';\n\t\t\t\t\tthis.list.push(p);\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase 'circle':\n\t\t\t\tfor (let i = 0; i < this.amount; i++) {\n\t\t\t\t\tthis.randomX = randomInt(this.minX, this.maxX);\n\t\t\t\t\tthis.randomY = randomInt(this.minY, this.maxY);\n\t\t\t\t\tlet p = new RigidBody(\n\t\t\t\t\t\tthis.randomX,\n\t\t\t\t\t\tthis.randomY,\n\t\t\t\t\t\tthis.w,\n\t\t\t\t\t\tthis.h,\n\t\t\t\t\t\tthis.r,\n\t\t\t\t\t\t'circle',\n\t\t\t\t\t\tthis.graphic\n\t\t\t\t\t);\n\t\t\t\t\tp.type = 'ParticleChild';\n\t\t\t\t\tthis.list.push(p);\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase 'sprite':\n\t\t\t\tfor (let i = 0; i < this.amount; i++) {\n\t\t\t\t\tthis.randomX = randomInt(this.minX, this.maxX);\n\t\t\t\t\tthis.randomY = randomInt(this.minY, this.maxY);\n\t\t\t\t\tthis.list.push(\n\t\t\t\t\t\tnew RigidBody(\n\t\t\t\t\t\t\tthis.randomX,\n\t\t\t\t\t\t\tthis.randomY,\n\t\t\t\t\t\t\tthis.w,\n\t\t\t\t\t\t\tthis.h,\n\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\t'sprite',\n\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\tthis.graphic\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\tthrow 'Particles.shape is not a rect, roundrect, circle, or sprite.';\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\t/**\n\t * @description Draws particles, won't draw if particles are not emitting\n\t */\n\n\tdraw() {\n\t\tif (this.isEmitting) {\n\t\t\tthis.list.forEach((particle) => {\n\t\t\t\tparticle.draw();\n\t\t\t});\n\t\t}\n\t}\n\n\t/**\n\t * @description Starts emitting particles\n\t */\n\n\temit() {\n\t\tthis.isEmitting = true;\n\t\tif (this.debug) console.log('Started Emitting Particles');\n\t}\n\n\t/**\n\t * @description Stops emitting particles\n\t */\n\n\tstopEmitting() {\n\t\tthis.isEmitting = false;\n\t\tif (this.debug) console.log('Stopped Emitting Particles');\n\t}\n\n\t/**\n\t * @description Wobbles/Moves particles around randomly\n\t * @param {Number} speed Speed of particles\n\t */\n\n\twobble(speed) {\n\t\tif (typeof speed != 'number')\n\t\t\tthrow `Particles.wobble speed is not a number and is typeof ${typeof speed}`;\n\n\t\tthis.list.forEach((particle) => {\n\t\t\tlet random = Math.floor(Math.random() * (6 - 1 + 1) + 1);\n\t\t\tif (random >= 4) {\n\t\t\t\tparticle.x += speed;\n\t\t\t\tparticle.y -= speed;\n\t\t\t} else {\n\t\t\t\tparticle.y += speed;\n\t\t\t\tparticle.x -= speed;\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * @description Plays a preset animation. Valid Animations: explosion, smoke\n\t * @param {String} preset Animation, explosion or smoke\n\t * @param {Number} speed Speed of animation\n\t * @param {String} [dir=\"left\"] Direction of preset smoke, valid: left or right, optional, defaults to left if preset is smoke\n\t */\n\n\tanimate(preset, speed, dir) {\n\t\t// (very messy code)\n\t\tswitch (preset) {\n\t\t\tcase 'explosion':\n\t\t\t\tlet chunked = chunkify(\n\t\t\t\t\tthis.list,\n\t\t\t\t\t8,\n\t\t\t\t\ttrue\n\t\t\t\t); /* returns an array with nested arrays, 8 for 8 different directions,\n                                                             top left, up, top right, right, bottom right, bottom, bottom left, left */\n\t\t\t\t// top left\n\t\t\t\tfor (let i = 0; i < chunked[0].length; i++) {\n\t\t\t\t\tlet particle = chunked[0][i];\n\t\t\t\t\tparticle.x -= speed;\n\t\t\t\t\tparticle.y -= speed;\n\t\t\t\t}\n\n\t\t\t\t// top\n\t\t\t\tfor (let i = 0; i < chunked[1].length; i++) {\n\t\t\t\t\tlet particle = chunked[1][i];\n\t\t\t\t\tparticle.y -= speed;\n\t\t\t\t}\n\n\t\t\t\t// top right\n\t\t\t\tfor (let i = 0; i < chunked[2].length; i++) {\n\t\t\t\t\tlet particle = chunked[2][i];\n\t\t\t\t\tparticle.x += speed;\n\t\t\t\t\tparticle.y += speed;\n\t\t\t\t}\n\n\t\t\t\t// right\n\t\t\t\tfor (let i = 0; i < chunked[3].length; i++) {\n\t\t\t\t\tlet particle = chunked[3][i];\n\t\t\t\t\tparticle.x += speed;\n\t\t\t\t}\n\n\t\t\t\t// bottom right\n\t\t\t\tfor (let i = 0; i < chunked[4].length; i++) {\n\t\t\t\t\tlet particle = chunked[4][i];\n\t\t\t\t\tparticle.x += speed;\n\t\t\t\t\tparticle.y += speed;\n\t\t\t\t}\n\n\t\t\t\t// bottom\n\t\t\t\tfor (let i = 0; i < chunked[5].length; i++) {\n\t\t\t\t\tlet particle = chunked[5][i];\n\t\t\t\t\tparticle.y += speed;\n\t\t\t\t}\n\n\t\t\t\t// bottom left\n\t\t\t\tfor (let i = 0; i < chunked[6].length; i++) {\n\t\t\t\t\tlet particle = chunked[6][i];\n\t\t\t\t\tparticle.x -= speed;\n\t\t\t\t\tparticle.y -= speed;\n\t\t\t\t}\n\n\t\t\t\t// left\n\t\t\t\tfor (let i = 0; i < chunked[7].length; i++) {\n\t\t\t\t\tlet particle = chunked[7][i];\n\t\t\t\t\tparticle.x -= speed;\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'smoke':\n\t\t\t\tthis.list.forEach((particle) => {\n\t\t\t\t\tparticle.y -= speed;\n\t\t\t\t});\n\t\t\t\tif (dir == 'left') {\n\t\t\t\t\tthis.list.forEach((particle) => {\n\t\t\t\t\t\tparticle.x -= speed / 2;\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tif (dir == 'right') {\n\t\t\t\t\tthis.list.forEach((particle) => {\n\t\t\t\t\t\tparticle.x += speed / 2;\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\tthrow `Particles.animate preset does not match a preset. Valid presets are: \"explosion\", and \"smoke\"`;\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\t/**\n\t * @description Removes all or some particles from list and stopsEmitting if amount is passed\n\t * @param {Number} [amount] Amount of particles to destroy, optional, default to all particles\n\t */\n\n\tdestroy(amount) {\n\t\tif (amount > this.list.length)\n\t\t\tthrow 'Particles.destroy amount is greater than amount of particles';\n\n\t\tamount = amount || this.list.length;\n\n\t\tif (amount != this.list.length) {\n\t\t\tif (this.debug) console.log(`Destroyed ${amount} particles`);\n\n\t\t\tfor (let i = 0; i < amount; i++) {\n\t\t\t\tthis.list.splice(i, 1);\n\t\t\t}\n\t\t} else {\n\t\t\tif (this.debug) console.log('Destroyed all particles');\n\n\t\t\tthis.stopEmitting();\n\t\t\tthis.list.length = 0;\n\t\t}\n\t}\n}\n\n//#endregion\n\n//#region UI\n\n/**\n * @class Text\n * @classdesc Creates text on the canvas\n */\n\nclass Text extends Reflex {\n\t/**\n\t * @description Creates text\n\t * @param {Number} x X pos\n\t * @param {Number} y Y pos\n\t * @param {String} text The text to be displayed\n\t * @param {Object} styles Style option object\n\t * @param {String} styles.font Font in CSS format\n\t * @param {String} styles.color Color of text in hex\n\t * @param {String} [styles.textAlign=\"start\"] Text align of text, optional, defaults to start\n\t * @param {String} styles.method How you want the text rendered, fill, stroke, or fillstroke\n\t * @param {String} [styles.strokeStyle=\"#000000\"] Color of stroke in hex, optional, defaults to #000000\n\t * @param {Number} [styles.strokeWidth=1] Width of stroke, optional, defaults to 1px\n\t */\n\n\tconstructor(x, y, text, styles) {\n\t\tsuper(ReflexConfig);\n\t\tthis.type = 'Text';\n\t\tthis.id = randomInt(1, 100000);\n\n\t\tthis.x = x;\n\t\tthis.y = y;\n\t\tthis.text = text;\n\n\t\tthis.styles = styles;\n\n\t\tthis.font = this.styles.font;\n\t\tthis.color = this.styles.color;\n\t\tthis.textAlign = this.styles.textAlign || 'start';\n\t\tthis.method = this.styles.method;\n\t\tthis.strokeStyle = this.styles.strokeStyle || '#000000';\n\t\tthis.strokeWidth = this.styles.strokeWidth || 1;\n\n\t\tEntitys._Text.push(this);\n\t}\n\n\t/**\n\t * @description Draws text\n\t */\n\n\tdraw() {\n\t\tif (this.method == 'fill') {\n\t\t\tthis.ctx.font = this.font;\n\t\t\tthis.ctx.fillStyle = this.color;\n\t\t\tthis.ctx.textAlign = this.textAlign;\n\t\t\tthis.ctx.strokeStyle = this.strokeStyle;\n\t\t\tthis.ctx.lineWidth = this.strokeWidth;\n\t\t\tthis.ctx.fillText(this.text, this.x, this.y);\n\t\t}\n\n\t\tif (this.method == 'stroke') {\n\t\t\tthis.ctx.font = this.font;\n\t\t\tthis.ctx.fillStyle = this.color;\n\t\t\tthis.ctx.textAlign = this.textAlign;\n\t\t\tthis.ctx.strokeStyle = this.strokeStyle;\n\t\t\tthis.ctx.lineWidth = this.strokeWidth;\n\t\t\tthis.ctx.strokeText(this.text, this.x, this.y);\n\t\t}\n\n\t\tif (this.method == 'fillstroke') {\n\t\t\tthis.ctx.font = this.font;\n\t\t\tthis.ctx.fillStyle = this.color;\n\t\t\tthis.ctx.textAlign = this.textAlign;\n\t\t\tthis.ctx.strokeStyle = this.strokeStyle;\n\t\t\tthis.ctx.lineWidth = this.strokeWidth;\n\t\t\tthis.ctx.fillText(this.text, this.x, this.y);\n\t\t\tthis.ctx.strokeText(this.text, this.x, this.y);\n\t\t}\n\t}\n}\n\n/**\n * @class Button\n * @classdesc Creates a button on the canvas\n */\n\nclass Button extends Reflex {\n\t/**\n\t * @description Creates an interactive Button\n\t * @param {Number} x X pos\n\t * @param {Number} y Y pos\n\t * @param {Number} w Width of button\n\t * @param {Number} h Height of button\n\t * @param {Number} [r] Radius of button, optional, required if shape is roundrect\n\t * @param {String} text Text to display in the button\n\t * @param {Object} styles Object containing all the styles for the button and the text\n\t * @param {String} styles.shape Shape of button, rect, roundrect, or image\n\t * @param {String} styles.color Hex color(with \"#\"), rgb, or rgba\n\t * @param {String} [styles.imgPath] Img path of button, only required if shape is image\n\t * @param {Object} [styles.stroke] Object containing stroke styles for button\n\t * @param {String} [styles.stroke.style] Color of stroke\n\t * @param {Number} [styles.stroke.width] Width of stroke\n\t * @param {Object} styles.text Object containing all text styles\n\t * @param {String} styles.text.font Font of text in CSS style\n\t * @param {String} styles.text.color Hex Color of text with \"#\"\n\t * @param {String} styles.text.method Text render method, valid: fill, stroke, fillstroke\n\t * @param {Function} cb onclick callback\n\t *\n\t * @memberof Button\n\t */\n\n\tconstructor(x, y, w, h, r, text, styles, cb) {\n\t\tsuper(ReflexConfig);\n\t\tthis.type = 'Button';\n\t\tthis.id = randomInt(1, 100000);\n\n\t\tthis.x = x;\n\t\tthis.y = y;\n\t\tthis.w = w;\n\t\tthis.h = h;\n\t\tthis.r = r || 0;\n\t\tthis.text = text;\n\t\tthis.styles = styles;\n\t\tthis.cb = cb;\n\n\t\tthis.shape = this.styles.shape.toLowerCase();\n\t\tthis.color = this.styles.color;\n\t\tthis.imgPath = this.styles.imgPath || undefined;\n\n\t\tthis.stroke = this.styles.stroke || undefined;\n\t\tthis.strokeStyle = this.stroke.style || undefined;\n\t\tthis.strokeWidth = this.stroke.width || undefined;\n\n\t\tthis.font = this.styles.text.font;\n\t\tthis.fontColor = this.styles.text.color;\n\t\tthis.textMethod = this.styles.text.method;\n\n\t\tthis.textX = this.x + this.w / 2 - this.text.length * 1.75;\n\t\tthis.textY = this.y + this.y / 2;\n\n\t\tif (typeof this.cb != 'function') throw `Button cb is not a function`;\n\n\t\tthis.canvas.addEventListener(\n\t\t\t'click',\n\t\t\t(e) => {\n\t\t\t\tlet mousePos = this.getMousePos(e);\n\n\t\t\t\tif (this.isInside(mousePos, this)) {\n\t\t\t\t\tthis.cb();\n\t\t\t\t}\n\t\t\t},\n\t\t\tfalse\n\t\t);\n\n\t\tif (this.imgPath && this.shape == 'image') {\n\t\t\tthis.imgObj = new Image();\n\t\t}\n\n\t\tEntitys._Button.push(this);\n\t}\n\n\tdraw() {\n\t\tswitch (this.shape) {\n\t\t\tcase 'rect':\n\t\t\t\tthis.ctx.fillStyle = this.color;\n\t\t\t\tthis.ctx.lineWidth = this.strokeWidth;\n\t\t\t\tthis.ctx.strokeStyle = this.strokeStyle;\n\t\t\t\tthis.ctx.fillRect(this.x, this.y, this.w, this.h);\n\t\t\t\tthis.stroke();\n\t\t\t\tbreak;\n\n\t\t\tcase 'roundrect':\n\t\t\t\tif (this.w < 2 * this.r) this.r = this.w / 2;\n\t\t\t\tif (this.h < 2 * this.r) this.r = this.h / 2;\n\t\t\t\tthis.ctx.beginPath();\n\t\t\t\tthis.ctx.moveTo(this.x + this.r, this.y);\n\t\t\t\tthis.ctx.arcTo(\n\t\t\t\t\tthis.x + this.w,\n\t\t\t\t\tthis.y,\n\t\t\t\t\tthis.x + this.w,\n\t\t\t\t\tthis.y + this.h,\n\t\t\t\t\tthis.r\n\t\t\t\t);\n\t\t\t\tthis.ctx.arcTo(\n\t\t\t\t\tthis.x + this.w,\n\t\t\t\t\tthis.y + this.h,\n\t\t\t\t\tthis.x,\n\t\t\t\t\tthis.y + this.h,\n\t\t\t\t\tthis.r\n\t\t\t\t);\n\t\t\t\tthis.ctx.arcTo(this.x, this.y + this.h, this.x, this.y, this.r);\n\t\t\t\tthis.ctx.arcTo(this.x, this.y, this.x + this.w, this.y, this.r);\n\t\t\t\tthis.ctx.closePath();\n\t\t\t\tthis.ctx.fillStyle = this.color;\n\t\t\t\tthis.ctx.lineWidth = this.strokeWidth;\n\t\t\t\tthis.ctx.strokeStyle = this.strokeStyle;\n\t\t\t\tthis.ctx.fill();\n\t\t\t\tthis.ctx.stroke();\n\t\t\t\tbreak;\n\n\t\t\tcase 'image':\n\t\t\t\tthis.imgObj.src = this.imgPath;\n\t\t\t\tthis.ctx.drawImage(this.imgObj, this.x, this.y, this.w, this.h);\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\tthrow `${this.shape} is not a rect, roundrect, or circle.`;\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\t/**\n\t * @description Gets the mouse cursor postion\n\t * @param {MouseEvent} event\n\t * @returns {Object} Object with x and y properties\n\t */\n\n\tgetMousePos(event) {\n\t\tlet rect = this.canvas.getBoundingClientRect();\n\t\treturn {\n\t\t\tx: event.clientX - rect.left,\n\t\t\ty: event.clientY - rect.top,\n\t\t};\n\t}\n\n\t/**\n\t * @description Detects if button is being pressed\n\t * @param {Object} pos Object with x and y pos of mouse cursor\n\t * @param {Button} rect Button\n\t * @returns Boolean\n\t */\n\n\tisInside(pos, rect) {\n\t\treturn (\n\t\t\tpos.x > rect.x &&\n\t\t\tpos.x < rect.x + rect.w &&\n\t\t\tpos.y < rect.y + rect.h &&\n\t\t\tpos.y > rect.y\n\t\t);\n\t}\n}\n\n// end ui\n//#endregion\n\n//#region Lights\n\n/**\n * @class StaticLight\n * @classdesc Creates a StaticLight\n */\n\nclass StaticLight extends Reflex {\n\t/**\n\t * @description Creates a StaticLight which is a \"fake\" light\n\t * @param {Number} x X pos\n\t * @param {Number} y Y pos\n\t * @param {Number} r Radius of the light\n\t * @param {String} color Color of the light, RGBA color\n\t * @param {Number} blur Blur intenstity\n\t *\n\t * @memberof StaticLight\n\t */\n\n\tconstructor(x, y, r, color, blur) {\n\t\tsuper(ReflexConfig);\n\t\tthis.type = 'StaticLight';\n\t\tthis.id = randomInt(1, 100000);\n\n\t\tthis.x = x;\n\t\tthis.y = y;\n\t\tthis.r = r;\n\t\tthis.color = color;\n\t\tthis.blur = blur;\n\n\t\tthis.isEmitting = false;\n\t\tthis.isAttached = false;\n\t\tthis.appenedTo = undefined;\n\n\t\tEntitys._StaticLight.push(this);\n\t}\n\n\tdraw() {\n\t\tif (this.isEmitting) {\n\t\t\tthis.ctx.globalCompositeOperation = 'lighter';\n\t\t\tthis.ctx.beginPath();\n\t\t\tthis.ctx.arc(this.x, this.y, this.r, 0, 2 * Math.PI, false);\n\t\t\tthis.ctx.fillStyle = this.color;\n\t\t\tthis.ctx.fill();\n\t\t\tthis.ctx.globalCompositeOperation = 'source-over';\n\t\t}\n\t}\n\n\t/**\n\t * @description Starts emitting light\n\t */\n\n\temit() {\n\t\tthis.isEmitting = true;\n\t}\n\n\t/**\n\t * @description Stops emitting light\n\t */\n\n\tstopEmitting() {\n\t\tthis.isEmitting = false;\n\t}\n\n\t/**\n\t * @description Appends the light to a RigidBdy\n\t * @param {RigidBody} rigidbody A RigidBody\n\t */\n\n\tappendTo(rigidbody) {\n\t\tif (rigidbody.type != 'RigidBody')\n\t\t\tthrow `Cannot append shadow to ${rigidbody.type}`;\n\t\trigidbody.hasLight = true;\n\t\trigidbody.selfLight = this;\n\t\tthis.isAttached = true;\n\t\tthis.appenedTo = rigidbody;\n\t}\n\n\t/**\n\t * @description Removes a light from a RigidBdy\n\t * @param {RigidBody} rigidbody A RigidBody\n\t */\n\n\tunappend(rigidbody) {\n\t\tif (rigidbody.type != 'RigidBody')\n\t\t\tthrow `Cannot remove light from ${rigidbody.type}`;\n\t\tif (!rigidbody.hasLight)\n\t\t\tthrow `Cannot remove light, ${rigidbody} does not have a light to remove`;\n\t\trigidbody.selfLight = undefined;\n\t\trigidbody.hasLight = false;\n\t\tthis.isAppened = false;\n\t\tthis.appenedTo = undefined;\n\t}\n}\n\n/**\n * @class Gamepad\n * @classdesc Creates a Gamepad listener\n */\n\nclass Gamepad extends Reflex {\n\t/**\n\t * @description Creates and returns a gamepad api object\n\t * @param {object} options Options object\n\t * @param {boolean} options.turbo Determines if holding a button down is allowed\n\t * @param {Function} [options.turbo_fire=() => {}] Function to be called if button is being held\n\t * @param {Function} options.managePause Function to be called if button is being pressed\n\t *\n\t * @returns Gamepad | null\n\t * @memberof Gamepad\n\t */\n\n\tconstructor() {\n\t\tsuper(ReflexConfig);\n\t\tthis.id = randomInt(1, 100000);\n\t\tthis.type = 'Gamepad';\n\n\t\tthis.gamepad;\n\n\t\tthis.connected = false;\n\n\t\tif (navigator.getGamepads()[0] != null) {\n\t\t\tthis.connected = true;\n\t\t}\n\n\t\tthis.gamepadIndex;\n\t\twindow.addEventListener('gamepadconnected', (event) => {\n\t\t\tthis.gamepadIndex = event.gamepad.index;\n\t\t\tthis.connected = true;\n\t\t});\n\n\t\treturn navigator.getGamepads()[this.gamepadIndex];\n\t}\n\n\t/**\n\t * @description Updates the gamepad[s'] state\n\t */\n\n\tupdate() {\n\t\tif (this.gamepad && this.gamepadIndex) {\n\t\t\tthis.gamepad = navigator.getGamepads()[this.gamepadIndex];\n\t\t\tthis.connected = true;\n\t\t\tif (this.debug) {\n\t\t\t\tconsole.log(\n\t\t\t\t\t`Left stick at (${this.gamepad.axes[0]}, ${this.gamepad.axes[1]})`\n\t\t\t\t);\n\t\t\t\tconsole.log(\n\t\t\t\t\t`Right stick at (${this.gamepad.axes[2]}, ${this.gamepad.axes[3]})`\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n}\n\n// end lights\n//#endregion\n\n//#region Exports and Groups\n\n/**\n * @namespace\n * @description Reflex Object classes\n * @property {RigidBody} RigidBody\n * @property {Background} Background\n */\n\nlet Objects = {\n\tRigidBody: RigidBody,\n\tBackground: Background,\n};\n\n/**\n * @namespace\n * @description Reflex Light classes\n * @property {StaticLight} StaticLight\n */\n\nlet Lights = {\n\tStaticLight: StaticLight,\n};\n\n/**\n * @namespace\n * @description Reflex UI classes\n * @property {Text} Text\n * @property {Button} Button\n */\n\nlet UI = {\n\tText: Text,\n\tButton: Button,\n};\n\n/**\n * @namespace\n * @description Reflex GFX classes\n * @property {Shadow} Shadow\n * @property {Particles} Particles\n */\n\nlet GFX = {\n\tShadow: Shadow,\n\tParticles: Particles,\n};\n\n/**\n * @namespace\n * @description Reflex Audio classes\n * @property {Sound} Sound\n * @property {ProximitySound} ProximitySound\n */\n\nlet Audio = {\n\tSound: Sound,\n\tProximitySound: ProximitySound,\n};\n\n/**\n * @namespace\n * @description Reflex Movement classes\n * @property {Gamepad} Gamepad\n * @property {TouchController} TouchController\n */\n\nlet Movement = {\n\tGamepad: Gamepad,\n};\n\n/**\n * @namespace\n * @description Reflex Misc classes\n * @property {SpriteSheet} SpriteSheet\n */\n\nlet Misc = {\n\tSpriteSheet: SpriteSheet,\n};\n\n/**\n * @namespace\n * @description Reflex Data objects\n * @property {Entitys} Entitys\n */\n\nlet Data = {\n\tEntitys: Entitys,\n};\n\n// export as a module\n\nexport { Reflex, Objects, Lights, Misc, Audio, Movement, GFX, UI, Data };\n\n//#endregion\n"]}