diff --git a/dist/Excalibur.0.6.0.nupkg b/dist/Excalibur.0.6.0.nupkg index 2d3b10d41..38605d38c 100644 Binary files a/dist/Excalibur.0.6.0.nupkg and b/dist/Excalibur.0.6.0.nupkg differ diff --git a/dist/Excalibur.d.ts b/dist/Excalibur.d.ts index abce662ff..b57e6b106 100644 --- a/dist/Excalibur.d.ts +++ b/dist/Excalibur.d.ts @@ -3206,6 +3206,10 @@ declare module ex { * it from the scene graph. It will no longer be drawn or updated. */ kill(): void; + /** + * If the current actor is killed, it will now not be killed. + */ + unkill(): void; /** * Indicates wether the actor has been killed. */ diff --git a/dist/Excalibur.js b/dist/Excalibur.js index d6ebaa53a..b62b46962 100644 --- a/dist/Excalibur.js +++ b/dist/Excalibur.js @@ -1,4 +1,4 @@ -/*! excalibur - v0.6.0 - 2016-05-16 +/*! excalibur - v0.6.0 - 2016-05-25 * https://github.com/excaliburjs/Excalibur * Copyright (c) 2016 Excalibur.js ; Licensed BSD-2-Clause*/ if (typeof window === 'undefined') { @@ -5650,6 +5650,9 @@ var ex; return this.children.indexOf(actor) > -1; }; Scene.prototype.add = function (entity) { + if (entity instanceof ex.Actor) { + entity.unkill(); + } if (entity instanceof ex.UIActor) { if (!ex.Util.contains(this.uiActors, entity)) { this.addUIActor(entity); @@ -6386,6 +6389,12 @@ var ex; this.logger.warn('Cannot kill actor, it was never added to the Scene'); } }; + /** + * If the current actor is killed, it will now not be killed. + */ + Actor.prototype.unkill = function () { + this._isKilled = false; + }; /** * Indicates wether the actor has been killed. */ diff --git a/dist/Excalibur.min.js b/dist/Excalibur.min.js index 5f18e8f98..7c48eb354 100644 --- a/dist/Excalibur.min.js +++ b/dist/Excalibur.min.js @@ -1,11 +1,11 @@ -/*! excalibur - v0.6.0 - 2016-05-16 +/*! excalibur - v0.6.0 - 2016-05-25 * https://github.com/excaliburjs/Excalibur * Copyright (c) 2016 Excalibur.js ; Licensed BSD-2-Clause*/ "undefined"==typeof window&&(window={audioContext:function(){}}),"undefined"==typeof window||window.requestAnimationFrame||(window.requestAnimationFrame=window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(t){window.setInterval(t,1e3/60)}),"undefined"==typeof window||window.cancelAnimationFrame||(window.cancelAnimationFrame=window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||function(){}),"undefined"==typeof window||window.AudioContext||(window.AudioContext=window.AudioContext||window.webkitAudioContext||window.mozAudioContext||window.msAudioContext||window.oAudioContext),Array.prototype.forEach||(Array.prototype.forEach=function(t,e){var i,n;if(null==this)throw new TypeError(" this is null or not defined");var s=Object(this),o=s.length>>>0;if("function"!=typeof t)throw new TypeError(t+" is not a function");for(arguments.length>1&&(i=e),n=0;o>n;){var r;n in s&&(r=s[n],t.call(i,r,n,s)),n++}}),Array.prototype.some||(Array.prototype.some=function(t){"use strict";if(void 0===this||null===this)throw new TypeError;var e=Object(this),i=e.length>>>0;if("function"!=typeof t)throw new TypeError;for(var n=arguments.length>=2?arguments[1]:void 0,s=0;i>s;s++)if(s in e&&t.call(n,e[s],s,e))return!0;return!1}),Function.prototype.bind||(Function.prototype.bind=function(t){if("function"!=typeof this)throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");var e=Array.prototype.slice.call(arguments,1),i=this,n=function(){},s=function(){return i.apply(this instanceof n&&t?this:t,e.concat(Array.prototype.slice.call(arguments)))};return n.prototype=this.prototype,s.prototype=new n,s});var ex;(function(t){var e;(function(e){var i=function(){function t(){}return t.prototype.updatePixel=function(t,e,i){var n=4*(t+e*i.width),s=i.data,o=(s[n+0]+s[n+1]+s[n+2])/3;s[n+0]=o,s[n+1]=o,s[n+2]=o},t}();e.Grayscale=i;var n=function(){function t(){}return t.prototype.updatePixel=function(t,e,i){var n=4*(t+e*i.width),s=i.data;s[n+0]=255-s[n+0],s[n+1]=255-s[n+1],s[n+2]=255-s[n+2]},t}();e.Invert=n;var s=function(){function t(t){this.opacity=t}return t.prototype.updatePixel=function(t,e,i){var n=4*(t+e*i.width),s=i.data;0!==s[n+3]&&(s[n+3]=Math.round(255*this.opacity))},t}();e.Opacity=s;var o=function(){function t(t){this.color=t}return t.prototype.updatePixel=function(t,e,i){var n=4*(t+e*i.width),s=i.data;0!==s[n+3]&&(s[n+0]=(s[n+0]+this.color.r)/2,s[n+1]=(s[n+1]+this.color.g)/2,s[n+2]=(s[n+2]+this.color.b)/2)},t}();e.Colorize=o;var r=function(){function e(t){void 0===t&&(t=.1),this.factor=t}return e.prototype.updatePixel=function(e,i,n){var s=4*(e+i*n.width),o=n.data,r=t.Color.fromRGB(o[s+0],o[s+1],o[s+2],o[s+3]).lighten(this.factor);o[s+0]=r.r,o[s+1]=r.g,o[s+2]=r.b,o[s+3]=r.a},e}();e.Lighten=r;var h=function(){function e(t){void 0===t&&(t=.1),this.factor=t}return e.prototype.updatePixel=function(e,i,n){var s=4*(e+i*n.width),o=n.data,r=t.Color.fromRGB(o[s+0],o[s+1],o[s+2],o[s+3]).darken(this.factor);o[s+0]=r.r,o[s+1]=r.g,o[s+2]=r.b,o[s+3]=r.a},e}();e.Darken=h;var a=function(){function e(t){void 0===t&&(t=.1),this.factor=t}return e.prototype.updatePixel=function(e,i,n){var s=4*(e+i*n.width),o=n.data,r=t.Color.fromRGB(o[s+0],o[s+1],o[s+2],o[s+3]).saturate(this.factor);o[s+0]=r.r,o[s+1]=r.g,o[s+2]=r.b,o[s+3]=r.a},e}();e.Saturate=a;var c=function(){function e(t){void 0===t&&(t=.1),this.factor=t}return e.prototype.updatePixel=function(e,i,n){var s=4*(e+i*n.width),o=n.data,r=t.Color.fromRGB(o[s+0],o[s+1],o[s+2],o[s+3]).desaturate(this.factor);o[s+0]=r.r,o[s+1]=r.g,o[s+2]=r.b,o[s+3]=r.a},e}();e.Desaturate=c;var u=function(){function t(t){this.color=t}return t.prototype.updatePixel=function(t,e,i){var n=4*(t+e*i.width),s=i.data;0!==s[n+3]&&(s[n+0]=this.color.r,s[n+1]=this.color.g,s[n+2]=this.color.b)},t}();e.Fill=u})(e=t.Effects||(t.Effects={}))})(ex||(ex={}));var ex;(function(t){var e;(function(t){var e=function(){function t(){}return t.prototype.update=function(t,e,i){t.x+=t.dx*i/1e3,t.y+=t.dy*i/1e3,t.dx+=t.ax*i/1e3,t.dy+=t.ay*i/1e3,t.rotation+=t.rx*i/1e3,t.scale.x+=t.sx*i/1e3,t.scale.y+=t.sy*i/1e3},t}();t.Movement=e})(e=t.Traits||(t.Traits={}))})(ex||(ex={}));var ex;(function(t){var e=function(){function e(){this._topLeft=new t.Point(0,0),this._topRight=new t.Point(0,0),this._bottomLeft=new t.Point(0,0),this._bottomRight=new t.Point(0,0)}return e.prototype.isSpriteOffScreen=function(e,i){var n=e.currentDrawing.width*e.currentDrawing.scale.x,s=e.currentDrawing.height*e.currentDrawing.scale.y,o=e.rotation,r=e.getCenter().toPoint();this._topLeft.x=e.getWorldX()-n/2,this._topLeft.y=e.getWorldY()-s/2,this._topLeft=this._topLeft.rotate(o,r),this._topRight.x=e.getWorldX()+n/2,this._topRight.y=e.getWorldY()-s/2,this._topRight=this._topRight.rotate(o,r),this._bottomLeft.x=e.getWorldX()-n/2,this._bottomLeft.y=e.getWorldY()+s/2,this._bottomLeft=this._bottomLeft.rotate(o,r),this._bottomRight.x=e.getWorldX()+n/2,this._bottomRight.y=e.getWorldY()+s/2,this._bottomRight=this._bottomRight.rotate(o,r);var h=i.worldToScreenCoordinates(this._topLeft),a=i.worldToScreenCoordinates(this._topRight),c=i.worldToScreenCoordinates(this._bottomLeft),u=i.worldToScreenCoordinates(this._bottomRight);this._xCoords=[],this._yCoords=[],this._xCoords.push(h.x,a.x,c.x,u.x),this._yCoords.push(h.y,a.y,c.y,u.y),this._xMin=Math.min.apply(null,this._xCoords),this._yMin=Math.min.apply(null,this._yCoords),this._xMax=Math.max.apply(null,this._xCoords),this._yMax=Math.max.apply(null,this._yCoords);var l=i.screenToWorldCoordinates(new t.Point(this._xMin,this._yMin)),p=i.screenToWorldCoordinates(new t.Point(this._xMax,this._yMax));this._xMinWorld=l.x,this._yMinWorld=l.y,this._xMaxWorld=p.x,this._yMaxWorld=p.y;var d=[];d.push(new t.Point(this._xMin,this._yMin),new t.Point(this._xMax,this._yMin),new t.Point(this._xMin,this._yMax),new t.Point(this._xMax,this._yMax));for(var f=0;d.length>f;f++)if(d[f].x>0&&d[f].y>0&&d[f].x0&&a.y+h*c>0&&a.xa.x+r*c||0>a.y+h*c||a.x>i.width||a.y>i.height)&&u&&(n.emit("exitviewport",new t.ExitViewPortEvent),e.isOffScreen=!0)},e}();e.OffscreenCulling=i})(e=t.Traits||(t.Traits={}))})(ex||(ex={}));var ex;(function(t){var e;(function(t){var e=function(){function t(){}return t.prototype.update=function(t,e){t.enableCapturePointer&&(t.isKilled()||e.input.pointers.propogate(t))},t}();t.CapturePointer=e})(e=t.Traits||(t.Traits={}))})(ex||(ex={}));var ex;(function(t){var e;(function(e){var i=function(){function e(){}return e.prototype.update=function(e,i){var n=e.eventDispatcher;if(e.collisionType!==t.CollisionType.PreventCollision&&i.currentScene&&i.currentScene.tileMaps)for(var s=0;i.currentScene.tileMaps.length>s;s++)for(var o,r=i.currentScene.tileMaps[s],h=t.Side.None,a=2,c=!1;(o=r.collides(e))&&!(0>a--);)h=e.getSideFromIntersect(o),n.emit("collision",new t.CollisionEvent(e,null,h,o)),(e.collisionType===t.CollisionType.Active||e.collisionType===t.CollisionType.Elastic)&&(e.y+=o.y,e.x+=o.x,e.collisionType!==t.CollisionType.Elastic||c||(c=!0,h===t.Side.Left?e.dx=Math.abs(e.dx):h===t.Side.Right?e.dx=-Math.abs(e.dx):h===t.Side.Top?e.dy=Math.abs(e.dy):h===t.Side.Bottom&&(e.dy=-Math.abs(e.dy))))},e}();e.CollisionDetection=i})(e=t.Traits||(t.Traits={}))})(ex||(ex={}));var ex;(function(t){(function(t){t[t.None=0]="None",t[t.Top=1]="Top",t[t.Bottom=2]="Bottom",t[t.Left=3]="Left",t[t.Right=4]="Right"})(t.Side||(t.Side={})),t.Side})(ex||(ex={}));var __extends=this&&this.__extends||function(t,e){function i(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)},ex;(function(t){var e=function(){function e(t,e){this.x=t,this.y=e}return e.prototype.toVector=function(){return new i(this.x,this.y)},e.prototype.rotate=function(i,n){n||(n=new t.Point(0,0));var s=Math.sin(i),o=Math.cos(i),r=o*(this.x-n.x)-s*(this.y-n.y)+n.x,h=s*(this.x-n.x)+o*(this.y-n.y)+n.y;return new e(r,h)},e.prototype.add=function(t){return new e(this.x+t.x,this.y+t.y)},e.prototype.setTo=function(t,e){this.x=t,this.y=e},e.prototype.clone=function(){return new e(this.x,this.y)},e.prototype.equals=function(t){return this.x===t.x&&this.y===t.y},e}();t.Point=e;var i=function(t){function i(e,i){t.call(this,e,i),this.x=e,this.y=i}return __extends(i,t),i.fromAngle=function(t){return new i(Math.cos(t),Math.sin(t))},i.prototype.distance=function(t){return t||(t=new i(0,0)),Math.sqrt(Math.pow(this.x-t.x,2)+Math.pow(this.y-t.y,2))},i.prototype.normalize=function(){var t=this.distance();return t>0?new i(this.x/t,this.y/t):new i(0,1)},i.prototype.scale=function(t){return new i(this.x*t,this.y*t)},i.prototype.plus=function(t){return this.add(t)},i.prototype.add=function(t){return new i(this.x+t.x,this.y+t.y)},i.prototype.subtract=function(t){return this.minus(t)},i.prototype.minus=function(t){return new i(this.x-t.x,this.y-t.y)},i.prototype.dot=function(t){return this.x*t.x+this.y*t.y},i.prototype.cross=function(t){return this.x*t.y-this.y*t.x},i.prototype.perpendicular=function(){return new i(this.y,-this.x)},i.prototype.normal=function(){return this.perpendicular().normalize()},i.prototype.toAngle=function(){return Math.atan2(this.y,this.x)},i.prototype.toPoint=function(){return new e(this.x,this.y)},i.prototype.rotate=function(e,i){return t.prototype.rotate.call(this,e,i).toVector()},i.prototype.clone=function(){return new i(this.x,this.y)},i.Zero=new i(0,0),i}(e);t.Vector=i;var n=function(){function t(t,e){this.pos=t,this.dir=e.normalize()}return t.prototype.intersect=function(t){var e=t.begin.toVector().minus(this.pos.toVector());if(0===this.dir.cross(t.getSlope())&&0!==e.cross(this.dir))return-1;var i=this.dir.cross(t.getSlope());if(0===i)return-1;var n=e.cross(t.getSlope())/i;if(n>=0){var s=e.cross(this.dir)/i/t.getLength();if(s>=0&&1>=s)return n}return-1},t.prototype.getPoint=function(t){return this.pos.toVector().add(this.dir.scale(t)).toPoint()},t}();t.Ray=n;var s=function(){function t(t,e){this.begin=t,this.end=e}return t.prototype.getSlope=function(){var t=this.begin.toVector(),e=this.end.toVector(),i=t.distance(e);return e.minus(t).scale(1/i)},t.prototype.getLength=function(){var t=this.begin.toVector(),e=this.end.toVector(),i=t.distance(e);return i},t}();t.Line=s;var o=function(){function t(t,e){this.min=t,this.max=e}return t.prototype.overlaps=function(t){return this.max>t.min&&t.max>this.min},t.prototype.getOverlap=function(t){return this.overlaps(t)?this.max>t.max?t.max-this.min:this.max-t.min:0},t}();t.Projection=o})(ex||(ex={}));var ex;(function(t){var e;(function(e){function i(t){for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",i="",n=0;t.length>n;){var s,o,r=255&t.charCodeAt(n++),h=255&t.charCodeAt(n++),a=255&t.charCodeAt(n++),c=r>>2,u=(3&r)<<4|h>>4;isNaN(h)?s=o=64:(s=(15&h)<<2|a>>6,o=isNaN(a)?64:63&a),i+=e.charAt(c)+e.charAt(u)+e.charAt(s)+e.charAt(o)}return i}function n(t,e,i){return e>=t?e:t>=i?i:t}function s(t,e,i,n,s,o){t.beginPath(),t.strokeStyle=e,t.moveTo(i,n),t.lineTo(s,o),t.closePath(),t.stroke()}function o(t,e){return t+Math.random()*(e-t)}function r(t,e){return Math.round(o(t,e))}function h(t){var e=t;if(t>this.TwoPI)for(;e>this.TwoPI;)e-=this.TwoPI;if(0>t)for(;0>e;)e+=this.TwoPI;return e}function a(t){return 180/Math.PI*t}function c(t){return t/180*Math.PI}function u(e){var i=0,n=0,s=function(t){i+=t.offsetLeft,t.offsetParent&&s(t.offsetParent)},o=function(t){n+=t.offsetTop,t.offsetParent&&o(t.offsetParent)};return s(e),o(e),new t.Point(i,n)}function l(t,e){return-1===e.indexOf(t)?(e.push(t),!0):!1}function p(t,e){var i=-1;return(i=e.indexOf(t))>-1?(e.splice(i,1),!0):!1}function d(t,e){for(var i=0;t.length>i;i++)if(t[i]===e)return!0;return!1}function f(e){return e===t.Side.Top?t.Side.Bottom:e===t.Side.Bottom?t.Side.Top:e===t.Side.Left?t.Side.Right:e===t.Side.Right?t.Side.Left:t.Side.None}e.TwoPI=2*Math.PI,e.base64Encode=i,e.clamp=n,e.drawLine=s,e.randomInRange=o,e.randomIntInRange=r,e.canonicalizeAngle=h,e.toDegrees=a,e.toRadians=c,e.getPosition=u,e.addItemToArray=l,e.removeItemToArray=p,e.contains=d,e.getOppositeSide=f;var g=function(){function t(e){void 0===e&&(e=t.DefaultSize),this._internalArray=null,this._endPointer=0,this._internalArray=Array(e)}return t.prototype._resize=function(){for(var t=2*this._internalArray.length,e=Array(t),i=this.count(),n=0;i>n;n++)e[n]=this._internalArray[n];delete this._internalArray,this._internalArray=e},t.prototype.push=function(t){return this._endPointer===this._internalArray.length&&this._resize(),this._internalArray[this._endPointer++]=t},t.prototype.pop=function(){return this._endPointer=0>this._endPointer-1?0:this._endPointer-1,this._internalArray[this._endPointer]},t.prototype.count=function(){return this._endPointer},t.prototype.clear=function(){this._endPointer=0},t.prototype.internalSize=function(){return this._internalArray.length},t.prototype.elementAt=function(t){return t>=this.count()?void 0:this._internalArray[t]},t.prototype.insert=function(t,e){return t>=this.count()&&this._resize(),this._internalArray[t]=e},t.prototype.remove=function(t){var e=this.count();if(0!==e){for(var i=this._internalArray[t],n=t;e>n;n++)this._internalArray[n]=this._internalArray[n+1];return this._endPointer--,i}},t.prototype.removeElement=function(t){var e=this._internalArray.indexOf(t);this.remove(e)},t.prototype.toArray=function(){return this._internalArray.slice(0,this._endPointer)},t.prototype.forEach=function(t){var e=0,i=this.count();for(e;i>e;e++)t.call(this,this._internalArray[e],e)},t.prototype.map=function(t){for(var e=this.count(),i=0;e>i;i++)this._internalArray[i]=t.call(this,this._internalArray[i],i)},t.DefaultSize=200,t}();e.Collection=g})(e=t.Util||(t.Util={}))})(ex||(ex={}));var ex;(function(t){var e=function(){function e(e,i,n,s,o){var r=this;this.sx=i,this.sy=n,this.swidth=s,this.sheight=o,this.rotation=0,this.anchor=new t.Point(0,0),this.scale=new t.Point(1,1),this.logger=t.Logger.getInstance(),this.flipVertical=!1,this.flipHorizontal=!1,this.width=0,this.height=0,this.effects=[],this.internalImage=new Image,this.naturalWidth=0,this.naturalHeight=0,this._spriteCanvas=null,this._spriteCtx=null,this._pixelData=null,this._pixelsLoaded=!1,this._dirtyEffect=!1,(0>i||0>n||0>s||0>o)&&this.logger.error("Sprite cannot have any negative dimensions x:",i,"y:",n,"width:",s,"height:",o),this._texture=e,this._spriteCanvas=document.createElement("canvas"),this._spriteCanvas.width=s,this._spriteCanvas.height=o,this._spriteCtx=this._spriteCanvas.getContext("2d"),this._texture.loaded.then(function(){r._spriteCanvas.width=r._spriteCanvas.width||r._texture.image.naturalWidth,r._spriteCanvas.height=r._spriteCanvas.height||r._texture.image.naturalHeight,r._loadPixels(),r._dirtyEffect=!0}).error(function(t){r.logger.error("Error loading texture ",r._texture.path,t)}),this.width=s,this.height=o,this.naturalWidth=s,this.naturalHeight=o}return e.prototype._loadPixels=function(){if(this._texture.isLoaded()&&!this._pixelsLoaded){var e=t.Util.clamp,i=this._texture.image.naturalWidth||0,n=this._texture.image.naturalHeight||0;this.swidth>i&&this.logger.warn("The sprite width",this.swidth,"exceeds the width",i,"of the backing texture",this._texture.path),this.sheight>n&&this.logger.warn("The sprite height",this.sheight,"exceeds the height",n,"of the backing texture",this._texture.path),this._spriteCtx.drawImage(this._texture.image,e(this.sx,0,i),e(this.sy,0,n),e(this.swidth,0,i),e(this.sheight,0,n),0,0,this.swidth,this.sheight),this.internalImage.src=this._spriteCanvas.toDataURL("image/png"),this._pixelsLoaded=!0}},e.prototype.opacity=function(e){this.addEffect(new t.Effects.Opacity(e))},e.prototype.grayscale=function(){this.addEffect(new t.Effects.Grayscale)},e.prototype.invert=function(){this.addEffect(new t.Effects.Invert)},e.prototype.fill=function(e){this.addEffect(new t.Effects.Fill(e))},e.prototype.colorize=function(e){this.addEffect(new t.Effects.Colorize(e))},e.prototype.lighten=function(e){void 0===e&&(e=.1),this.addEffect(new t.Effects.Lighten(e))},e.prototype.darken=function(e){void 0===e&&(e=.1),this.addEffect(new t.Effects.Darken(e))},e.prototype.saturate=function(e){void 0===e&&(e=.1),this.addEffect(new t.Effects.Saturate(e))},e.prototype.desaturate=function(e){void 0===e&&(e=.1),this.addEffect(new t.Effects.Desaturate(e))},e.prototype.addEffect=function(t){this.effects.push(t),this._texture.isLoaded()&&this._pixelsLoaded?this._applyEffects():this._dirtyEffect=!0},e.prototype.removeEffect=function(t){var e=null;e="number"==typeof t?t:this.effects.indexOf(t),this.effects.splice(e,1),this._texture.isLoaded()&&this._pixelsLoaded?this._applyEffects():this._dirtyEffect=!0},e.prototype._applyEffects=function(){var e=t.Util.clamp,i=this._texture.image.naturalWidth||0,n=this._texture.image.naturalHeight||0;this._spriteCtx.clearRect(0,0,this.swidth,this.sheight),this._spriteCtx.drawImage(this._texture.image,e(this.sx,0,i),e(this.sy,0,n),e(this.swidth,0,i),e(this.sheight,0,n),0,0,this.swidth,this.sheight),this._pixelData=this._spriteCtx.getImageData(0,0,this.swidth,this.sheight);var s=0,o=0,r=0,h=this.effects.length;for(s;h>s;s++)for(r=0;this.sheight>r;r++)for(o=0;this.swidth>o;o++)this.effects[s].updatePixel(o,r,this._pixelData);this._spriteCtx.clearRect(0,0,this.swidth,this.sheight),this._spriteCtx.putImageData(this._pixelData,0,0),this.internalImage.src=this._spriteCanvas.toDataURL("image/png")},e.prototype.clearEffects=function(){this.effects.length=0,this._applyEffects()},e.prototype.reset=function(){},e.prototype.debugDraw=function(e,i,n){e.save(),e.translate(i,n),e.rotate(this.rotation);var s=this.width*this.scale.x*this.anchor.x,o=this.height*this.scale.y*this.anchor.y;e.strokeStyle=t.Color.Black,e.strokeRect(-s,-o,this.width*this.scale.x,this.height*this.scale.y),e.restore()},e.prototype.draw=function(t,e,i){this._dirtyEffect&&(this._applyEffects(),this._dirtyEffect=!1),this.width=this.naturalWidth*this.scale.x,this.height=this.naturalHeight*this.scale.y,t.save();var n=this.width*this.anchor.x,s=this.height*this.anchor.y;t.translate(e,i),t.rotate(this.rotation),this.flipHorizontal&&(t.translate(this.swidth*this.scale.x,0),t.scale(-1,1)),this.flipVertical&&(t.translate(0,this.sheight*this.scale.y),t.scale(1,-1)),this.internalImage&&t.drawImage(this.internalImage,0,0,this.swidth,this.sheight,-n,-s,this.swidth*this.scale.x,this.sheight*this.scale.y),t.restore()},e.prototype.clone=function(){var t=new e(this._texture,this.sx,this.sy,this.swidth,this.sheight);t.scale=this.scale.clone(),t.rotation=this.rotation,t.flipHorizontal=this.flipHorizontal,t.flipVertical=this.flipVertical;var i=0,n=this.effects.length;for(i;n>i;i++)t.addEffect(this.effects[i]);return t},e}();t.Sprite=e})(ex||(ex={}));var ex;(function(t){var e=function(){function e(e,i,n,s,o){this.image=e,this.columns=i,this.rows=n,this.sprites=[],this._internalImage=e.image,this.sprites=Array(i*n);var r=0,h=0;for(r=0;n>r;r++)for(h=0;i>h;h++)this.sprites[h+r*i]=new t.Sprite(this.image,h*s,r*o,s,o)}return e.prototype.getAnimationByIndices=function(e,i,n){var s=this,o=i.map(function(t){return s.sprites[t]});return o=o.map(function(t){return t.clone()}),new t.Animation(e,o,n)},e.prototype.getAnimationBetween=function(e,i,n,s){var o=this.sprites.slice(i,n);return o=o.map(function(t){return t.clone()}),new t.Animation(e,o,s)},e.prototype.getAnimationForAll=function(e,i){var n=this.sprites.map(function(t){return t.clone()});return new t.Animation(e,n,i)},e.prototype.getSprite=function(t){return t>=0&&this.sprites.length>t?this.sprites[t]:void 0},e}();t.SpriteSheet=e;var i=function(e){function i(i,n,s,o,r,h,a){e.call(this,i,o,r,h,a),this.image=i,this.alphabet=n,this.caseInsensitive=s,this.spWidth=h,this.spHeight=a,this._spriteLookup={},this._colorLookup={},this._currentColor=t.Color.Black.clone(),this._currentOpacity=1,this._sprites={},this._textShadowOn=!1,this._textShadowDirty=!0,this._textShadowColor=t.Color.Black.clone(),this._textShadowSprites={},this._shadowOffsetX=5,this._shadowOffsetY=5,this._sprites=this.getTextSprites()}return __extends(i,e),i.prototype.getTextSprites=function(){for(var t={},e=0;this.alphabet.length>e;e++){var i=this.alphabet[e];this.caseInsensitive&&(i=i.toLowerCase()),t[i]=this.sprites[e].clone()}return t},i.prototype.setTextShadow=function(t,e,i){this._textShadowOn=!0,this._shadowOffsetX=t,this._shadowOffsetY=e,this._textShadowColor=i.clone(),this._textShadowDirty=!0;for(var n in this._sprites)this._textShadowSprites[n]=this._sprites[n].clone()},i.prototype.useTextShadow=function(t){this._textShadowOn=t,t&&this.setTextShadow(5,5,this._textShadowColor)},i.prototype.draw=function(e,i,n,s,o){if(o=this._parseOptions(o),""+this._currentColor!=""+o.color||this._currentOpacity!==o.opacity){this._currentOpacity=o.opacity,this._currentColor=o.color;for(var r in this._sprites)this._sprites[r].clearEffects(),this._sprites[r].fill(o.color),this._sprites[r].opacity(o.opacity)}if(this._textShadowOn&&this._textShadowDirty&&this._textShadowColor){for(var h in this._textShadowSprites)this._textShadowSprites[h].clearEffects(),this._textShadowSprites[h].addEffect(new t.Effects.Fill(this._textShadowColor.clone()));this._textShadowDirty=!1}var a=this.sprites[0],c=a.sheight,u=o.fontSize/c,l=i.length*a.swidth*u+i.length*o.letterSpacing,p=n;o.textAlign===t.TextAlign.Left||o.textAlign===t.TextAlign.Start?p=n:o.textAlign===t.TextAlign.Right||o.textAlign===t.TextAlign.End?p=n-l:o.textAlign===t.TextAlign.Center&&(p=n-l/2);var d=s-c*u;o.baseAlign===t.BaseAlign.Top||o.baseAlign===t.BaseAlign.Hanging?d=s:o.baseAlign===t.BaseAlign.Ideographic||o.baseAlign===t.BaseAlign.Bottom||o.baseAlign===t.BaseAlign.Alphabetic?d=s-c*u:o.baseAlign===t.BaseAlign.Middle&&(d=s-c*u/2);for(var f=0;i.length>f;f++){var g=i[f];this.caseInsensitive&&(g=g.toLowerCase());try{this._textShadowOn&&(this._textShadowSprites[g].scale.x=u,this._textShadowSprites[g].scale.y=u,this._textShadowSprites[g].draw(e,p+this._shadowOffsetX,d+this._shadowOffsetY));var _=this._sprites[g];_.scale.x=u,_.scale.y=u,_.draw(e,p,d),p+=_.width+o.letterSpacing}catch(y){t.Logger.getInstance().error("SpriteFont Error drawing char "+g)}}},i.prototype._parseOptions=function(e){return{fontSize:e.fontSize||10,letterSpacing:e.letterSpacing||0,color:e.color||t.Color.Black.clone(),textAlign:void 0===typeof e.textAlign?t.TextAlign.Left:e.textAlign,baseAlign:void 0===typeof e.baseAlign?t.BaseAlign.Bottom:e.baseAlign,maxWidth:e.maxWidth||-1,opacity:e.opacity||0}},i}(e);t.SpriteFont=i})(ex||(ex={}));var ex;(function(t){var e=function(){function e(e,i,s,o,r,h){var a=this;this.x=e,this.y=i,this.cellWidth=s,this.cellHeight=o,this.rows=r,this.cols=h,this._collidingX=-1,this._collidingY=-1,this._onScreenXStart=0,this._onScreenXEnd=9999,this._onScreenYStart=0,this._onScreenYEnd=9999,this._spriteSheets={},this.logger=t.Logger.getInstance(),this.data=[],this.data=Array(r*h);for(var c=0;h>c;c++)for(var u=0;r>u;u++)(function(){var t=new n(c*s+e,u*o+i,s,o,c+u*h);a.data[c+u*h]=t})()}return e.prototype.registerSpriteSheet=function(t,e){this._spriteSheets[t]=e},e.prototype.collides=function(e){for(var i=e.x+e.getWidth(),n=e.y+e.getHeight(),s=e.getBounds(),o=[],r=s.left;i>=r;r+=Math.min(e.getWidth()/2,this.cellWidth/2))for(var h=s.top;n>=h;h+=Math.min(e.getHeight()/2,this.cellHeight/2)){var a=this.getCellByPoint(r,h);if(a&&a.solid){var c=s.collides(a.getBounds()),u=e.getCenter().minus(a.getCenter());c&&c.dot(u)>0&&o.push(c)}}if(0===o.length)return null;var l=o.reduce(function(e,i){var n=e.x,s=e.y;return Math.abs(e.x)t||0>e||t>=this.cols||e>=this.rows?null:this.data[t+e*this.cols]},e.prototype.getCellByPoint=function(t,e){t=Math.floor((t-this.x)/this.cellWidth),e=Math.floor((e-this.y)/this.cellHeight);var i=this.getCell(t,e);return t>=0&&e>=0&&this.cols>t&&this.rows>e&&i?i:null},e.prototype.update=function(e){var i=e.screenToWorldCoordinates(new t.Point(0,0)),n=e.screenToWorldCoordinates(new t.Point(e.canvas.clientWidth,e.canvas.clientHeight));this._onScreenXStart=Math.max(Math.floor(i.x/this.cellWidth)-2,0),this._onScreenYStart=Math.max(Math.floor((i.y-this.y)/this.cellHeight)-2,0),this._onScreenXEnd=Math.max(Math.floor(n.x/this.cellWidth)+2,0),this._onScreenYEnd=Math.max(Math.floor((n.y-this.y)/this.cellHeight)+2,0)},e.prototype.draw=function(t){t.save(),t.translate(this.x,this.y);var e,i,n,s=this._onScreenXStart,o=Math.min(this._onScreenXEnd,this.cols),r=this._onScreenYStart,h=Math.min(this._onScreenYEnd,this.rows);for(s;o>s;s++){for(r;h>r;r++)for(e=this.getCell(s,r).sprites.filter(function(t){return t.spriteId>-1}),i=0,n=e.length;n>i;i++){var a=this._spriteSheets[e[i].spriteSheetKey];if(a){var c=a.getSprite(e[i].spriteId);c?c.draw(t,s*this.cellWidth,r*this.cellHeight):this.logger.warn("Sprite does not exist for id",e[i].spriteId,"in sprite sheet",e[i].spriteSheetKey,c,a)}else this.logger.warn("Sprite sheet",e[i].spriteSheetKey,"does not exist",a)}r=this._onScreenYStart}t.restore()},e.prototype.debugDraw=function(e){var i=this.cols*this.cellWidth,n=this.rows*this.cellHeight;e.save(),e.strokeStyle=""+t.Color.Red;for(var s=0;this.cols+1>s;s++)e.beginPath(),e.moveTo(this.x+s*this.cellWidth,this.y),e.lineTo(this.x+s*this.cellWidth,this.y+n),e.stroke();for(var o=0;this.rows+1>o;o++)e.beginPath(),e.moveTo(this.x,this.y+o*this.cellHeight),e.lineTo(this.x+i,this.y+o*this.cellHeight),e.stroke();var r=t.Color.Red.clone();r.a=.3,this.data.filter(function(t){return t.solid}).forEach(function(t){e.fillStyle=""+r,e.fillRect(t.x,t.y,t.width,t.height)}),this._collidingY>-1&&this._collidingX>-1&&(e.fillStyle=""+t.Color.Cyan,e.fillRect(this.x+this._collidingX*this.cellWidth,this.y+this._collidingY*this.cellHeight,this.cellWidth,this.cellHeight)),e.restore()},e}();t.TileMap=e;var i=function(){function t(t,e){this.spriteSheetKey=t,this.spriteId=e}return t}();t.TileSprite=i;var n=function(){function e(e,i,n,s,o,r,h){void 0===r&&(r=!1),void 0===h&&(h=[]),this.x=e,this.y=i,this.width=n,this.height=s,this.index=o,this.solid=r,this.sprites=h,this._bounds=new t.BoundingBox(this.x,this.y,this.x+this.width,this.y+this.height)}return e.prototype.getBounds=function(){return this._bounds},e.prototype.getCenter=function(){return new t.Vector(this.x+this.width/2,this.y+this.height/2)},e.prototype.pushSprite=function(t){this.sprites.push(t)},e.prototype.removeSprite=function(t){var e=-1;(e=this.sprites.indexOf(t))>-1&&this.sprites.splice(e,1)},e.prototype.clearSprites=function(){this.sprites.length=0},e}();t.Cell=n})(ex||(ex={}));var ex;(function(t){(function(t){t[t.Naive=0]="Naive",t[t.DynamicAABBTree=1]="DynamicAABBTree",t[t.SeparatingAxis=2]="SeparatingAxis"})(t.CollisionStrategy||(t.CollisionStrategy={})),t.CollisionStrategy;var e=function(){function e(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),this.left=t,this.top=e,this.right=i,this.bottom=n}return e.prototype.getWidth=function(){return this.right-this.left},e.prototype.getHeight=function(){return this.bottom-this.top},e.prototype.getPerimeter=function(){var t=this.getWidth(),e=this.getHeight();return 2*(t+e)},e.prototype.contains=function(i){return i instanceof t.Point?this.left<=i.x&&this.top<=i.y&&this.bottom>=i.y&&this.right>=i.x:i instanceof e?this.left=n.left&&this.right<=n.right?n.left-this.right:n.right-this.left;var r=0;return r=this.top<=n.bottom&&this.top>=n.top?n.bottom-this.top:n.top-this.bottom,Math.abs(o)n;n++)e.push(new t.Line(this._points[n],this._points[(n+1)%i]));return e},e.prototype.getAxes=function(){for(var t=[],e=this._points.length,i=0;e>i;i++)t.push(this._points[i].minus(this._points[(i+1)%e]).normal());return t},e.prototype.project=function(e){for(var i=[],n=this._points.length,s=0;n>s;s++)i.push(this._points[s].dot(e));return new t.Projection(Math.min.apply(Math,i),Math.max.apply(Math,i))},e.prototype.getWidth=function(){var t=this._points.reduce(function(t,e){return Math.min(t,e.x)},1/0),e=this._points.reduce(function(t,e){return Math.max(t,e.x)},-1/0);return e-t},e.prototype.getHeight=function(){var t=this._points.reduce(function(t,e){return Math.min(t,e.y)},1/0),e=this._points.reduce(function(t,e){return Math.max(t,e.y)},-1/0);return t-e},e.prototype.contains=function(e){var i=new t.Ray(e,new t.Vector(1,0)),n=this.getSides().reduce(function(t,e){return i.intersect(e)>=0?t+1:t},0);return 0===n%2?!1:!0},e.prototype.collides=function(t){if(t instanceof e){var i=t,n=this.getAxes();n=i.getAxes().concat(n);for(var s=99999,o=null,r=0;n.length>r;r++){var h=this.project(n[r]),a=i.project(n[r]),c=h.getOverlap(a);if(0===c)return null;s>=c&&(s=c,o=n[r])}return o?o.normalize().scale(s):null}return null},e.prototype.debugDraw=function(e){e.beginPath(),e.lineWidth=2;var i=this._points[0];e.moveTo(i.x,i.y);var n=0,s=this._points.length;for(n;s>n;n++)e.lineTo(this._points[n].x,this._points[n].y);e.lineTo(i.x,i.y),e.closePath(),e.strokeStyle=""+t.Color.Blue,e.stroke()},e}();t.SATBoundingBox=i})(ex||(ex={}));var ex;(function(t){var e=function(){function e(){this.eventDispatcher=new t.EventDispatcher(this)}return e.prototype.addEventListener=function(t,e){this.eventDispatcher.subscribe(t,e)},e.prototype.removeEventListener=function(t,e){this.eventDispatcher.unsubscribe(t,e)},e.prototype.on=function(t,e){this.eventDispatcher.subscribe(t,e)},e.prototype.off=function(t,e){this.eventDispatcher.unsubscribe(t,e)},e.prototype.emit=function(t,e){this.eventDispatcher.emit(t,e)},e.extend=function(t){var i,n=this;i=t&&t.hasOwnProperty("constructor")?t.constructor:function(){return n.apply(this,arguments)};var s=function(){this.constructor=i};if(s.prototype=n.prototype,i.prototype=new s,t)for(var o in t)t.hasOwnProperty(o)&&(i.prototype[o]=t[o]);return i.extend=e.extend,i},e}();t.Class=e})(ex||(ex={})); var ex;(function(t){var e=function(){function t(e,i,n){this.id=0,this.interval=10,this.fcn=function(){},this.repeats=!1,this._elapsedTime=0,this._totalTimeAlive=0,this.complete=!1,this.scene=null,this.id=t.id++,this.interval=i||this.interval,this.fcn=e||this.fcn,this.repeats=n||this.repeats}return t.prototype.update=function(t){this._totalTimeAlive+=t,this._elapsedTime+=t,this._elapsedTime>this.interval&&(this.fcn.call(this),this.repeats?this._elapsedTime=0:this.complete=!0)},t.prototype.getTimeRunning=function(){return this._totalTimeAlive},t.prototype.cancel=function(){this.scene&&this.scene.cancelTimer(this)},t.id=0,t}();t.Timer=e})(ex||(ex={}));var ex;(function(t){var e=function(){function e(){}return e.prototype.register=function(){},e.prototype.remove=function(){},e.prototype.evaluate=function(e){for(var i,n,s=e.filter(function(e){return!e.isKilled()&&e.collisionType!==t.CollisionType.PreventCollision}),o=[],r=0,h=s.length;h>r;r++){i=s[r];for(var a=r+1;h>a;a++){n=s[a];var c;if(c=i.collides(n)){var u=i.getSideFromIntersect(c),l=new t.CollisionPair(i,n,c,u);o.some(function(t){return t.equals(l)})||o.push(l)}}}var p=0,d=o.length;for(p;d>p;p++)o[p].evaluate();return o},e.prototype.update=function(){return 0},e.prototype.debugDraw=function(){},e}();t.NaiveCollisionResolver=e})(ex||(ex={}));var ex;(function(t){var e=function(){function e(e){this.parent=e,this.parent=e||null,this.actor=null,this.bounds=new t.BoundingBox,this.left=null,this.right=null,this.height=0}return e.prototype.isLeaf=function(){return!this.left&&!this.right},e}();t.TreeNode=e;var i=function(){function t(){this.root=null,this.nodes={}}return t.prototype.insert=function(t){if(null===this.root)return this.root=t,this.root.parent=null,void 0;for(var i=t.bounds,n=this.root;!n.isLeaf();){var s,o,r=n.left,h=n.right,a=n.bounds.getPerimeter(),c=n.bounds.combine(i),u=c.getPerimeter(),l=2*u,p=2*(u-a),d=0,f=i.combine(r.bounds);r.isLeaf()?d=f.getPerimeter()+p:(o=r.bounds.getPerimeter(),s=f.getPerimeter(),d=s-o+p);var g=0,_=i.combine(h.bounds);if(h.isLeaf()?g=_.getPerimeter()+p:(o=h.bounds.getPerimeter(),s=_.getPerimeter(),g=s-o+p),d>l&&g>l)break;n=g>d?r:h}var y=n.parent,A=new e(y);A.bounds=i.combine(n.bounds),A.height=n.height+1,null!==y?(y.left===n?y.left=A:y.right=A,A.left=n,A.right=t,n.parent=A,t.parent=A):(A.left=n,A.right=t,n.parent=A,t.parent=A,this.root=A);for(var v=t.parent;v;){if(v=this.balance(v),!v.left)throw Error("Parent of current leaf cannot have a null left child"+v);if(!v.right)throw Error("Parent of current leaf cannot have a null right child"+v);v.height=1+Math.max(v.left.height,v.right.height),v.bounds=v.left.bounds.combine(v.right.bounds),v=v.parent}},t.prototype.remove=function(t){if(t===this.root)return this.root=null,void 0;var e,i=t.parent,n=i.parent;if(e=i.left===t?i.right:i.left,n){n.left===i?n.left=e:n.right=e,e.parent=n;for(var s=n;s;)s=this.balance(s),s.bounds=s.left.bounds.combine(s.right.bounds),s.height=1+Math.max(s.left.height,s.right.height),s=s.parent}else this.root=e,e.parent=null},t.prototype.registerActor=function(t){var i=new e;i.actor=t,i.bounds=t.getBounds(),i.bounds.left-=2,i.bounds.top-=2,i.bounds.right+=2,i.bounds.bottom+=2,this.nodes[t.id]=i,this.insert(i)},t.prototype.updateActor=function(t){var e=this.nodes[t.id];if(e){var i=t.getBounds();if(e.bounds.contains(i))return!1;this.remove(e),i.left-=5,i.top-=5,i.right+=5,i.bottom+=5;var n=2*t.dx,s=2*t.dy;return 0>n?i.left+=n:i.right+=n,0>s?i.top+=s:i.bottom+=s,e.bounds=i,this.insert(e),!0}},t.prototype.removeActor=function(t){var e=this.nodes[t.id];e&&(this.remove(e),this.nodes[t.id]=null,delete this.nodes[t.id])},t.prototype.balance=function(t){if(null===t)throw Error("Cannot balance at null node");if(t.isLeaf()||2>t.height)return t;var e=t.left,i=t.right,n=t,s=e,o=i,r=e.left,h=e.right,a=i.left,c=i.right,u=o.height-s.height;if(u>1)return o.left=n,o.parent=n.parent,n.parent=o,o.parent?o.parent.left===n?o.parent.left=o:o.parent.right=o:this.root=o,a.height>c.height?(o.right=a,n.right=c,c.parent=n,n.bounds=s.bounds.combine(c.bounds),o.bounds=n.bounds.combine(a.bounds),n.height=1+Math.max(s.height,c.height),o.height=1+Math.max(n.height,a.height)):(o.right=c,n.right=a,a.parent=n,n.bounds=s.bounds.combine(a.bounds),o.bounds=n.bounds.combine(c.bounds),n.height=1+Math.max(s.height,a.height),o.height=1+Math.max(n.height,c.height)),o;if(-1>u){if(s.left=n,s.parent=n.parent,n.parent=s,s.parent)if(s.parent.left===n)s.parent.left=s;else{if(s.parent.right!==n)throw"Error rotating Dynamic Tree";s.parent.right=s}else this.root=s;return r.height>h.height?(s.right=r,n.left=h,h.parent=n,n.bounds=o.bounds.combine(h.bounds),s.bounds=n.bounds.combine(r.bounds),n.height=1+Math.max(o.height,h.height),s.height=1+Math.max(n.height,r.height)):(s.right=h,n.left=r,r.parent=n,n.bounds=o.bounds.combine(r.bounds),s.bounds=n.bounds.combine(h.bounds),n.height=1+Math.max(o.height,r.height),s.height=1+Math.max(n.height,h.height)),s}return t},t.prototype.getHeight=function(){return null===this.root?0:this.root.height},t.prototype.query=function(t,e){var i=t.getBounds(),n=function(s){return s&&s.bounds.collides(i)?s.isLeaf()&&s.actor!==t?e.call(t,s.actor)?!0:void 0:n(s.left)||n(s.right):null};return n(this.root)},t.prototype.rayCast=function(){return null},t.prototype.getNodes=function(){var t=function(e){return e?[e].concat(t(e.left),t(e.right)):[]};return t(this.root)},t.prototype.debugDraw=function(t){var e=function(i){i&&(t.strokeStyle=i.isLeaf()?"green":"white",i.bounds.debugDraw(t),i.left&&e(i.left),i.right&&e(i.right))};e(this.root)},t}();t.DynamicTree=i})(ex||(ex={}));var ex;(function(t){var e=function(){function e(){this._dynamicCollisionTree=new t.DynamicTree}return e.prototype.register=function(t){this._dynamicCollisionTree.registerActor(t)},e.prototype.remove=function(t){this._dynamicCollisionTree.removeActor(t)},e.prototype.evaluate=function(e){for(var i,n=e.filter(function(e){return!e.isKilled()&&e.collisionType!==t.CollisionType.PreventCollision}),s=[],o=0,r=n.length;r>o;o++)i=n[o],this._dynamicCollisionTree.query(i,function(e){if(e.collisionType===t.CollisionType.PreventCollision||e.isKilled())return!1;var n;if(n=i.collides(e)){var o=i.getSideFromIntersect(n),r=new t.CollisionPair(i,e,n,o);return s.some(function(t){return t.equals(r)})||s.push(r),!0}return!1});var h=0,a=s.length;for(h;a>h;h++)s[h].evaluate();return s},e.prototype.update=function(t){var e=0,i=0,n=t.length;for(i;n>i;i++)this._dynamicCollisionTree.updateActor(t[i])&&e++;return e},e.prototype.debugDraw=function(t,e){this._dynamicCollisionTree.debugDraw(t,e)},e}();t.DynamicTreeCollisionResolver=e})(ex||(ex={}));var ex;(function(t){var e=function(){function e(t,e,i,n){this.left=t,this.right=e,this.intersect=i,this.side=n}return e.prototype.equals=function(t){return t.left===this.left&&t.right===this.right||t.right===this.left&&t.left===this.right},e.prototype.evaluate=function(){this.left.eventDispatcher.emit("collision",new t.CollisionEvent(this.left,this.right,this.side,this.intersect)),this.right.eventDispatcher.emit("collision",new t.CollisionEvent(this.right,this.left,t.Util.getOppositeSide(this.side),this.intersect.scale(-1)));var e=this.side;this.left.collisionType!==t.CollisionType.Active&&this.left.collisionType!==t.CollisionType.Elastic||this.right.collisionType===t.CollisionType.Passive||(this.left.y+=this.intersect.y,this.left.x+=this.intersect.x,this.left.collisionType===t.CollisionType.Elastic?e===t.Side.Left?this.left.dx=Math.abs(this.left.dx):e===t.Side.Right?this.left.dx=-Math.abs(this.left.dx):e===t.Side.Top?this.left.dy=Math.abs(this.left.dy):e===t.Side.Bottom&&(this.left.dy=-Math.abs(this.left.dy)):(0!==this.intersect.x&&(this.left.dx=0>=this.left.dx&&0>=this.right.dx?Math.max(this.left.dx,this.right.dx):this.left.dx>=0&&this.right.dx>=0?Math.min(this.left.dx,this.right.dx):0),0!==this.intersect.y&&(this.left.dy=0>=this.left.dy&&0>=this.right.dy?Math.max(this.left.dy,this.right.dy):this.left.dy>=0&&this.right.dy>=0?Math.min(this.left.dy,this.right.dy):0)));var i=t.Util.getOppositeSide(this.side),n=this.intersect.scale(-1);this.right.collisionType!==t.CollisionType.Active&&this.right.collisionType!==t.CollisionType.Elastic||this.left.collisionType===t.CollisionType.Passive||(this.right.y+=n.y,this.right.x+=n.x,this.right.collisionType===t.CollisionType.Elastic?i===t.Side.Left?this.right.dx=Math.abs(this.right.dx):i===t.Side.Right?this.right.dx=-Math.abs(this.right.dx):i===t.Side.Top?this.right.dy=Math.abs(this.right.dy):i===t.Side.Bottom&&(this.right.dy=-Math.abs(this.right.dy)):(0!==n.x&&(this.right.dx=0>=this.right.dx&&0>=this.left.dx?Math.max(this.left.dx,this.right.dx):this.left.dx>=0&&this.right.dx>=0?Math.min(this.left.dx,this.right.dx):0),0!==n.y&&(this.right.dy=0>=this.right.dy&&0>=this.left.dy?Math.max(this.left.dy,this.right.dy):this.left.dy>=0&&this.right.dy>=0?Math.min(this.left.dy,this.right.dy):0)))},e}();t.CollisionPair=e})(ex||(ex={}));var ex;(function(t){var e=function(){function e(){this.focus=new t.Point(0,0),this.lerp=!1,this.x=0,this.y=0,this.z=1,this.dx=0,this.dy=0,this.dz=0,this.ax=0,this.ay=0,this.az=0,this.rotation=0,this.rx=0,this._cameraMoving=!1,this._currentLerpTime=0,this._lerpDuration=1e3,this._totalLerpTime=0,this._lerpStart=null,this._lerpEnd=null,this._isShaking=!1,this._shakeMagnitudeX=0,this._shakeMagnitudeY=0,this._shakeDuration=0,this._elapsedShakeTime=0,this._isZooming=!1,this._currentZoomScale=1,this._maxZoomScale=1,this._zoomDuration=0,this._elapsedZoomTime=0,this._zoomIncrement=.01}return e.prototype._easeInOutCubic=function(t,e,i,n){return i-=e,t/=n/2,1>t?i/2*t*t*t+e:(t-=2,i/2*(t*t*t+2)+e)},e.prototype.setActorToFollow=function(t){this._follow=t},e.prototype.getFocus=function(){return new t.Point(this.x,this.y)},e.prototype.setFocus=function(e,i){this._follow||this.lerp||(this.x=e,this.y=i),this.lerp&&(this._lerpStart=this.getFocus().clone(),this._lerpEnd=new t.Point(e,i),this._currentLerpTime=0,this._cameraMoving=!0)},e.prototype.shake=function(t,e,i){this._isShaking=!0,this._shakeMagnitudeX=t,this._shakeMagnitudeY=e,this._shakeDuration=i},e.prototype.zoom=function(t,e){void 0===e&&(e=0),this._isZooming=!0,this._maxZoomScale=t,this._zoomDuration=e,e&&(this._zoomIncrement=1e3*(Math.abs(this._maxZoomScale-this._currentZoomScale)/e)),1>this._maxZoomScale?e?this._zoomIncrement=-1*this._zoomIncrement:(this._isZooming=!1,this._setCurrentZoomScale(this._maxZoomScale)):e||(this._isZooming=!1,this._setCurrentZoomScale(this._maxZoomScale))},e.prototype.getZoom=function(){return this.z},e.prototype._setCurrentZoomScale=function(t){this.z=t},e.prototype.update=function(t,e){this.x+=this.dx*e/1e3,this.y+=this.dy*e/1e3,this.z+=this.dz*e/1e3,this.dx+=this.ax*e/1e3,this.dy+=this.ay*e/1e3,this.dz+=this.az*e/1e3,this.rotation+=this.rx*e/1e3;var i=this.getFocus(),n=0,s=0,o=t.canvas.width,r=t.canvas.height,h=o/this.getZoom(),a=r/this.getZoom();this.lerp&&(this._currentLerpTime=this._shakeDuration},e.prototype._isDoneZooming=function(){return 0!==this._zoomDuration?this._elapsedZoomTime>=this._zoomDuration:1>this._maxZoomScale?this._currentZoomScale<=this._maxZoomScale:this._currentZoomScale>=this._maxZoomScale},e}();t.BaseCamera=e;var i=function(e){function i(){e.apply(this,arguments)}return __extends(i,e),i.prototype.getFocus=function(){return this._follow?new t.Point(this._follow.x+this._follow.getWidth()/2,this.focus.y):this.focus},i}(e);t.SideCamera=i;var n=function(e){function i(){e.apply(this,arguments)}return __extends(i,e),i.prototype.getFocus=function(){return this._follow?new t.Point(this._follow.x+this._follow.getWidth()/2,this._follow.y+this._follow.getHeight()/2):this.focus},i}(e);t.LockedCamera=n})(ex||(ex={}));var ex;(function(t){(function(t){t[t.ShortestPath=0]="ShortestPath",t[t.LongestPath=1]="LongestPath",t[t.Clockwise=2]="Clockwise",t[t.CounterClockwise=3]="CounterClockwise"})(t.RotationType||(t.RotationType={})),t.RotationType})(ex||(ex={}));var ex;(function(t){var e;(function(e){var i;(function(e){var i=function(){function e(e,i,n,s,o){this.actor=e,this.easingFcn=o,this._currentLerpTime=0,this._lerpDuration=1e3,this._lerpStart=new t.Point(0,0),this._lerpEnd=new t.Point(0,0),this._initialized=!1,this._stopped=!1,this._distance=0,this._lerpDuration=s,this._lerpEnd=new t.Point(i,n)}return e.prototype._initialize=function(){this._lerpStart=new t.Point(this.actor.x,this.actor.y),this._currentLerpTime=0,this._distance=this._lerpStart.toVector().distance(this._lerpEnd.toVector())},e.prototype.update=function(t){this._initialized||(this._initialize(),this._initialized=!0);var e=this.actor.x,i=this.actor.y;this._currentLerpTime=this._distance},e.prototype.reset=function(){this._initialized=!1},e.prototype.stop=function(){this._stopped=!0},e}();e.EaseTo=i;var n=function(){function e(e,i,n,s){this._started=!1,this._stopped=!1,this._actor=e,this._end=new t.Vector(i,n),this._speed=s}return e.prototype.update=function(){this._started||(this._started=!0,this._start=new t.Vector(this._actor.x,this._actor.y),this._distance=this._start.distance(this._end),this._dir=this._end.minus(this._start).normalize());var e=this._dir.scale(this._speed);this._actor.dx=e.x,this._actor.dy=e.y,this.isComplete(this._actor)&&(this._actor.x=this._end.x,this._actor.y=this._end.y,this._actor.dy=0,this._actor.dx=0)},e.prototype.isComplete=function(e){return this._stopped||new t.Vector(e.x,e.y).distance(this._start)>=this._distance},e.prototype.stop=function(){this._actor.dy=0,this._actor.dx=0,this._stopped=!0},e.prototype.reset=function(){this._started=!1},e}();e.MoveTo=n;var s=function(){function e(e,i,n,s){if(this._started=!1,this._stopped=!1,this._actor=e,this._end=new t.Vector(i,n),0>=s)throw t.Logger.getInstance().error("Attempted to moveBy time less than or equal to zero : "+s),Error("Cannot move in time <= 0");this._time=s}return e.prototype.update=function(){this._started||(this._started=!0,this._start=new t.Vector(this._actor.x,this._actor.y),this._distance=this._start.distance(this._end),this._dir=this._end.minus(this._start).normalize(),this._speed=this._distance/(this._time/1e3));var e=this._dir.scale(this._speed);this._actor.dx=e.x,this._actor.dy=e.y,this.isComplete(this._actor)&&(this._actor.x=this._end.x,this._actor.y=this._end.y,this._actor.dy=0,this._actor.dx=0)},e.prototype.isComplete=function(e){return this._stopped||new t.Vector(e.x,e.y).distance(this._start)>=this._distance},e.prototype.stop=function(){this._actor.dy=0,this._actor.dx=0,this._stopped=!0},e.prototype.reset=function(){this._started=!1},e}();e.MoveBy=s;var o=function(){function e(e,i,n){this._started=!1,this._stopped=!1,this._actor=e,this._actorToFollow=i,this._current=new t.Vector(this._actor.x,this._actor.y),this._end=new t.Vector(i.x,i.y),this._maximumDistance=void 0!==n?n:this._current.distance(this._end),this._speed=0}return e.prototype.update=function(){this._started||(this._started=!0,this._distanceBetween=this._current.distance(this._end),this._dir=this._end.minus(this._current).normalize());var t=Math.sqrt(Math.pow(this._actorToFollow.dx,2)+Math.pow(this._actorToFollow.dy,2));if(0!==t&&(this._speed=t),this._current.x=this._actor.x,this._current.y=this._actor.y,this._end.x=this._actorToFollow.x,this._end.y=this._actorToFollow.y,this._distanceBetween=this._current.distance(this._end),this._dir=this._end.minus(this._current).normalize(),this._distanceBetween>=this._maximumDistance){var e=this._dir.scale(this._speed);this._actor.dx=e.x,this._actor.dy=e.y}else this._actor.dx=0,this._actor.dy=0;this.isComplete(this._actor)&&(this._actor.x=this._end.x,this._actor.y=this._end.y,this._actor.dy=0,this._actor.dx=0)},e.prototype.stop=function(){this._actor.dy=0,this._actor.dx=0,this._stopped=!0},e.prototype.isComplete=function(){return this._stopped},e.prototype.reset=function(){this._started=!1},e}();e.Follow=o;var r=function(){function e(e,i,n){this._started=!1,this._stopped=!1,this._speedWasSpecified=!1,this._actor=e,this._actorToMeet=i,this._current=new t.Vector(this._actor.x,this._actor.y),this._end=new t.Vector(i.x,i.y),this._speed=n||0,void 0!==n&&(this._speedWasSpecified=!0)}return e.prototype.update=function(){this._started||(this._started=!0,this._distanceBetween=this._current.distance(this._end),this._dir=this._end.minus(this._current).normalize());var t=Math.sqrt(Math.pow(this._actorToMeet.dx,2)+Math.pow(this._actorToMeet.dy,2));0===t||this._speedWasSpecified||(this._speed=t),this._current.x=this._actor.x,this._current.y=this._actor.y,this._end.x=this._actorToMeet.x,this._end.y=this._actorToMeet.y,this._distanceBetween=this._current.distance(this._end),this._dir=this._end.minus(this._current).normalize();var e=this._dir.scale(this._speed);this._actor.dx=e.x,this._actor.dy=e.y,this.isComplete(this._actor)&&(this._actor.x=this._end.x,this._actor.y=this._end.y,this._actor.dy=0,this._actor.dx=0)},e.prototype.isComplete=function(){return this._stopped||1>=this._distanceBetween},e.prototype.stop=function(){this._actor.dy=0,this._actor.dx=0,this._stopped=!0},e.prototype.reset=function(){this._started=!1},e}();e.Meet=r;var h=function(){function e(e,i,n,s){this._started=!1,this._stopped=!1,this._actor=e,this._end=i,this._speed=n,this._rotationType=s||t.RotationType.ShortestPath}return e.prototype.update=function(){if(!this._started){this._started=!0,this._start=this._actor.rotation;var e=Math.abs(this._end-this._start),i=t.Util.TwoPI-e;switch(e>i?(this._shortDistance=i,this._longDistance=e):(this._shortDistance=e,this._longDistance=i),this._shortestPathIsPositive=(this._start-this._end+t.Util.TwoPI)%t.Util.TwoPI>=Math.PI,this._rotationType){case t.RotationType.ShortestPath:this._distance=this._shortDistance,this._direction=this._shortestPathIsPositive?1:-1;break;case t.RotationType.LongestPath:this._distance=this._longDistance,this._direction=this._shortestPathIsPositive?-1:1;break;case t.RotationType.Clockwise:this._direction=1,this._distance=this._shortestPathIsPositive?this._shortDistance:this._longDistance;break;case t.RotationType.CounterClockwise:this._direction=-1,this._distance=this._shortestPathIsPositive?this._longDistance:this._shortDistance}}this._actor.rx=this._direction*this._speed,this.isComplete(this._actor)&&(this._actor.rotation=this._end,this._actor.rx=0,this._stopped=!0)},e.prototype.isComplete=function(){var t=Math.abs(this._actor.rotation-this._start);return this._stopped||t>=Math.abs(this._distance)},e.prototype.stop=function(){this._actor.rx=0,this._stopped=!0},e.prototype.reset=function(){this._started=!1},e}();e.RotateTo=h;var a=function(){function e(e,i,n,s){this._started=!1,this._stopped=!1,this._actor=e,this._end=i,this._time=n,this._rotationType=s||t.RotationType.ShortestPath}return e.prototype.update=function(){if(!this._started){this._started=!0,this._start=this._actor.rotation;var e=Math.abs(this._end-this._start),i=t.Util.TwoPI-e;switch(e>i?(this._shortDistance=i,this._longDistance=e):(this._shortDistance=e,this._longDistance=i),this._shortestPathIsPositive=(this._start-this._end+t.Util.TwoPI)%t.Util.TwoPI>=Math.PI,this._rotationType){case t.RotationType.ShortestPath:this._distance=this._shortDistance,this._direction=this._shortestPathIsPositive?1:-1;break;case t.RotationType.LongestPath:this._distance=this._longDistance,this._direction=this._shortestPathIsPositive?-1:1;break;case t.RotationType.Clockwise:this._direction=1,this._distance=this._shortDistance>=0?this._shortDistance:this._longDistance;break;case t.RotationType.CounterClockwise:this._direction=-1,this._distance=0>=this._shortDistance?this._shortDistance:this._longDistance}this._speed=Math.abs(1e3*(this._distance/this._time))}this._actor.rx=this._direction*this._speed,this.isComplete(this._actor)&&(this._actor.rotation=this._end,this._actor.rx=0,this._stopped=!0)},e.prototype.isComplete=function(){var t=Math.abs(this._actor.rotation-this._start);return this._stopped||t>=Math.abs(this._distance)},e.prototype.stop=function(){this._actor.rx=0,this._stopped=!0},e.prototype.reset=function(){this._started=!1},e}();e.RotateBy=a;var c=function(){function t(t,e,i,n,s){this._started=!1,this._stopped=!1,this._actor=t,this._endX=e,this._endY=i,this._speedX=n,this._speedY=s}return t.prototype.update=function(){if(this._started||(this._started=!0,this._startX=this._actor.scale.x,this._startY=this._actor.scale.y,this._distanceX=Math.abs(this._endX-this._startX),this._distanceY=Math.abs(this._endY-this._startY)),Math.abs(this._actor.scale.x-this._startX)>=this._distanceX)this._actor.sx=0;else{var t=this._endY=this._distanceY)this._actor.sy=0;else{var e=this._endY=this._distanceX&&Math.abs(this._actor.scale.y-this._startY)>=this._distanceY},t.prototype.stop=function(){this._actor.sx=0,this._actor.sy=0,this._stopped=!0},t.prototype.reset=function(){this._started=!1},t}();e.ScaleTo=c;var u=function(){function t(t,e,i,n){this._started=!1,this._stopped=!1,this._actor=t,this._endX=e,this._endY=i,this._time=n,this._speedX=1e3*((this._endX-this._actor.scale.x)/n),this._speedY=1e3*((this._endY-this._actor.scale.y)/n)}return t.prototype.update=function(){this._started||(this._started=!0,this._startX=this._actor.scale.x,this._startY=this._actor.scale.y,this._distanceX=Math.abs(this._endX-this._startX),this._distanceY=Math.abs(this._endY-this._startY));var t=this._endX=this._distanceX&&Math.abs(this._actor.scale.y-this._startY)>=this._distanceY},t.prototype.stop=function(){this._actor.sx=0,this._actor.sy=0,this._stopped=!0},t.prototype.reset=function(){this._started=!1},t}();e.ScaleBy=u;var l=function(){function t(t,e){this._elapsedTime=0,this._started=!1,this._stopped=!1,this._actor=t,this._delay=e}return t.prototype.update=function(t){this._started||(this._started=!0),this.x=this._actor.x,this.y=this._actor.y,this._elapsedTime+=t},t.prototype.isComplete=function(){return this._stopped||this._elapsedTime>=this._delay},t.prototype.stop=function(){this._stopped=!0},t.prototype.reset=function(){this._elapsedTime=0,this._started=!1},t}();e.Delay=l;var p=function(){function t(t,e,i,n){void 0===n&&(n=1),this._timeVisible=0,this._timeNotVisible=0,this._elapsedTime=0,this._totalTime=0,this._stopped=!1,this._started=!1,this._actor=t,this._timeVisible=e,this._timeNotVisible=i,this._duration=(e+i)*n}return t.prototype.update=function(t){this._started||(this._started=!0),this._elapsedTime+=t,this._totalTime+=t,this._actor.visible&&this._elapsedTime>=this._timeVisible&&(this._actor.visible=!1,this._elapsedTime=0),!this._actor.visible&&this._elapsedTime>=this._timeNotVisible&&(this._actor.visible=!0,this._elapsedTime=0),this.isComplete(this._actor)&&(this._actor.visible=!0)},t.prototype.isComplete=function(){return this._stopped||this._totalTime>=this._duration},t.prototype.stop=function(){this._actor.visible=!0,this._stopped=!0},t.prototype.reset=function(){this._started=!1,this._elapsedTime=0,this._totalTime=0},t}();e.Blink=p;var d=function(){function e(t,e,i){this._multiplyer=1,this._started=!1,this._stopped=!1,this._actor=t,this._endOpacity=e,this._speed=i,t.opacity>e&&(this._multiplyer=-1)}return e.prototype.update=function(e){this._started||(this._started=!0),this._speed>0&&(this._actor.opacity+=this._multiplyer*Math.abs(this._actor.opacity-this._endOpacity)*e/this._speed),this._speed-=e,t.Logger.getInstance().debug("actor opacity: "+this._actor.opacity),this.isComplete(this._actor)&&(this._actor.opacity=this._endOpacity)},e.prototype.isComplete=function(){return this._stopped||.05>Math.abs(this._actor.opacity-this._endOpacity)},e.prototype.stop=function(){this._stopped=!0},e.prototype.reset=function(){this._started=!1},e}();e.Fade=d;var f=function(){function t(t){this._started=!1,this._stopped=!1,this._actor=t}return t.prototype.update=function(){this._actor.actionQueue.clearActions(),this._actor.kill(),this._stopped=!0},t.prototype.isComplete=function(){return this._stopped},t.prototype.stop=function(){},t.prototype.reset=function(){},t}();e.Die=f;var g=function(){function t(t,e){this._method=null,this._actor=null,this._hasBeenCalled=!1,this._actor=t,this._method=e}return t.prototype.update=function(){this._method.call(this._actor),this._hasBeenCalled=!0},t.prototype.isComplete=function(){return this._hasBeenCalled},t.prototype.reset=function(){this._hasBeenCalled=!1},t.prototype.stop=function(){this._hasBeenCalled=!0},t}();e.CallMethod=g;var _=function(){function t(t,e,i){this._stopped=!1,this._actor=t,this._actionQueue=new A(t),this._repeat=e,this._originalRepeat=e;var n=0,s=i.length;for(n;s>n;n++)i[n].reset(),this._actionQueue.add(i[n])}return t.prototype.update=function(t){this.x=this._actor.x,this.y=this._actor.y,this._actionQueue.hasNext()||(this._actionQueue.reset(),this._repeat--),this._actionQueue.update(t)},t.prototype.isComplete=function(){return this._stopped||0>=this._repeat},t.prototype.stop=function(){this._stopped=!0},t.prototype.reset=function(){this._repeat=this._originalRepeat},t}();e.Repeat=_;var y=function(){function t(t,e){this._stopped=!1,this._actor=t,this._actionQueue=new A(t);var i=0,n=e.length;for(i;n>i;i++)e[i].reset(),this._actionQueue.add(e[i])}return t.prototype.update=function(t){this.x=this._actor.x,this.y=this._actor.y,this._stopped||(this._actionQueue.hasNext()||this._actionQueue.reset(),this._actionQueue.update(t))},t.prototype.isComplete=function(){return this._stopped},t.prototype.stop=function(){this._stopped=!0,this._actionQueue.clearActions()},t.prototype.reset=function(){},t}();e.RepeatForever=y;var A=function(){function t(t){this._actions=[],this._completedActions=[],this._actor=t}return t.prototype.add=function(t){this._actions.push(t)},t.prototype.remove=function(t){var e=this._actions.indexOf(t);this._actions.splice(e,1)},t.prototype.clearActions=function(){this._actions.length=0,this._completedActions.length=0,this._currentAction&&this._currentAction.stop()},t.prototype.getActions=function(){return this._actions.concat(this._completedActions)},t.prototype.hasNext=function(){return this._actions.length>0},t.prototype.reset=function(){this._actions=this.getActions();var t=0,e=this._actions.length;for(t;e>t;t++)this._actions[t].reset();this._completedActions=[]},t.prototype.update=function(t){this._actions.length>0&&(this._currentAction=this._actions[0],this._currentAction.update(t),this._currentAction.isComplete(this._actor)&&this._completedActions.push(this._actions.shift()))},t}();e.ActionQueue=A})(i=e.Actions||(e.Actions={}))})(e=t.Internal||(t.Internal={}))})(ex||(ex={}));var ex;(function(t){var e=function(){function e(){this._actors=[],this._queues=[],null!==arguments&&(this._actors=Array.prototype.slice.call(arguments,0),this._queues=this._actors.map(function(t){return t.actionQueue}))}return e.prototype.clearActions=function(){var t=0,e=this._queues.length;for(t;e>t;t++)this._queues[t].clearActions()},e.prototype.addActorToContext=function(t){this._actors.push(t),this._queues.push(t.actionQueue)},e.prototype.removeActorFromContext=function(t){var e=this._actors.indexOf(t);e>-1&&(this._actors.splice(e,1),this._queues.splice(e,1))},e.prototype.easeTo=function(e,i,n,s){void 0===s&&(s=t.EasingFunctions.Linear);var o=0,r=this._queues.length;for(o;r>o;o++)this._queues[o].add(new t.Internal.Actions.EaseTo(this._actors[o],e,i,n,s));return this},e.prototype.moveTo=function(e,i,n){var s=0,o=this._queues.length;for(s;o>s;s++)this._queues[s].add(new t.Internal.Actions.MoveTo(this._actors[s],e,i,n));return this},e.prototype.moveBy=function(e,i,n){var s=0,o=this._queues.length;for(s;o>s;s++)this._queues[s].add(new t.Internal.Actions.MoveBy(this._actors[s],e,i,n));return this},e.prototype.rotateTo=function(e,i,n){var s=0,o=this._queues.length;for(s;o>s;s++)this._queues[s].add(new t.Internal.Actions.RotateTo(this._actors[s],e,i,n));return this},e.prototype.rotateBy=function(e,i,n){var s=0,o=this._queues.length;for(s;o>s;s++)this._queues[s].add(new t.Internal.Actions.RotateBy(this._actors[s],e,i,n));return this},e.prototype.scaleTo=function(e,i,n,s){var o=0,r=this._queues.length;for(o;r>o;o++)this._queues[o].add(new t.Internal.Actions.ScaleTo(this._actors[o],e,i,n,s));return this},e.prototype.scaleBy=function(e,i,n){var s=0,o=this._queues.length;for(s;o>s;s++)this._queues[s].add(new t.Internal.Actions.ScaleBy(this._actors[s],e,i,n));return this},e.prototype.blink=function(e,i,n){void 0===n&&(n=1);var s=0,o=this._queues.length;for(s;o>s;s++)this._queues[s].add(new t.Internal.Actions.Blink(this._actors[s],e,i,n));return this},e.prototype.fade=function(e,i){var n=0,s=this._queues.length;for(n;s>n;n++)this._queues[n].add(new t.Internal.Actions.Fade(this._actors[n],e,i));return this},e.prototype.delay=function(e){var i=0,n=this._queues.length;for(i;n>i;i++)this._queues[i].add(new t.Internal.Actions.Delay(this._actors[i],e));return this},e.prototype.die=function(){var e=0,i=this._queues.length;for(e;i>e;e++)this._queues[e].add(new t.Internal.Actions.Die(this._actors[e]));return this},e.prototype.callMethod=function(e){var i=0,n=this._queues.length;for(i;n>i;i++)this._queues[i].add(new t.Internal.Actions.CallMethod(this._actors[i],e));return this},e.prototype.repeat=function(e){if(!e)return this.repeatForever(),this;var i=0,n=this._queues.length;for(i;n>i;i++)this._queues[i].add(new t.Internal.Actions.Repeat(this._actors[i],e,this._actors[i].actionQueue.getActions())); -return this},e.prototype.repeatForever=function(){var e=0,i=this._queues.length;for(e;i>e;e++)this._queues[e].add(new t.Internal.Actions.RepeatForever(this._actors[e],this._actors[e].actionQueue.getActions()));return this},e.prototype.follow=function(e,i){var n=0,s=this._queues.length;for(n;s>n;n++)void 0===i?this._queues[n].add(new t.Internal.Actions.Follow(this._actors[n],e)):this._queues[n].add(new t.Internal.Actions.Follow(this._actors[n],e,i));return this},e.prototype.meet=function(e,i){var n=0,s=this._queues.length;for(n;s>n;n++)void 0===i?this._queues[n].add(new t.Internal.Actions.Meet(this._actors[n],e)):this._queues[n].add(new t.Internal.Actions.Meet(this._actors[n],e,i));return this},e.prototype.asPromise=function(){var e=this,i=this._queues.map(function(i,n){var s=new t.Promise;return i.add(new t.Internal.Actions.CallMethod(e._actors[n],function(){s.resolve()})),s});return t.Promise.join.apply(this,i)},e}();t.ActionContext=e})(ex||(ex={}));var ex;(function(t){var e=function(e){function i(i,n){if(e.call(this),this.name=i,this.scene=n,this._logger=t.Logger.getInstance(),this._members=[],this.actions=new t.ActionContext,null==n)this._logger.error("Invalid constructor arguments passed to Group: ",i,", scene must not be null!");else{var s=n.groups[i];s&&this._logger.warn("Group with name",i,"already exists. This new group will replace it."),n.groups[i]=this}}return __extends(i,e),i.prototype.add=function(e){e instanceof t.Actor&&(e=[].concat(e));var i,n=0,s=e.length;for(n;s>n;n++)i=this.getMembers().indexOf(e[n]),-1===i&&(this._members.push(e[n]),this.scene.add(e[n]),this.actions.addActorToContext(e[n]),this.eventDispatcher.wire(e[n].eventDispatcher))},i.prototype.remove=function(t){var e=this._members.indexOf(t);e>-1&&(this._members.splice(e,1),this.actions.removeActorFromContext(t),this.eventDispatcher.unwire(t.eventDispatcher))},i.prototype.move=function(e){var i=0,n=this.getMembers(),s=n.length;if(1===arguments.length&&e instanceof t.Vector)for(i;s>i;i++)n[i].x+=e.x,n[i].y+=e.y;else if("number"==typeof arguments[0]&&"number"==typeof arguments[1]){var o=arguments[0],r=arguments[1];for(i;s>i;i++)n[i].x+=o,n[i].y+=r}else this._logger.error("Invalid arguments passed to group move",this.name,"args:",arguments)},i.prototype.rotate=function(){if("number"==typeof arguments[0]){var t=arguments[0],e=0,i=this.getMembers(),n=i.length;for(e;n>e;e++)i[e].rotation+=t}else this._logger.error("Invalid arguments passed to group rotate",this.name,"args:",arguments)},i.prototype.on=function(t,e){this.eventDispatcher.subscribe(t,e)},i.prototype.off=function(t,e){this.eventDispatcher.unsubscribe(t,e)},i.prototype.emit=function(t,e){this.eventDispatcher.emit(t,e)},i.prototype.contains=function(t){return this.getMembers().indexOf(t)>-1},i.prototype.getMembers=function(){return this._members},i.prototype.getRandomMember=function(){return this._members[Math.floor(Math.random()*this._members.length)]},i.prototype.getBounds=function(){return this.getMembers().map(function(t){return t.getBounds()}).reduce(function(t,e){return t.combine(e)})},i}(t.Class);t.Group=e})(ex||(ex={}));var ex;(function(t){var e=function(){function t(t){this._getComparable=t}return t.prototype.find=function(t){return this._find(this._root,t)},t.prototype._find=function(t,e){return null==t?!1:this._getComparable.call(e)===t.getKey()?t.getData().indexOf(e)>-1?!0:!1:this._getComparable.call(e)e?this._get(t.getLeft(),e):this._get(t.getRight(),e)},t.prototype.add=function(t){return null==this._root?(this._root=new i(this._getComparable.call(t),[t],null,null),!0):this._insert(this._root,t)},t.prototype._insert=function(t,e){return null!=t?this._getComparable.call(e)===t.getKey()?t.getData().indexOf(e)>-1?!1:(t.getData().push(e),!0):this._getComparable.call(e)-1){if(t.getData().splice(i,1),0===t.getData().length){if(null==t.getLeft()&&null==t.getRight())return null;if(null==t.getLeft())return t.getRight();if(null==t.getRight())return t.getLeft();var n=this._findMinNode(t.getRight());return t.setKey(n.getKey()),t.setData(n.getData()),t.setRight(this._cleanup(t.getRight(),n)),t}return t}},t.prototype._cleanup=function(t,e){var i=e.getKey();if(null==t)return null;if(i===t.getKey()){if(null==t.getLeft()&&null==t.getRight())return null;if(null==t.getLeft())return t.getRight();if(null==t.getRight())return t.getLeft();var n=this._findMinNode(t.getRight());return t.setKey(n.getKey()),t.setData(n.getData()),t.setRight(this._cleanup(t.getRight(),n)),t}return this._getComparable.call(e)n;n++)this.uiActors[n].update(e,i);for(n=0,s=this.tileMaps.length;s>n;n++)this.tileMaps[n].update(e,i);for(n=0,s=this.children.length;s>n;n++)this.children[n].update(e,i);this._collisionResolver&&(this._collisionResolver.update(this.children),this._collisionResolver.evaluate(this.children));var o;for(n=0,s=this._killQueue.length;s>n;n++)o=this.children.indexOf(this._killQueue[n]),o>-1&&(this._sortedDrawingTree.removeByComparable(this._killQueue[n]),this.children.splice(o,1));for(this._killQueue.length=0,n=0,s=this._cancelQueue.length;s>n;n++)this.removeTimer(this._cancelQueue[n]);this._cancelQueue.length=0,this._timers=this._timers.filter(function(t){return t.update(i),!t.complete}),this.emit("postupdate",new t.PostUpdateEvent(e,i,this))},i.prototype.draw=function(e,i){this.emit("predraw",new t.PreDrawEvent(e,i,this)),e.save(),this.camera&&this.camera.update(e,i);var n,s;for(n=0,s=this.tileMaps.length;s>n;n++)this.tileMaps[n].draw(e,i);var o=this._sortedDrawingTree.list();for(n=0,s=o.length;s>n;n++)o[n].visible&&!o[n].isOffScreen&&o[n].draw(e,i);for(this.engine&&this.engine.isDebug&&(e.strokeStyle="yellow",this.debugDraw(e)),e.restore(),n=0,s=this.uiActors.length;s>n;n++)this.uiActors[n].visible&&this.uiActors[n].draw(e,i);if(this.engine&&this.engine.isDebug)for(n=0,s=this.uiActors.length;s>n;n++)this.uiActors[n].debugDraw(e);this.emit("postdraw",new t.PreDrawEvent(e,i,this))},i.prototype.debugDraw=function(e){this.emit("predebugdraw",new t.PreDebugDrawEvent(e,this));var i,n;for(i=0,n=this.tileMaps.length;n>i;i++)this.tileMaps[i].debugDraw(e);for(i=0,n=this.children.length;n>i;i++)this.children[i].debugDraw(e);this.camera.debugDraw(e),this.emit("postdebugdraw",new t.PostDebugDrawEvent(e,this))},i.prototype.contains=function(t){return this.children.indexOf(t)>-1},i.prototype.add=function(e){return e instanceof t.UIActor?(t.Util.contains(this.uiActors,e)||this.addUIActor(e),void 0):e instanceof t.Actor?(t.Util.contains(this.children,e)||(this.addChild(e),this._sortedDrawingTree.add(e)),void 0):e instanceof t.Timer?(t.Util.contains(this._timers,e)||this.addTimer(e),void 0):(e instanceof t.TileMap&&(t.Util.contains(this.tileMaps,e)||this.addTileMap(e)),void 0)},i.prototype.remove=function(e){return e instanceof t.UIActor?(this.removeUIActor(e),void 0):(e instanceof t.Actor&&(this._collisionResolver.remove(e),this.removeChild(e)),e instanceof t.Timer&&this.removeTimer(e),e instanceof t.TileMap&&this.removeTileMap(e),void 0)},i.prototype.addUIActor=function(t){this.uiActors.push(t),t.scene=this},i.prototype.removeUIActor=function(t){var e=this.uiActors.indexOf(t);e>-1&&this.uiActors.splice(e,1)},i.prototype.addChild=function(t){this._collisionResolver.register(t),t.scene=this,this.children.push(t),this._sortedDrawingTree.add(t),t.parent=this.actor},i.prototype.addTileMap=function(t){this.tileMaps.push(t)},i.prototype.removeTileMap=function(t){var e=this.tileMaps.indexOf(t);e>-1&&this.tileMaps.splice(e,1)},i.prototype.removeChild=function(t){this._collisionResolver.remove(t),this._killQueue.push(t),t.parent=null},i.prototype.addTimer=function(t){return this._timers.push(t),t.scene=this,t},i.prototype.removeTimer=function(t){var e=this._timers.indexOf(t);return-1!==e&&this._timers.splice(e,1),t},i.prototype.cancelTimer=function(t){return this._cancelQueue.push(t),t},i.prototype.isTimerActive=function(t){return this._timers.indexOf(t)>-1},i.prototype.createGroup=function(e){return new t.Group(e,this)},i.prototype.getGroup=function(t){return this.groups[t]},i.prototype.removeGroup=function(e){"string"==typeof e?delete this.groups[e]:e instanceof t.Group?delete this.groups[e.name]:this._logger.error("Invalid arguments to removeGroup",e)},i.prototype.cleanupDrawTree=function(t){this._sortedDrawingTree.removeByComparable(t)},i.prototype.updateDrawTree=function(t){this._sortedDrawingTree.add(t)},i}(t.Class);t.Scene=e})(ex||(ex={}));var ex;(function(t){var e=function(){function t(){}return t.Linear=function(t,e,i,n){return i-=e,i*t/n+e},t.EaseInQuad=function(t,e,i,n){t/=n},t.EaseOutQuad=function(t,e,i,n){return t/=n,-i*t*(t-2)+e},t.EaseInOutQuad=function(t,e,i,n){return i-=e,t/=n/2,1>t?i/2*t*t+e:(t--,-i/2*(t*(t-2)-1)+e)},t.EaseInCubic=function(t,e,i,n){return i-=e,t/=n,i*t*t*t+e},t.EaseOutCubic=function(t,e,i,n){return i-=e,t/=n,i*(t*t*t+1)+e},t.EaseInOutCubic=function(t,e,i,n){return i-=e,t/=n/2,1>t?i/2*t*t*t+e:(t-=2,i/2*(t*t*t+2)+e)},t}();t.EasingFunctions=e})(ex||(ex={}));var ex;(function(t){var e=function(e){function n(s,o,r,h,a){e.call(this),this.id=n.maxId++,this.x=0,this.y=0,this._height=0,this._width=0,this.rotation=0,this.rx=0,this.scale=new t.Vector(1,1),this.sx=0,this.sy=0,this.dx=0,this.dy=0,this.ax=0,this.ay=0,this.isOffScreen=!1,this.visible=!0,this.opacity=1,this.previousOpacity=1,this.logger=t.Logger.getInstance(),this.scene=null,this.parent=null,this.children=[],this.collisionType=i.PreventCollision,this.collisionGroups=[],this._collisionHandlers={},this._isInitialized=!1,this.frames={},this.currentDrawing=null,this.centerDrawingX=!0,this.centerDrawingY=!0,this.traits=[],this.enableCapturePointer=!1,this.capturePointer={captureMoveEvents:!1},this._zIndex=0,this._isKilled=!1,this.x=s||0,this.y=o||0,this._width=r||0,this._height=h||0,a&&(this.color=a.clone(),this.opacity=a.a),this.traits.push(new t.Traits.Movement),this.traits.push(new t.Traits.CollisionDetection),this.traits.push(new t.Traits.OffscreenCulling),this.traits.push(new t.Traits.CapturePointer),this.actionQueue=new t.Internal.Actions.ActionQueue(this),this.actions=new t.ActionContext(this),this.anchor=new t.Point(.5,.5)}return __extends(n,e),n.prototype.onInitialize=function(){},n.prototype._checkForPointerOptIn=function(t){!t||"pointerdown"!==t.toLowerCase()&&"pointerdown"!==t.toLowerCase()&&"pointermove"!==t.toLowerCase()||(this.enableCapturePointer=!0,"pointermove"===t.toLowerCase()&&(this.capturePointer.captureMoveEvents=!0))},n.prototype.addEventListener=function(t,i){this._checkForPointerOptIn(t),e.prototype.addEventListener.call(this,t,i)},n.prototype.on=function(t,e){this._checkForPointerOptIn(t),this.eventDispatcher.subscribe(t,e)},n.prototype.kill=function(){this.scene?(this.emit("kill",new t.KillEvent(this)),this.scene.remove(this),this._isKilled=!0):this.logger.warn("Cannot kill actor, it was never added to the Scene")},n.prototype.isKilled=function(){return this._isKilled},n.prototype.add=function(e){e.collisionType=i.PreventCollision,t.Util.addItemToArray(e,this.children)&&(e.parent=this)},n.prototype.remove=function(e){t.Util.removeItemToArray(e,this.children)&&(e.parent=null)},n.prototype.setDrawing=function(e){e=""+e,this.currentDrawing!==this.frames[e]&&(null!=this.frames[e]?(this.frames[e].reset(),this.currentDrawing=this.frames[e]):t.Logger.getInstance().error("the specified drawing key '"+e+"' does not exist"))},n.prototype.addDrawing=function(){2===arguments.length?(this.frames[arguments[0]]=arguments[1],this.currentDrawing||(this.currentDrawing=arguments[1])):(arguments[0]instanceof t.Sprite&&this.addDrawing("default",arguments[0]),arguments[0]instanceof t.Texture&&this.addDrawing("default",arguments[0].asSprite()))},n.prototype.getZIndex=function(){return this._zIndex},n.prototype.setZIndex=function(t){this.scene.cleanupDrawTree(this),this._zIndex=t,this.scene.updateDrawTree(this)},n.prototype.addCollisionGroup=function(t){this.collisionGroups.push(t)},n.prototype.removeCollisionGroup=function(t){var e=this.collisionGroups.indexOf(t);-1!==e&&this.collisionGroups.splice(e,1)},n.prototype.getCenter=function(){return new t.Vector(this.x+this.getWidth()/2-this.anchor.x*this.getWidth(),this.y+this.getHeight()/2-this.anchor.y*this.getHeight())},n.prototype.getWidth=function(){return this._width*this.scale.x},n.prototype.setWidth=function(t){this._width=t/this.scale.x},n.prototype.getHeight=function(){return this._height*this.scale.y},n.prototype.setHeight=function(t){this._height=t/this.scale.y},n.prototype.setCenterDrawing=function(t){this.centerDrawingY=t,this.centerDrawingX=t},n.prototype.getLeft=function(){return this.getBounds().left},n.prototype.getRight=function(){return this.getBounds().right},n.prototype.getTop=function(){return this.getBounds().top},n.prototype.getBottom=function(){return this.getBounds().bottom},n.prototype.getWorldX=function(){return this.parent?this.x*this.parent.scale.x+this.parent.getWorldX():this.x},n.prototype.getWorldY=function(){return this.parent?this.y*this.parent.scale.y+this.parent.getWorldY():this.y},n.prototype.getGlobalScale=function(){if(!this.parent)return new t.Point(this.scale.x,this.scale.y);var e=this.parent.getGlobalScale();return new t.Point(this.scale.x*e.x,this.scale.y*e.y)},n.prototype.getBounds=function(){var e=this._getCalculatedAnchor();return new t.BoundingBox(this.getWorldX()-e.x,this.getWorldY()-e.y,this.getWorldX()+this.getWidth()-e.x,this.getWorldY()+this.getHeight()-e.y)},n.prototype.contains=function(e,i,n){void 0===n&&(n=!1);var s=this.getBounds().contains(new t.Point(e,i));return n?s||this.children.some(function(t){return t.contains(e,i,!0)}):s},n.prototype.getSideFromIntersect=function(e){return e?Math.abs(e.x)>Math.abs(e.y)?0>e.x?t.Side.Right:t.Side.Left:0>e.y?t.Side.Bottom:t.Side.Top:t.Side.None},n.prototype.collidesWithSide=function(e){var i=this.collides(e);return i?Math.abs(i.x)>Math.abs(i.y)?this.x=Math.sqrt(Math.pow(this.x-t.x,2)+Math.pow(this.y-t.y,2))},n.prototype.clearActions=function(){this.actionQueue.clearActions()},n.prototype.easeTo=function(e,i,n,s){return void 0===s&&(s=t.EasingFunctions.Linear),this.actionQueue.add(new t.Internal.Actions.EaseTo(this,e,i,n,s)),this},n.prototype.moveTo=function(e,i,n){return this.actionQueue.add(new t.Internal.Actions.MoveTo(this,e,i,n)),this},n.prototype.moveBy=function(e,i,n){return this.actionQueue.add(new t.Internal.Actions.MoveBy(this,e,i,n)),this},n.prototype.rotateTo=function(e,i,n){return this.actionQueue.add(new t.Internal.Actions.RotateTo(this,e,i,n)),this},n.prototype.rotateBy=function(e,i,n){return this.actionQueue.add(new t.Internal.Actions.RotateBy(this,e,i,n)),this},n.prototype.scaleTo=function(e,i,n,s){return this.actionQueue.add(new t.Internal.Actions.ScaleTo(this,e,i,n,s)),this},n.prototype.scaleBy=function(e,i,n){return this.actionQueue.add(new t.Internal.Actions.ScaleBy(this,e,i,n)),this},n.prototype.blink=function(e,i,n){return void 0===n&&(n=1),this.actionQueue.add(new t.Internal.Actions.Blink(this,e,i,n)),this},n.prototype.fade=function(e,i){return this.actionQueue.add(new t.Internal.Actions.Fade(this,e,i)),this},n.prototype.delay=function(e){return this.actionQueue.add(new t.Internal.Actions.Delay(this,e)),this},n.prototype.die=function(){return this.actionQueue.add(new t.Internal.Actions.Die(this)),this},n.prototype.callMethod=function(e){return this.actionQueue.add(new t.Internal.Actions.CallMethod(this,e)),this},n.prototype.repeat=function(e){return e?(this.actionQueue.add(new t.Internal.Actions.Repeat(this,e,this.actionQueue.getActions())),this):(this.repeatForever(),this)},n.prototype.repeatForever=function(){return this.actionQueue.add(new t.Internal.Actions.RepeatForever(this,this.actionQueue.getActions())),this},n.prototype.follow=function(e,i){return i===void 0?this.actionQueue.add(new t.Internal.Actions.Follow(this,e)):this.actionQueue.add(new t.Internal.Actions.Follow(this,e,i)),this},n.prototype.meet=function(e,i){return i===void 0?this.actionQueue.add(new t.Internal.Actions.Meet(this,e)):this.actionQueue.add(new t.Internal.Actions.Meet(this,e,i)),this},n.prototype.asPromise=function(){var e=new t.Promise;return this.callMethod(function(){e.resolve()}),e},n.prototype._getCalculatedAnchor=function(){return new t.Point(this.getWidth()*this.anchor.x,this.getHeight()*this.anchor.y)},n.prototype.update=function(e,i){this._isInitialized||(this.onInitialize(e),this.eventDispatcher.emit("initialize",new t.InitializeEvent(e)),this._isInitialized=!0),this.emit("preupdate",new t.PreUpdateEvent(e,i,this));var n=this.eventDispatcher;this.actionQueue.update(i),this.color&&(this.color.a=this.opacity);for(var s=0;this.traits.length>s;s++)this.traits[s].update(this,e,i);n.emit("update",new t.UpdateEvent(i)),this.emit("postupdate",new t.PostUpdateEvent(e,i,this))},n.prototype.draw=function(e,i){var n=this._getCalculatedAnchor();if(e.save(),e.translate(this.x,this.y),e.scale(this.scale.x,this.scale.y),e.rotate(this.rotation),this.emit("predraw",new t.PreDrawEvent(e,i,this)),this.previousOpacity!==this.opacity){for(var s in this.frames)this.frames[s].addEffect(new t.Effects.Opacity(this.opacity));this.previousOpacity=this.opacity}if(this.currentDrawing){var o=0,r=0;this.centerDrawingX&&(o=(this.currentDrawing.naturalWidth*this.currentDrawing.scale.x-this.getWidth())/2-this.currentDrawing.naturalWidth*this.currentDrawing.scale.x*this.currentDrawing.anchor.x),this.centerDrawingY&&(r=(this.currentDrawing.naturalHeight*this.currentDrawing.scale.y-this.getHeight())/2-this.currentDrawing.naturalHeight*this.currentDrawing.scale.y*this.currentDrawing.anchor.y),this.currentDrawing.draw(e,-n.x-o,-n.y-r)}else this.color&&(e.fillStyle=""+this.color,e.fillRect(-n.x,-n.y,this._width,this._height));for(var h=0;this.children.length>h;h++)this.children[h].visible&&this.children[h].draw(e,i);this.emit("postdraw",new t.PostDrawEvent(e,i,this)),e.restore()},n.prototype.debugDraw=function(e){this.emit("predebugdraw",new t.PreDebugDrawEvent(e,this));var i=this.getBounds();i.debugDraw(e),e.fillText("id: "+this.id,i.left+3,i.top+10),e.fillStyle=""+t.Color.Yellow,e.beginPath(),e.arc(this.getWorldX(),this.getWorldY(),3,0,2*Math.PI),e.closePath(),e.fill();for(var n=0;this.traits.length>n;n++)this.traits[n]instanceof t.Traits.OffscreenCulling&&this.traits[n].cullingBox.debugDraw(e);e.strokeStyle=""+t.Color.Yellow,e.beginPath();var s=Math.min(this.getWidth(),this.getHeight());e.arc(this.getWorldX(),this.getWorldY(),s,0,2*Math.PI),e.closePath(),e.stroke();var o={"0 Pi":0,"Pi/2":Math.PI/2,Pi:Math.PI,"3/2 Pi":3*Math.PI/2},r=e.font;for(var h in o)e.fillStyle=""+t.Color.Yellow,e.font="14px",e.textAlign="center",e.fillText(h,this.getWorldX()+Math.cos(o[h])*(s+10),this.getWorldY()+Math.sin(o[h])*(s+10));e.font=r,e.save(),e.translate(this.x,this.y),e.rotate(this.rotation);for(var a=0;this.children.length>a;a++)this.children[a].debugDraw(e);e.restore(),this.emit("postdebugdraw",new t.PostDebugDrawEvent(e,this))},n.maxId=0,n}(t.Class);t.Actor=e,function(t){t[t.PreventCollision=0]="PreventCollision",t[t.Passive=1]="Passive",t[t.Active=2]="Active",t[t.Elastic=3]="Elastic",t[t.Fixed=4]="Fixed"}(t.CollisionType||(t.CollisionType={}));var i=t.CollisionType})(ex||(ex={}));var ex;(function(t){(function(t){t[t.Debug=0]="Debug",t[t.Info=1]="Info",t[t.Warn=2]="Warn",t[t.Error=3]="Error",t[t.Fatal=4]="Fatal"})(t.LogLevel||(t.LogLevel={}));var e=t.LogLevel,i=function(){function t(){if(this._appenders=[],this.defaultLevel=e.Info,t._instance)throw Error("Logger is a singleton");return t._instance=this,t._instance.addAppender(new n),t._instance}return t.getInstance=function(){return null==t._instance&&(t._instance=new t),t._instance},t.prototype.addAppender=function(t){this._appenders.push(t)},t.prototype.clearAppenders=function(){this._appenders.length=0},t.prototype._log=function(t,e){null==t&&(t=this.defaultLevel);var i=0,n=this._appenders.length;for(i;n>i;i++)t>=this.defaultLevel&&this._appenders[i].log(t,e)},t.prototype.debug=function(){for(var t=[],i=0;arguments.length>i;i++)t[i-0]=arguments[i];this._log(e.Debug,t)},t.prototype.info=function(){for(var t=[],i=0;arguments.length>i;i++)t[i-0]=arguments[i];this._log(e.Info,t)},t.prototype.warn=function(){for(var t=[],i=0;arguments.length>i;i++)t[i-0]=arguments[i];this._log(e.Warn,t)},t.prototype.error=function(){for(var t=[],i=0;arguments.length>i;i++)t[i-0]=arguments[i];this._log(e.Error,t)},t.prototype.fatal=function(){for(var t=[],i=0;arguments.length>i;i++)t[i-0]=arguments[i];this._log(e.Fatal,t)},t._instance=null,t}();t.Logger=i;var n=function(){function t(){}return t.prototype.log=function(t,i){if(console||console.log||!console.warn||!console.error){var n=[];n.unshift.apply(n,i),n.unshift("["+e[t]+"] : "),e.Warn>t?console.log.apply?console.log.apply(console,n):console.log(n.join(" ")):e.Error>t?console.warn.apply?console.warn.apply(console,n):console.warn(n.join(" ")):console.error.apply?console.error.apply(console,n):console.error(n.join(" "))}},t}();t.ConsoleAppender=n;var s=function(){function t(t,e){this._messages=[],this._canvas=document.createElement("canvas"),this._canvas.width=t||window.innerWidth,this._canvas.height=e||window.innerHeight,this._canvas.style.position="absolute",this._ctx=this._canvas.getContext("2d"),document.body.appendChild(this._canvas)}return t.prototype.log=function(t,i){var n=i.join(",");this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._messages.unshift("["+e[t]+"] : "+n);for(var s=10,o=1,r=0;this._messages.length>r;r++)this._ctx.fillStyle="rgba(255,255,255,"+o.toFixed(2)+")",this._ctx.fillText(this._messages[r],200,s),s+=10,o=o>0?o-.05:0},t}();t.ScreenAppender=s})(ex||(ex={}));var ex;(function(t){var e=function(){function t(){}return t}();t.GameEvent=e;var i=function(t){function e(e){t.call(this),this.target=e}return __extends(e,t),e}(e);t.KillEvent=i;var n=function(t){function e(e,i,n){t.call(this),this.ctx=e,this.delta=i,this.target=n}return __extends(e,t),e}(e);t.PreDrawEvent=n;var s=function(t){function e(e,i,n){t.call(this),this.ctx=e,this.delta=i,this.target=n}return __extends(e,t),e}(e);t.PostDrawEvent=s;var o=function(t){function e(e,i){t.call(this),this.ctx=e,this.target=i}return __extends(e,t),e}(e);t.PreDebugDrawEvent=o;var r=function(t){function e(e,i){t.call(this),this.ctx=e,this.target=i}return __extends(e,t),e}(e);t.PostDebugDrawEvent=r;var h=function(t){function e(e,i,n){t.call(this),this.engine=e,this.delta=i,this.target=n}return __extends(e,t),e}(e);t.PreUpdateEvent=h;var a=function(t){function e(e,i,n){t.call(this),this.engine=e,this.delta=i,this.target=n}return __extends(e,t),e}(e);t.PostUpdateEvent=a;var c=function(t){function e(e,i){t.call(this),this.index=e,this.gamepad=i}return __extends(e,t),e}(e);t.GamepadConnectEvent=c;var u=function(t){function e(e){t.call(this),this.index=e}return __extends(e,t),e}(e);t.GamepadDisconnectEvent=u;var l=function(t){function e(e,i){t.call(this),this.button=e,this.value=i}return __extends(e,t),e}(t.GameEvent);t.GamepadButtonEvent=l;var p=function(t){function e(e,i){t.call(this),this.axis=e,this.value=i}return __extends(e,t),e}(t.GameEvent);t.GamepadAxisEvent=p;var d=function(t){function e(e,i){t.call(this),this.topic=e,this.handler=i}return __extends(e,t),e}(e);t.SubscribeEvent=d;var f=function(t){function e(e,i){t.call(this),this.topic=e,this.handler=i}return __extends(e,t),e}(e);t.UnsubscribeEvent=f;var g=function(t){function e(){t.call(this)}return __extends(e,t),e}(e);t.VisibleEvent=g;var _=function(t){function e(){t.call(this)}return __extends(e,t),e}(e);t.HiddenEvent=_;var y=function(t){function e(e,i,n,s){t.call(this),this.actor=e,this.other=i,this.side=n,this.intersection=s}return __extends(e,t),e}(e);t.CollisionEvent=y;var A=function(t){function e(e){t.call(this),this.delta=e}return __extends(e,t),e}(e);t.UpdateEvent=A;var v=function(t){function e(e){t.call(this),this.engine=e}return __extends(e,t),e}(e);t.InitializeEvent=v;var m=function(t){function e(e){t.call(this),this.oldScene=e}return __extends(e,t),e}(e);t.ActivateEvent=m;var x=function(t){function e(e){t.call(this),this.newScene=e}return __extends(e,t),e}(e);t.DeactivateEvent=x;var w=function(t){function e(){t.call(this)}return __extends(e,t),e}(e);t.ExitViewPortEvent=w;var b=function(t){function e(){t.call(this)}return __extends(e,t),e}(e);t.EnterViewPortEvent=b})(ex||(ex={}));var ex;(function(t){var e=function(){function e(e){this._handlers={},this._wiredEventDispatchers=[],this._log=t.Logger.getInstance(),this._target=e}return e.prototype.publish=function(e,i){if(e){e=e.toLowerCase();var n=this._target;i||(i=new t.GameEvent),i.target=n;var s,o;if(this._handlers[e])for(s=0,o=this._handlers[e].length,s;o>s;s++)this._handlers[e][s].call(n,i);for(s=0,o=this._wiredEventDispatchers.length,s;o>s;s++)this._wiredEventDispatchers[s].emit(e,i)}},e.prototype.emit=function(t,e){this.publish(t,e)},e.prototype.subscribe=function(e,i){e=e.toLowerCase(),this._handlers[e]||(this._handlers[e]=[]),this._handlers[e].push(i),"unsubscribe"!==e&&"subscribe"!==e&&this.emit("subscribe",new t.SubscribeEvent(e,i))},e.prototype.unsubscribe=function(e,i){e=e.toLowerCase();var n=this._handlers[e];if(n)if(i){var s=n.indexOf(i);this._handlers[e].splice(s,1)}else this._handlers[e].length=0;"unsubscribe"!==e&&"subscribe"!==e&&this.emit("unsubscribe",new t.UnsubscribeEvent(e,i))},e.prototype.wire=function(t){t._wiredEventDispatchers.push(this)},e.prototype.unwire=function(t){var e=t._wiredEventDispatchers.indexOf(this);e>-1&&t._wiredEventDispatchers.splice(e,1)},e}();t.EventDispatcher=e})(ex||(ex={}));var ex;(function(t){var e=function(){function t(t,e,i,n){this.r=t,this.g=e,this.b=i,this.a=null!=n?n:1}return t.fromRGB=function(e,i,n,s){return new t(e,i,n,s)},t.fromHex=function(e){var i=/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})?$/i,n=null;if(n=e.match(i)){var s=parseInt(n[1],16),o=parseInt(n[2],16),r=parseInt(n[3],16),h=1;return n[4]&&(h=parseInt(n[4],16)/255),new t(s,o,r,h)}throw Error("Invalid hex string: "+e)},t.fromHSL=function(t,e,n,s){void 0===s&&(s=1);var o=new i(t,e,n,s);return o.toRGBA()},t.prototype.lighten=function(t){void 0===t&&(t=.1);var e=i.fromRGBA(this.r,this.g,this.b,this.a);return e.l+=e.l*t,e.toRGBA()},t.prototype.darken=function(t){void 0===t&&(t=.1);var e=i.fromRGBA(this.r,this.g,this.b,this.a);return e.l-=e.l*t,e.toRGBA()},t.prototype.saturate=function(t){void 0===t&&(t=.1);var e=i.fromRGBA(this.r,this.g,this.b,this.a);return e.s+=e.s*t,e.toRGBA()},t.prototype.desaturate=function(t){void 0===t&&(t=.1);var e=i.fromRGBA(this.r,this.g,this.b,this.a);return e.s-=e.s*t,e.toRGBA()},t.prototype.mulitiply=function(e){var i=255*(e.r/255*this.r/255),n=255*(e.g/255*this.g/255),s=255*(e.b/255*this.b/255),o=e.a*this.a;return new t(i,n,s,o)},t.prototype.screen=function(t){var e=t.invert(),i=t.invert();return e.mulitiply(i).invert()},t.prototype.invert=function(){return new t(255-this.r,255-this.g,255-this.b,1-this.a)},t.prototype.average=function(e){var i=(e.r+this.r)/2,n=(e.g+this.g)/2,s=(e.b+this.b)/2,o=(e.a+this.a)/2;return new t(i,n,s,o)},t.prototype.toString=function(){var t=this.r.toFixed(0)+""+", "+(this.g.toFixed(0)+"")+", "+(this.b.toFixed(0)+"");return void 0!==this.a||null!==this.a?"rgba("+t+", "+(this.a+"")+")":"rgb("+t+")"},t.prototype.fillStyle=function(){return""+this},t.prototype.clone=function(){return new t(this.r,this.g,this.b,this.a)},t.Black=t.fromHex("#000000"),t.White=t.fromHex("#FFFFFF"),t.Gray=t.fromHex("#808080"),t.LightGray=t.fromHex("#D3D3D3"),t.DarkGray=t.fromHex("#A9A9A9"),t.Yellow=t.fromHex("#FFFF00"),t.Orange=t.fromHex("#FFA500"),t.Red=t.fromHex("#FF0000"),t.Vermillion=t.fromHex("#FF5B31"),t.Rose=t.fromHex("#FF007F"),t.Magenta=t.fromHex("#FF00FF"),t.Violet=t.fromHex("#7F00FF"),t.Blue=t.fromHex("#0000FF"),t.Azure=t.fromHex("#007FFF"),t.Cyan=t.fromHex("#00FFFF"),t.Viridian=t.fromHex("#59978F"),t.Green=t.fromHex("#00FF00"),t.Chartreuse=t.fromHex("#7FFF00"),t.Transparent=t.fromHex("#FFFFFF00"),t}();t.Color=e;var i=function(){function t(t,e,i,n){this.h=t,this.s=e,this.l=i,this.a=n}return t.fromRGBA=function(e,i,n,s){e/=255,i/=255,n/=255;var o,r,h=Math.max(e,i,n),a=Math.min(e,i,n),c=(h+a)/2;if(h===a)o=r=0;else{var u=h-a;switch(r=c>.5?u/(2-h-a):u/(h+a),h){case e:o=(i-n)/u+(n>i?6:0);break;case i:o=(n-e)/u+2;break;case n:o=(e-i)/u+4}o/=6}return new t(o,r,c,s)},t.prototype.toRGBA=function(){function t(t,e,i){return 0>i&&(i+=1),i>1&&(i-=1),1/6>i?t+6*(e-t)*i:.5>i?e:2/3>i?t+6*(e-t)*(2/3-i):t}var i,n,s;if(0===this.s)i=n=s=this.l;else{var o=.5>this.l?this.l*(1+this.s):this.l+this.s-this.l*this.s,r=2*this.l-o;i=t(r,o,this.h+1/3),n=t(r,o,this.h),s=t(r,o,this.h-1/3)}return new e(255*i,255*n,255*s,this.a)},t}()})(ex||(ex={}));var ex;(function(t){var e=function(e){function i(i,n,s,o){e.call(this,i,n,s,o),this.traits=[],this.traits.push(new t.Traits.Movement),this.traits.push(new t.Traits.CapturePointer),this.anchor.setTo(0,0),this.collisionType=t.CollisionType.PreventCollision,this.enableCapturePointer=!0 -}return __extends(i,e),i.prototype.onInitialize=function(t){this._engine=t},i.prototype.contains=function(i,n,s){if(void 0===s&&(s=!0),s)return e.prototype.contains.call(this,i,n);var o=this._engine.worldToScreenCoordinates(new t.Point(i,n));return e.prototype.contains.call(this,o.x,o.y)},i}(t.Actor);t.UIActor=e})(ex||(ex={}));var ex;(function(t){var e=function(e){function i(i,n,s,o,r,h){e.call(this,i,n,s,o),this._action=function(){},this.repeats=1,this.target=null,this.repeats=h||this.repeats,this._action=r||this._action,this.collisionType=t.CollisionType.PreventCollision,this.eventDispatcher=new t.EventDispatcher(this),this.actionQueue=new t.Internal.Actions.ActionQueue(this)}return __extends(i,e),i.prototype.update=function(e,i){if(this.actionQueue.update(i),this.x+=this.dx*i/1e3,this.y+=this.dy*i/1e3,this.rotation+=this.rx*i/1e3,this.scale.x+=this.sx*i/1e3,this.scale.y+=this.sy*i/1e3,this.target)this.collides(this.target)&&this._dispatchAction();else for(var n=0;e.currentScene.children.length>n;n++){var s=e.currentScene.children[n];s!==this&&s.collisionType!==t.CollisionType.PreventCollision&&this.collides(s)&&this._dispatchAction()}0===this.repeats&&this.kill()},i.prototype._dispatchAction=function(){this._action.call(this),this.repeats--},i.prototype.draw=function(){},i.prototype.debugDraw=function(i){e.prototype.debugDraw.call(this,i),i.save(),i.translate(this.x,this.y);var n=this.getBounds();n.left=n.left-this.getWorldX(),n.right=n.right-this.getWorldX(),n.top=n.top-this.getWorldY(),n.bottom=n.bottom-this.getWorldY(),i.fillStyle=""+t.Color.Violet,i.strokeStyle=""+t.Color.Violet,i.fillText("Trigger",10,10),n.debugDraw(i),i.restore()},i}(t.Actor);t.Trigger=e})(ex||(ex={}));var ex;(function(t){(function(t){t[t.Circle=0]="Circle",t[t.Rectangle=1]="Rectangle"})(t.EmitterType||(t.EmitterType={}));var e=t.EmitterType,i=function(){function e(e,i,n,s,o,r,h,a,c,u){this.position=new t.Vector(0,0),this.velocity=new t.Vector(0,0),this.acceleration=new t.Vector(0,0),this.particleRotationalVelocity=0,this.currentRotation=0,this.focus=null,this.focusAccel=0,this.opacity=1,this.beginColor=t.Color.White.clone(),this.endColor=t.Color.White.clone(),this.life=300,this.fadeFlag=!1,this._rRate=1,this._gRate=1,this._bRate=1,this._aRate=0,this._currentColor=t.Color.White.clone(),this.emitter=null,this.particleSize=5,this.particleSprite=null,this.sizeRate=0,this.elapsedMultiplier=0,this.emitter=e,this.life=i||this.life,this.opacity=n||this.opacity,this.endColor=o||this.endColor.clone(),this.beginColor=s||this.beginColor.clone(),this._currentColor=this.beginColor.clone(),this.position=r||this.position,this.velocity=h||this.velocity,this.acceleration=a||this.acceleration,this._rRate=(this.endColor.r-this.beginColor.r)/this.life,this._gRate=(this.endColor.g-this.beginColor.g)/this.life,this._bRate=(this.endColor.b-this.beginColor.b)/this.life,this._aRate=this.opacity/this.life,this.startSize=c||0,this.endSize=u||0,this.endSize>0&&this.startSize>0&&(this.sizeRate=(this.endSize-this.startSize)/this.life,this.particleSize=this.startSize)}return e.prototype.kill=function(){this.emitter.removeParticle(this)},e.prototype.update=function(e){if(this.life=this.life-e,this.elapsedMultiplier=this.elapsedMultiplier+e,0>this.life&&this.kill(),this.fadeFlag&&(this.opacity=t.Util.clamp(this._aRate*this.life,1e-4,1)),this.startSize>0&&this.endSize>0&&(this.particleSize=t.Util.clamp(this.sizeRate*e+this.particleSize,Math.min(this.startSize,this.endSize),Math.max(this.startSize,this.endSize))),this._currentColor.r=t.Util.clamp(this._currentColor.r+this._rRate*e,0,255),this._currentColor.g=t.Util.clamp(this._currentColor.g+this._gRate*e,0,255),this._currentColor.b=t.Util.clamp(this._currentColor.b+this._bRate*e,0,255),this._currentColor.a=t.Util.clamp(this.opacity,1e-4,1),this.focus){var i=this.focus.minus(this.position).normalize().scale(this.focusAccel).scale(e/1e3);this.velocity=this.velocity.add(i)}else this.velocity=this.velocity.add(this.acceleration.scale(e/1e3));this.position=this.position.add(this.velocity.scale(e/1e3)),this.particleRotationalVelocity&&(this.currentRotation=(this.currentRotation+this.particleRotationalVelocity*e/1e3)%(2*Math.PI))},e.prototype.draw=function(e){return this.particleSprite?(this.particleSprite.rotation=this.currentRotation,this.particleSprite.scale.setTo(this.particleSize,this.particleSize),this.particleSprite.draw(e,this.position.x,this.position.y),void 0):(this._currentColor.a=t.Util.clamp(this.opacity,1e-4,1),e.fillStyle=""+this._currentColor,e.beginPath(),e.arc(this.position.x,this.position.y,this.particleSize,0,2*Math.PI),e.fill(),e.closePath(),void 0)},e}();t.Particle=i;var n=function(n){function s(i,s,o,r){n.call(this,i,s,o,r,t.Color.White),this._particlesToEmit=0,this.numParticles=0,this.isEmitting=!0,this.particles=null,this.deadParticles=null,this.minVel=0,this.maxVel=0,this.acceleration=new t.Vector(0,0),this.minAngle=0,this.maxAngle=0,this.emitRate=1,this.particleLife=2e3,this.opacity=1,this.fadeFlag=!1,this.focus=null,this.focusAccel=1,this.startSize=null,this.endSize=null,this.minSize=5,this.maxSize=5,this.beginColor=t.Color.White,this.endColor=t.Color.White,this.particleSprite=null,this.emitterType=e.Rectangle,this.radius=0,this.particleRotationalVelocity=0,this.randomRotation=!1,this.collisionType=t.CollisionType.PreventCollision,this.particles=new t.Util.Collection,this.deadParticles=new t.Util.Collection;for(var h in this.traits)this.traits[h]instanceof t.Traits.OffscreenCulling&&this.traits.splice(h,1)}return __extends(s,n),s.prototype.removeParticle=function(t){this.deadParticles.push(t)},s.prototype.emitParticles=function(t){for(var e=0;t>e;e++)this.particles.push(this._createParticle())},s.prototype.clearParticles=function(){this.particles.clear()},s.prototype._createParticle=function(){var n=0,s=0,o=t.Util.randomInRange(this.minAngle,this.maxAngle),r=t.Util.randomInRange(this.minVel,this.maxVel),h=this.startSize||t.Util.randomInRange(this.minSize,this.maxSize),a=r*Math.cos(o),c=r*Math.sin(o);if(this.emitterType===e.Rectangle)n=t.Util.randomInRange(this.x,this.x+this.getWidth()),s=t.Util.randomInRange(this.y,this.y+this.getHeight());else if(this.emitterType===e.Circle){var u=t.Util.randomInRange(0,this.radius);n=u*Math.cos(o)+this.x,s=u*Math.sin(o)+this.y}var l=new i(this,this.particleLife,this.opacity,this.beginColor,this.endColor,new t.Vector(n,s),new t.Vector(a,c),this.acceleration,this.startSize,this.endSize);return l.fadeFlag=this.fadeFlag,l.particleSize=h,this.particleSprite&&(l.particleSprite=this.particleSprite),l.particleRotationalVelocity=this.particleRotationalVelocity,this.randomRotation&&(l.currentRotation=t.Util.randomInRange(0,2*Math.PI)),this.focus&&(l.focus=this.focus.add(new t.Vector(this.x,this.y)),l.focusAccel=this.focusAccel),l},s.prototype.update=function(t,e){var i=this;n.prototype.update.call(this,t,e),this.isEmitting&&(this._particlesToEmit+=this.emitRate*(e/1e3),this._particlesToEmit>1&&(this.emitParticles(Math.floor(this._particlesToEmit)),this._particlesToEmit=this._particlesToEmit-Math.floor(this._particlesToEmit))),this.particles.forEach(function(t){return t.update(e)}),this.deadParticles.forEach(function(t){return i.particles.removeElement(t)}),this.deadParticles.clear()},s.prototype.draw=function(t){this.particles.forEach(function(e){return e.draw(t)})},s.prototype.debugDraw=function(e){n.prototype.debugDraw.call(this,e),e.fillStyle=""+t.Color.Black,e.fillText("Particles: "+this.particles.count(),this.x,this.y+20),this.focus&&(e.fillRect(this.focus.x+this.x,this.focus.y+this.y,3,3),t.Util.drawLine(e,"yellow",this.focus.x+this.x,this.focus.y+this.y,n.prototype.getCenter.call(this).x,n.prototype.getCenter.call(this).y),e.fillText("Focus",this.focus.x+this.x,this.focus.y+this.y))},s}(t.Actor);t.ParticleEmitter=n})(ex||(ex={}));var ex;(function(t){var e=function(){function e(e,i,n,s){this.currentFrame=0,this._oldTime=Date.now(),this.anchor=new t.Point(0,0),this.rotation=0,this.scale=new t.Point(1,1),this.loop=!1,this.freezeFrame=-1,this.flipVertical=!1,this.flipHorizontal=!1,this.width=0,this.height=0,this.naturalWidth=0,this.naturalHeight=0,this.sprites=i,this.speed=n,this._engine=e,null!=s&&(this.loop=s),i&&i[0]&&(this.height=i[0]?i[0].height:0,this.width=i[0]?i[0].width:0,this.naturalWidth=i[0]?i[0].naturalWidth:0,this.naturalHeight=i[0]?i[0].naturalHeight:0,this.freezeFrame=i.length-1)}return e.prototype.opacity=function(e){this.addEffect(new t.Effects.Opacity(e))},e.prototype.grayscale=function(){this.addEffect(new t.Effects.Grayscale)},e.prototype.invert=function(){this.addEffect(new t.Effects.Invert)},e.prototype.fill=function(e){this.addEffect(new t.Effects.Fill(e))},e.prototype.colorize=function(e){this.addEffect(new t.Effects.Colorize(e))},e.prototype.lighten=function(e){void 0===e&&(e=.1),this.addEffect(new t.Effects.Lighten(e))},e.prototype.darken=function(e){void 0===e&&(e=.1),this.addEffect(new t.Effects.Darken(e))},e.prototype.saturate=function(e){void 0===e&&(e=.1),this.addEffect(new t.Effects.Saturate(e))},e.prototype.desaturate=function(e){void 0===e&&(e=.1),this.addEffect(new t.Effects.Desaturate(e))},e.prototype.addEffect=function(t){for(var e in this.sprites)this.sprites[e].addEffect(t)},e.prototype.removeEffect=function(t){for(var e in this.sprites)this.sprites[e].removeEffect(t)},e.prototype.clearEffects=function(){for(var t in this.sprites)this.sprites[t].clearEffects()},e.prototype._setAnchor=function(t){for(var e in this.sprites)this.sprites[e].anchor.setTo(t.x,t.y)},e.prototype._setRotation=function(t){for(var e in this.sprites)this.sprites[e].rotation=t},e.prototype._setScale=function(t){for(var e in this.sprites)this.sprites[e].scale=t},e.prototype.reset=function(){this.currentFrame=0},e.prototype.isDone=function(){return!this.loop&&this.currentFrame>=this.sprites.length},e.prototype.tick=function(){var t=Date.now();t-this._oldTime>this.speed&&(this.currentFrame=this.loop?(this.currentFrame+1)%this.sprites.length:this.currentFrame+1,this._oldTime=t)},e.prototype._updateValues=function(){this._setAnchor(this.anchor),this._setRotation(this.rotation),this._setScale(this.scale)},e.prototype.skip=function(t){this.currentFrame=(this.currentFrame+t)%this.sprites.length},e.prototype.draw=function(e,i,n){this.tick(),this._updateValues();var s;this.currentFrame=this.sprites.length&&(s=this.sprites[t.Util.clamp(this.freezeFrame,0,this.sprites.length-1)],s.draw(e,i,n)),s&&(this.width=s.width,this.height=s.height)},e.prototype.play=function(t,e){this.reset(),this._engine.playAnimation(this,t,e)},e}();t.Animation=e})(ex||(ex={}));var ex;(function(t){var e;(function(e){var i=function(){function e(e,i){this.path=e,this._log=t.Logger.getInstance(),this.onload=function(){},this.onprogress=function(){},this.onerror=function(){},window.AudioContext?(this._log.debug("Using new Web Audio Api for "+e),this._soundImpl=new o(e,i)):(this._log.debug("Falling back to Audio Element for "+e),this._soundImpl=new n(e,i))}return e.prototype.setVolume=function(t){this._soundImpl.setVolume(t)},e.prototype.setLoop=function(t){this._soundImpl.setLoop(t)},e.prototype.load=function(){this._soundImpl.onload=this.onload,this._soundImpl.onprogress=this.onprogress,this._soundImpl.onerror=this.onerror,this._soundImpl.load()},e.prototype.processData=function(t){return this._soundImpl.processData(t)},e.prototype.getData=function(){return this._soundImpl.getData()},e.prototype.setData=function(t){this._soundImpl.setData(t)},e.prototype.isPlaying=function(){return this._soundImpl.isPlaying()},e.prototype.play=function(){return this._soundImpl.play()},e.prototype.pause=function(){this._soundImpl.pause()},e.prototype.stop=function(){this._soundImpl.stop()},e}();e.FallbackAudio=i;var n=function(){function e(e,i){var n=this;this.path=e,this._audioElements=Array(5),this._loadedAudio=null,this._isLoaded=!1,this._index=0,this._log=t.Logger.getInstance(),this._isPlaying=!1,this._currentOffset=0,this.onload=function(){},this.onprogress=function(){},this.onerror=function(){};for(var s=0;this._audioElements.length>s;s++)(function(t){n._audioElements[t]=new Audio})(s);i?this.setVolume(t.Util.clamp(i,0,1)):this.setVolume(1)}return e.prototype.isPlaying=function(){return this._isPlaying},e.prototype._audioLoaded=function(){this._isLoaded=!0},e.prototype.setVolume=function(t){var e=0,i=this._audioElements.length;for(e;i>e;e++)this._audioElements[e].volume=t},e.prototype.setLoop=function(t){var e=0,i=this._audioElements.length;for(e;i>e;e++)this._audioElements[e].loop=t},e.prototype.getLoop=function(){this._audioElements.some(function(t){return t.loop})},e.prototype.load=function(){var t=this;if(!this._loadedAudio){var e=new XMLHttpRequest;e.open("GET",this.path,!0),e.responseType="blob",e.onprogress=this.onprogress,e.onerror=this.onerror,e.onload=function(i){return 200!==e.status?(t._log.error("Failed to load audio resource ",t.path," server responded with error code",e.status),t.onerror(e.response),t._isLoaded=!1,void 0):(t._isLoaded=!0,t.setData(e.response),t.onload(i),void 0)},e.send()}},e.prototype.getData=function(){return this._loadedAudio},e.prototype.setData=function(t){this._isLoaded=!0,this._loadedAudio=this.processData(t)},e.prototype.processData=function(t){var e=URL.createObjectURL(t);return this._audioElements.forEach(function(t){t.src=e}),this._audioLoaded(),e},e.prototype.play=function(){var e=this;this._audioElements[this._index].load(),this._audioElements[this._index].play(),this._currentOffset=0;var i=new t.Promise;return this._isPlaying=!0,this.getLoop()||this._audioElements[this._index].addEventListener("ended",function(){e._isPlaying=!1,i.resolve(!0)}),this._index=(this._index+1)%this._audioElements.length,i},e.prototype.pause=function(){this._index=(this._index-1+this._audioElements.length)%this._audioElements.length,this._currentOffset=this._audioElements[this._index].currentTime,this._audioElements.forEach(function(t){t.pause()}),this._isPlaying=!1},e.prototype.stop=function(){this._audioElements.forEach(function(t){t.pause()}),this._isPlaying=!1},e}();if(e.AudioTag=n,window.AudioContext)var s=new window.AudioContext;var o=function(){function e(e,i){this.path=e,this._context=s,this._volume=this._context.createGain(),this._buffer=null,this._sound=null,this._isLoaded=!1,this._loop=!1,this._isPlaying=!1,this._isPaused=!1,this._currentOffset=0,this._logger=t.Logger.getInstance(),this._data=null,this.onload=function(){},this.onprogress=function(){},this.onerror=function(){},this._volume.gain.value=i?t.Util.clamp(i,0,1):1}return e.prototype.setVolume=function(t){this._volume.gain.value=t},e.prototype.load=function(){var t=this;if(null===this._data){var e=new XMLHttpRequest;e.open("GET",this.path),e.responseType="arraybuffer",e.onprogress=this.onprogress,e.onerror=this.onerror,e.onload=function(){return 200!==e.status?(t._logger.error("Failed to load audio resource ",t.path," server responded with error code",e.status),t.onerror(e.response),t._isLoaded=!1,void 0):(t.setData(e.response),void 0)};try{e.send()}catch(i){console.error("Error loading sound! If this is a cross origin error, you must host your sound with your html and javascript.")}}},e.prototype.getData=function(){return this._data},e.prototype.setData=function(t){this._data=this.processData(t)},e.prototype.processData=function(t){var e=this;return this._context.decodeAudioData(t,function(t){e._buffer=t,e._isLoaded=!0,e.onload(e)},function(){e._logger.error("Unable to decode "+e.path+" this browser may not fully support this format, or the file may be corrupt, "+"if this is an mp3 try removing id3 tags and album art from the file."),e._isLoaded=!1,e.onload(e)}),t},e.prototype.setLoop=function(t){this._loop=t},e.prototype.isPlaying=function(){return this._isPlaying},e.prototype.play=function(){var e=this;if(this._isLoaded){this._sound=this._context.createBufferSource(),this._sound.buffer=this._buffer,this._sound.loop=this._loop,this._sound.connect(this._volume),this._volume.connect(this._context.destination),this._sound.start(0,this._currentOffset%this._buffer.duration),this._currentOffset=0;var i;return i=this._isPaused&&this._playPromise?this._playPromise:new t.Promise,this._isPaused=!1,this._isPlaying=!0,this._loop||(this._sound.onended=function(){e._isPlaying=!1,e._isPaused||i.resolve(!0)}.bind(this)),this._playPromise=i,i}return t.Promise.wrap(!0)},e.prototype.pause=function(){if(this._isPlaying)try{window.clearTimeout(this._playingTimer),this._sound.stop(0),this._currentOffset=this._context.currentTime,this._isPlaying=!1,this._isPaused=!0}catch(t){this._logger.warn("The sound clip",this.path,"has already been paused!")}},e.prototype.stop=function(){if(this._sound)try{window.clearTimeout(this._playingTimer),this._currentOffset=0,this._sound.stop(0),this._isPlaying=!1,this._isPaused=!1}catch(t){this._logger.warn("The sound clip",this.path,"has already been stopped!")}},e}();e.WebAudio=o})(e=t.Internal||(t.Internal={}))})(ex||(ex={}));var ex;(function(t){(function(t){t[t.Resolved=0]="Resolved",t[t.Rejected=1]="Rejected",t[t.Pending=2]="Pending"})(t.PromiseState||(t.PromiseState={}));var e=t.PromiseState,i=function(){function i(){this._state=e.Pending,this._successCallbacks=[],this._rejectCallback=function(){},this._logger=t.Logger.getInstance()}return i.wrap=function(t){var e=(new i).resolve(t);return e},i.join=function(){for(var t=[],e=0;arguments.length>e;e++)t[e-0]=arguments[e];var n=new i;if(!t||!t.length)return n.resolve();var s=t.length,o=0,r=0,h=[];return t.forEach(function(t){t.then(function(){o+=1,o===s?n.resolve():o+r+h.length===s&&n.reject(h)},function(){r+=1,o+r+h.length===s&&n.reject(h)}).error(function(t){h.push(t),h.length+o+r===s&&n.reject(h)})}),n},i.prototype.then=function(t,i){if(t&&(this._successCallbacks.push(t),this.state()===e.Resolved))try{t.call(this,this._value)}catch(n){this._handleError(n)}if(i&&(this._rejectCallback=i,this.state()===e.Rejected))try{i.call(this,this._value)}catch(n){this._handleError(n)}return this},i.prototype.error=function(t){return t&&(this._errorCallback=t),this},i.prototype.resolve=function(t){var i=this;if(this._state!==e.Pending)throw Error("Cannot resolve a promise that is not in a pending state!");this._value=t;try{this._state=e.Resolved,this._successCallbacks.forEach(function(t){t.call(i,i._value)})}catch(n){this._handleError(n)}return this},i.prototype.reject=function(t){if(this._state!==e.Pending)throw Error("Cannot reject a promise that is not in a pending state!");this._value=t;try{this._state=e.Rejected,this._rejectCallback.call(this,this._value)}catch(i){this._handleError(i)}return this},i.prototype.state=function(){return this._state},i.prototype._handleError=function(t){if(!this._errorCallback)throw t;this._errorCallback.call(this,t)},i}();t.Promise=i})(ex||(ex={}));var ex;(function(t){var e=function(e){function i(i,n,s){void 0===s&&(s=!0),e.call(this),this.path=i,this.responseType=n,this.bustCache=s,this.data=null,this.logger=t.Logger.getInstance(),this.onprogress=function(){},this.oncomplete=function(){},this.onerror=function(){}}return __extends(i,e),i.prototype.isLoaded=function(){return null!==this.data},i.prototype.wireEngine=function(t){this._engine=t},i.prototype._cacheBust=function(t){var e=/\?\w*=\w*/;return t+=e.test(t)?"&__="+Date.now():"?__="+Date.now()},i.prototype._start=function(){this.logger.debug("Started loading resource "+this.path)},i.prototype.load=function(){var e=this,i=new t.Promise;if(null!==this.data)return this.logger.debug("Already have data for resource",this.path),i.resolve(this.data),this.oncomplete(),i;var n=new XMLHttpRequest;return n.open("GET",this.bustCache?this._cacheBust(this.path):this.path,!0),n.responseType=this.responseType,n.onloadstart=function(t){e._start(t)},n.onprogress=this.onprogress,n.onerror=this.onerror,n.onload=function(){return 200!==n.status?(e.logger.error("Failed to load resource ",e.path," server responded with error code",n.status),e.onerror(n.response),i.resolve(n.response),void 0):(e.data=e.processData(n.response),e.oncomplete(),e.logger.debug("Completed loading resource",e.path),i.resolve(e.data),void 0)},n.send(),i},i.prototype.getData=function(){return this.data},i.prototype.setData=function(t){this.data=this.processData(t)},i.prototype.processData=function(t){return URL.createObjectURL(t)},i}(t.Class);t.Resource=e})(ex||(ex={}));var ex;(function(t){var e=function(e){function i(i,n){void 0===n&&(n=!0),e.call(this,i,"blob",n),this.path=i,this.bustCache=n,this.loaded=new t.Promise,this._isLoaded=!1,this._sprite=null,this._sprite=new t.Sprite(this,0,0,0,0)}return __extends(i,e),i.prototype.isLoaded=function(){return this._isLoaded},i.prototype.load=function(){var i=this,n=new t.Promise,s=e.prototype.load.call(this);return s.then(function(){i.image=new Image,i.image.addEventListener("load",function(){i._isLoaded=!0,i.width=i._sprite.swidth=i._sprite.naturalWidth=i._sprite.width=i.image.naturalWidth,i.height=i._sprite.sheight=i._sprite.naturalHeight=i._sprite.height=i.image.naturalHeight,i.loaded.resolve(i.image),n.resolve(i.image)}),i.image.src=e.prototype.getData.call(i)},function(){n.reject("Error loading texture.")}),n},i.prototype.asSprite=function(){return this._sprite},i}(t.Resource);t.Texture=e;var i=function(){function e(){for(var i=[],n=0;arguments.length>n;n++)i[n-0]=arguments[n];this._logger=t.Logger.getInstance(),this.onprogress=function(){},this.oncomplete=function(){},this.onerror=function(){},this.onload=function(){},this._isLoaded=!1,this._wasPlayingOnHidden=!1,this.path="";for(var s=0;i.length>s;s++)if(e.canPlayFile(i[s])){this.path=i[s];break}this.path||(this._logger.warn("This browser does not support any of the audio files specified:",i.join(", ")),this._logger.warn("Attempting to use",i[0]),this.path=i[0]),this.sound=new t.Internal.FallbackAudio(this.path,1)}return e.canPlayFile=function(e){try{var i=new Audio,n=/.*\.([A-Za-z0-9]+)$/,s=e.match(n)[1];return i.canPlayType("audio/"+s)?!0:!1}catch(o){return t.Logger.getInstance().warn("Cannot determine audio support, assuming no support for the Audio Tag",o),!1}},e.prototype.wireEngine=function(t){var e=this;t&&(this._engine=t,this._engine.on("hidden",function(){t.pauseAudioWhenHidden&&e.isPlaying()&&(e._wasPlayingOnHidden=!0,e.pause())}),this._engine.on("visible",function(){t.pauseAudioWhenHidden&&e._wasPlayingOnHidden&&(e.play(),e._wasPlayingOnHidden=!1)}))},e.prototype.setVolume=function(t){this.sound&&this.sound.setVolume(t)},e.prototype.setLoop=function(t){this.sound&&this.sound.setLoop(t)},e.prototype.isPlaying=function(){return this.sound?this.sound.isPlaying():void 0},e.prototype.play=function(){return this.sound?this.sound.play():void 0},e.prototype.pause=function(){this.sound&&this.sound.pause()},e.prototype.stop=function(){this.sound&&this.sound.stop()},e.prototype.isLoaded=function(){return this._isLoaded},e.prototype.load=function(){var e=this,i=new t.Promise;return null!==this.sound.getData()?(this._logger.debug("Already have data for resource",this.path),i.resolve(this.sound),i):(this._logger.debug("Started loading sound",this.path),this.sound.onprogress=this.onprogress,this.sound.onload=function(){e.oncomplete(),e._isLoaded=!0,e._logger.debug("Completed loading sound",e.path),i.resolve(e.sound)},this.sound.onerror=function(t){e.onerror(t),i.resolve(t)},this.sound.load(),i)},e.prototype.getData=function(){return this.sound.getData()},e.prototype.setData=function(t){this.sound.setData(t)},e.prototype.processData=function(t){return this.sound.processData(t)},e}();t.Sound=i;var n=function(){function e(t){this._resourceList=[],this._index=0,this._resourceCount=0,this._numLoaded=0,this._progressCounts={},this._totalCounts={},this.getData=function(){},this.setData=function(){},this.processData=function(){},this.onprogress=function(){},this.oncomplete=function(){},this.onerror=function(){},t&&this.addResources(t)}return e.prototype.wireEngine=function(t){this._engine=t},e.prototype.addResource=function(t){var e=this._index++;this._resourceList.push(t),this._progressCounts[e]=0,this._totalCounts[e]=1,this._resourceCount++},e.prototype.addResources=function(t){var e=0,i=t.length;for(e;i>e;e++)this.addResource(t[e])},e.prototype._sumCounts=function(t){var e=0;for(var i in t)e+=0|t[i];return e},e.prototype.isLoaded=function(){return this._numLoaded===this._resourceCount},e.prototype.load=function(){function e(t,i){t[i]&&t[i].load().then(function(){e(t,i+1)})}var i=this,n=new t.Promise,s=this;if(0===this._resourceList.length)return s.oncomplete.call(s),n;var o=Array(this._resourceList.length),r=this._resourceList.length;return this._resourceList.forEach(function(t,e){i._engine&&t.wireEngine(i._engine),t.onprogress=function(t){var i=t.total,n=t.loaded;o[e]={loaded:n/i*(100/r),total:100};var h=o.reduce(function(t,e){return{loaded:t.loaded+e.loaded,total:100}},{loaded:0,total:100});s.onprogress.call(s,h)},t.oncomplete=t.onerror=function(){s._numLoaded++,s._numLoaded===s._resourceCount&&(s.onprogress.call(s,{loaded:100,total:100}),s.oncomplete.call(s),n.resolve())}}),e(this._resourceList,0),n},e}();t.Loader=n})(ex||(ex={}));var ex;(function(t){var e=function(){function e(){this.failedTests=[],this._criticalTests={canvasSupport:function(){var t=document.createElement("canvas");return!(!t.getContext||!t.getContext("2d"))},arrayBufferSupport:function(){var t=new XMLHttpRequest;t.open("GET","/");try{t.responseType="arraybuffer"}catch(e){return!1}return"arraybuffer"===t.responseType},dataUrlSupport:function(){var t=document.createElement("canvas");return 0===t.toDataURL("image/png").indexOf("data:image/png")},objectUrlSupport:function(){return"URL"in window&&"revokeObjectURL"in URL&&"createObjectURL"in URL},rgbaSupport:function(){var t=document.createElement("a").style;return t.cssText="background-color:rgba(150,255,150,.5)",(""+t.backgroundColor).indexOf("rgba")>-1}},this._warningTest={webAudioSupport:function(){return!!(window.AudioContext||window.webkitAudioContext||window.mozAudioContext||window.msAudioContext||window.oAudioContext)},webglSupport:function(){var t=document.createElement("canvas");return!(!t.getContext||!t.getContext("webgl"))}}}return e.prototype.test=function(){var e=!1;for(var i in this._criticalTests)this._criticalTests[i]()||(this.failedTests.push(i),t.Logger.getInstance().error("Critical browser feature missing, Excalibur requires:",i),e=!0);if(e)return!1;for(var n in this._warningTest)this._warningTest[n]()||t.Logger.getInstance().warn("Warning browser feature missing, Excalibur will have reduced performance:",n);return!0},e}();t.Detector=e})(ex||(ex={}));var ex;(function(t){var e=function(){function e(e){this.path=e,this._isLoaded=!1,this.logger=t.Logger.getInstance(),this.onprogress=function(){},this.oncomplete=function(){},this.onerror=function(){},this._innerElement=document.createElement("div"),this._innerElement.className="excalibur-template"}return e.prototype.wireEngine=function(t){this._engine=t},e.prototype.getTemplateString=function(){return this._isLoaded?this._htmlString:""},e.prototype._compile=function(){this._innerElement.innerHTML=this._htmlString,this._styleElements=this._innerElement.querySelectorAll("[data-style]"),this._textElements=this._innerElement.querySelectorAll("[data-text]")},e.prototype._evaluateExpresion=function(t,e){var i=Function("return "+t+";"),n=i.call(e);return n},e.prototype.apply=function(t){for(var e=this,i=0;this._styleElements.length>i;i++)(function(){var n={};e._styleElements[i].dataset.style.split(";").forEach(function(t){if(t){var e=t.split(":");n[e[0].trim()]=e[1].trim()}});for(var s in n)(function(){var o=n[s];e._styleElements[i].style[s]=e._evaluateExpresion(o,t)})()})();for(var n=0;this._textElements.length>n;n++)(function(){var i=e._textElements[n].dataset.text;e._textElements[n].innerText=e._evaluateExpresion(i,t)})();return 1===this._innerElement.children.length&&(this._innerElement=this._innerElement.firstChild),this._innerElement},e.prototype.load=function(){var e=this,i=new t.Promise,n=new XMLHttpRequest;return n.open("GET",this.path,!0),n.responseType="text",n.onprogress=this.onprogress,n.onerror=this.onerror,n.onload=function(){return 200!==n.status?(e.logger.error("Failed to load html template resource ",e.path," server responded with error code",n.status),e.onerror(n.response),e._isLoaded=!1,i.resolve("error"),void 0):(e.setData(n.response),e.oncomplete(),e.logger.debug("Completed loading template",e.path),i.resolve(e._htmlString),void 0)},n.overrideMimeType&&n.overrideMimeType("text/plain; charset=x-user-defined"),n.send(),i},e.prototype.getData=function(){return this._htmlString},e.prototype.setData=function(t){this._htmlString=this.processData(t),this._compile(),this._isLoaded=!0},e.prototype.processData=function(t){return t},e.prototype.isLoaded=function(){return this._isLoaded},e}();t.Template=e;var i=function(){function t(t,e,i){this.parent=document.getElementById(t),this.template=e,this._ctx=i,this.update()}return t.prototype.listen=function(t,e,i){var n=this;i||(i=function(){n.update()}),t.addEventListener&&e.forEach(function(e){t.addEventListener(e,i)})},t.prototype.update=function(){var t=this._applyTemplate(this.template,this._ctx);t instanceof String&&(this.parent.innerHTML=t),t instanceof Node&&this.parent.lastChild!==t&&this.parent.appendChild(t)},t.prototype._applyTemplate=function(t,e){return t.isLoaded()?t.apply(e):void 0},t}();t.Binding=i})(ex||(ex={}));var ex;(function(t){(function(t){t[t.Em=0]="Em",t[t.Rem=1]="Rem",t[t.Px=2]="Px",t[t.Pt=3]="Pt",t[t.Percent=4]="Percent"})(t.FontUnit||(t.FontUnit={}));var e=t.FontUnit;(function(t){t[t.Left=0]="Left",t[t.Right=1]="Right",t[t.Center=2]="Center",t[t.Start=3]="Start",t[t.End=4]="End"})(t.TextAlign||(t.TextAlign={}));var i=t.TextAlign;(function(t){t[t.Top=0]="Top",t[t.Hanging=1]="Hanging",t[t.Middle=2]="Middle",t[t.Alphabetic=3]="Alphabetic",t[t.Ideographic=4]="Ideographic",t[t.Bottom=5]="Bottom"})(t.BaseAlign||(t.BaseAlign={}));var n=t.BaseAlign,s=function(s){function o(o,r,h,a,c){s.call(this,r,h),this.fontSize=10,this.fontUnit=e.Px,this.textAlign=i.Left,this.baseAlign=n.Bottom,this.letterSpacing=0,this.caseInsensitive=!0,this._textShadowOn=!1,this._shadowOffsetX=0,this._shadowOffsetY=0,this._shadowColor=t.Color.Black.clone(),this._shadowColorDirty=!1,this._textSprites={},this._shadowSprites={},this._color=t.Color.Black.clone(),this.text=o||"",this.color=t.Color.Black.clone(),this.spriteFont=c,this.collisionType=t.CollisionType.PreventCollision,this.fontFamily=a||"10px sans-serif"}return __extends(o,s),o.prototype.getTextWidth=function(t){var e=t.font;t.font=this.fontFamily;var i=t.measureText(this.text).width;return t.font=e,i},o.prototype._lookupFontUnit=function(t){switch(t){case e.Em:return"em";case e.Rem:return"rem";case e.Pt:return"pt";case e.Px:return"px";case e.Percent:return"%";default:return"px"}},o.prototype._lookupTextAlign=function(t){switch(t){case i.Left:return"left";case i.Right:return"right";case i.Center:return"center";case i.End:return"end";case i.Start:return"start";default:return"start"}},o.prototype._lookupBaseAlign=function(t){switch(t){case n.Alphabetic:return"alphabetic";case n.Bottom:return"bottom";case n.Hanging:return"hangin";case n.Ideographic:return"ideographic";case n.Middle:return"middle";case n.Top:return"top";default:return"alphabetic"}},o.prototype.setTextShadow=function(t,e,i){this.spriteFont.setTextShadow(t,e,i)},o.prototype.useTextShadow=function(t){this.spriteFont.useTextShadow(t)},o.prototype.clearTextShadow=function(){this._textShadowOn=!1,this._shadowOffsetX=0,this._shadowOffsetY=0,this._shadowColor=t.Color.Black.clone()},o.prototype.update=function(t,e){s.prototype.update.call(this,t,e)},o.prototype.draw=function(t,e){t.save(),t.translate(this.x,this.y),t.scale(this.scale.x,this.scale.y),t.rotate(this.rotation),this._textShadowOn&&(t.save(),t.translate(this._shadowOffsetX,this._shadowOffsetY),this._fontDraw(t,e,this._shadowSprites),t.restore()),this._fontDraw(t,e,this._textSprites),s.prototype.draw.call(this,t,e),t.restore() -},o.prototype._fontDraw=function(t){if(this.spriteFont)this.spriteFont.draw(t,this.text,0,0,{color:this.color.clone(),baseAlign:this.baseAlign,textAlign:this.textAlign,fontSize:this.fontSize,letterSpacing:this.letterSpacing,opacity:this.opacity});else{var e=t.textAlign,i=t.textBaseline;t.textAlign=this._lookupTextAlign(this.textAlign),t.textBaseline=this._lookupBaseAlign(this.baseAlign),this.color&&(this.color.a=this.opacity),t.fillStyle=""+this.color,t.font=""+this.fontSize+this._lookupFontUnit(this.fontUnit)+" "+this.fontFamily,this.maxWidth?t.fillText(this.text,0,0,this.maxWidth):t.fillText(this.text,0,0),t.textAlign=e,t.textBaseline=i}},o.prototype.debugDraw=function(t){s.prototype.debugDraw.call(this,t)},o}(t.Actor);t.Label=s})(ex||(ex={}));var ex;(function(t){var e;(function(e){(function(t){t[t.Touch=0]="Touch",t[t.Mouse=1]="Mouse",t[t.Pen=2]="Pen",t[t.Unknown=3]="Unknown"})(e.PointerType||(e.PointerType={}));var i=e.PointerType;(function(t){t[t.Left=0]="Left",t[t.Middle=1]="Middle",t[t.Right=2]="Right",t[t.Unknown=3]="Unknown"})(e.PointerButton||(e.PointerButton={}));var n=e.PointerButton;(function(t){t[t.Canvas=0]="Canvas",t[t.Document=1]="Document"})(e.PointerScope||(e.PointerScope={}));var s=e.PointerScope,o=function(t){function e(e,i,n,s,o,r){t.call(this),this.x=e,this.y=i,this.index=n,this.pointerType=s,this.button=o,this.ev=r}return __extends(e,t),e}(t.GameEvent);e.PointerEvent=o;var r=function(e){function r(t){e.call(this),this._pointerDown=[],this._pointerUp=[],this._pointerMove=[],this._pointerCancel=[],this._pointers=[],this._activePointers=[],this._engine=t,this._pointers.push(new h),this._activePointers=[-1],this.primary=this._pointers[0]}return __extends(r,e),r.prototype.init=function(t){void 0===t&&(t=s.Document);var e=document;e=t===s.Document?document:this._engine.canvas,e.addEventListener("touchstart",this._handleTouchEvent("down",this._pointerDown)),e.addEventListener("touchend",this._handleTouchEvent("up",this._pointerUp)),e.addEventListener("touchmove",this._handleTouchEvent("move",this._pointerMove)),e.addEventListener("touchcancel",this._handleTouchEvent("cancel",this._pointerCancel)),window.PointerEvent?(this._engine.canvas.style.touchAction="none",e.addEventListener("pointerdown",this._handlePointerEvent("down",this._pointerDown)),e.addEventListener("pointerup",this._handlePointerEvent("up",this._pointerUp)),e.addEventListener("pointermove",this._handlePointerEvent("move",this._pointerMove)),e.addEventListener("pointercancel",this._handlePointerEvent("cancel",this._pointerMove))):window.MSPointerEvent?(this._engine.canvas.style.msTouchAction="none",e.addEventListener("MSPointerDown",this._handlePointerEvent("down",this._pointerDown)),e.addEventListener("MSPointerUp",this._handlePointerEvent("up",this._pointerUp)),e.addEventListener("MSPointerMove",this._handlePointerEvent("move",this._pointerMove)),e.addEventListener("MSPointerCancel",this._handlePointerEvent("cancel",this._pointerMove))):(e.addEventListener("mousedown",this._handleMouseEvent("down",this._pointerDown)),e.addEventListener("mouseup",this._handleMouseEvent("up",this._pointerUp)),e.addEventListener("mousemove",this._handleMouseEvent("move",this._pointerMove)))},r.prototype.update=function(){this._pointerUp.length=0,this._pointerDown.length=0,this._pointerMove.length=0,this._pointerCancel.length=0},r.prototype.at=function(t){if(t>=this._pointers.length)for(var e=this._pointers.length-1,i=t;i>e;e++)this._pointers.push(new h),this._activePointers.push(-1);return this._pointers[t]},r.prototype.count=function(){return this._pointers.length},r.prototype.propogate=function(e){var i=e instanceof t.UIActor,n=0,s=this._pointerUp.length;for(n;s>n;n++)e.contains(this._pointerUp[n].x,this._pointerUp[n].y,!i)&&e.eventDispatcher.emit("pointerup",this._pointerUp[n]);for(n=0,s=this._pointerDown.length,n;s>n;n++)e.contains(this._pointerDown[n].x,this._pointerDown[n].y,!i)&&e.eventDispatcher.emit("pointerdown",this._pointerDown[n]);if(e.capturePointer.captureMoveEvents)for(n=0,s=this._pointerMove.length,n;s>n;n++)e.contains(this._pointerMove[n].x,this._pointerMove[n].y,!i)&&e.eventDispatcher.emit("pointermove",this._pointerMove[n]);for(n=0,s=this._pointerCancel.length,n;s>n;n++)e.contains(this._pointerCancel[n].x,this._pointerCancel[n].y,!i)&&e.eventDispatcher.emit("pointercancel",this._pointerCancel[n])},r.prototype._handleMouseEvent=function(e,n){var s=this;return function(r){r.preventDefault();var h=r.pageX-t.Util.getPosition(s._engine.canvas).x,a=r.pageY-t.Util.getPosition(s._engine.canvas).y,c=s._engine.screenToWorldCoordinates(new t.Point(h,a)),u=new o(c.x,c.y,0,i.Mouse,r.button,r);n.push(u),s.at(0).eventDispatcher.emit(e,u)}},r.prototype._handleTouchEvent=function(e,s){var r=this;return function(h){h.preventDefault();for(var a=0,c=h.changedTouches.length;c>a;a++){var u=r._pointers.length>1?r._getPointerIndex(h.changedTouches[a].identifier):0;if(-1!==u){var l=h.changedTouches[a].pageX-t.Util.getPosition(r._engine.canvas).x,p=h.changedTouches[a].pageY-t.Util.getPosition(r._engine.canvas).y,d=r._engine.screenToWorldCoordinates(new t.Point(l,p)),f=new o(d.x,d.y,u,i.Touch,n.Unknown,h);s.push(f),r.at(u).eventDispatcher.emit(e,f),r._pointers.length>1&&("up"===e?r._activePointers[u]=-1:"down"===e&&(r._activePointers[u]=h.changedTouches[a].identifier))}}}},r.prototype._handlePointerEvent=function(e,i){var n=this;return function(s){s.preventDefault();var r=n._pointers.length>1?n._getPointerIndex(s.pointerId):0;if(-1!==r){var h=s.pageX-t.Util.getPosition(n._engine.canvas).x,a=s.pageY-t.Util.getPosition(n._engine.canvas).y,c=n._engine.screenToWorldCoordinates(new t.Point(h,a)),u=new o(c.x,c.y,r,n._stringToPointerType(s.pointerType),s.button,s);i.push(u),n.at(r).eventDispatcher.emit(e,u),n._pointers.length>1&&("up"===e?n._activePointers[r]=-1:"down"===e&&(n._activePointers[r]=s.pointerId))}}},r.prototype._getPointerIndex=function(t){var e;if((e=this._activePointers.indexOf(t))>-1)return e;for(var i=0;this._activePointers.length>i;i++)if(-1===this._activePointers[i])return i;return-1},r.prototype._stringToPointerType=function(t){switch(t){case"touch":return i.Touch;case"mouse":return i.Mouse;case"pen":return i.Pen;default:return i.Unknown}},r}(t.Class);e.Pointers=r;var h=function(t){function e(){t.apply(this,arguments)}return __extends(e,t),e}(t.Class);e.Pointer=h})(e=t.Input||(t.Input={}))})(ex||(ex={}));var ex;(function(t){var e;(function(e){(function(t){t[t.Num1=97]="Num1",t[t.Num2=98]="Num2",t[t.Num3=99]="Num3",t[t.Num4=100]="Num4",t[t.Num5=101]="Num5",t[t.Num6=102]="Num6",t[t.Num7=103]="Num7",t[t.Num8=104]="Num8",t[t.Num9=105]="Num9",t[t.Num0=96]="Num0",t[t.Numlock=144]="Numlock",t[t.Semicolon=186]="Semicolon",t[t.A=65]="A",t[t.B=66]="B",t[t.C=67]="C",t[t.D=68]="D",t[t.E=69]="E",t[t.F=70]="F",t[t.G=71]="G",t[t.H=72]="H",t[t.I=73]="I",t[t.J=74]="J",t[t.K=75]="K",t[t.L=76]="L",t[t.M=77]="M",t[t.N=78]="N",t[t.O=79]="O",t[t.P=80]="P",t[t.Q=81]="Q",t[t.R=82]="R",t[t.S=83]="S",t[t.T=84]="T",t[t.U=85]="U",t[t.V=86]="V",t[t.W=87]="W",t[t.X=88]="X",t[t.Y=89]="Y",t[t.Z=90]="Z",t[t.Shift=16]="Shift",t[t.Alt=18]="Alt",t[t.Up=38]="Up",t[t.Down=40]="Down",t[t.Left=37]="Left",t[t.Right=39]="Right",t[t.Space=32]="Space",t[t.Esc=27]="Esc"})(e.Keys||(e.Keys={})),e.Keys;var i=function(t){function e(e){t.call(this),this.key=e}return __extends(e,t),e}(t.GameEvent);e.KeyEvent=i;var n=function(t){function e(e){t.call(this),this._keys=[],this._keysUp=[],this._keysDown=[],this._engine=e}return __extends(e,t),e.prototype.init=function(){var t=this;window.addEventListener("blur",function(){t._keys.length=0}),window.addEventListener("keyup",function(e){var n=t._keys.indexOf(e.keyCode);t._keys.splice(n,1),t._keysUp.push(e.keyCode);var s=new i(e.keyCode);t.eventDispatcher.emit("up",s),t.eventDispatcher.emit("release",s)}),window.addEventListener("keydown",function(e){if(-1===t._keys.indexOf(e.keyCode)){t._keys.push(e.keyCode),t._keysDown.push(e.keyCode);var n=new i(e.keyCode);t.eventDispatcher.emit("down",n),t.eventDispatcher.emit("press",n)}})},e.prototype.update=function(){this._keysDown.length=0,this._keysUp.length=0;for(var t=0;this._keys.length>t;t++)this.eventDispatcher.emit("hold",new i(this._keys[t]))},e.prototype.getKeys=function(){return this._keys},e.prototype.wasPressed=function(t){return this._keysDown.indexOf(t)>-1},e.prototype.isHeld=function(t){return this._keys.indexOf(t)>-1},e.prototype.wasReleased=function(t){return this._keysUp.indexOf(t)>-1},e}(t.Class);e.Keyboard=n})(e=t.Input||(t.Input={}))})(ex||(ex={}));var ex;(function(t){var e;(function(e){var i=function(e){function i(t){e.call(this),this.enabled=!1,this.supported=!!navigator.getGamepads,this._gamePadTimeStamps=[0,0,0,0],this._oldPads=[],this._pads=[],this._initSuccess=!1,this._navigator=navigator,this._minimumConfiguration=null,this._engine=t}return __extends(i,e),i.prototype.init=function(){this.supported&&(this._initSuccess||(this._oldPads=this._clonePads(this._navigator.getGamepads()),this._oldPads.length&&this._oldPads[0]&&(this._initSuccess=!0)))},i.prototype.setMinimumGamepadConfiguration=function(t){this._enableAndUpdate(),this._minimumConfiguration=t},i.prototype._enableAndUpdate=function(){this.enabled||(this.enabled=!0,this.update(100))},i.prototype._isGamepadValid=function(t){if(!this._minimumConfiguration)return!0;if(!t)return!1;var e=t.axes.filter(function(t){return void 0!==typeof t}).length,i=t.buttons.filter(function(t){return void 0!==typeof t}).length;return e>=this._minimumConfiguration.axis&&i>=this._minimumConfiguration.buttons&&t.connected},i.prototype.on=function(t,i){this._enableAndUpdate(),e.prototype.on.call(this,t,i)},i.prototype.off=function(t,i){this._enableAndUpdate(),e.prototype.off.call(this,t,i)},i.prototype.update=function(){if(this.enabled&&this.supported){this.init();for(var e=this._navigator.getGamepads(),i=0;e.length>i;i++)if(e[i]){if(!this.at(i).connected&&this._isGamepadValid(e[i])&&this.eventDispatcher.emit("connect",new t.GamepadConnectEvent(i,this.at(i))),this.at(i).connected=!0,!e[i].timestamp||e[i].timestamp!==this._gamePadTimeStamps[i]){this._gamePadTimeStamps[i]=e[i].timestamp,this.at(i).navigatorGamepad=e[i];var n,r,h,a,c;for(n in s)"number"==typeof s[n]&&(a=s[n],e[i].buttons[a]&&(h=e[i].buttons[a].value,h!==this._oldPads[i].getButton(a)&&(e[i].buttons[a].pressed?(this.at(i).updateButton(a,h),this.at(i).eventDispatcher.publish("button",new t.GamepadButtonEvent(a,h))):this.at(i).updateButton(a,0))));for(r in o)"number"==typeof o[r]&&(c=o[r],h=e[i].axes[c],h!==this._oldPads[i].getAxes(c)&&(this.at(i).updateAxes(c,h),this.at(i).eventDispatcher.emit("axis",new t.GamepadAxisEvent(c,h))));this._oldPads[i]=this._clonePad(e[i])}}else this.at(i).connected&&this.eventDispatcher.emit("disconnect",new t.GamepadDisconnectEvent(i)),this.at(i).connected=!1}},i.prototype.at=function(t){if(this._enableAndUpdate(),t>=this._pads.length)for(var e=this._pads.length-1,i=t;i>e;e++)this._pads.push(new n),this._oldPads.push(new n);return this._pads[t]},i.prototype.getValidGamepads=function(){this._enableAndUpdate();for(var t=[],e=0;this._pads.length>e;e++)this._isGamepadValid(this.at(e).navigatorGamepad)&&this.at(e).connected&&t.push(this.at(e));return t},i.prototype.count=function(){return this._pads.filter(function(t){return t.connected}).length},i.prototype._clonePads=function(t){for(var e=[],i=0,n=t.length;n>i;i++)e.push(this._clonePad(t[i]));return e},i.prototype._clonePad=function(t){var e,i,s=new n;if(!t)return s;for(e=0,i=t.buttons.length;i>e;e++)t.buttons[e]&&s.updateButton(e,t.buttons[e].value);for(e=0,i=t.axes.length;i>e;e++)s.updateAxes(e,t.axes[e]);return s},i.MinAxisMoveThreshold=.05,i}(t.Class);e.Gamepads=i;var n=function(t){function e(){t.call(this),this.connected=!1,this._buttons=Array(16),this._axes=Array(4);var e;for(e=0;this._buttons.length>e;e++)this._buttons[e]=0;for(e=0;this._axes.length>e;e++)this._axes[e]=0}return __extends(e,t),e.prototype.isButtonPressed=function(t,e){return void 0===e&&(e=1),this._buttons[t]>=e},e.prototype.getButton=function(t){return this._buttons[t]},e.prototype.getAxes=function(t){var e=this._axes[t];return Math.abs(e)n;n++)this._animations[n].animation.draw(i,this._animations[n].x,this._animations[n].y);if(this.fps=1/(e/1e3),this.isDebug){this.ctx.font="Consolas",this.ctx.fillStyle=""+this.debugColor;for(var o=this.input.keyboard.getKeys(),r=0;o.length>r;r++)this.ctx.fillText(""+o[r]+" : "+(t.Input.Keys[o[r]]?t.Input.Keys[o[r]]:"Not Mapped"),100,10*r+10);this.ctx.fillText("FPS:"+(""+this.fps.toFixed(2)),10,10)}for(var h=0;this.postProcessors.length>h;h++)this.postProcessors[h].process(this.ctx.getImageData(0,0,this.width,this.height),this.ctx);this.emit("postdraw",new t.PreDrawEvent(i,e,this))},s.prototype.start=function(e){if(!this._compatible){var i=new t.Promise;return i.reject("Excalibur is incompatible with your browser")}var n;if(e?(e.wireEngine(this),n=this.load(e)):n=t.Promise.wrap(),!this._hasStarted){this._hasStarted=!0,this._logger.debug("Starting game...");var s=Date.now(),o=this;(function r(){if(o._hasStarted)try{o._requestId=window.requestAnimationFrame(r);var t=Date.now(),e=Math.floor(t-s)||1;e>200&&(e=1),o._update(e),o._draw(e),s=t}catch(i){window.cancelAnimationFrame(o._requestId),o.stop(),o.onFatalException(i)}})(),this._logger.debug("Game started")}return n},s.prototype.stop=function(){this._hasStarted&&(this._hasStarted=!1,this._logger.debug("Game stopped"))},s.prototype.screenshot=function(){var t=new Image,e=this.canvas.toDataURL("image/png");return t.src=e,t},s.prototype._drawLoadingBar=function(t,e,i){if(this._loadingDraw)return this._loadingDraw(t,e,i),void 0;var n=this.canvas.height/2,s=this.canvas.width/3,o=s,r=new Image;r.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAyAAAAEsCAYAAAA7Ldc6AAAACXBIWXMAAA7CAAAOwgEVKEqAAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJ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ptE/5z7e2HgReQipVPb0zTc/ep8qTS1qnuIBAAAA+jyAmBBSkLTsPl5ddSILIZXKnu7fX/UOPHckzVA0AAAAQP8Zev36de2HoaG3fnnnir6VlHEfT06m9PHH72l4+GgoH761taNvvvnRP9vWjBkMDwAH3H0VAABItmMtfn9J0j03hKyuOtrc3NHvfz+h8fHRjj74wYN1/5gPwgcAAADQ55peAZGkO1eUknRbUs77/ORkSh9+eE5jY8etP2xv75XW1p7rwYP1erNrET4ANMQVEAAABiSAeILIvKTr/ufHxo7r/fdPa3z8pMbGfvVW96ytrR1tbu5oY6Piv8mgqyzpC244CIAAAgAAAcQfQjKSbsp3NaRNjmr3HFlgul0ABBAAAAggzYJITtJVSdMEDwAEEAAAEGkA8QSRlAkhn6k2UD3TIHCUJH0tqTi1qCKrHQABBACAAQ8gAAAAABC1I6wCAAAAAAQQAAAAAH3n/w8AmB1j3tEUq4sAAAAASUVORK5CYII="; +return this},e.prototype.repeatForever=function(){var e=0,i=this._queues.length;for(e;i>e;e++)this._queues[e].add(new t.Internal.Actions.RepeatForever(this._actors[e],this._actors[e].actionQueue.getActions()));return this},e.prototype.follow=function(e,i){var n=0,s=this._queues.length;for(n;s>n;n++)void 0===i?this._queues[n].add(new t.Internal.Actions.Follow(this._actors[n],e)):this._queues[n].add(new t.Internal.Actions.Follow(this._actors[n],e,i));return this},e.prototype.meet=function(e,i){var n=0,s=this._queues.length;for(n;s>n;n++)void 0===i?this._queues[n].add(new t.Internal.Actions.Meet(this._actors[n],e)):this._queues[n].add(new t.Internal.Actions.Meet(this._actors[n],e,i));return this},e.prototype.asPromise=function(){var e=this,i=this._queues.map(function(i,n){var s=new t.Promise;return i.add(new t.Internal.Actions.CallMethod(e._actors[n],function(){s.resolve()})),s});return t.Promise.join.apply(this,i)},e}();t.ActionContext=e})(ex||(ex={}));var ex;(function(t){var e=function(e){function i(i,n){if(e.call(this),this.name=i,this.scene=n,this._logger=t.Logger.getInstance(),this._members=[],this.actions=new t.ActionContext,null==n)this._logger.error("Invalid constructor arguments passed to Group: ",i,", scene must not be null!");else{var s=n.groups[i];s&&this._logger.warn("Group with name",i,"already exists. This new group will replace it."),n.groups[i]=this}}return __extends(i,e),i.prototype.add=function(e){e instanceof t.Actor&&(e=[].concat(e));var i,n=0,s=e.length;for(n;s>n;n++)i=this.getMembers().indexOf(e[n]),-1===i&&(this._members.push(e[n]),this.scene.add(e[n]),this.actions.addActorToContext(e[n]),this.eventDispatcher.wire(e[n].eventDispatcher))},i.prototype.remove=function(t){var e=this._members.indexOf(t);e>-1&&(this._members.splice(e,1),this.actions.removeActorFromContext(t),this.eventDispatcher.unwire(t.eventDispatcher))},i.prototype.move=function(e){var i=0,n=this.getMembers(),s=n.length;if(1===arguments.length&&e instanceof t.Vector)for(i;s>i;i++)n[i].x+=e.x,n[i].y+=e.y;else if("number"==typeof arguments[0]&&"number"==typeof arguments[1]){var o=arguments[0],r=arguments[1];for(i;s>i;i++)n[i].x+=o,n[i].y+=r}else this._logger.error("Invalid arguments passed to group move",this.name,"args:",arguments)},i.prototype.rotate=function(){if("number"==typeof arguments[0]){var t=arguments[0],e=0,i=this.getMembers(),n=i.length;for(e;n>e;e++)i[e].rotation+=t}else this._logger.error("Invalid arguments passed to group rotate",this.name,"args:",arguments)},i.prototype.on=function(t,e){this.eventDispatcher.subscribe(t,e)},i.prototype.off=function(t,e){this.eventDispatcher.unsubscribe(t,e)},i.prototype.emit=function(t,e){this.eventDispatcher.emit(t,e)},i.prototype.contains=function(t){return this.getMembers().indexOf(t)>-1},i.prototype.getMembers=function(){return this._members},i.prototype.getRandomMember=function(){return this._members[Math.floor(Math.random()*this._members.length)]},i.prototype.getBounds=function(){return this.getMembers().map(function(t){return t.getBounds()}).reduce(function(t,e){return t.combine(e)})},i}(t.Class);t.Group=e})(ex||(ex={}));var ex;(function(t){var e=function(){function t(t){this._getComparable=t}return t.prototype.find=function(t){return this._find(this._root,t)},t.prototype._find=function(t,e){return null==t?!1:this._getComparable.call(e)===t.getKey()?t.getData().indexOf(e)>-1?!0:!1:this._getComparable.call(e)e?this._get(t.getLeft(),e):this._get(t.getRight(),e)},t.prototype.add=function(t){return null==this._root?(this._root=new i(this._getComparable.call(t),[t],null,null),!0):this._insert(this._root,t)},t.prototype._insert=function(t,e){return null!=t?this._getComparable.call(e)===t.getKey()?t.getData().indexOf(e)>-1?!1:(t.getData().push(e),!0):this._getComparable.call(e)-1){if(t.getData().splice(i,1),0===t.getData().length){if(null==t.getLeft()&&null==t.getRight())return null;if(null==t.getLeft())return t.getRight();if(null==t.getRight())return t.getLeft();var n=this._findMinNode(t.getRight());return t.setKey(n.getKey()),t.setData(n.getData()),t.setRight(this._cleanup(t.getRight(),n)),t}return t}},t.prototype._cleanup=function(t,e){var i=e.getKey();if(null==t)return null;if(i===t.getKey()){if(null==t.getLeft()&&null==t.getRight())return null;if(null==t.getLeft())return t.getRight();if(null==t.getRight())return t.getLeft();var n=this._findMinNode(t.getRight());return t.setKey(n.getKey()),t.setData(n.getData()),t.setRight(this._cleanup(t.getRight(),n)),t}return this._getComparable.call(e)n;n++)this.uiActors[n].update(e,i);for(n=0,s=this.tileMaps.length;s>n;n++)this.tileMaps[n].update(e,i);for(n=0,s=this.children.length;s>n;n++)this.children[n].update(e,i);this._collisionResolver&&(this._collisionResolver.update(this.children),this._collisionResolver.evaluate(this.children));var o;for(n=0,s=this._killQueue.length;s>n;n++)o=this.children.indexOf(this._killQueue[n]),o>-1&&(this._sortedDrawingTree.removeByComparable(this._killQueue[n]),this.children.splice(o,1));for(this._killQueue.length=0,n=0,s=this._cancelQueue.length;s>n;n++)this.removeTimer(this._cancelQueue[n]);this._cancelQueue.length=0,this._timers=this._timers.filter(function(t){return t.update(i),!t.complete}),this.emit("postupdate",new t.PostUpdateEvent(e,i,this))},i.prototype.draw=function(e,i){this.emit("predraw",new t.PreDrawEvent(e,i,this)),e.save(),this.camera&&this.camera.update(e,i);var n,s;for(n=0,s=this.tileMaps.length;s>n;n++)this.tileMaps[n].draw(e,i);var o=this._sortedDrawingTree.list();for(n=0,s=o.length;s>n;n++)o[n].visible&&!o[n].isOffScreen&&o[n].draw(e,i);for(this.engine&&this.engine.isDebug&&(e.strokeStyle="yellow",this.debugDraw(e)),e.restore(),n=0,s=this.uiActors.length;s>n;n++)this.uiActors[n].visible&&this.uiActors[n].draw(e,i);if(this.engine&&this.engine.isDebug)for(n=0,s=this.uiActors.length;s>n;n++)this.uiActors[n].debugDraw(e);this.emit("postdraw",new t.PreDrawEvent(e,i,this))},i.prototype.debugDraw=function(e){this.emit("predebugdraw",new t.PreDebugDrawEvent(e,this));var i,n;for(i=0,n=this.tileMaps.length;n>i;i++)this.tileMaps[i].debugDraw(e);for(i=0,n=this.children.length;n>i;i++)this.children[i].debugDraw(e);this.camera.debugDraw(e),this.emit("postdebugdraw",new t.PostDebugDrawEvent(e,this))},i.prototype.contains=function(t){return this.children.indexOf(t)>-1},i.prototype.add=function(e){return e instanceof t.Actor&&e.unkill(),e instanceof t.UIActor?(t.Util.contains(this.uiActors,e)||this.addUIActor(e),void 0):e instanceof t.Actor?(t.Util.contains(this.children,e)||(this.addChild(e),this._sortedDrawingTree.add(e)),void 0):e instanceof t.Timer?(t.Util.contains(this._timers,e)||this.addTimer(e),void 0):(e instanceof t.TileMap&&(t.Util.contains(this.tileMaps,e)||this.addTileMap(e)),void 0)},i.prototype.remove=function(e){return e instanceof t.UIActor?(this.removeUIActor(e),void 0):(e instanceof t.Actor&&(this._collisionResolver.remove(e),this.removeChild(e)),e instanceof t.Timer&&this.removeTimer(e),e instanceof t.TileMap&&this.removeTileMap(e),void 0)},i.prototype.addUIActor=function(t){this.uiActors.push(t),t.scene=this},i.prototype.removeUIActor=function(t){var e=this.uiActors.indexOf(t);e>-1&&this.uiActors.splice(e,1)},i.prototype.addChild=function(t){this._collisionResolver.register(t),t.scene=this,this.children.push(t),this._sortedDrawingTree.add(t),t.parent=this.actor},i.prototype.addTileMap=function(t){this.tileMaps.push(t)},i.prototype.removeTileMap=function(t){var e=this.tileMaps.indexOf(t);e>-1&&this.tileMaps.splice(e,1)},i.prototype.removeChild=function(t){this._collisionResolver.remove(t),this._killQueue.push(t),t.parent=null},i.prototype.addTimer=function(t){return this._timers.push(t),t.scene=this,t},i.prototype.removeTimer=function(t){var e=this._timers.indexOf(t);return-1!==e&&this._timers.splice(e,1),t},i.prototype.cancelTimer=function(t){return this._cancelQueue.push(t),t},i.prototype.isTimerActive=function(t){return this._timers.indexOf(t)>-1},i.prototype.createGroup=function(e){return new t.Group(e,this)},i.prototype.getGroup=function(t){return this.groups[t]},i.prototype.removeGroup=function(e){"string"==typeof e?delete this.groups[e]:e instanceof t.Group?delete this.groups[e.name]:this._logger.error("Invalid arguments to removeGroup",e)},i.prototype.cleanupDrawTree=function(t){this._sortedDrawingTree.removeByComparable(t)},i.prototype.updateDrawTree=function(t){this._sortedDrawingTree.add(t)},i}(t.Class);t.Scene=e})(ex||(ex={}));var ex;(function(t){var e=function(){function t(){}return t.Linear=function(t,e,i,n){return i-=e,i*t/n+e},t.EaseInQuad=function(t,e,i,n){t/=n},t.EaseOutQuad=function(t,e,i,n){return t/=n,-i*t*(t-2)+e},t.EaseInOutQuad=function(t,e,i,n){return i-=e,t/=n/2,1>t?i/2*t*t+e:(t--,-i/2*(t*(t-2)-1)+e)},t.EaseInCubic=function(t,e,i,n){return i-=e,t/=n,i*t*t*t+e},t.EaseOutCubic=function(t,e,i,n){return i-=e,t/=n,i*(t*t*t+1)+e},t.EaseInOutCubic=function(t,e,i,n){return i-=e,t/=n/2,1>t?i/2*t*t*t+e:(t-=2,i/2*(t*t*t+2)+e)},t}();t.EasingFunctions=e})(ex||(ex={}));var ex;(function(t){var e=function(e){function n(s,o,r,h,a){e.call(this),this.id=n.maxId++,this.x=0,this.y=0,this._height=0,this._width=0,this.rotation=0,this.rx=0,this.scale=new t.Vector(1,1),this.sx=0,this.sy=0,this.dx=0,this.dy=0,this.ax=0,this.ay=0,this.isOffScreen=!1,this.visible=!0,this.opacity=1,this.previousOpacity=1,this.logger=t.Logger.getInstance(),this.scene=null,this.parent=null,this.children=[],this.collisionType=i.PreventCollision,this.collisionGroups=[],this._collisionHandlers={},this._isInitialized=!1,this.frames={},this.currentDrawing=null,this.centerDrawingX=!0,this.centerDrawingY=!0,this.traits=[],this.enableCapturePointer=!1,this.capturePointer={captureMoveEvents:!1},this._zIndex=0,this._isKilled=!1,this.x=s||0,this.y=o||0,this._width=r||0,this._height=h||0,a&&(this.color=a.clone(),this.opacity=a.a),this.traits.push(new t.Traits.Movement),this.traits.push(new t.Traits.CollisionDetection),this.traits.push(new t.Traits.OffscreenCulling),this.traits.push(new t.Traits.CapturePointer),this.actionQueue=new t.Internal.Actions.ActionQueue(this),this.actions=new t.ActionContext(this),this.anchor=new t.Point(.5,.5)}return __extends(n,e),n.prototype.onInitialize=function(){},n.prototype._checkForPointerOptIn=function(t){!t||"pointerdown"!==t.toLowerCase()&&"pointerdown"!==t.toLowerCase()&&"pointermove"!==t.toLowerCase()||(this.enableCapturePointer=!0,"pointermove"===t.toLowerCase()&&(this.capturePointer.captureMoveEvents=!0))},n.prototype.addEventListener=function(t,i){this._checkForPointerOptIn(t),e.prototype.addEventListener.call(this,t,i)},n.prototype.on=function(t,e){this._checkForPointerOptIn(t),this.eventDispatcher.subscribe(t,e)},n.prototype.kill=function(){this.scene?(this.emit("kill",new t.KillEvent(this)),this.scene.remove(this),this._isKilled=!0):this.logger.warn("Cannot kill actor, it was never added to the Scene")},n.prototype.unkill=function(){this._isKilled=!1},n.prototype.isKilled=function(){return this._isKilled},n.prototype.add=function(e){e.collisionType=i.PreventCollision,t.Util.addItemToArray(e,this.children)&&(e.parent=this)},n.prototype.remove=function(e){t.Util.removeItemToArray(e,this.children)&&(e.parent=null)},n.prototype.setDrawing=function(e){e=""+e,this.currentDrawing!==this.frames[e]&&(null!=this.frames[e]?(this.frames[e].reset(),this.currentDrawing=this.frames[e]):t.Logger.getInstance().error("the specified drawing key '"+e+"' does not exist"))},n.prototype.addDrawing=function(){2===arguments.length?(this.frames[arguments[0]]=arguments[1],this.currentDrawing||(this.currentDrawing=arguments[1])):(arguments[0]instanceof t.Sprite&&this.addDrawing("default",arguments[0]),arguments[0]instanceof t.Texture&&this.addDrawing("default",arguments[0].asSprite()))},n.prototype.getZIndex=function(){return this._zIndex},n.prototype.setZIndex=function(t){this.scene.cleanupDrawTree(this),this._zIndex=t,this.scene.updateDrawTree(this)},n.prototype.addCollisionGroup=function(t){this.collisionGroups.push(t)},n.prototype.removeCollisionGroup=function(t){var e=this.collisionGroups.indexOf(t);-1!==e&&this.collisionGroups.splice(e,1)},n.prototype.getCenter=function(){return new t.Vector(this.x+this.getWidth()/2-this.anchor.x*this.getWidth(),this.y+this.getHeight()/2-this.anchor.y*this.getHeight())},n.prototype.getWidth=function(){return this._width*this.scale.x},n.prototype.setWidth=function(t){this._width=t/this.scale.x},n.prototype.getHeight=function(){return this._height*this.scale.y},n.prototype.setHeight=function(t){this._height=t/this.scale.y},n.prototype.setCenterDrawing=function(t){this.centerDrawingY=t,this.centerDrawingX=t},n.prototype.getLeft=function(){return this.getBounds().left},n.prototype.getRight=function(){return this.getBounds().right},n.prototype.getTop=function(){return this.getBounds().top},n.prototype.getBottom=function(){return this.getBounds().bottom},n.prototype.getWorldX=function(){return this.parent?this.x*this.parent.scale.x+this.parent.getWorldX():this.x},n.prototype.getWorldY=function(){return this.parent?this.y*this.parent.scale.y+this.parent.getWorldY():this.y},n.prototype.getGlobalScale=function(){if(!this.parent)return new t.Point(this.scale.x,this.scale.y);var e=this.parent.getGlobalScale();return new t.Point(this.scale.x*e.x,this.scale.y*e.y)},n.prototype.getBounds=function(){var e=this._getCalculatedAnchor();return new t.BoundingBox(this.getWorldX()-e.x,this.getWorldY()-e.y,this.getWorldX()+this.getWidth()-e.x,this.getWorldY()+this.getHeight()-e.y)},n.prototype.contains=function(e,i,n){void 0===n&&(n=!1);var s=this.getBounds().contains(new t.Point(e,i));return n?s||this.children.some(function(t){return t.contains(e,i,!0)}):s},n.prototype.getSideFromIntersect=function(e){return e?Math.abs(e.x)>Math.abs(e.y)?0>e.x?t.Side.Right:t.Side.Left:0>e.y?t.Side.Bottom:t.Side.Top:t.Side.None},n.prototype.collidesWithSide=function(e){var i=this.collides(e);return i?Math.abs(i.x)>Math.abs(i.y)?this.x=Math.sqrt(Math.pow(this.x-t.x,2)+Math.pow(this.y-t.y,2))},n.prototype.clearActions=function(){this.actionQueue.clearActions()},n.prototype.easeTo=function(e,i,n,s){return void 0===s&&(s=t.EasingFunctions.Linear),this.actionQueue.add(new t.Internal.Actions.EaseTo(this,e,i,n,s)),this},n.prototype.moveTo=function(e,i,n){return this.actionQueue.add(new t.Internal.Actions.MoveTo(this,e,i,n)),this},n.prototype.moveBy=function(e,i,n){return this.actionQueue.add(new t.Internal.Actions.MoveBy(this,e,i,n)),this},n.prototype.rotateTo=function(e,i,n){return this.actionQueue.add(new t.Internal.Actions.RotateTo(this,e,i,n)),this},n.prototype.rotateBy=function(e,i,n){return this.actionQueue.add(new t.Internal.Actions.RotateBy(this,e,i,n)),this},n.prototype.scaleTo=function(e,i,n,s){return this.actionQueue.add(new t.Internal.Actions.ScaleTo(this,e,i,n,s)),this},n.prototype.scaleBy=function(e,i,n){return this.actionQueue.add(new t.Internal.Actions.ScaleBy(this,e,i,n)),this},n.prototype.blink=function(e,i,n){return void 0===n&&(n=1),this.actionQueue.add(new t.Internal.Actions.Blink(this,e,i,n)),this},n.prototype.fade=function(e,i){return this.actionQueue.add(new t.Internal.Actions.Fade(this,e,i)),this},n.prototype.delay=function(e){return this.actionQueue.add(new t.Internal.Actions.Delay(this,e)),this},n.prototype.die=function(){return this.actionQueue.add(new t.Internal.Actions.Die(this)),this},n.prototype.callMethod=function(e){return this.actionQueue.add(new t.Internal.Actions.CallMethod(this,e)),this},n.prototype.repeat=function(e){return e?(this.actionQueue.add(new t.Internal.Actions.Repeat(this,e,this.actionQueue.getActions())),this):(this.repeatForever(),this)},n.prototype.repeatForever=function(){return this.actionQueue.add(new t.Internal.Actions.RepeatForever(this,this.actionQueue.getActions())),this},n.prototype.follow=function(e,i){return i===void 0?this.actionQueue.add(new t.Internal.Actions.Follow(this,e)):this.actionQueue.add(new t.Internal.Actions.Follow(this,e,i)),this},n.prototype.meet=function(e,i){return i===void 0?this.actionQueue.add(new t.Internal.Actions.Meet(this,e)):this.actionQueue.add(new t.Internal.Actions.Meet(this,e,i)),this},n.prototype.asPromise=function(){var e=new t.Promise;return this.callMethod(function(){e.resolve()}),e},n.prototype._getCalculatedAnchor=function(){return new t.Point(this.getWidth()*this.anchor.x,this.getHeight()*this.anchor.y)},n.prototype.update=function(e,i){this._isInitialized||(this.onInitialize(e),this.eventDispatcher.emit("initialize",new t.InitializeEvent(e)),this._isInitialized=!0),this.emit("preupdate",new t.PreUpdateEvent(e,i,this));var n=this.eventDispatcher;this.actionQueue.update(i),this.color&&(this.color.a=this.opacity);for(var s=0;this.traits.length>s;s++)this.traits[s].update(this,e,i);n.emit("update",new t.UpdateEvent(i)),this.emit("postupdate",new t.PostUpdateEvent(e,i,this))},n.prototype.draw=function(e,i){var n=this._getCalculatedAnchor();if(e.save(),e.translate(this.x,this.y),e.scale(this.scale.x,this.scale.y),e.rotate(this.rotation),this.emit("predraw",new t.PreDrawEvent(e,i,this)),this.previousOpacity!==this.opacity){for(var s in this.frames)this.frames[s].addEffect(new t.Effects.Opacity(this.opacity));this.previousOpacity=this.opacity}if(this.currentDrawing){var o=0,r=0;this.centerDrawingX&&(o=(this.currentDrawing.naturalWidth*this.currentDrawing.scale.x-this.getWidth())/2-this.currentDrawing.naturalWidth*this.currentDrawing.scale.x*this.currentDrawing.anchor.x),this.centerDrawingY&&(r=(this.currentDrawing.naturalHeight*this.currentDrawing.scale.y-this.getHeight())/2-this.currentDrawing.naturalHeight*this.currentDrawing.scale.y*this.currentDrawing.anchor.y),this.currentDrawing.draw(e,-n.x-o,-n.y-r)}else this.color&&(e.fillStyle=""+this.color,e.fillRect(-n.x,-n.y,this._width,this._height));for(var h=0;this.children.length>h;h++)this.children[h].visible&&this.children[h].draw(e,i);this.emit("postdraw",new t.PostDrawEvent(e,i,this)),e.restore()},n.prototype.debugDraw=function(e){this.emit("predebugdraw",new t.PreDebugDrawEvent(e,this));var i=this.getBounds();i.debugDraw(e),e.fillText("id: "+this.id,i.left+3,i.top+10),e.fillStyle=""+t.Color.Yellow,e.beginPath(),e.arc(this.getWorldX(),this.getWorldY(),3,0,2*Math.PI),e.closePath(),e.fill();for(var n=0;this.traits.length>n;n++)this.traits[n]instanceof t.Traits.OffscreenCulling&&this.traits[n].cullingBox.debugDraw(e);e.strokeStyle=""+t.Color.Yellow,e.beginPath();var s=Math.min(this.getWidth(),this.getHeight());e.arc(this.getWorldX(),this.getWorldY(),s,0,2*Math.PI),e.closePath(),e.stroke();var o={"0 Pi":0,"Pi/2":Math.PI/2,Pi:Math.PI,"3/2 Pi":3*Math.PI/2},r=e.font;for(var h in o)e.fillStyle=""+t.Color.Yellow,e.font="14px",e.textAlign="center",e.fillText(h,this.getWorldX()+Math.cos(o[h])*(s+10),this.getWorldY()+Math.sin(o[h])*(s+10));e.font=r,e.save(),e.translate(this.x,this.y),e.rotate(this.rotation);for(var a=0;this.children.length>a;a++)this.children[a].debugDraw(e);e.restore(),this.emit("postdebugdraw",new t.PostDebugDrawEvent(e,this))},n.maxId=0,n}(t.Class);t.Actor=e,function(t){t[t.PreventCollision=0]="PreventCollision",t[t.Passive=1]="Passive",t[t.Active=2]="Active",t[t.Elastic=3]="Elastic",t[t.Fixed=4]="Fixed"}(t.CollisionType||(t.CollisionType={}));var i=t.CollisionType})(ex||(ex={}));var ex;(function(t){(function(t){t[t.Debug=0]="Debug",t[t.Info=1]="Info",t[t.Warn=2]="Warn",t[t.Error=3]="Error",t[t.Fatal=4]="Fatal"})(t.LogLevel||(t.LogLevel={}));var e=t.LogLevel,i=function(){function t(){if(this._appenders=[],this.defaultLevel=e.Info,t._instance)throw Error("Logger is a singleton");return t._instance=this,t._instance.addAppender(new n),t._instance}return t.getInstance=function(){return null==t._instance&&(t._instance=new t),t._instance},t.prototype.addAppender=function(t){this._appenders.push(t)},t.prototype.clearAppenders=function(){this._appenders.length=0},t.prototype._log=function(t,e){null==t&&(t=this.defaultLevel);var i=0,n=this._appenders.length;for(i;n>i;i++)t>=this.defaultLevel&&this._appenders[i].log(t,e)},t.prototype.debug=function(){for(var t=[],i=0;arguments.length>i;i++)t[i-0]=arguments[i];this._log(e.Debug,t)},t.prototype.info=function(){for(var t=[],i=0;arguments.length>i;i++)t[i-0]=arguments[i];this._log(e.Info,t)},t.prototype.warn=function(){for(var t=[],i=0;arguments.length>i;i++)t[i-0]=arguments[i];this._log(e.Warn,t)},t.prototype.error=function(){for(var t=[],i=0;arguments.length>i;i++)t[i-0]=arguments[i];this._log(e.Error,t)},t.prototype.fatal=function(){for(var t=[],i=0;arguments.length>i;i++)t[i-0]=arguments[i];this._log(e.Fatal,t)},t._instance=null,t}();t.Logger=i;var n=function(){function t(){}return t.prototype.log=function(t,i){if(console||console.log||!console.warn||!console.error){var n=[];n.unshift.apply(n,i),n.unshift("["+e[t]+"] : "),e.Warn>t?console.log.apply?console.log.apply(console,n):console.log(n.join(" ")):e.Error>t?console.warn.apply?console.warn.apply(console,n):console.warn(n.join(" ")):console.error.apply?console.error.apply(console,n):console.error(n.join(" "))}},t}();t.ConsoleAppender=n;var s=function(){function t(t,e){this._messages=[],this._canvas=document.createElement("canvas"),this._canvas.width=t||window.innerWidth,this._canvas.height=e||window.innerHeight,this._canvas.style.position="absolute",this._ctx=this._canvas.getContext("2d"),document.body.appendChild(this._canvas)}return t.prototype.log=function(t,i){var n=i.join(",");this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._messages.unshift("["+e[t]+"] : "+n);for(var s=10,o=1,r=0;this._messages.length>r;r++)this._ctx.fillStyle="rgba(255,255,255,"+o.toFixed(2)+")",this._ctx.fillText(this._messages[r],200,s),s+=10,o=o>0?o-.05:0},t}();t.ScreenAppender=s})(ex||(ex={}));var ex;(function(t){var e=function(){function t(){}return t}();t.GameEvent=e;var i=function(t){function e(e){t.call(this),this.target=e}return __extends(e,t),e}(e);t.KillEvent=i;var n=function(t){function e(e,i,n){t.call(this),this.ctx=e,this.delta=i,this.target=n}return __extends(e,t),e}(e);t.PreDrawEvent=n;var s=function(t){function e(e,i,n){t.call(this),this.ctx=e,this.delta=i,this.target=n}return __extends(e,t),e}(e);t.PostDrawEvent=s;var o=function(t){function e(e,i){t.call(this),this.ctx=e,this.target=i}return __extends(e,t),e}(e);t.PreDebugDrawEvent=o;var r=function(t){function e(e,i){t.call(this),this.ctx=e,this.target=i}return __extends(e,t),e}(e);t.PostDebugDrawEvent=r;var h=function(t){function e(e,i,n){t.call(this),this.engine=e,this.delta=i,this.target=n}return __extends(e,t),e}(e);t.PreUpdateEvent=h;var a=function(t){function e(e,i,n){t.call(this),this.engine=e,this.delta=i,this.target=n}return __extends(e,t),e}(e);t.PostUpdateEvent=a;var c=function(t){function e(e,i){t.call(this),this.index=e,this.gamepad=i}return __extends(e,t),e}(e);t.GamepadConnectEvent=c;var u=function(t){function e(e){t.call(this),this.index=e}return __extends(e,t),e}(e);t.GamepadDisconnectEvent=u;var l=function(t){function e(e,i){t.call(this),this.button=e,this.value=i}return __extends(e,t),e}(t.GameEvent);t.GamepadButtonEvent=l;var p=function(t){function e(e,i){t.call(this),this.axis=e,this.value=i}return __extends(e,t),e}(t.GameEvent);t.GamepadAxisEvent=p;var d=function(t){function e(e,i){t.call(this),this.topic=e,this.handler=i}return __extends(e,t),e}(e);t.SubscribeEvent=d;var f=function(t){function e(e,i){t.call(this),this.topic=e,this.handler=i}return __extends(e,t),e}(e);t.UnsubscribeEvent=f;var g=function(t){function e(){t.call(this)}return __extends(e,t),e}(e);t.VisibleEvent=g;var _=function(t){function e(){t.call(this)}return __extends(e,t),e}(e);t.HiddenEvent=_;var y=function(t){function e(e,i,n,s){t.call(this),this.actor=e,this.other=i,this.side=n,this.intersection=s}return __extends(e,t),e}(e);t.CollisionEvent=y;var A=function(t){function e(e){t.call(this),this.delta=e}return __extends(e,t),e}(e);t.UpdateEvent=A;var v=function(t){function e(e){t.call(this),this.engine=e}return __extends(e,t),e}(e);t.InitializeEvent=v;var m=function(t){function e(e){t.call(this),this.oldScene=e}return __extends(e,t),e}(e);t.ActivateEvent=m;var x=function(t){function e(e){t.call(this),this.newScene=e}return __extends(e,t),e}(e);t.DeactivateEvent=x;var w=function(t){function e(){t.call(this)}return __extends(e,t),e}(e);t.ExitViewPortEvent=w;var b=function(t){function e(){t.call(this)}return __extends(e,t),e}(e);t.EnterViewPortEvent=b})(ex||(ex={}));var ex;(function(t){var e=function(){function e(e){this._handlers={},this._wiredEventDispatchers=[],this._log=t.Logger.getInstance(),this._target=e}return e.prototype.publish=function(e,i){if(e){e=e.toLowerCase();var n=this._target;i||(i=new t.GameEvent),i.target=n;var s,o;if(this._handlers[e])for(s=0,o=this._handlers[e].length,s;o>s;s++)this._handlers[e][s].call(n,i);for(s=0,o=this._wiredEventDispatchers.length,s;o>s;s++)this._wiredEventDispatchers[s].emit(e,i)}},e.prototype.emit=function(t,e){this.publish(t,e)},e.prototype.subscribe=function(e,i){e=e.toLowerCase(),this._handlers[e]||(this._handlers[e]=[]),this._handlers[e].push(i),"unsubscribe"!==e&&"subscribe"!==e&&this.emit("subscribe",new t.SubscribeEvent(e,i))},e.prototype.unsubscribe=function(e,i){e=e.toLowerCase();var n=this._handlers[e];if(n)if(i){var s=n.indexOf(i);this._handlers[e].splice(s,1)}else this._handlers[e].length=0;"unsubscribe"!==e&&"subscribe"!==e&&this.emit("unsubscribe",new t.UnsubscribeEvent(e,i))},e.prototype.wire=function(t){t._wiredEventDispatchers.push(this)},e.prototype.unwire=function(t){var e=t._wiredEventDispatchers.indexOf(this);e>-1&&t._wiredEventDispatchers.splice(e,1)},e}();t.EventDispatcher=e})(ex||(ex={}));var ex;(function(t){var e=function(){function t(t,e,i,n){this.r=t,this.g=e,this.b=i,this.a=null!=n?n:1}return t.fromRGB=function(e,i,n,s){return new t(e,i,n,s)},t.fromHex=function(e){var i=/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})?$/i,n=null;if(n=e.match(i)){var s=parseInt(n[1],16),o=parseInt(n[2],16),r=parseInt(n[3],16),h=1;return n[4]&&(h=parseInt(n[4],16)/255),new t(s,o,r,h)}throw Error("Invalid hex string: "+e)},t.fromHSL=function(t,e,n,s){void 0===s&&(s=1);var o=new i(t,e,n,s);return o.toRGBA()},t.prototype.lighten=function(t){void 0===t&&(t=.1);var e=i.fromRGBA(this.r,this.g,this.b,this.a);return e.l+=e.l*t,e.toRGBA()},t.prototype.darken=function(t){void 0===t&&(t=.1);var e=i.fromRGBA(this.r,this.g,this.b,this.a);return e.l-=e.l*t,e.toRGBA()},t.prototype.saturate=function(t){void 0===t&&(t=.1);var e=i.fromRGBA(this.r,this.g,this.b,this.a);return e.s+=e.s*t,e.toRGBA()},t.prototype.desaturate=function(t){void 0===t&&(t=.1);var e=i.fromRGBA(this.r,this.g,this.b,this.a);return e.s-=e.s*t,e.toRGBA()},t.prototype.mulitiply=function(e){var i=255*(e.r/255*this.r/255),n=255*(e.g/255*this.g/255),s=255*(e.b/255*this.b/255),o=e.a*this.a;return new t(i,n,s,o)},t.prototype.screen=function(t){var e=t.invert(),i=t.invert();return e.mulitiply(i).invert()},t.prototype.invert=function(){return new t(255-this.r,255-this.g,255-this.b,1-this.a)},t.prototype.average=function(e){var i=(e.r+this.r)/2,n=(e.g+this.g)/2,s=(e.b+this.b)/2,o=(e.a+this.a)/2;return new t(i,n,s,o)},t.prototype.toString=function(){var t=this.r.toFixed(0)+""+", "+(this.g.toFixed(0)+"")+", "+(this.b.toFixed(0)+"");return void 0!==this.a||null!==this.a?"rgba("+t+", "+(this.a+"")+")":"rgb("+t+")"},t.prototype.fillStyle=function(){return""+this},t.prototype.clone=function(){return new t(this.r,this.g,this.b,this.a)},t.Black=t.fromHex("#000000"),t.White=t.fromHex("#FFFFFF"),t.Gray=t.fromHex("#808080"),t.LightGray=t.fromHex("#D3D3D3"),t.DarkGray=t.fromHex("#A9A9A9"),t.Yellow=t.fromHex("#FFFF00"),t.Orange=t.fromHex("#FFA500"),t.Red=t.fromHex("#FF0000"),t.Vermillion=t.fromHex("#FF5B31"),t.Rose=t.fromHex("#FF007F"),t.Magenta=t.fromHex("#FF00FF"),t.Violet=t.fromHex("#7F00FF"),t.Blue=t.fromHex("#0000FF"),t.Azure=t.fromHex("#007FFF"),t.Cyan=t.fromHex("#00FFFF"),t.Viridian=t.fromHex("#59978F"),t.Green=t.fromHex("#00FF00"),t.Chartreuse=t.fromHex("#7FFF00"),t.Transparent=t.fromHex("#FFFFFF00"),t}();t.Color=e;var i=function(){function t(t,e,i,n){this.h=t,this.s=e,this.l=i,this.a=n}return t.fromRGBA=function(e,i,n,s){e/=255,i/=255,n/=255;var o,r,h=Math.max(e,i,n),a=Math.min(e,i,n),c=(h+a)/2;if(h===a)o=r=0;else{var u=h-a;switch(r=c>.5?u/(2-h-a):u/(h+a),h){case e:o=(i-n)/u+(n>i?6:0);break;case i:o=(n-e)/u+2;break;case n:o=(e-i)/u+4}o/=6}return new t(o,r,c,s)},t.prototype.toRGBA=function(){function t(t,e,i){return 0>i&&(i+=1),i>1&&(i-=1),1/6>i?t+6*(e-t)*i:.5>i?e:2/3>i?t+6*(e-t)*(2/3-i):t}var i,n,s;if(0===this.s)i=n=s=this.l;else{var o=.5>this.l?this.l*(1+this.s):this.l+this.s-this.l*this.s,r=2*this.l-o;i=t(r,o,this.h+1/3),n=t(r,o,this.h),s=t(r,o,this.h-1/3)}return new e(255*i,255*n,255*s,this.a)},t}() +})(ex||(ex={}));var ex;(function(t){var e=function(e){function i(i,n,s,o){e.call(this,i,n,s,o),this.traits=[],this.traits.push(new t.Traits.Movement),this.traits.push(new t.Traits.CapturePointer),this.anchor.setTo(0,0),this.collisionType=t.CollisionType.PreventCollision,this.enableCapturePointer=!0}return __extends(i,e),i.prototype.onInitialize=function(t){this._engine=t},i.prototype.contains=function(i,n,s){if(void 0===s&&(s=!0),s)return e.prototype.contains.call(this,i,n);var o=this._engine.worldToScreenCoordinates(new t.Point(i,n));return e.prototype.contains.call(this,o.x,o.y)},i}(t.Actor);t.UIActor=e})(ex||(ex={}));var ex;(function(t){var e=function(e){function i(i,n,s,o,r,h){e.call(this,i,n,s,o),this._action=function(){},this.repeats=1,this.target=null,this.repeats=h||this.repeats,this._action=r||this._action,this.collisionType=t.CollisionType.PreventCollision,this.eventDispatcher=new t.EventDispatcher(this),this.actionQueue=new t.Internal.Actions.ActionQueue(this)}return __extends(i,e),i.prototype.update=function(e,i){if(this.actionQueue.update(i),this.x+=this.dx*i/1e3,this.y+=this.dy*i/1e3,this.rotation+=this.rx*i/1e3,this.scale.x+=this.sx*i/1e3,this.scale.y+=this.sy*i/1e3,this.target)this.collides(this.target)&&this._dispatchAction();else for(var n=0;e.currentScene.children.length>n;n++){var s=e.currentScene.children[n];s!==this&&s.collisionType!==t.CollisionType.PreventCollision&&this.collides(s)&&this._dispatchAction()}0===this.repeats&&this.kill()},i.prototype._dispatchAction=function(){this._action.call(this),this.repeats--},i.prototype.draw=function(){},i.prototype.debugDraw=function(i){e.prototype.debugDraw.call(this,i),i.save(),i.translate(this.x,this.y);var n=this.getBounds();n.left=n.left-this.getWorldX(),n.right=n.right-this.getWorldX(),n.top=n.top-this.getWorldY(),n.bottom=n.bottom-this.getWorldY(),i.fillStyle=""+t.Color.Violet,i.strokeStyle=""+t.Color.Violet,i.fillText("Trigger",10,10),n.debugDraw(i),i.restore()},i}(t.Actor);t.Trigger=e})(ex||(ex={}));var ex;(function(t){(function(t){t[t.Circle=0]="Circle",t[t.Rectangle=1]="Rectangle"})(t.EmitterType||(t.EmitterType={}));var e=t.EmitterType,i=function(){function e(e,i,n,s,o,r,h,a,c,u){this.position=new t.Vector(0,0),this.velocity=new t.Vector(0,0),this.acceleration=new t.Vector(0,0),this.particleRotationalVelocity=0,this.currentRotation=0,this.focus=null,this.focusAccel=0,this.opacity=1,this.beginColor=t.Color.White.clone(),this.endColor=t.Color.White.clone(),this.life=300,this.fadeFlag=!1,this._rRate=1,this._gRate=1,this._bRate=1,this._aRate=0,this._currentColor=t.Color.White.clone(),this.emitter=null,this.particleSize=5,this.particleSprite=null,this.sizeRate=0,this.elapsedMultiplier=0,this.emitter=e,this.life=i||this.life,this.opacity=n||this.opacity,this.endColor=o||this.endColor.clone(),this.beginColor=s||this.beginColor.clone(),this._currentColor=this.beginColor.clone(),this.position=r||this.position,this.velocity=h||this.velocity,this.acceleration=a||this.acceleration,this._rRate=(this.endColor.r-this.beginColor.r)/this.life,this._gRate=(this.endColor.g-this.beginColor.g)/this.life,this._bRate=(this.endColor.b-this.beginColor.b)/this.life,this._aRate=this.opacity/this.life,this.startSize=c||0,this.endSize=u||0,this.endSize>0&&this.startSize>0&&(this.sizeRate=(this.endSize-this.startSize)/this.life,this.particleSize=this.startSize)}return e.prototype.kill=function(){this.emitter.removeParticle(this)},e.prototype.update=function(e){if(this.life=this.life-e,this.elapsedMultiplier=this.elapsedMultiplier+e,0>this.life&&this.kill(),this.fadeFlag&&(this.opacity=t.Util.clamp(this._aRate*this.life,1e-4,1)),this.startSize>0&&this.endSize>0&&(this.particleSize=t.Util.clamp(this.sizeRate*e+this.particleSize,Math.min(this.startSize,this.endSize),Math.max(this.startSize,this.endSize))),this._currentColor.r=t.Util.clamp(this._currentColor.r+this._rRate*e,0,255),this._currentColor.g=t.Util.clamp(this._currentColor.g+this._gRate*e,0,255),this._currentColor.b=t.Util.clamp(this._currentColor.b+this._bRate*e,0,255),this._currentColor.a=t.Util.clamp(this.opacity,1e-4,1),this.focus){var i=this.focus.minus(this.position).normalize().scale(this.focusAccel).scale(e/1e3);this.velocity=this.velocity.add(i)}else this.velocity=this.velocity.add(this.acceleration.scale(e/1e3));this.position=this.position.add(this.velocity.scale(e/1e3)),this.particleRotationalVelocity&&(this.currentRotation=(this.currentRotation+this.particleRotationalVelocity*e/1e3)%(2*Math.PI))},e.prototype.draw=function(e){return this.particleSprite?(this.particleSprite.rotation=this.currentRotation,this.particleSprite.scale.setTo(this.particleSize,this.particleSize),this.particleSprite.draw(e,this.position.x,this.position.y),void 0):(this._currentColor.a=t.Util.clamp(this.opacity,1e-4,1),e.fillStyle=""+this._currentColor,e.beginPath(),e.arc(this.position.x,this.position.y,this.particleSize,0,2*Math.PI),e.fill(),e.closePath(),void 0)},e}();t.Particle=i;var n=function(n){function s(i,s,o,r){n.call(this,i,s,o,r,t.Color.White),this._particlesToEmit=0,this.numParticles=0,this.isEmitting=!0,this.particles=null,this.deadParticles=null,this.minVel=0,this.maxVel=0,this.acceleration=new t.Vector(0,0),this.minAngle=0,this.maxAngle=0,this.emitRate=1,this.particleLife=2e3,this.opacity=1,this.fadeFlag=!1,this.focus=null,this.focusAccel=1,this.startSize=null,this.endSize=null,this.minSize=5,this.maxSize=5,this.beginColor=t.Color.White,this.endColor=t.Color.White,this.particleSprite=null,this.emitterType=e.Rectangle,this.radius=0,this.particleRotationalVelocity=0,this.randomRotation=!1,this.collisionType=t.CollisionType.PreventCollision,this.particles=new t.Util.Collection,this.deadParticles=new t.Util.Collection;for(var h in this.traits)this.traits[h]instanceof t.Traits.OffscreenCulling&&this.traits.splice(h,1)}return __extends(s,n),s.prototype.removeParticle=function(t){this.deadParticles.push(t)},s.prototype.emitParticles=function(t){for(var e=0;t>e;e++)this.particles.push(this._createParticle())},s.prototype.clearParticles=function(){this.particles.clear()},s.prototype._createParticle=function(){var n=0,s=0,o=t.Util.randomInRange(this.minAngle,this.maxAngle),r=t.Util.randomInRange(this.minVel,this.maxVel),h=this.startSize||t.Util.randomInRange(this.minSize,this.maxSize),a=r*Math.cos(o),c=r*Math.sin(o);if(this.emitterType===e.Rectangle)n=t.Util.randomInRange(this.x,this.x+this.getWidth()),s=t.Util.randomInRange(this.y,this.y+this.getHeight());else if(this.emitterType===e.Circle){var u=t.Util.randomInRange(0,this.radius);n=u*Math.cos(o)+this.x,s=u*Math.sin(o)+this.y}var l=new i(this,this.particleLife,this.opacity,this.beginColor,this.endColor,new t.Vector(n,s),new t.Vector(a,c),this.acceleration,this.startSize,this.endSize);return l.fadeFlag=this.fadeFlag,l.particleSize=h,this.particleSprite&&(l.particleSprite=this.particleSprite),l.particleRotationalVelocity=this.particleRotationalVelocity,this.randomRotation&&(l.currentRotation=t.Util.randomInRange(0,2*Math.PI)),this.focus&&(l.focus=this.focus.add(new t.Vector(this.x,this.y)),l.focusAccel=this.focusAccel),l},s.prototype.update=function(t,e){var i=this;n.prototype.update.call(this,t,e),this.isEmitting&&(this._particlesToEmit+=this.emitRate*(e/1e3),this._particlesToEmit>1&&(this.emitParticles(Math.floor(this._particlesToEmit)),this._particlesToEmit=this._particlesToEmit-Math.floor(this._particlesToEmit))),this.particles.forEach(function(t){return t.update(e)}),this.deadParticles.forEach(function(t){return i.particles.removeElement(t)}),this.deadParticles.clear()},s.prototype.draw=function(t){this.particles.forEach(function(e){return e.draw(t)})},s.prototype.debugDraw=function(e){n.prototype.debugDraw.call(this,e),e.fillStyle=""+t.Color.Black,e.fillText("Particles: "+this.particles.count(),this.x,this.y+20),this.focus&&(e.fillRect(this.focus.x+this.x,this.focus.y+this.y,3,3),t.Util.drawLine(e,"yellow",this.focus.x+this.x,this.focus.y+this.y,n.prototype.getCenter.call(this).x,n.prototype.getCenter.call(this).y),e.fillText("Focus",this.focus.x+this.x,this.focus.y+this.y))},s}(t.Actor);t.ParticleEmitter=n})(ex||(ex={}));var ex;(function(t){var e=function(){function e(e,i,n,s){this.currentFrame=0,this._oldTime=Date.now(),this.anchor=new t.Point(0,0),this.rotation=0,this.scale=new t.Point(1,1),this.loop=!1,this.freezeFrame=-1,this.flipVertical=!1,this.flipHorizontal=!1,this.width=0,this.height=0,this.naturalWidth=0,this.naturalHeight=0,this.sprites=i,this.speed=n,this._engine=e,null!=s&&(this.loop=s),i&&i[0]&&(this.height=i[0]?i[0].height:0,this.width=i[0]?i[0].width:0,this.naturalWidth=i[0]?i[0].naturalWidth:0,this.naturalHeight=i[0]?i[0].naturalHeight:0,this.freezeFrame=i.length-1)}return e.prototype.opacity=function(e){this.addEffect(new t.Effects.Opacity(e))},e.prototype.grayscale=function(){this.addEffect(new t.Effects.Grayscale)},e.prototype.invert=function(){this.addEffect(new t.Effects.Invert)},e.prototype.fill=function(e){this.addEffect(new t.Effects.Fill(e))},e.prototype.colorize=function(e){this.addEffect(new t.Effects.Colorize(e))},e.prototype.lighten=function(e){void 0===e&&(e=.1),this.addEffect(new t.Effects.Lighten(e))},e.prototype.darken=function(e){void 0===e&&(e=.1),this.addEffect(new t.Effects.Darken(e))},e.prototype.saturate=function(e){void 0===e&&(e=.1),this.addEffect(new t.Effects.Saturate(e))},e.prototype.desaturate=function(e){void 0===e&&(e=.1),this.addEffect(new t.Effects.Desaturate(e))},e.prototype.addEffect=function(t){for(var e in this.sprites)this.sprites[e].addEffect(t)},e.prototype.removeEffect=function(t){for(var e in this.sprites)this.sprites[e].removeEffect(t)},e.prototype.clearEffects=function(){for(var t in this.sprites)this.sprites[t].clearEffects()},e.prototype._setAnchor=function(t){for(var e in this.sprites)this.sprites[e].anchor.setTo(t.x,t.y)},e.prototype._setRotation=function(t){for(var e in this.sprites)this.sprites[e].rotation=t},e.prototype._setScale=function(t){for(var e in this.sprites)this.sprites[e].scale=t},e.prototype.reset=function(){this.currentFrame=0},e.prototype.isDone=function(){return!this.loop&&this.currentFrame>=this.sprites.length},e.prototype.tick=function(){var t=Date.now();t-this._oldTime>this.speed&&(this.currentFrame=this.loop?(this.currentFrame+1)%this.sprites.length:this.currentFrame+1,this._oldTime=t)},e.prototype._updateValues=function(){this._setAnchor(this.anchor),this._setRotation(this.rotation),this._setScale(this.scale)},e.prototype.skip=function(t){this.currentFrame=(this.currentFrame+t)%this.sprites.length},e.prototype.draw=function(e,i,n){this.tick(),this._updateValues();var s;this.currentFrame=this.sprites.length&&(s=this.sprites[t.Util.clamp(this.freezeFrame,0,this.sprites.length-1)],s.draw(e,i,n)),s&&(this.width=s.width,this.height=s.height)},e.prototype.play=function(t,e){this.reset(),this._engine.playAnimation(this,t,e)},e}();t.Animation=e})(ex||(ex={}));var ex;(function(t){var e;(function(e){var i=function(){function e(e,i){this.path=e,this._log=t.Logger.getInstance(),this.onload=function(){},this.onprogress=function(){},this.onerror=function(){},window.AudioContext?(this._log.debug("Using new Web Audio Api for "+e),this._soundImpl=new o(e,i)):(this._log.debug("Falling back to Audio Element for "+e),this._soundImpl=new n(e,i))}return e.prototype.setVolume=function(t){this._soundImpl.setVolume(t)},e.prototype.setLoop=function(t){this._soundImpl.setLoop(t)},e.prototype.load=function(){this._soundImpl.onload=this.onload,this._soundImpl.onprogress=this.onprogress,this._soundImpl.onerror=this.onerror,this._soundImpl.load()},e.prototype.processData=function(t){return this._soundImpl.processData(t)},e.prototype.getData=function(){return this._soundImpl.getData()},e.prototype.setData=function(t){this._soundImpl.setData(t)},e.prototype.isPlaying=function(){return this._soundImpl.isPlaying()},e.prototype.play=function(){return this._soundImpl.play()},e.prototype.pause=function(){this._soundImpl.pause()},e.prototype.stop=function(){this._soundImpl.stop()},e}();e.FallbackAudio=i;var n=function(){function e(e,i){var n=this;this.path=e,this._audioElements=Array(5),this._loadedAudio=null,this._isLoaded=!1,this._index=0,this._log=t.Logger.getInstance(),this._isPlaying=!1,this._currentOffset=0,this.onload=function(){},this.onprogress=function(){},this.onerror=function(){};for(var s=0;this._audioElements.length>s;s++)(function(t){n._audioElements[t]=new Audio})(s);i?this.setVolume(t.Util.clamp(i,0,1)):this.setVolume(1)}return e.prototype.isPlaying=function(){return this._isPlaying},e.prototype._audioLoaded=function(){this._isLoaded=!0},e.prototype.setVolume=function(t){var e=0,i=this._audioElements.length;for(e;i>e;e++)this._audioElements[e].volume=t},e.prototype.setLoop=function(t){var e=0,i=this._audioElements.length;for(e;i>e;e++)this._audioElements[e].loop=t},e.prototype.getLoop=function(){this._audioElements.some(function(t){return t.loop})},e.prototype.load=function(){var t=this;if(!this._loadedAudio){var e=new XMLHttpRequest;e.open("GET",this.path,!0),e.responseType="blob",e.onprogress=this.onprogress,e.onerror=this.onerror,e.onload=function(i){return 200!==e.status?(t._log.error("Failed to load audio resource ",t.path," server responded with error code",e.status),t.onerror(e.response),t._isLoaded=!1,void 0):(t._isLoaded=!0,t.setData(e.response),t.onload(i),void 0)},e.send()}},e.prototype.getData=function(){return this._loadedAudio},e.prototype.setData=function(t){this._isLoaded=!0,this._loadedAudio=this.processData(t)},e.prototype.processData=function(t){var e=URL.createObjectURL(t);return this._audioElements.forEach(function(t){t.src=e}),this._audioLoaded(),e},e.prototype.play=function(){var e=this;this._audioElements[this._index].load(),this._audioElements[this._index].play(),this._currentOffset=0;var i=new t.Promise;return this._isPlaying=!0,this.getLoop()||this._audioElements[this._index].addEventListener("ended",function(){e._isPlaying=!1,i.resolve(!0)}),this._index=(this._index+1)%this._audioElements.length,i},e.prototype.pause=function(){this._index=(this._index-1+this._audioElements.length)%this._audioElements.length,this._currentOffset=this._audioElements[this._index].currentTime,this._audioElements.forEach(function(t){t.pause()}),this._isPlaying=!1},e.prototype.stop=function(){this._audioElements.forEach(function(t){t.pause()}),this._isPlaying=!1},e}();if(e.AudioTag=n,window.AudioContext)var s=new window.AudioContext;var o=function(){function e(e,i){this.path=e,this._context=s,this._volume=this._context.createGain(),this._buffer=null,this._sound=null,this._isLoaded=!1,this._loop=!1,this._isPlaying=!1,this._isPaused=!1,this._currentOffset=0,this._logger=t.Logger.getInstance(),this._data=null,this.onload=function(){},this.onprogress=function(){},this.onerror=function(){},this._volume.gain.value=i?t.Util.clamp(i,0,1):1}return e.prototype.setVolume=function(t){this._volume.gain.value=t},e.prototype.load=function(){var t=this;if(null===this._data){var e=new XMLHttpRequest;e.open("GET",this.path),e.responseType="arraybuffer",e.onprogress=this.onprogress,e.onerror=this.onerror,e.onload=function(){return 200!==e.status?(t._logger.error("Failed to load audio resource ",t.path," server responded with error code",e.status),t.onerror(e.response),t._isLoaded=!1,void 0):(t.setData(e.response),void 0)};try{e.send()}catch(i){console.error("Error loading sound! If this is a cross origin error, you must host your sound with your html and javascript.")}}},e.prototype.getData=function(){return this._data},e.prototype.setData=function(t){this._data=this.processData(t)},e.prototype.processData=function(t){var e=this;return this._context.decodeAudioData(t,function(t){e._buffer=t,e._isLoaded=!0,e.onload(e)},function(){e._logger.error("Unable to decode "+e.path+" this browser may not fully support this format, or the file may be corrupt, "+"if this is an mp3 try removing id3 tags and album art from the file."),e._isLoaded=!1,e.onload(e)}),t},e.prototype.setLoop=function(t){this._loop=t},e.prototype.isPlaying=function(){return this._isPlaying},e.prototype.play=function(){var e=this;if(this._isLoaded){this._sound=this._context.createBufferSource(),this._sound.buffer=this._buffer,this._sound.loop=this._loop,this._sound.connect(this._volume),this._volume.connect(this._context.destination),this._sound.start(0,this._currentOffset%this._buffer.duration),this._currentOffset=0;var i;return i=this._isPaused&&this._playPromise?this._playPromise:new t.Promise,this._isPaused=!1,this._isPlaying=!0,this._loop||(this._sound.onended=function(){e._isPlaying=!1,e._isPaused||i.resolve(!0)}.bind(this)),this._playPromise=i,i}return t.Promise.wrap(!0)},e.prototype.pause=function(){if(this._isPlaying)try{window.clearTimeout(this._playingTimer),this._sound.stop(0),this._currentOffset=this._context.currentTime,this._isPlaying=!1,this._isPaused=!0}catch(t){this._logger.warn("The sound clip",this.path,"has already been paused!")}},e.prototype.stop=function(){if(this._sound)try{window.clearTimeout(this._playingTimer),this._currentOffset=0,this._sound.stop(0),this._isPlaying=!1,this._isPaused=!1}catch(t){this._logger.warn("The sound clip",this.path,"has already been stopped!")}},e}();e.WebAudio=o})(e=t.Internal||(t.Internal={}))})(ex||(ex={}));var ex;(function(t){(function(t){t[t.Resolved=0]="Resolved",t[t.Rejected=1]="Rejected",t[t.Pending=2]="Pending"})(t.PromiseState||(t.PromiseState={}));var e=t.PromiseState,i=function(){function i(){this._state=e.Pending,this._successCallbacks=[],this._rejectCallback=function(){},this._logger=t.Logger.getInstance()}return i.wrap=function(t){var e=(new i).resolve(t);return e},i.join=function(){for(var t=[],e=0;arguments.length>e;e++)t[e-0]=arguments[e];var n=new i;if(!t||!t.length)return n.resolve();var s=t.length,o=0,r=0,h=[];return t.forEach(function(t){t.then(function(){o+=1,o===s?n.resolve():o+r+h.length===s&&n.reject(h)},function(){r+=1,o+r+h.length===s&&n.reject(h)}).error(function(t){h.push(t),h.length+o+r===s&&n.reject(h)})}),n},i.prototype.then=function(t,i){if(t&&(this._successCallbacks.push(t),this.state()===e.Resolved))try{t.call(this,this._value)}catch(n){this._handleError(n)}if(i&&(this._rejectCallback=i,this.state()===e.Rejected))try{i.call(this,this._value)}catch(n){this._handleError(n)}return this},i.prototype.error=function(t){return t&&(this._errorCallback=t),this},i.prototype.resolve=function(t){var i=this;if(this._state!==e.Pending)throw Error("Cannot resolve a promise that is not in a pending state!");this._value=t;try{this._state=e.Resolved,this._successCallbacks.forEach(function(t){t.call(i,i._value)})}catch(n){this._handleError(n)}return this},i.prototype.reject=function(t){if(this._state!==e.Pending)throw Error("Cannot reject a promise that is not in a pending state!");this._value=t;try{this._state=e.Rejected,this._rejectCallback.call(this,this._value)}catch(i){this._handleError(i)}return this},i.prototype.state=function(){return this._state},i.prototype._handleError=function(t){if(!this._errorCallback)throw t;this._errorCallback.call(this,t)},i}();t.Promise=i})(ex||(ex={}));var ex;(function(t){var e=function(e){function i(i,n,s){void 0===s&&(s=!0),e.call(this),this.path=i,this.responseType=n,this.bustCache=s,this.data=null,this.logger=t.Logger.getInstance(),this.onprogress=function(){},this.oncomplete=function(){},this.onerror=function(){}}return __extends(i,e),i.prototype.isLoaded=function(){return null!==this.data},i.prototype.wireEngine=function(t){this._engine=t},i.prototype._cacheBust=function(t){var e=/\?\w*=\w*/;return t+=e.test(t)?"&__="+Date.now():"?__="+Date.now()},i.prototype._start=function(){this.logger.debug("Started loading resource "+this.path)},i.prototype.load=function(){var e=this,i=new t.Promise;if(null!==this.data)return this.logger.debug("Already have data for resource",this.path),i.resolve(this.data),this.oncomplete(),i;var n=new XMLHttpRequest;return n.open("GET",this.bustCache?this._cacheBust(this.path):this.path,!0),n.responseType=this.responseType,n.onloadstart=function(t){e._start(t)},n.onprogress=this.onprogress,n.onerror=this.onerror,n.onload=function(){return 200!==n.status?(e.logger.error("Failed to load resource ",e.path," server responded with error code",n.status),e.onerror(n.response),i.resolve(n.response),void 0):(e.data=e.processData(n.response),e.oncomplete(),e.logger.debug("Completed loading resource",e.path),i.resolve(e.data),void 0)},n.send(),i},i.prototype.getData=function(){return this.data},i.prototype.setData=function(t){this.data=this.processData(t)},i.prototype.processData=function(t){return URL.createObjectURL(t)},i}(t.Class);t.Resource=e})(ex||(ex={}));var ex;(function(t){var e=function(e){function i(i,n){void 0===n&&(n=!0),e.call(this,i,"blob",n),this.path=i,this.bustCache=n,this.loaded=new t.Promise,this._isLoaded=!1,this._sprite=null,this._sprite=new t.Sprite(this,0,0,0,0)}return __extends(i,e),i.prototype.isLoaded=function(){return this._isLoaded},i.prototype.load=function(){var i=this,n=new t.Promise,s=e.prototype.load.call(this);return s.then(function(){i.image=new Image,i.image.addEventListener("load",function(){i._isLoaded=!0,i.width=i._sprite.swidth=i._sprite.naturalWidth=i._sprite.width=i.image.naturalWidth,i.height=i._sprite.sheight=i._sprite.naturalHeight=i._sprite.height=i.image.naturalHeight,i.loaded.resolve(i.image),n.resolve(i.image)}),i.image.src=e.prototype.getData.call(i)},function(){n.reject("Error loading texture.")}),n},i.prototype.asSprite=function(){return this._sprite},i}(t.Resource);t.Texture=e;var i=function(){function e(){for(var i=[],n=0;arguments.length>n;n++)i[n-0]=arguments[n];this._logger=t.Logger.getInstance(),this.onprogress=function(){},this.oncomplete=function(){},this.onerror=function(){},this.onload=function(){},this._isLoaded=!1,this._wasPlayingOnHidden=!1,this.path="";for(var s=0;i.length>s;s++)if(e.canPlayFile(i[s])){this.path=i[s];break}this.path||(this._logger.warn("This browser does not support any of the audio files specified:",i.join(", ")),this._logger.warn("Attempting to use",i[0]),this.path=i[0]),this.sound=new t.Internal.FallbackAudio(this.path,1)}return e.canPlayFile=function(e){try{var i=new Audio,n=/.*\.([A-Za-z0-9]+)$/,s=e.match(n)[1];return i.canPlayType("audio/"+s)?!0:!1}catch(o){return t.Logger.getInstance().warn("Cannot determine audio support, assuming no support for the Audio Tag",o),!1}},e.prototype.wireEngine=function(t){var e=this;t&&(this._engine=t,this._engine.on("hidden",function(){t.pauseAudioWhenHidden&&e.isPlaying()&&(e._wasPlayingOnHidden=!0,e.pause())}),this._engine.on("visible",function(){t.pauseAudioWhenHidden&&e._wasPlayingOnHidden&&(e.play(),e._wasPlayingOnHidden=!1)}))},e.prototype.setVolume=function(t){this.sound&&this.sound.setVolume(t)},e.prototype.setLoop=function(t){this.sound&&this.sound.setLoop(t)},e.prototype.isPlaying=function(){return this.sound?this.sound.isPlaying():void 0},e.prototype.play=function(){return this.sound?this.sound.play():void 0},e.prototype.pause=function(){this.sound&&this.sound.pause()},e.prototype.stop=function(){this.sound&&this.sound.stop()},e.prototype.isLoaded=function(){return this._isLoaded},e.prototype.load=function(){var e=this,i=new t.Promise;return null!==this.sound.getData()?(this._logger.debug("Already have data for resource",this.path),i.resolve(this.sound),i):(this._logger.debug("Started loading sound",this.path),this.sound.onprogress=this.onprogress,this.sound.onload=function(){e.oncomplete(),e._isLoaded=!0,e._logger.debug("Completed loading sound",e.path),i.resolve(e.sound)},this.sound.onerror=function(t){e.onerror(t),i.resolve(t)},this.sound.load(),i)},e.prototype.getData=function(){return this.sound.getData()},e.prototype.setData=function(t){this.sound.setData(t)},e.prototype.processData=function(t){return this.sound.processData(t)},e}();t.Sound=i;var n=function(){function e(t){this._resourceList=[],this._index=0,this._resourceCount=0,this._numLoaded=0,this._progressCounts={},this._totalCounts={},this.getData=function(){},this.setData=function(){},this.processData=function(){},this.onprogress=function(){},this.oncomplete=function(){},this.onerror=function(){},t&&this.addResources(t)}return e.prototype.wireEngine=function(t){this._engine=t},e.prototype.addResource=function(t){var e=this._index++;this._resourceList.push(t),this._progressCounts[e]=0,this._totalCounts[e]=1,this._resourceCount++},e.prototype.addResources=function(t){var e=0,i=t.length;for(e;i>e;e++)this.addResource(t[e])},e.prototype._sumCounts=function(t){var e=0;for(var i in t)e+=0|t[i];return e},e.prototype.isLoaded=function(){return this._numLoaded===this._resourceCount},e.prototype.load=function(){function e(t,i){t[i]&&t[i].load().then(function(){e(t,i+1)})}var i=this,n=new t.Promise,s=this;if(0===this._resourceList.length)return s.oncomplete.call(s),n;var o=Array(this._resourceList.length),r=this._resourceList.length;return this._resourceList.forEach(function(t,e){i._engine&&t.wireEngine(i._engine),t.onprogress=function(t){var i=t.total,n=t.loaded;o[e]={loaded:n/i*(100/r),total:100};var h=o.reduce(function(t,e){return{loaded:t.loaded+e.loaded,total:100}},{loaded:0,total:100});s.onprogress.call(s,h)},t.oncomplete=t.onerror=function(){s._numLoaded++,s._numLoaded===s._resourceCount&&(s.onprogress.call(s,{loaded:100,total:100}),s.oncomplete.call(s),n.resolve())}}),e(this._resourceList,0),n},e}();t.Loader=n})(ex||(ex={}));var ex;(function(t){var e=function(){function e(){this.failedTests=[],this._criticalTests={canvasSupport:function(){var t=document.createElement("canvas");return!(!t.getContext||!t.getContext("2d"))},arrayBufferSupport:function(){var t=new XMLHttpRequest;t.open("GET","/");try{t.responseType="arraybuffer"}catch(e){return!1}return"arraybuffer"===t.responseType},dataUrlSupport:function(){var t=document.createElement("canvas");return 0===t.toDataURL("image/png").indexOf("data:image/png")},objectUrlSupport:function(){return"URL"in window&&"revokeObjectURL"in URL&&"createObjectURL"in URL},rgbaSupport:function(){var t=document.createElement("a").style;return t.cssText="background-color:rgba(150,255,150,.5)",(""+t.backgroundColor).indexOf("rgba")>-1}},this._warningTest={webAudioSupport:function(){return!!(window.AudioContext||window.webkitAudioContext||window.mozAudioContext||window.msAudioContext||window.oAudioContext)},webglSupport:function(){var t=document.createElement("canvas");return!(!t.getContext||!t.getContext("webgl"))}}}return e.prototype.test=function(){var e=!1;for(var i in this._criticalTests)this._criticalTests[i]()||(this.failedTests.push(i),t.Logger.getInstance().error("Critical browser feature missing, Excalibur requires:",i),e=!0);if(e)return!1;for(var n in this._warningTest)this._warningTest[n]()||t.Logger.getInstance().warn("Warning browser feature missing, Excalibur will have reduced performance:",n);return!0},e}();t.Detector=e})(ex||(ex={}));var ex;(function(t){var e=function(){function e(e){this.path=e,this._isLoaded=!1,this.logger=t.Logger.getInstance(),this.onprogress=function(){},this.oncomplete=function(){},this.onerror=function(){},this._innerElement=document.createElement("div"),this._innerElement.className="excalibur-template"}return e.prototype.wireEngine=function(t){this._engine=t},e.prototype.getTemplateString=function(){return this._isLoaded?this._htmlString:""},e.prototype._compile=function(){this._innerElement.innerHTML=this._htmlString,this._styleElements=this._innerElement.querySelectorAll("[data-style]"),this._textElements=this._innerElement.querySelectorAll("[data-text]")},e.prototype._evaluateExpresion=function(t,e){var i=Function("return "+t+";"),n=i.call(e);return n},e.prototype.apply=function(t){for(var e=this,i=0;this._styleElements.length>i;i++)(function(){var n={};e._styleElements[i].dataset.style.split(";").forEach(function(t){if(t){var e=t.split(":");n[e[0].trim()]=e[1].trim()}});for(var s in n)(function(){var o=n[s];e._styleElements[i].style[s]=e._evaluateExpresion(o,t)})()})();for(var n=0;this._textElements.length>n;n++)(function(){var i=e._textElements[n].dataset.text;e._textElements[n].innerText=e._evaluateExpresion(i,t)})();return 1===this._innerElement.children.length&&(this._innerElement=this._innerElement.firstChild),this._innerElement},e.prototype.load=function(){var e=this,i=new t.Promise,n=new XMLHttpRequest;return n.open("GET",this.path,!0),n.responseType="text",n.onprogress=this.onprogress,n.onerror=this.onerror,n.onload=function(){return 200!==n.status?(e.logger.error("Failed to load html template resource ",e.path," server responded with error code",n.status),e.onerror(n.response),e._isLoaded=!1,i.resolve("error"),void 0):(e.setData(n.response),e.oncomplete(),e.logger.debug("Completed loading template",e.path),i.resolve(e._htmlString),void 0)},n.overrideMimeType&&n.overrideMimeType("text/plain; charset=x-user-defined"),n.send(),i},e.prototype.getData=function(){return this._htmlString},e.prototype.setData=function(t){this._htmlString=this.processData(t),this._compile(),this._isLoaded=!0},e.prototype.processData=function(t){return t},e.prototype.isLoaded=function(){return this._isLoaded},e}();t.Template=e;var i=function(){function t(t,e,i){this.parent=document.getElementById(t),this.template=e,this._ctx=i,this.update()}return t.prototype.listen=function(t,e,i){var n=this;i||(i=function(){n.update()}),t.addEventListener&&e.forEach(function(e){t.addEventListener(e,i)})},t.prototype.update=function(){var t=this._applyTemplate(this.template,this._ctx);t instanceof String&&(this.parent.innerHTML=t),t instanceof Node&&this.parent.lastChild!==t&&this.parent.appendChild(t)},t.prototype._applyTemplate=function(t,e){return t.isLoaded()?t.apply(e):void 0},t}();t.Binding=i})(ex||(ex={}));var ex;(function(t){(function(t){t[t.Em=0]="Em",t[t.Rem=1]="Rem",t[t.Px=2]="Px",t[t.Pt=3]="Pt",t[t.Percent=4]="Percent"})(t.FontUnit||(t.FontUnit={}));var e=t.FontUnit;(function(t){t[t.Left=0]="Left",t[t.Right=1]="Right",t[t.Center=2]="Center",t[t.Start=3]="Start",t[t.End=4]="End"})(t.TextAlign||(t.TextAlign={}));var i=t.TextAlign;(function(t){t[t.Top=0]="Top",t[t.Hanging=1]="Hanging",t[t.Middle=2]="Middle",t[t.Alphabetic=3]="Alphabetic",t[t.Ideographic=4]="Ideographic",t[t.Bottom=5]="Bottom"})(t.BaseAlign||(t.BaseAlign={}));var n=t.BaseAlign,s=function(s){function o(o,r,h,a,c){s.call(this,r,h),this.fontSize=10,this.fontUnit=e.Px,this.textAlign=i.Left,this.baseAlign=n.Bottom,this.letterSpacing=0,this.caseInsensitive=!0,this._textShadowOn=!1,this._shadowOffsetX=0,this._shadowOffsetY=0,this._shadowColor=t.Color.Black.clone(),this._shadowColorDirty=!1,this._textSprites={},this._shadowSprites={},this._color=t.Color.Black.clone(),this.text=o||"",this.color=t.Color.Black.clone(),this.spriteFont=c,this.collisionType=t.CollisionType.PreventCollision,this.fontFamily=a||"10px sans-serif"}return __extends(o,s),o.prototype.getTextWidth=function(t){var e=t.font;t.font=this.fontFamily;var i=t.measureText(this.text).width;return t.font=e,i},o.prototype._lookupFontUnit=function(t){switch(t){case e.Em:return"em";case e.Rem:return"rem";case e.Pt:return"pt";case e.Px:return"px";case e.Percent:return"%";default:return"px"}},o.prototype._lookupTextAlign=function(t){switch(t){case i.Left:return"left";case i.Right:return"right";case i.Center:return"center";case i.End:return"end";case i.Start:return"start";default:return"start"}},o.prototype._lookupBaseAlign=function(t){switch(t){case n.Alphabetic:return"alphabetic";case n.Bottom:return"bottom";case n.Hanging:return"hangin";case n.Ideographic:return"ideographic";case n.Middle:return"middle";case n.Top:return"top";default:return"alphabetic"}},o.prototype.setTextShadow=function(t,e,i){this.spriteFont.setTextShadow(t,e,i)},o.prototype.useTextShadow=function(t){this.spriteFont.useTextShadow(t)},o.prototype.clearTextShadow=function(){this._textShadowOn=!1,this._shadowOffsetX=0,this._shadowOffsetY=0,this._shadowColor=t.Color.Black.clone() +},o.prototype.update=function(t,e){s.prototype.update.call(this,t,e)},o.prototype.draw=function(t,e){t.save(),t.translate(this.x,this.y),t.scale(this.scale.x,this.scale.y),t.rotate(this.rotation),this._textShadowOn&&(t.save(),t.translate(this._shadowOffsetX,this._shadowOffsetY),this._fontDraw(t,e,this._shadowSprites),t.restore()),this._fontDraw(t,e,this._textSprites),s.prototype.draw.call(this,t,e),t.restore()},o.prototype._fontDraw=function(t){if(this.spriteFont)this.spriteFont.draw(t,this.text,0,0,{color:this.color.clone(),baseAlign:this.baseAlign,textAlign:this.textAlign,fontSize:this.fontSize,letterSpacing:this.letterSpacing,opacity:this.opacity});else{var e=t.textAlign,i=t.textBaseline;t.textAlign=this._lookupTextAlign(this.textAlign),t.textBaseline=this._lookupBaseAlign(this.baseAlign),this.color&&(this.color.a=this.opacity),t.fillStyle=""+this.color,t.font=""+this.fontSize+this._lookupFontUnit(this.fontUnit)+" "+this.fontFamily,this.maxWidth?t.fillText(this.text,0,0,this.maxWidth):t.fillText(this.text,0,0),t.textAlign=e,t.textBaseline=i}},o.prototype.debugDraw=function(t){s.prototype.debugDraw.call(this,t)},o}(t.Actor);t.Label=s})(ex||(ex={}));var ex;(function(t){var e;(function(e){(function(t){t[t.Touch=0]="Touch",t[t.Mouse=1]="Mouse",t[t.Pen=2]="Pen",t[t.Unknown=3]="Unknown"})(e.PointerType||(e.PointerType={}));var i=e.PointerType;(function(t){t[t.Left=0]="Left",t[t.Middle=1]="Middle",t[t.Right=2]="Right",t[t.Unknown=3]="Unknown"})(e.PointerButton||(e.PointerButton={}));var n=e.PointerButton;(function(t){t[t.Canvas=0]="Canvas",t[t.Document=1]="Document"})(e.PointerScope||(e.PointerScope={}));var s=e.PointerScope,o=function(t){function e(e,i,n,s,o,r){t.call(this),this.x=e,this.y=i,this.index=n,this.pointerType=s,this.button=o,this.ev=r}return __extends(e,t),e}(t.GameEvent);e.PointerEvent=o;var r=function(e){function r(t){e.call(this),this._pointerDown=[],this._pointerUp=[],this._pointerMove=[],this._pointerCancel=[],this._pointers=[],this._activePointers=[],this._engine=t,this._pointers.push(new h),this._activePointers=[-1],this.primary=this._pointers[0]}return __extends(r,e),r.prototype.init=function(t){void 0===t&&(t=s.Document);var e=document;e=t===s.Document?document:this._engine.canvas,e.addEventListener("touchstart",this._handleTouchEvent("down",this._pointerDown)),e.addEventListener("touchend",this._handleTouchEvent("up",this._pointerUp)),e.addEventListener("touchmove",this._handleTouchEvent("move",this._pointerMove)),e.addEventListener("touchcancel",this._handleTouchEvent("cancel",this._pointerCancel)),window.PointerEvent?(this._engine.canvas.style.touchAction="none",e.addEventListener("pointerdown",this._handlePointerEvent("down",this._pointerDown)),e.addEventListener("pointerup",this._handlePointerEvent("up",this._pointerUp)),e.addEventListener("pointermove",this._handlePointerEvent("move",this._pointerMove)),e.addEventListener("pointercancel",this._handlePointerEvent("cancel",this._pointerMove))):window.MSPointerEvent?(this._engine.canvas.style.msTouchAction="none",e.addEventListener("MSPointerDown",this._handlePointerEvent("down",this._pointerDown)),e.addEventListener("MSPointerUp",this._handlePointerEvent("up",this._pointerUp)),e.addEventListener("MSPointerMove",this._handlePointerEvent("move",this._pointerMove)),e.addEventListener("MSPointerCancel",this._handlePointerEvent("cancel",this._pointerMove))):(e.addEventListener("mousedown",this._handleMouseEvent("down",this._pointerDown)),e.addEventListener("mouseup",this._handleMouseEvent("up",this._pointerUp)),e.addEventListener("mousemove",this._handleMouseEvent("move",this._pointerMove)))},r.prototype.update=function(){this._pointerUp.length=0,this._pointerDown.length=0,this._pointerMove.length=0,this._pointerCancel.length=0},r.prototype.at=function(t){if(t>=this._pointers.length)for(var e=this._pointers.length-1,i=t;i>e;e++)this._pointers.push(new h),this._activePointers.push(-1);return this._pointers[t]},r.prototype.count=function(){return this._pointers.length},r.prototype.propogate=function(e){var i=e instanceof t.UIActor,n=0,s=this._pointerUp.length;for(n;s>n;n++)e.contains(this._pointerUp[n].x,this._pointerUp[n].y,!i)&&e.eventDispatcher.emit("pointerup",this._pointerUp[n]);for(n=0,s=this._pointerDown.length,n;s>n;n++)e.contains(this._pointerDown[n].x,this._pointerDown[n].y,!i)&&e.eventDispatcher.emit("pointerdown",this._pointerDown[n]);if(e.capturePointer.captureMoveEvents)for(n=0,s=this._pointerMove.length,n;s>n;n++)e.contains(this._pointerMove[n].x,this._pointerMove[n].y,!i)&&e.eventDispatcher.emit("pointermove",this._pointerMove[n]);for(n=0,s=this._pointerCancel.length,n;s>n;n++)e.contains(this._pointerCancel[n].x,this._pointerCancel[n].y,!i)&&e.eventDispatcher.emit("pointercancel",this._pointerCancel[n])},r.prototype._handleMouseEvent=function(e,n){var s=this;return function(r){r.preventDefault();var h=r.pageX-t.Util.getPosition(s._engine.canvas).x,a=r.pageY-t.Util.getPosition(s._engine.canvas).y,c=s._engine.screenToWorldCoordinates(new t.Point(h,a)),u=new o(c.x,c.y,0,i.Mouse,r.button,r);n.push(u),s.at(0).eventDispatcher.emit(e,u)}},r.prototype._handleTouchEvent=function(e,s){var r=this;return function(h){h.preventDefault();for(var a=0,c=h.changedTouches.length;c>a;a++){var u=r._pointers.length>1?r._getPointerIndex(h.changedTouches[a].identifier):0;if(-1!==u){var l=h.changedTouches[a].pageX-t.Util.getPosition(r._engine.canvas).x,p=h.changedTouches[a].pageY-t.Util.getPosition(r._engine.canvas).y,d=r._engine.screenToWorldCoordinates(new t.Point(l,p)),f=new o(d.x,d.y,u,i.Touch,n.Unknown,h);s.push(f),r.at(u).eventDispatcher.emit(e,f),r._pointers.length>1&&("up"===e?r._activePointers[u]=-1:"down"===e&&(r._activePointers[u]=h.changedTouches[a].identifier))}}}},r.prototype._handlePointerEvent=function(e,i){var n=this;return function(s){s.preventDefault();var r=n._pointers.length>1?n._getPointerIndex(s.pointerId):0;if(-1!==r){var h=s.pageX-t.Util.getPosition(n._engine.canvas).x,a=s.pageY-t.Util.getPosition(n._engine.canvas).y,c=n._engine.screenToWorldCoordinates(new t.Point(h,a)),u=new o(c.x,c.y,r,n._stringToPointerType(s.pointerType),s.button,s);i.push(u),n.at(r).eventDispatcher.emit(e,u),n._pointers.length>1&&("up"===e?n._activePointers[r]=-1:"down"===e&&(n._activePointers[r]=s.pointerId))}}},r.prototype._getPointerIndex=function(t){var e;if((e=this._activePointers.indexOf(t))>-1)return e;for(var i=0;this._activePointers.length>i;i++)if(-1===this._activePointers[i])return i;return-1},r.prototype._stringToPointerType=function(t){switch(t){case"touch":return i.Touch;case"mouse":return i.Mouse;case"pen":return i.Pen;default:return i.Unknown}},r}(t.Class);e.Pointers=r;var h=function(t){function e(){t.apply(this,arguments)}return __extends(e,t),e}(t.Class);e.Pointer=h})(e=t.Input||(t.Input={}))})(ex||(ex={}));var ex;(function(t){var e;(function(e){(function(t){t[t.Num1=97]="Num1",t[t.Num2=98]="Num2",t[t.Num3=99]="Num3",t[t.Num4=100]="Num4",t[t.Num5=101]="Num5",t[t.Num6=102]="Num6",t[t.Num7=103]="Num7",t[t.Num8=104]="Num8",t[t.Num9=105]="Num9",t[t.Num0=96]="Num0",t[t.Numlock=144]="Numlock",t[t.Semicolon=186]="Semicolon",t[t.A=65]="A",t[t.B=66]="B",t[t.C=67]="C",t[t.D=68]="D",t[t.E=69]="E",t[t.F=70]="F",t[t.G=71]="G",t[t.H=72]="H",t[t.I=73]="I",t[t.J=74]="J",t[t.K=75]="K",t[t.L=76]="L",t[t.M=77]="M",t[t.N=78]="N",t[t.O=79]="O",t[t.P=80]="P",t[t.Q=81]="Q",t[t.R=82]="R",t[t.S=83]="S",t[t.T=84]="T",t[t.U=85]="U",t[t.V=86]="V",t[t.W=87]="W",t[t.X=88]="X",t[t.Y=89]="Y",t[t.Z=90]="Z",t[t.Shift=16]="Shift",t[t.Alt=18]="Alt",t[t.Up=38]="Up",t[t.Down=40]="Down",t[t.Left=37]="Left",t[t.Right=39]="Right",t[t.Space=32]="Space",t[t.Esc=27]="Esc"})(e.Keys||(e.Keys={})),e.Keys;var i=function(t){function e(e){t.call(this),this.key=e}return __extends(e,t),e}(t.GameEvent);e.KeyEvent=i;var n=function(t){function e(e){t.call(this),this._keys=[],this._keysUp=[],this._keysDown=[],this._engine=e}return __extends(e,t),e.prototype.init=function(){var t=this;window.addEventListener("blur",function(){t._keys.length=0}),window.addEventListener("keyup",function(e){var n=t._keys.indexOf(e.keyCode);t._keys.splice(n,1),t._keysUp.push(e.keyCode);var s=new i(e.keyCode);t.eventDispatcher.emit("up",s),t.eventDispatcher.emit("release",s)}),window.addEventListener("keydown",function(e){if(-1===t._keys.indexOf(e.keyCode)){t._keys.push(e.keyCode),t._keysDown.push(e.keyCode);var n=new i(e.keyCode);t.eventDispatcher.emit("down",n),t.eventDispatcher.emit("press",n)}})},e.prototype.update=function(){this._keysDown.length=0,this._keysUp.length=0;for(var t=0;this._keys.length>t;t++)this.eventDispatcher.emit("hold",new i(this._keys[t]))},e.prototype.getKeys=function(){return this._keys},e.prototype.wasPressed=function(t){return this._keysDown.indexOf(t)>-1},e.prototype.isHeld=function(t){return this._keys.indexOf(t)>-1},e.prototype.wasReleased=function(t){return this._keysUp.indexOf(t)>-1},e}(t.Class);e.Keyboard=n})(e=t.Input||(t.Input={}))})(ex||(ex={}));var ex;(function(t){var e;(function(e){var i=function(e){function i(t){e.call(this),this.enabled=!1,this.supported=!!navigator.getGamepads,this._gamePadTimeStamps=[0,0,0,0],this._oldPads=[],this._pads=[],this._initSuccess=!1,this._navigator=navigator,this._minimumConfiguration=null,this._engine=t}return __extends(i,e),i.prototype.init=function(){this.supported&&(this._initSuccess||(this._oldPads=this._clonePads(this._navigator.getGamepads()),this._oldPads.length&&this._oldPads[0]&&(this._initSuccess=!0)))},i.prototype.setMinimumGamepadConfiguration=function(t){this._enableAndUpdate(),this._minimumConfiguration=t},i.prototype._enableAndUpdate=function(){this.enabled||(this.enabled=!0,this.update(100))},i.prototype._isGamepadValid=function(t){if(!this._minimumConfiguration)return!0;if(!t)return!1;var e=t.axes.filter(function(t){return void 0!==typeof t}).length,i=t.buttons.filter(function(t){return void 0!==typeof t}).length;return e>=this._minimumConfiguration.axis&&i>=this._minimumConfiguration.buttons&&t.connected},i.prototype.on=function(t,i){this._enableAndUpdate(),e.prototype.on.call(this,t,i)},i.prototype.off=function(t,i){this._enableAndUpdate(),e.prototype.off.call(this,t,i)},i.prototype.update=function(){if(this.enabled&&this.supported){this.init();for(var e=this._navigator.getGamepads(),i=0;e.length>i;i++)if(e[i]){if(!this.at(i).connected&&this._isGamepadValid(e[i])&&this.eventDispatcher.emit("connect",new t.GamepadConnectEvent(i,this.at(i))),this.at(i).connected=!0,!e[i].timestamp||e[i].timestamp!==this._gamePadTimeStamps[i]){this._gamePadTimeStamps[i]=e[i].timestamp,this.at(i).navigatorGamepad=e[i];var n,r,h,a,c;for(n in s)"number"==typeof s[n]&&(a=s[n],e[i].buttons[a]&&(h=e[i].buttons[a].value,h!==this._oldPads[i].getButton(a)&&(e[i].buttons[a].pressed?(this.at(i).updateButton(a,h),this.at(i).eventDispatcher.publish("button",new t.GamepadButtonEvent(a,h))):this.at(i).updateButton(a,0))));for(r in o)"number"==typeof o[r]&&(c=o[r],h=e[i].axes[c],h!==this._oldPads[i].getAxes(c)&&(this.at(i).updateAxes(c,h),this.at(i).eventDispatcher.emit("axis",new t.GamepadAxisEvent(c,h))));this._oldPads[i]=this._clonePad(e[i])}}else this.at(i).connected&&this.eventDispatcher.emit("disconnect",new t.GamepadDisconnectEvent(i)),this.at(i).connected=!1}},i.prototype.at=function(t){if(this._enableAndUpdate(),t>=this._pads.length)for(var e=this._pads.length-1,i=t;i>e;e++)this._pads.push(new n),this._oldPads.push(new n);return this._pads[t]},i.prototype.getValidGamepads=function(){this._enableAndUpdate();for(var t=[],e=0;this._pads.length>e;e++)this._isGamepadValid(this.at(e).navigatorGamepad)&&this.at(e).connected&&t.push(this.at(e));return t},i.prototype.count=function(){return this._pads.filter(function(t){return t.connected}).length},i.prototype._clonePads=function(t){for(var e=[],i=0,n=t.length;n>i;i++)e.push(this._clonePad(t[i]));return e},i.prototype._clonePad=function(t){var e,i,s=new n;if(!t)return s;for(e=0,i=t.buttons.length;i>e;e++)t.buttons[e]&&s.updateButton(e,t.buttons[e].value);for(e=0,i=t.axes.length;i>e;e++)s.updateAxes(e,t.axes[e]);return s},i.MinAxisMoveThreshold=.05,i}(t.Class);e.Gamepads=i;var n=function(t){function e(){t.call(this),this.connected=!1,this._buttons=Array(16),this._axes=Array(4);var e;for(e=0;this._buttons.length>e;e++)this._buttons[e]=0;for(e=0;this._axes.length>e;e++)this._axes[e]=0}return __extends(e,t),e.prototype.isButtonPressed=function(t,e){return void 0===e&&(e=1),this._buttons[t]>=e},e.prototype.getButton=function(t){return this._buttons[t]},e.prototype.getAxes=function(t){var e=this._axes[t];return Math.abs(e)n;n++)this._animations[n].animation.draw(i,this._animations[n].x,this._animations[n].y);if(this.fps=1/(e/1e3),this.isDebug){this.ctx.font="Consolas",this.ctx.fillStyle=""+this.debugColor;for(var o=this.input.keyboard.getKeys(),r=0;o.length>r;r++)this.ctx.fillText(""+o[r]+" : "+(t.Input.Keys[o[r]]?t.Input.Keys[o[r]]:"Not Mapped"),100,10*r+10);this.ctx.fillText("FPS:"+(""+this.fps.toFixed(2)),10,10)}for(var h=0;this.postProcessors.length>h;h++)this.postProcessors[h].process(this.ctx.getImageData(0,0,this.width,this.height),this.ctx);this.emit("postdraw",new t.PreDrawEvent(i,e,this))},s.prototype.start=function(e){if(!this._compatible){var i=new t.Promise;return i.reject("Excalibur is incompatible with your browser")}var n;if(e?(e.wireEngine(this),n=this.load(e)):n=t.Promise.wrap(),!this._hasStarted){this._hasStarted=!0,this._logger.debug("Starting game...");var s=Date.now(),o=this;(function r(){if(o._hasStarted)try{o._requestId=window.requestAnimationFrame(r);var t=Date.now(),e=Math.floor(t-s)||1;e>200&&(e=1),o._update(e),o._draw(e),s=t}catch(i){window.cancelAnimationFrame(o._requestId),o.stop(),o.onFatalException(i)}})(),this._logger.debug("Game started")}return n},s.prototype.stop=function(){this._hasStarted&&(this._hasStarted=!1,this._logger.debug("Game stopped"))},s.prototype.screenshot=function(){var t=new Image,e=this.canvas.toDataURL("image/png");return t.src=e,t},s.prototype._drawLoadingBar=function(t,e,i){if(this._loadingDraw)return this._loadingDraw(t,e,i),void 0;var n=this.canvas.height/2,s=this.canvas.width/3,o=s,r=new Image;r.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAyAAAAEsCAYAAAA7Ldc6AAAACXBIWXMAAA7CAAAOwgEVKEqAAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAa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D0WQAxiu4Pq6tOTxZob++VvwtWgWICAAAA+jOAfPUmgGz2ZDD62tpz7+eWzZUZAAAAAP0WQKYWtSxPN6xHj552dWH29l7pwYN171O3KCIAAACgTwOI8aX7w8OHT1Wp7HVtYR49OvR5jqQFiggAAADo7wCyIDPz1N7eK5VKj7uyIFtbO/rhh0NXP76cWnwzMxcAAACAPgwgptE/5z7e2HgReQipVPb0zTc/ep8qTS1qnuIBAAAA+jyAmBBSkLTsPl5ddSILIZXKnu7fX/UOPHckzVA0AAAAQP8Zev36de2HoaG3fnnnir6VlHEfT06m9PHH72l4+GgoH761taNvvvnRP9vWjBkMDwAH3H0VAABItmMtfn9J0j03hKyuOtrc3NHvfz+h8fHRjj74wYN1/5gPwgcAAADQ55peAZGkO1eUknRbUs77/ORkSh9+eE5jY8etP2xv75XW1p7rwYP1erNrET4ANMQVEAAABiSAeILIvKTr/ufHxo7r/fdPa3z8pMbGfvVW96ytrR1tbu5oY6Piv8mgqyzpC244CIAAAgAAAcQfQjKSbsp3NaRNjmr3HFlgul0ABBAAAAggzYJITtJVSdMEDwAEEAAAEGkA8QSRlAkhn6k2UD3TIHCUJH0tqTi1qCKrHQABBACAAQ8gAAAAABC1I6wCAAAAAAQQAAAAAH3n/w8AmB1j3tEUq4sAAAAASUVORK5CYII="; var h=3*s/8,a=this.getAntialiasing();this.setAntialiasing(!0),t.drawImage(r,0,0,800,300,o,n-h-20,s,h),t.strokeStyle="white",t.lineWidth=2,t.strokeRect(o,n,s,20);var c=s*(e/i);t.fillStyle="white";var u=5,l=c-2*u,p=20-2*u;t.fillRect(o+u,n+u,l>0?l:0,p),this.setAntialiasing(a)},s.prototype.setLoadingDrawFunction=function(t){this._loadingDraw=t},s.prototype.load=function(e){var i=this,n=new t.Promise;return this._isLoading=!0,e.onprogress=function(t){i._progress=t.loaded,i._total=t.total,i._logger.debug("Loading "+(100*i._progress/i._total).toFixed(0))},e.oncomplete=function(){setTimeout(function(){i._isLoading=!1,n.resolve()},500)},e.load(),n},s}(t.Class);t.Engine=e,function(t){t[t.FullScreen=0]="FullScreen",t[t.Container=1]="Container",t[t.Fixed=2]="Fixed"}(t.DisplayMode||(t.DisplayMode={}));var i=t.DisplayMode,n=function(){function t(t,e,i){this.animation=t,this.x=e,this.y=i}return t}()})(ex||(ex={})); ; // Concatenated onto excalibur after build diff --git a/dist/excalibur-0.6.0.d.ts b/dist/excalibur-0.6.0.d.ts index abce662ff..b57e6b106 100644 --- a/dist/excalibur-0.6.0.d.ts +++ b/dist/excalibur-0.6.0.d.ts @@ -3206,6 +3206,10 @@ declare module ex { * it from the scene graph. It will no longer be drawn or updated. */ kill(): void; + /** + * If the current actor is killed, it will now not be killed. + */ + unkill(): void; /** * Indicates wether the actor has been killed. */ diff --git a/dist/excalibur-0.6.0.js b/dist/excalibur-0.6.0.js index d6ebaa53a..b62b46962 100644 --- a/dist/excalibur-0.6.0.js +++ b/dist/excalibur-0.6.0.js @@ -1,4 +1,4 @@ -/*! excalibur - v0.6.0 - 2016-05-16 +/*! excalibur - v0.6.0 - 2016-05-25 * https://github.com/excaliburjs/Excalibur * Copyright (c) 2016 Excalibur.js ; Licensed BSD-2-Clause*/ if (typeof window === 'undefined') { @@ -5650,6 +5650,9 @@ var ex; return this.children.indexOf(actor) > -1; }; Scene.prototype.add = function (entity) { + if (entity instanceof ex.Actor) { + entity.unkill(); + } if (entity instanceof ex.UIActor) { if (!ex.Util.contains(this.uiActors, entity)) { this.addUIActor(entity); @@ -6386,6 +6389,12 @@ var ex; this.logger.warn('Cannot kill actor, it was never added to the Scene'); } }; + /** + * If the current actor is killed, it will now not be killed. + */ + Actor.prototype.unkill = function () { + this._isKilled = false; + }; /** * Indicates wether the actor has been killed. */ diff --git a/dist/excalibur-0.6.0.min.js b/dist/excalibur-0.6.0.min.js index 5f18e8f98..7c48eb354 100644 --- a/dist/excalibur-0.6.0.min.js +++ b/dist/excalibur-0.6.0.min.js @@ -1,11 +1,11 @@ -/*! excalibur - v0.6.0 - 2016-05-16 +/*! excalibur - v0.6.0 - 2016-05-25 * https://github.com/excaliburjs/Excalibur * Copyright (c) 2016 Excalibur.js ; Licensed BSD-2-Clause*/ "undefined"==typeof window&&(window={audioContext:function(){}}),"undefined"==typeof window||window.requestAnimationFrame||(window.requestAnimationFrame=window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(t){window.setInterval(t,1e3/60)}),"undefined"==typeof window||window.cancelAnimationFrame||(window.cancelAnimationFrame=window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||function(){}),"undefined"==typeof window||window.AudioContext||(window.AudioContext=window.AudioContext||window.webkitAudioContext||window.mozAudioContext||window.msAudioContext||window.oAudioContext),Array.prototype.forEach||(Array.prototype.forEach=function(t,e){var i,n;if(null==this)throw new TypeError(" this is null or not defined");var s=Object(this),o=s.length>>>0;if("function"!=typeof t)throw new TypeError(t+" is not a function");for(arguments.length>1&&(i=e),n=0;o>n;){var r;n in s&&(r=s[n],t.call(i,r,n,s)),n++}}),Array.prototype.some||(Array.prototype.some=function(t){"use strict";if(void 0===this||null===this)throw new TypeError;var e=Object(this),i=e.length>>>0;if("function"!=typeof t)throw new TypeError;for(var n=arguments.length>=2?arguments[1]:void 0,s=0;i>s;s++)if(s in e&&t.call(n,e[s],s,e))return!0;return!1}),Function.prototype.bind||(Function.prototype.bind=function(t){if("function"!=typeof this)throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");var e=Array.prototype.slice.call(arguments,1),i=this,n=function(){},s=function(){return i.apply(this instanceof n&&t?this:t,e.concat(Array.prototype.slice.call(arguments)))};return n.prototype=this.prototype,s.prototype=new n,s});var ex;(function(t){var e;(function(e){var i=function(){function t(){}return t.prototype.updatePixel=function(t,e,i){var n=4*(t+e*i.width),s=i.data,o=(s[n+0]+s[n+1]+s[n+2])/3;s[n+0]=o,s[n+1]=o,s[n+2]=o},t}();e.Grayscale=i;var n=function(){function t(){}return t.prototype.updatePixel=function(t,e,i){var n=4*(t+e*i.width),s=i.data;s[n+0]=255-s[n+0],s[n+1]=255-s[n+1],s[n+2]=255-s[n+2]},t}();e.Invert=n;var s=function(){function t(t){this.opacity=t}return t.prototype.updatePixel=function(t,e,i){var n=4*(t+e*i.width),s=i.data;0!==s[n+3]&&(s[n+3]=Math.round(255*this.opacity))},t}();e.Opacity=s;var o=function(){function t(t){this.color=t}return t.prototype.updatePixel=function(t,e,i){var n=4*(t+e*i.width),s=i.data;0!==s[n+3]&&(s[n+0]=(s[n+0]+this.color.r)/2,s[n+1]=(s[n+1]+this.color.g)/2,s[n+2]=(s[n+2]+this.color.b)/2)},t}();e.Colorize=o;var r=function(){function e(t){void 0===t&&(t=.1),this.factor=t}return e.prototype.updatePixel=function(e,i,n){var s=4*(e+i*n.width),o=n.data,r=t.Color.fromRGB(o[s+0],o[s+1],o[s+2],o[s+3]).lighten(this.factor);o[s+0]=r.r,o[s+1]=r.g,o[s+2]=r.b,o[s+3]=r.a},e}();e.Lighten=r;var h=function(){function e(t){void 0===t&&(t=.1),this.factor=t}return e.prototype.updatePixel=function(e,i,n){var s=4*(e+i*n.width),o=n.data,r=t.Color.fromRGB(o[s+0],o[s+1],o[s+2],o[s+3]).darken(this.factor);o[s+0]=r.r,o[s+1]=r.g,o[s+2]=r.b,o[s+3]=r.a},e}();e.Darken=h;var a=function(){function e(t){void 0===t&&(t=.1),this.factor=t}return e.prototype.updatePixel=function(e,i,n){var s=4*(e+i*n.width),o=n.data,r=t.Color.fromRGB(o[s+0],o[s+1],o[s+2],o[s+3]).saturate(this.factor);o[s+0]=r.r,o[s+1]=r.g,o[s+2]=r.b,o[s+3]=r.a},e}();e.Saturate=a;var c=function(){function e(t){void 0===t&&(t=.1),this.factor=t}return e.prototype.updatePixel=function(e,i,n){var s=4*(e+i*n.width),o=n.data,r=t.Color.fromRGB(o[s+0],o[s+1],o[s+2],o[s+3]).desaturate(this.factor);o[s+0]=r.r,o[s+1]=r.g,o[s+2]=r.b,o[s+3]=r.a},e}();e.Desaturate=c;var u=function(){function t(t){this.color=t}return t.prototype.updatePixel=function(t,e,i){var n=4*(t+e*i.width),s=i.data;0!==s[n+3]&&(s[n+0]=this.color.r,s[n+1]=this.color.g,s[n+2]=this.color.b)},t}();e.Fill=u})(e=t.Effects||(t.Effects={}))})(ex||(ex={}));var ex;(function(t){var e;(function(t){var e=function(){function t(){}return t.prototype.update=function(t,e,i){t.x+=t.dx*i/1e3,t.y+=t.dy*i/1e3,t.dx+=t.ax*i/1e3,t.dy+=t.ay*i/1e3,t.rotation+=t.rx*i/1e3,t.scale.x+=t.sx*i/1e3,t.scale.y+=t.sy*i/1e3},t}();t.Movement=e})(e=t.Traits||(t.Traits={}))})(ex||(ex={}));var ex;(function(t){var e=function(){function e(){this._topLeft=new t.Point(0,0),this._topRight=new t.Point(0,0),this._bottomLeft=new t.Point(0,0),this._bottomRight=new t.Point(0,0)}return e.prototype.isSpriteOffScreen=function(e,i){var n=e.currentDrawing.width*e.currentDrawing.scale.x,s=e.currentDrawing.height*e.currentDrawing.scale.y,o=e.rotation,r=e.getCenter().toPoint();this._topLeft.x=e.getWorldX()-n/2,this._topLeft.y=e.getWorldY()-s/2,this._topLeft=this._topLeft.rotate(o,r),this._topRight.x=e.getWorldX()+n/2,this._topRight.y=e.getWorldY()-s/2,this._topRight=this._topRight.rotate(o,r),this._bottomLeft.x=e.getWorldX()-n/2,this._bottomLeft.y=e.getWorldY()+s/2,this._bottomLeft=this._bottomLeft.rotate(o,r),this._bottomRight.x=e.getWorldX()+n/2,this._bottomRight.y=e.getWorldY()+s/2,this._bottomRight=this._bottomRight.rotate(o,r);var h=i.worldToScreenCoordinates(this._topLeft),a=i.worldToScreenCoordinates(this._topRight),c=i.worldToScreenCoordinates(this._bottomLeft),u=i.worldToScreenCoordinates(this._bottomRight);this._xCoords=[],this._yCoords=[],this._xCoords.push(h.x,a.x,c.x,u.x),this._yCoords.push(h.y,a.y,c.y,u.y),this._xMin=Math.min.apply(null,this._xCoords),this._yMin=Math.min.apply(null,this._yCoords),this._xMax=Math.max.apply(null,this._xCoords),this._yMax=Math.max.apply(null,this._yCoords);var l=i.screenToWorldCoordinates(new t.Point(this._xMin,this._yMin)),p=i.screenToWorldCoordinates(new t.Point(this._xMax,this._yMax));this._xMinWorld=l.x,this._yMinWorld=l.y,this._xMaxWorld=p.x,this._yMaxWorld=p.y;var d=[];d.push(new t.Point(this._xMin,this._yMin),new t.Point(this._xMax,this._yMin),new t.Point(this._xMin,this._yMax),new t.Point(this._xMax,this._yMax));for(var f=0;d.length>f;f++)if(d[f].x>0&&d[f].y>0&&d[f].x0&&a.y+h*c>0&&a.xa.x+r*c||0>a.y+h*c||a.x>i.width||a.y>i.height)&&u&&(n.emit("exitviewport",new t.ExitViewPortEvent),e.isOffScreen=!0)},e}();e.OffscreenCulling=i})(e=t.Traits||(t.Traits={}))})(ex||(ex={}));var ex;(function(t){var e;(function(t){var e=function(){function t(){}return t.prototype.update=function(t,e){t.enableCapturePointer&&(t.isKilled()||e.input.pointers.propogate(t))},t}();t.CapturePointer=e})(e=t.Traits||(t.Traits={}))})(ex||(ex={}));var ex;(function(t){var e;(function(e){var i=function(){function e(){}return e.prototype.update=function(e,i){var n=e.eventDispatcher;if(e.collisionType!==t.CollisionType.PreventCollision&&i.currentScene&&i.currentScene.tileMaps)for(var s=0;i.currentScene.tileMaps.length>s;s++)for(var o,r=i.currentScene.tileMaps[s],h=t.Side.None,a=2,c=!1;(o=r.collides(e))&&!(0>a--);)h=e.getSideFromIntersect(o),n.emit("collision",new t.CollisionEvent(e,null,h,o)),(e.collisionType===t.CollisionType.Active||e.collisionType===t.CollisionType.Elastic)&&(e.y+=o.y,e.x+=o.x,e.collisionType!==t.CollisionType.Elastic||c||(c=!0,h===t.Side.Left?e.dx=Math.abs(e.dx):h===t.Side.Right?e.dx=-Math.abs(e.dx):h===t.Side.Top?e.dy=Math.abs(e.dy):h===t.Side.Bottom&&(e.dy=-Math.abs(e.dy))))},e}();e.CollisionDetection=i})(e=t.Traits||(t.Traits={}))})(ex||(ex={}));var ex;(function(t){(function(t){t[t.None=0]="None",t[t.Top=1]="Top",t[t.Bottom=2]="Bottom",t[t.Left=3]="Left",t[t.Right=4]="Right"})(t.Side||(t.Side={})),t.Side})(ex||(ex={}));var __extends=this&&this.__extends||function(t,e){function i(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)},ex;(function(t){var e=function(){function e(t,e){this.x=t,this.y=e}return e.prototype.toVector=function(){return new i(this.x,this.y)},e.prototype.rotate=function(i,n){n||(n=new t.Point(0,0));var s=Math.sin(i),o=Math.cos(i),r=o*(this.x-n.x)-s*(this.y-n.y)+n.x,h=s*(this.x-n.x)+o*(this.y-n.y)+n.y;return new e(r,h)},e.prototype.add=function(t){return new e(this.x+t.x,this.y+t.y)},e.prototype.setTo=function(t,e){this.x=t,this.y=e},e.prototype.clone=function(){return new e(this.x,this.y)},e.prototype.equals=function(t){return this.x===t.x&&this.y===t.y},e}();t.Point=e;var i=function(t){function i(e,i){t.call(this,e,i),this.x=e,this.y=i}return __extends(i,t),i.fromAngle=function(t){return new i(Math.cos(t),Math.sin(t))},i.prototype.distance=function(t){return t||(t=new i(0,0)),Math.sqrt(Math.pow(this.x-t.x,2)+Math.pow(this.y-t.y,2))},i.prototype.normalize=function(){var t=this.distance();return t>0?new i(this.x/t,this.y/t):new i(0,1)},i.prototype.scale=function(t){return new i(this.x*t,this.y*t)},i.prototype.plus=function(t){return this.add(t)},i.prototype.add=function(t){return new i(this.x+t.x,this.y+t.y)},i.prototype.subtract=function(t){return this.minus(t)},i.prototype.minus=function(t){return new i(this.x-t.x,this.y-t.y)},i.prototype.dot=function(t){return this.x*t.x+this.y*t.y},i.prototype.cross=function(t){return this.x*t.y-this.y*t.x},i.prototype.perpendicular=function(){return new i(this.y,-this.x)},i.prototype.normal=function(){return this.perpendicular().normalize()},i.prototype.toAngle=function(){return Math.atan2(this.y,this.x)},i.prototype.toPoint=function(){return new e(this.x,this.y)},i.prototype.rotate=function(e,i){return t.prototype.rotate.call(this,e,i).toVector()},i.prototype.clone=function(){return new i(this.x,this.y)},i.Zero=new i(0,0),i}(e);t.Vector=i;var n=function(){function t(t,e){this.pos=t,this.dir=e.normalize()}return t.prototype.intersect=function(t){var e=t.begin.toVector().minus(this.pos.toVector());if(0===this.dir.cross(t.getSlope())&&0!==e.cross(this.dir))return-1;var i=this.dir.cross(t.getSlope());if(0===i)return-1;var n=e.cross(t.getSlope())/i;if(n>=0){var s=e.cross(this.dir)/i/t.getLength();if(s>=0&&1>=s)return n}return-1},t.prototype.getPoint=function(t){return this.pos.toVector().add(this.dir.scale(t)).toPoint()},t}();t.Ray=n;var s=function(){function t(t,e){this.begin=t,this.end=e}return t.prototype.getSlope=function(){var t=this.begin.toVector(),e=this.end.toVector(),i=t.distance(e);return e.minus(t).scale(1/i)},t.prototype.getLength=function(){var t=this.begin.toVector(),e=this.end.toVector(),i=t.distance(e);return i},t}();t.Line=s;var o=function(){function t(t,e){this.min=t,this.max=e}return t.prototype.overlaps=function(t){return this.max>t.min&&t.max>this.min},t.prototype.getOverlap=function(t){return this.overlaps(t)?this.max>t.max?t.max-this.min:this.max-t.min:0},t}();t.Projection=o})(ex||(ex={}));var ex;(function(t){var e;(function(e){function i(t){for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",i="",n=0;t.length>n;){var s,o,r=255&t.charCodeAt(n++),h=255&t.charCodeAt(n++),a=255&t.charCodeAt(n++),c=r>>2,u=(3&r)<<4|h>>4;isNaN(h)?s=o=64:(s=(15&h)<<2|a>>6,o=isNaN(a)?64:63&a),i+=e.charAt(c)+e.charAt(u)+e.charAt(s)+e.charAt(o)}return i}function n(t,e,i){return e>=t?e:t>=i?i:t}function s(t,e,i,n,s,o){t.beginPath(),t.strokeStyle=e,t.moveTo(i,n),t.lineTo(s,o),t.closePath(),t.stroke()}function o(t,e){return t+Math.random()*(e-t)}function r(t,e){return Math.round(o(t,e))}function h(t){var e=t;if(t>this.TwoPI)for(;e>this.TwoPI;)e-=this.TwoPI;if(0>t)for(;0>e;)e+=this.TwoPI;return e}function a(t){return 180/Math.PI*t}function c(t){return t/180*Math.PI}function u(e){var i=0,n=0,s=function(t){i+=t.offsetLeft,t.offsetParent&&s(t.offsetParent)},o=function(t){n+=t.offsetTop,t.offsetParent&&o(t.offsetParent)};return s(e),o(e),new t.Point(i,n)}function l(t,e){return-1===e.indexOf(t)?(e.push(t),!0):!1}function p(t,e){var i=-1;return(i=e.indexOf(t))>-1?(e.splice(i,1),!0):!1}function d(t,e){for(var i=0;t.length>i;i++)if(t[i]===e)return!0;return!1}function f(e){return e===t.Side.Top?t.Side.Bottom:e===t.Side.Bottom?t.Side.Top:e===t.Side.Left?t.Side.Right:e===t.Side.Right?t.Side.Left:t.Side.None}e.TwoPI=2*Math.PI,e.base64Encode=i,e.clamp=n,e.drawLine=s,e.randomInRange=o,e.randomIntInRange=r,e.canonicalizeAngle=h,e.toDegrees=a,e.toRadians=c,e.getPosition=u,e.addItemToArray=l,e.removeItemToArray=p,e.contains=d,e.getOppositeSide=f;var g=function(){function t(e){void 0===e&&(e=t.DefaultSize),this._internalArray=null,this._endPointer=0,this._internalArray=Array(e)}return t.prototype._resize=function(){for(var t=2*this._internalArray.length,e=Array(t),i=this.count(),n=0;i>n;n++)e[n]=this._internalArray[n];delete this._internalArray,this._internalArray=e},t.prototype.push=function(t){return this._endPointer===this._internalArray.length&&this._resize(),this._internalArray[this._endPointer++]=t},t.prototype.pop=function(){return this._endPointer=0>this._endPointer-1?0:this._endPointer-1,this._internalArray[this._endPointer]},t.prototype.count=function(){return this._endPointer},t.prototype.clear=function(){this._endPointer=0},t.prototype.internalSize=function(){return this._internalArray.length},t.prototype.elementAt=function(t){return t>=this.count()?void 0:this._internalArray[t]},t.prototype.insert=function(t,e){return t>=this.count()&&this._resize(),this._internalArray[t]=e},t.prototype.remove=function(t){var e=this.count();if(0!==e){for(var i=this._internalArray[t],n=t;e>n;n++)this._internalArray[n]=this._internalArray[n+1];return this._endPointer--,i}},t.prototype.removeElement=function(t){var e=this._internalArray.indexOf(t);this.remove(e)},t.prototype.toArray=function(){return this._internalArray.slice(0,this._endPointer)},t.prototype.forEach=function(t){var e=0,i=this.count();for(e;i>e;e++)t.call(this,this._internalArray[e],e)},t.prototype.map=function(t){for(var e=this.count(),i=0;e>i;i++)this._internalArray[i]=t.call(this,this._internalArray[i],i)},t.DefaultSize=200,t}();e.Collection=g})(e=t.Util||(t.Util={}))})(ex||(ex={}));var ex;(function(t){var e=function(){function e(e,i,n,s,o){var r=this;this.sx=i,this.sy=n,this.swidth=s,this.sheight=o,this.rotation=0,this.anchor=new t.Point(0,0),this.scale=new t.Point(1,1),this.logger=t.Logger.getInstance(),this.flipVertical=!1,this.flipHorizontal=!1,this.width=0,this.height=0,this.effects=[],this.internalImage=new Image,this.naturalWidth=0,this.naturalHeight=0,this._spriteCanvas=null,this._spriteCtx=null,this._pixelData=null,this._pixelsLoaded=!1,this._dirtyEffect=!1,(0>i||0>n||0>s||0>o)&&this.logger.error("Sprite cannot have any negative dimensions x:",i,"y:",n,"width:",s,"height:",o),this._texture=e,this._spriteCanvas=document.createElement("canvas"),this._spriteCanvas.width=s,this._spriteCanvas.height=o,this._spriteCtx=this._spriteCanvas.getContext("2d"),this._texture.loaded.then(function(){r._spriteCanvas.width=r._spriteCanvas.width||r._texture.image.naturalWidth,r._spriteCanvas.height=r._spriteCanvas.height||r._texture.image.naturalHeight,r._loadPixels(),r._dirtyEffect=!0}).error(function(t){r.logger.error("Error loading texture ",r._texture.path,t)}),this.width=s,this.height=o,this.naturalWidth=s,this.naturalHeight=o}return e.prototype._loadPixels=function(){if(this._texture.isLoaded()&&!this._pixelsLoaded){var e=t.Util.clamp,i=this._texture.image.naturalWidth||0,n=this._texture.image.naturalHeight||0;this.swidth>i&&this.logger.warn("The sprite width",this.swidth,"exceeds the width",i,"of the backing texture",this._texture.path),this.sheight>n&&this.logger.warn("The sprite height",this.sheight,"exceeds the height",n,"of the backing texture",this._texture.path),this._spriteCtx.drawImage(this._texture.image,e(this.sx,0,i),e(this.sy,0,n),e(this.swidth,0,i),e(this.sheight,0,n),0,0,this.swidth,this.sheight),this.internalImage.src=this._spriteCanvas.toDataURL("image/png"),this._pixelsLoaded=!0}},e.prototype.opacity=function(e){this.addEffect(new t.Effects.Opacity(e))},e.prototype.grayscale=function(){this.addEffect(new t.Effects.Grayscale)},e.prototype.invert=function(){this.addEffect(new t.Effects.Invert)},e.prototype.fill=function(e){this.addEffect(new t.Effects.Fill(e))},e.prototype.colorize=function(e){this.addEffect(new t.Effects.Colorize(e))},e.prototype.lighten=function(e){void 0===e&&(e=.1),this.addEffect(new t.Effects.Lighten(e))},e.prototype.darken=function(e){void 0===e&&(e=.1),this.addEffect(new t.Effects.Darken(e))},e.prototype.saturate=function(e){void 0===e&&(e=.1),this.addEffect(new t.Effects.Saturate(e))},e.prototype.desaturate=function(e){void 0===e&&(e=.1),this.addEffect(new t.Effects.Desaturate(e))},e.prototype.addEffect=function(t){this.effects.push(t),this._texture.isLoaded()&&this._pixelsLoaded?this._applyEffects():this._dirtyEffect=!0},e.prototype.removeEffect=function(t){var e=null;e="number"==typeof t?t:this.effects.indexOf(t),this.effects.splice(e,1),this._texture.isLoaded()&&this._pixelsLoaded?this._applyEffects():this._dirtyEffect=!0},e.prototype._applyEffects=function(){var e=t.Util.clamp,i=this._texture.image.naturalWidth||0,n=this._texture.image.naturalHeight||0;this._spriteCtx.clearRect(0,0,this.swidth,this.sheight),this._spriteCtx.drawImage(this._texture.image,e(this.sx,0,i),e(this.sy,0,n),e(this.swidth,0,i),e(this.sheight,0,n),0,0,this.swidth,this.sheight),this._pixelData=this._spriteCtx.getImageData(0,0,this.swidth,this.sheight);var s=0,o=0,r=0,h=this.effects.length;for(s;h>s;s++)for(r=0;this.sheight>r;r++)for(o=0;this.swidth>o;o++)this.effects[s].updatePixel(o,r,this._pixelData);this._spriteCtx.clearRect(0,0,this.swidth,this.sheight),this._spriteCtx.putImageData(this._pixelData,0,0),this.internalImage.src=this._spriteCanvas.toDataURL("image/png")},e.prototype.clearEffects=function(){this.effects.length=0,this._applyEffects()},e.prototype.reset=function(){},e.prototype.debugDraw=function(e,i,n){e.save(),e.translate(i,n),e.rotate(this.rotation);var s=this.width*this.scale.x*this.anchor.x,o=this.height*this.scale.y*this.anchor.y;e.strokeStyle=t.Color.Black,e.strokeRect(-s,-o,this.width*this.scale.x,this.height*this.scale.y),e.restore()},e.prototype.draw=function(t,e,i){this._dirtyEffect&&(this._applyEffects(),this._dirtyEffect=!1),this.width=this.naturalWidth*this.scale.x,this.height=this.naturalHeight*this.scale.y,t.save();var n=this.width*this.anchor.x,s=this.height*this.anchor.y;t.translate(e,i),t.rotate(this.rotation),this.flipHorizontal&&(t.translate(this.swidth*this.scale.x,0),t.scale(-1,1)),this.flipVertical&&(t.translate(0,this.sheight*this.scale.y),t.scale(1,-1)),this.internalImage&&t.drawImage(this.internalImage,0,0,this.swidth,this.sheight,-n,-s,this.swidth*this.scale.x,this.sheight*this.scale.y),t.restore()},e.prototype.clone=function(){var t=new e(this._texture,this.sx,this.sy,this.swidth,this.sheight);t.scale=this.scale.clone(),t.rotation=this.rotation,t.flipHorizontal=this.flipHorizontal,t.flipVertical=this.flipVertical;var i=0,n=this.effects.length;for(i;n>i;i++)t.addEffect(this.effects[i]);return t},e}();t.Sprite=e})(ex||(ex={}));var ex;(function(t){var e=function(){function e(e,i,n,s,o){this.image=e,this.columns=i,this.rows=n,this.sprites=[],this._internalImage=e.image,this.sprites=Array(i*n);var r=0,h=0;for(r=0;n>r;r++)for(h=0;i>h;h++)this.sprites[h+r*i]=new t.Sprite(this.image,h*s,r*o,s,o)}return e.prototype.getAnimationByIndices=function(e,i,n){var s=this,o=i.map(function(t){return s.sprites[t]});return o=o.map(function(t){return t.clone()}),new t.Animation(e,o,n)},e.prototype.getAnimationBetween=function(e,i,n,s){var o=this.sprites.slice(i,n);return o=o.map(function(t){return t.clone()}),new t.Animation(e,o,s)},e.prototype.getAnimationForAll=function(e,i){var n=this.sprites.map(function(t){return t.clone()});return new t.Animation(e,n,i)},e.prototype.getSprite=function(t){return t>=0&&this.sprites.length>t?this.sprites[t]:void 0},e}();t.SpriteSheet=e;var i=function(e){function i(i,n,s,o,r,h,a){e.call(this,i,o,r,h,a),this.image=i,this.alphabet=n,this.caseInsensitive=s,this.spWidth=h,this.spHeight=a,this._spriteLookup={},this._colorLookup={},this._currentColor=t.Color.Black.clone(),this._currentOpacity=1,this._sprites={},this._textShadowOn=!1,this._textShadowDirty=!0,this._textShadowColor=t.Color.Black.clone(),this._textShadowSprites={},this._shadowOffsetX=5,this._shadowOffsetY=5,this._sprites=this.getTextSprites()}return __extends(i,e),i.prototype.getTextSprites=function(){for(var t={},e=0;this.alphabet.length>e;e++){var i=this.alphabet[e];this.caseInsensitive&&(i=i.toLowerCase()),t[i]=this.sprites[e].clone()}return t},i.prototype.setTextShadow=function(t,e,i){this._textShadowOn=!0,this._shadowOffsetX=t,this._shadowOffsetY=e,this._textShadowColor=i.clone(),this._textShadowDirty=!0;for(var n in this._sprites)this._textShadowSprites[n]=this._sprites[n].clone()},i.prototype.useTextShadow=function(t){this._textShadowOn=t,t&&this.setTextShadow(5,5,this._textShadowColor)},i.prototype.draw=function(e,i,n,s,o){if(o=this._parseOptions(o),""+this._currentColor!=""+o.color||this._currentOpacity!==o.opacity){this._currentOpacity=o.opacity,this._currentColor=o.color;for(var r in this._sprites)this._sprites[r].clearEffects(),this._sprites[r].fill(o.color),this._sprites[r].opacity(o.opacity)}if(this._textShadowOn&&this._textShadowDirty&&this._textShadowColor){for(var h in this._textShadowSprites)this._textShadowSprites[h].clearEffects(),this._textShadowSprites[h].addEffect(new t.Effects.Fill(this._textShadowColor.clone()));this._textShadowDirty=!1}var a=this.sprites[0],c=a.sheight,u=o.fontSize/c,l=i.length*a.swidth*u+i.length*o.letterSpacing,p=n;o.textAlign===t.TextAlign.Left||o.textAlign===t.TextAlign.Start?p=n:o.textAlign===t.TextAlign.Right||o.textAlign===t.TextAlign.End?p=n-l:o.textAlign===t.TextAlign.Center&&(p=n-l/2);var d=s-c*u;o.baseAlign===t.BaseAlign.Top||o.baseAlign===t.BaseAlign.Hanging?d=s:o.baseAlign===t.BaseAlign.Ideographic||o.baseAlign===t.BaseAlign.Bottom||o.baseAlign===t.BaseAlign.Alphabetic?d=s-c*u:o.baseAlign===t.BaseAlign.Middle&&(d=s-c*u/2);for(var f=0;i.length>f;f++){var g=i[f];this.caseInsensitive&&(g=g.toLowerCase());try{this._textShadowOn&&(this._textShadowSprites[g].scale.x=u,this._textShadowSprites[g].scale.y=u,this._textShadowSprites[g].draw(e,p+this._shadowOffsetX,d+this._shadowOffsetY));var _=this._sprites[g];_.scale.x=u,_.scale.y=u,_.draw(e,p,d),p+=_.width+o.letterSpacing}catch(y){t.Logger.getInstance().error("SpriteFont Error drawing char "+g)}}},i.prototype._parseOptions=function(e){return{fontSize:e.fontSize||10,letterSpacing:e.letterSpacing||0,color:e.color||t.Color.Black.clone(),textAlign:void 0===typeof e.textAlign?t.TextAlign.Left:e.textAlign,baseAlign:void 0===typeof e.baseAlign?t.BaseAlign.Bottom:e.baseAlign,maxWidth:e.maxWidth||-1,opacity:e.opacity||0}},i}(e);t.SpriteFont=i})(ex||(ex={}));var ex;(function(t){var e=function(){function e(e,i,s,o,r,h){var a=this;this.x=e,this.y=i,this.cellWidth=s,this.cellHeight=o,this.rows=r,this.cols=h,this._collidingX=-1,this._collidingY=-1,this._onScreenXStart=0,this._onScreenXEnd=9999,this._onScreenYStart=0,this._onScreenYEnd=9999,this._spriteSheets={},this.logger=t.Logger.getInstance(),this.data=[],this.data=Array(r*h);for(var c=0;h>c;c++)for(var u=0;r>u;u++)(function(){var t=new n(c*s+e,u*o+i,s,o,c+u*h);a.data[c+u*h]=t})()}return e.prototype.registerSpriteSheet=function(t,e){this._spriteSheets[t]=e},e.prototype.collides=function(e){for(var i=e.x+e.getWidth(),n=e.y+e.getHeight(),s=e.getBounds(),o=[],r=s.left;i>=r;r+=Math.min(e.getWidth()/2,this.cellWidth/2))for(var h=s.top;n>=h;h+=Math.min(e.getHeight()/2,this.cellHeight/2)){var a=this.getCellByPoint(r,h);if(a&&a.solid){var c=s.collides(a.getBounds()),u=e.getCenter().minus(a.getCenter());c&&c.dot(u)>0&&o.push(c)}}if(0===o.length)return null;var l=o.reduce(function(e,i){var n=e.x,s=e.y;return Math.abs(e.x)t||0>e||t>=this.cols||e>=this.rows?null:this.data[t+e*this.cols]},e.prototype.getCellByPoint=function(t,e){t=Math.floor((t-this.x)/this.cellWidth),e=Math.floor((e-this.y)/this.cellHeight);var i=this.getCell(t,e);return t>=0&&e>=0&&this.cols>t&&this.rows>e&&i?i:null},e.prototype.update=function(e){var i=e.screenToWorldCoordinates(new t.Point(0,0)),n=e.screenToWorldCoordinates(new t.Point(e.canvas.clientWidth,e.canvas.clientHeight));this._onScreenXStart=Math.max(Math.floor(i.x/this.cellWidth)-2,0),this._onScreenYStart=Math.max(Math.floor((i.y-this.y)/this.cellHeight)-2,0),this._onScreenXEnd=Math.max(Math.floor(n.x/this.cellWidth)+2,0),this._onScreenYEnd=Math.max(Math.floor((n.y-this.y)/this.cellHeight)+2,0)},e.prototype.draw=function(t){t.save(),t.translate(this.x,this.y);var e,i,n,s=this._onScreenXStart,o=Math.min(this._onScreenXEnd,this.cols),r=this._onScreenYStart,h=Math.min(this._onScreenYEnd,this.rows);for(s;o>s;s++){for(r;h>r;r++)for(e=this.getCell(s,r).sprites.filter(function(t){return t.spriteId>-1}),i=0,n=e.length;n>i;i++){var a=this._spriteSheets[e[i].spriteSheetKey];if(a){var c=a.getSprite(e[i].spriteId);c?c.draw(t,s*this.cellWidth,r*this.cellHeight):this.logger.warn("Sprite does not exist for id",e[i].spriteId,"in sprite sheet",e[i].spriteSheetKey,c,a)}else this.logger.warn("Sprite sheet",e[i].spriteSheetKey,"does not exist",a)}r=this._onScreenYStart}t.restore()},e.prototype.debugDraw=function(e){var i=this.cols*this.cellWidth,n=this.rows*this.cellHeight;e.save(),e.strokeStyle=""+t.Color.Red;for(var s=0;this.cols+1>s;s++)e.beginPath(),e.moveTo(this.x+s*this.cellWidth,this.y),e.lineTo(this.x+s*this.cellWidth,this.y+n),e.stroke();for(var o=0;this.rows+1>o;o++)e.beginPath(),e.moveTo(this.x,this.y+o*this.cellHeight),e.lineTo(this.x+i,this.y+o*this.cellHeight),e.stroke();var r=t.Color.Red.clone();r.a=.3,this.data.filter(function(t){return t.solid}).forEach(function(t){e.fillStyle=""+r,e.fillRect(t.x,t.y,t.width,t.height)}),this._collidingY>-1&&this._collidingX>-1&&(e.fillStyle=""+t.Color.Cyan,e.fillRect(this.x+this._collidingX*this.cellWidth,this.y+this._collidingY*this.cellHeight,this.cellWidth,this.cellHeight)),e.restore()},e}();t.TileMap=e;var i=function(){function t(t,e){this.spriteSheetKey=t,this.spriteId=e}return t}();t.TileSprite=i;var n=function(){function e(e,i,n,s,o,r,h){void 0===r&&(r=!1),void 0===h&&(h=[]),this.x=e,this.y=i,this.width=n,this.height=s,this.index=o,this.solid=r,this.sprites=h,this._bounds=new t.BoundingBox(this.x,this.y,this.x+this.width,this.y+this.height)}return e.prototype.getBounds=function(){return this._bounds},e.prototype.getCenter=function(){return new t.Vector(this.x+this.width/2,this.y+this.height/2)},e.prototype.pushSprite=function(t){this.sprites.push(t)},e.prototype.removeSprite=function(t){var e=-1;(e=this.sprites.indexOf(t))>-1&&this.sprites.splice(e,1)},e.prototype.clearSprites=function(){this.sprites.length=0},e}();t.Cell=n})(ex||(ex={}));var ex;(function(t){(function(t){t[t.Naive=0]="Naive",t[t.DynamicAABBTree=1]="DynamicAABBTree",t[t.SeparatingAxis=2]="SeparatingAxis"})(t.CollisionStrategy||(t.CollisionStrategy={})),t.CollisionStrategy;var e=function(){function e(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),this.left=t,this.top=e,this.right=i,this.bottom=n}return e.prototype.getWidth=function(){return this.right-this.left},e.prototype.getHeight=function(){return this.bottom-this.top},e.prototype.getPerimeter=function(){var t=this.getWidth(),e=this.getHeight();return 2*(t+e)},e.prototype.contains=function(i){return i instanceof t.Point?this.left<=i.x&&this.top<=i.y&&this.bottom>=i.y&&this.right>=i.x:i instanceof e?this.left=n.left&&this.right<=n.right?n.left-this.right:n.right-this.left;var r=0;return r=this.top<=n.bottom&&this.top>=n.top?n.bottom-this.top:n.top-this.bottom,Math.abs(o)n;n++)e.push(new t.Line(this._points[n],this._points[(n+1)%i]));return e},e.prototype.getAxes=function(){for(var t=[],e=this._points.length,i=0;e>i;i++)t.push(this._points[i].minus(this._points[(i+1)%e]).normal());return t},e.prototype.project=function(e){for(var i=[],n=this._points.length,s=0;n>s;s++)i.push(this._points[s].dot(e));return new t.Projection(Math.min.apply(Math,i),Math.max.apply(Math,i))},e.prototype.getWidth=function(){var t=this._points.reduce(function(t,e){return Math.min(t,e.x)},1/0),e=this._points.reduce(function(t,e){return Math.max(t,e.x)},-1/0);return e-t},e.prototype.getHeight=function(){var t=this._points.reduce(function(t,e){return Math.min(t,e.y)},1/0),e=this._points.reduce(function(t,e){return Math.max(t,e.y)},-1/0);return t-e},e.prototype.contains=function(e){var i=new t.Ray(e,new t.Vector(1,0)),n=this.getSides().reduce(function(t,e){return i.intersect(e)>=0?t+1:t},0);return 0===n%2?!1:!0},e.prototype.collides=function(t){if(t instanceof e){var i=t,n=this.getAxes();n=i.getAxes().concat(n);for(var s=99999,o=null,r=0;n.length>r;r++){var h=this.project(n[r]),a=i.project(n[r]),c=h.getOverlap(a);if(0===c)return null;s>=c&&(s=c,o=n[r])}return o?o.normalize().scale(s):null}return null},e.prototype.debugDraw=function(e){e.beginPath(),e.lineWidth=2;var i=this._points[0];e.moveTo(i.x,i.y);var n=0,s=this._points.length;for(n;s>n;n++)e.lineTo(this._points[n].x,this._points[n].y);e.lineTo(i.x,i.y),e.closePath(),e.strokeStyle=""+t.Color.Blue,e.stroke()},e}();t.SATBoundingBox=i})(ex||(ex={}));var ex;(function(t){var e=function(){function e(){this.eventDispatcher=new t.EventDispatcher(this)}return e.prototype.addEventListener=function(t,e){this.eventDispatcher.subscribe(t,e)},e.prototype.removeEventListener=function(t,e){this.eventDispatcher.unsubscribe(t,e)},e.prototype.on=function(t,e){this.eventDispatcher.subscribe(t,e)},e.prototype.off=function(t,e){this.eventDispatcher.unsubscribe(t,e)},e.prototype.emit=function(t,e){this.eventDispatcher.emit(t,e)},e.extend=function(t){var i,n=this;i=t&&t.hasOwnProperty("constructor")?t.constructor:function(){return n.apply(this,arguments)};var s=function(){this.constructor=i};if(s.prototype=n.prototype,i.prototype=new s,t)for(var o in t)t.hasOwnProperty(o)&&(i.prototype[o]=t[o]);return i.extend=e.extend,i},e}();t.Class=e})(ex||(ex={})); var ex;(function(t){var e=function(){function t(e,i,n){this.id=0,this.interval=10,this.fcn=function(){},this.repeats=!1,this._elapsedTime=0,this._totalTimeAlive=0,this.complete=!1,this.scene=null,this.id=t.id++,this.interval=i||this.interval,this.fcn=e||this.fcn,this.repeats=n||this.repeats}return t.prototype.update=function(t){this._totalTimeAlive+=t,this._elapsedTime+=t,this._elapsedTime>this.interval&&(this.fcn.call(this),this.repeats?this._elapsedTime=0:this.complete=!0)},t.prototype.getTimeRunning=function(){return this._totalTimeAlive},t.prototype.cancel=function(){this.scene&&this.scene.cancelTimer(this)},t.id=0,t}();t.Timer=e})(ex||(ex={}));var ex;(function(t){var e=function(){function e(){}return e.prototype.register=function(){},e.prototype.remove=function(){},e.prototype.evaluate=function(e){for(var i,n,s=e.filter(function(e){return!e.isKilled()&&e.collisionType!==t.CollisionType.PreventCollision}),o=[],r=0,h=s.length;h>r;r++){i=s[r];for(var a=r+1;h>a;a++){n=s[a];var c;if(c=i.collides(n)){var u=i.getSideFromIntersect(c),l=new t.CollisionPair(i,n,c,u);o.some(function(t){return t.equals(l)})||o.push(l)}}}var p=0,d=o.length;for(p;d>p;p++)o[p].evaluate();return o},e.prototype.update=function(){return 0},e.prototype.debugDraw=function(){},e}();t.NaiveCollisionResolver=e})(ex||(ex={}));var ex;(function(t){var e=function(){function e(e){this.parent=e,this.parent=e||null,this.actor=null,this.bounds=new t.BoundingBox,this.left=null,this.right=null,this.height=0}return e.prototype.isLeaf=function(){return!this.left&&!this.right},e}();t.TreeNode=e;var i=function(){function t(){this.root=null,this.nodes={}}return t.prototype.insert=function(t){if(null===this.root)return this.root=t,this.root.parent=null,void 0;for(var i=t.bounds,n=this.root;!n.isLeaf();){var s,o,r=n.left,h=n.right,a=n.bounds.getPerimeter(),c=n.bounds.combine(i),u=c.getPerimeter(),l=2*u,p=2*(u-a),d=0,f=i.combine(r.bounds);r.isLeaf()?d=f.getPerimeter()+p:(o=r.bounds.getPerimeter(),s=f.getPerimeter(),d=s-o+p);var g=0,_=i.combine(h.bounds);if(h.isLeaf()?g=_.getPerimeter()+p:(o=h.bounds.getPerimeter(),s=_.getPerimeter(),g=s-o+p),d>l&&g>l)break;n=g>d?r:h}var y=n.parent,A=new e(y);A.bounds=i.combine(n.bounds),A.height=n.height+1,null!==y?(y.left===n?y.left=A:y.right=A,A.left=n,A.right=t,n.parent=A,t.parent=A):(A.left=n,A.right=t,n.parent=A,t.parent=A,this.root=A);for(var v=t.parent;v;){if(v=this.balance(v),!v.left)throw Error("Parent of current leaf cannot have a null left child"+v);if(!v.right)throw Error("Parent of current leaf cannot have a null right child"+v);v.height=1+Math.max(v.left.height,v.right.height),v.bounds=v.left.bounds.combine(v.right.bounds),v=v.parent}},t.prototype.remove=function(t){if(t===this.root)return this.root=null,void 0;var e,i=t.parent,n=i.parent;if(e=i.left===t?i.right:i.left,n){n.left===i?n.left=e:n.right=e,e.parent=n;for(var s=n;s;)s=this.balance(s),s.bounds=s.left.bounds.combine(s.right.bounds),s.height=1+Math.max(s.left.height,s.right.height),s=s.parent}else this.root=e,e.parent=null},t.prototype.registerActor=function(t){var i=new e;i.actor=t,i.bounds=t.getBounds(),i.bounds.left-=2,i.bounds.top-=2,i.bounds.right+=2,i.bounds.bottom+=2,this.nodes[t.id]=i,this.insert(i)},t.prototype.updateActor=function(t){var e=this.nodes[t.id];if(e){var i=t.getBounds();if(e.bounds.contains(i))return!1;this.remove(e),i.left-=5,i.top-=5,i.right+=5,i.bottom+=5;var n=2*t.dx,s=2*t.dy;return 0>n?i.left+=n:i.right+=n,0>s?i.top+=s:i.bottom+=s,e.bounds=i,this.insert(e),!0}},t.prototype.removeActor=function(t){var e=this.nodes[t.id];e&&(this.remove(e),this.nodes[t.id]=null,delete this.nodes[t.id])},t.prototype.balance=function(t){if(null===t)throw Error("Cannot balance at null node");if(t.isLeaf()||2>t.height)return t;var e=t.left,i=t.right,n=t,s=e,o=i,r=e.left,h=e.right,a=i.left,c=i.right,u=o.height-s.height;if(u>1)return o.left=n,o.parent=n.parent,n.parent=o,o.parent?o.parent.left===n?o.parent.left=o:o.parent.right=o:this.root=o,a.height>c.height?(o.right=a,n.right=c,c.parent=n,n.bounds=s.bounds.combine(c.bounds),o.bounds=n.bounds.combine(a.bounds),n.height=1+Math.max(s.height,c.height),o.height=1+Math.max(n.height,a.height)):(o.right=c,n.right=a,a.parent=n,n.bounds=s.bounds.combine(a.bounds),o.bounds=n.bounds.combine(c.bounds),n.height=1+Math.max(s.height,a.height),o.height=1+Math.max(n.height,c.height)),o;if(-1>u){if(s.left=n,s.parent=n.parent,n.parent=s,s.parent)if(s.parent.left===n)s.parent.left=s;else{if(s.parent.right!==n)throw"Error rotating Dynamic Tree";s.parent.right=s}else this.root=s;return r.height>h.height?(s.right=r,n.left=h,h.parent=n,n.bounds=o.bounds.combine(h.bounds),s.bounds=n.bounds.combine(r.bounds),n.height=1+Math.max(o.height,h.height),s.height=1+Math.max(n.height,r.height)):(s.right=h,n.left=r,r.parent=n,n.bounds=o.bounds.combine(r.bounds),s.bounds=n.bounds.combine(h.bounds),n.height=1+Math.max(o.height,r.height),s.height=1+Math.max(n.height,h.height)),s}return t},t.prototype.getHeight=function(){return null===this.root?0:this.root.height},t.prototype.query=function(t,e){var i=t.getBounds(),n=function(s){return s&&s.bounds.collides(i)?s.isLeaf()&&s.actor!==t?e.call(t,s.actor)?!0:void 0:n(s.left)||n(s.right):null};return n(this.root)},t.prototype.rayCast=function(){return null},t.prototype.getNodes=function(){var t=function(e){return e?[e].concat(t(e.left),t(e.right)):[]};return t(this.root)},t.prototype.debugDraw=function(t){var e=function(i){i&&(t.strokeStyle=i.isLeaf()?"green":"white",i.bounds.debugDraw(t),i.left&&e(i.left),i.right&&e(i.right))};e(this.root)},t}();t.DynamicTree=i})(ex||(ex={}));var ex;(function(t){var e=function(){function e(){this._dynamicCollisionTree=new t.DynamicTree}return e.prototype.register=function(t){this._dynamicCollisionTree.registerActor(t)},e.prototype.remove=function(t){this._dynamicCollisionTree.removeActor(t)},e.prototype.evaluate=function(e){for(var i,n=e.filter(function(e){return!e.isKilled()&&e.collisionType!==t.CollisionType.PreventCollision}),s=[],o=0,r=n.length;r>o;o++)i=n[o],this._dynamicCollisionTree.query(i,function(e){if(e.collisionType===t.CollisionType.PreventCollision||e.isKilled())return!1;var n;if(n=i.collides(e)){var o=i.getSideFromIntersect(n),r=new t.CollisionPair(i,e,n,o);return s.some(function(t){return t.equals(r)})||s.push(r),!0}return!1});var h=0,a=s.length;for(h;a>h;h++)s[h].evaluate();return s},e.prototype.update=function(t){var e=0,i=0,n=t.length;for(i;n>i;i++)this._dynamicCollisionTree.updateActor(t[i])&&e++;return e},e.prototype.debugDraw=function(t,e){this._dynamicCollisionTree.debugDraw(t,e)},e}();t.DynamicTreeCollisionResolver=e})(ex||(ex={}));var ex;(function(t){var e=function(){function e(t,e,i,n){this.left=t,this.right=e,this.intersect=i,this.side=n}return e.prototype.equals=function(t){return t.left===this.left&&t.right===this.right||t.right===this.left&&t.left===this.right},e.prototype.evaluate=function(){this.left.eventDispatcher.emit("collision",new t.CollisionEvent(this.left,this.right,this.side,this.intersect)),this.right.eventDispatcher.emit("collision",new t.CollisionEvent(this.right,this.left,t.Util.getOppositeSide(this.side),this.intersect.scale(-1)));var e=this.side;this.left.collisionType!==t.CollisionType.Active&&this.left.collisionType!==t.CollisionType.Elastic||this.right.collisionType===t.CollisionType.Passive||(this.left.y+=this.intersect.y,this.left.x+=this.intersect.x,this.left.collisionType===t.CollisionType.Elastic?e===t.Side.Left?this.left.dx=Math.abs(this.left.dx):e===t.Side.Right?this.left.dx=-Math.abs(this.left.dx):e===t.Side.Top?this.left.dy=Math.abs(this.left.dy):e===t.Side.Bottom&&(this.left.dy=-Math.abs(this.left.dy)):(0!==this.intersect.x&&(this.left.dx=0>=this.left.dx&&0>=this.right.dx?Math.max(this.left.dx,this.right.dx):this.left.dx>=0&&this.right.dx>=0?Math.min(this.left.dx,this.right.dx):0),0!==this.intersect.y&&(this.left.dy=0>=this.left.dy&&0>=this.right.dy?Math.max(this.left.dy,this.right.dy):this.left.dy>=0&&this.right.dy>=0?Math.min(this.left.dy,this.right.dy):0)));var i=t.Util.getOppositeSide(this.side),n=this.intersect.scale(-1);this.right.collisionType!==t.CollisionType.Active&&this.right.collisionType!==t.CollisionType.Elastic||this.left.collisionType===t.CollisionType.Passive||(this.right.y+=n.y,this.right.x+=n.x,this.right.collisionType===t.CollisionType.Elastic?i===t.Side.Left?this.right.dx=Math.abs(this.right.dx):i===t.Side.Right?this.right.dx=-Math.abs(this.right.dx):i===t.Side.Top?this.right.dy=Math.abs(this.right.dy):i===t.Side.Bottom&&(this.right.dy=-Math.abs(this.right.dy)):(0!==n.x&&(this.right.dx=0>=this.right.dx&&0>=this.left.dx?Math.max(this.left.dx,this.right.dx):this.left.dx>=0&&this.right.dx>=0?Math.min(this.left.dx,this.right.dx):0),0!==n.y&&(this.right.dy=0>=this.right.dy&&0>=this.left.dy?Math.max(this.left.dy,this.right.dy):this.left.dy>=0&&this.right.dy>=0?Math.min(this.left.dy,this.right.dy):0)))},e}();t.CollisionPair=e})(ex||(ex={}));var ex;(function(t){var e=function(){function e(){this.focus=new t.Point(0,0),this.lerp=!1,this.x=0,this.y=0,this.z=1,this.dx=0,this.dy=0,this.dz=0,this.ax=0,this.ay=0,this.az=0,this.rotation=0,this.rx=0,this._cameraMoving=!1,this._currentLerpTime=0,this._lerpDuration=1e3,this._totalLerpTime=0,this._lerpStart=null,this._lerpEnd=null,this._isShaking=!1,this._shakeMagnitudeX=0,this._shakeMagnitudeY=0,this._shakeDuration=0,this._elapsedShakeTime=0,this._isZooming=!1,this._currentZoomScale=1,this._maxZoomScale=1,this._zoomDuration=0,this._elapsedZoomTime=0,this._zoomIncrement=.01}return e.prototype._easeInOutCubic=function(t,e,i,n){return i-=e,t/=n/2,1>t?i/2*t*t*t+e:(t-=2,i/2*(t*t*t+2)+e)},e.prototype.setActorToFollow=function(t){this._follow=t},e.prototype.getFocus=function(){return new t.Point(this.x,this.y)},e.prototype.setFocus=function(e,i){this._follow||this.lerp||(this.x=e,this.y=i),this.lerp&&(this._lerpStart=this.getFocus().clone(),this._lerpEnd=new t.Point(e,i),this._currentLerpTime=0,this._cameraMoving=!0)},e.prototype.shake=function(t,e,i){this._isShaking=!0,this._shakeMagnitudeX=t,this._shakeMagnitudeY=e,this._shakeDuration=i},e.prototype.zoom=function(t,e){void 0===e&&(e=0),this._isZooming=!0,this._maxZoomScale=t,this._zoomDuration=e,e&&(this._zoomIncrement=1e3*(Math.abs(this._maxZoomScale-this._currentZoomScale)/e)),1>this._maxZoomScale?e?this._zoomIncrement=-1*this._zoomIncrement:(this._isZooming=!1,this._setCurrentZoomScale(this._maxZoomScale)):e||(this._isZooming=!1,this._setCurrentZoomScale(this._maxZoomScale))},e.prototype.getZoom=function(){return this.z},e.prototype._setCurrentZoomScale=function(t){this.z=t},e.prototype.update=function(t,e){this.x+=this.dx*e/1e3,this.y+=this.dy*e/1e3,this.z+=this.dz*e/1e3,this.dx+=this.ax*e/1e3,this.dy+=this.ay*e/1e3,this.dz+=this.az*e/1e3,this.rotation+=this.rx*e/1e3;var i=this.getFocus(),n=0,s=0,o=t.canvas.width,r=t.canvas.height,h=o/this.getZoom(),a=r/this.getZoom();this.lerp&&(this._currentLerpTime=this._shakeDuration},e.prototype._isDoneZooming=function(){return 0!==this._zoomDuration?this._elapsedZoomTime>=this._zoomDuration:1>this._maxZoomScale?this._currentZoomScale<=this._maxZoomScale:this._currentZoomScale>=this._maxZoomScale},e}();t.BaseCamera=e;var i=function(e){function i(){e.apply(this,arguments)}return __extends(i,e),i.prototype.getFocus=function(){return this._follow?new t.Point(this._follow.x+this._follow.getWidth()/2,this.focus.y):this.focus},i}(e);t.SideCamera=i;var n=function(e){function i(){e.apply(this,arguments)}return __extends(i,e),i.prototype.getFocus=function(){return this._follow?new t.Point(this._follow.x+this._follow.getWidth()/2,this._follow.y+this._follow.getHeight()/2):this.focus},i}(e);t.LockedCamera=n})(ex||(ex={}));var ex;(function(t){(function(t){t[t.ShortestPath=0]="ShortestPath",t[t.LongestPath=1]="LongestPath",t[t.Clockwise=2]="Clockwise",t[t.CounterClockwise=3]="CounterClockwise"})(t.RotationType||(t.RotationType={})),t.RotationType})(ex||(ex={}));var ex;(function(t){var e;(function(e){var i;(function(e){var i=function(){function e(e,i,n,s,o){this.actor=e,this.easingFcn=o,this._currentLerpTime=0,this._lerpDuration=1e3,this._lerpStart=new t.Point(0,0),this._lerpEnd=new t.Point(0,0),this._initialized=!1,this._stopped=!1,this._distance=0,this._lerpDuration=s,this._lerpEnd=new t.Point(i,n)}return e.prototype._initialize=function(){this._lerpStart=new t.Point(this.actor.x,this.actor.y),this._currentLerpTime=0,this._distance=this._lerpStart.toVector().distance(this._lerpEnd.toVector())},e.prototype.update=function(t){this._initialized||(this._initialize(),this._initialized=!0);var e=this.actor.x,i=this.actor.y;this._currentLerpTime=this._distance},e.prototype.reset=function(){this._initialized=!1},e.prototype.stop=function(){this._stopped=!0},e}();e.EaseTo=i;var n=function(){function e(e,i,n,s){this._started=!1,this._stopped=!1,this._actor=e,this._end=new t.Vector(i,n),this._speed=s}return e.prototype.update=function(){this._started||(this._started=!0,this._start=new t.Vector(this._actor.x,this._actor.y),this._distance=this._start.distance(this._end),this._dir=this._end.minus(this._start).normalize());var e=this._dir.scale(this._speed);this._actor.dx=e.x,this._actor.dy=e.y,this.isComplete(this._actor)&&(this._actor.x=this._end.x,this._actor.y=this._end.y,this._actor.dy=0,this._actor.dx=0)},e.prototype.isComplete=function(e){return this._stopped||new t.Vector(e.x,e.y).distance(this._start)>=this._distance},e.prototype.stop=function(){this._actor.dy=0,this._actor.dx=0,this._stopped=!0},e.prototype.reset=function(){this._started=!1},e}();e.MoveTo=n;var s=function(){function e(e,i,n,s){if(this._started=!1,this._stopped=!1,this._actor=e,this._end=new t.Vector(i,n),0>=s)throw t.Logger.getInstance().error("Attempted to moveBy time less than or equal to zero : "+s),Error("Cannot move in time <= 0");this._time=s}return e.prototype.update=function(){this._started||(this._started=!0,this._start=new t.Vector(this._actor.x,this._actor.y),this._distance=this._start.distance(this._end),this._dir=this._end.minus(this._start).normalize(),this._speed=this._distance/(this._time/1e3));var e=this._dir.scale(this._speed);this._actor.dx=e.x,this._actor.dy=e.y,this.isComplete(this._actor)&&(this._actor.x=this._end.x,this._actor.y=this._end.y,this._actor.dy=0,this._actor.dx=0)},e.prototype.isComplete=function(e){return this._stopped||new t.Vector(e.x,e.y).distance(this._start)>=this._distance},e.prototype.stop=function(){this._actor.dy=0,this._actor.dx=0,this._stopped=!0},e.prototype.reset=function(){this._started=!1},e}();e.MoveBy=s;var o=function(){function e(e,i,n){this._started=!1,this._stopped=!1,this._actor=e,this._actorToFollow=i,this._current=new t.Vector(this._actor.x,this._actor.y),this._end=new t.Vector(i.x,i.y),this._maximumDistance=void 0!==n?n:this._current.distance(this._end),this._speed=0}return e.prototype.update=function(){this._started||(this._started=!0,this._distanceBetween=this._current.distance(this._end),this._dir=this._end.minus(this._current).normalize());var t=Math.sqrt(Math.pow(this._actorToFollow.dx,2)+Math.pow(this._actorToFollow.dy,2));if(0!==t&&(this._speed=t),this._current.x=this._actor.x,this._current.y=this._actor.y,this._end.x=this._actorToFollow.x,this._end.y=this._actorToFollow.y,this._distanceBetween=this._current.distance(this._end),this._dir=this._end.minus(this._current).normalize(),this._distanceBetween>=this._maximumDistance){var e=this._dir.scale(this._speed);this._actor.dx=e.x,this._actor.dy=e.y}else this._actor.dx=0,this._actor.dy=0;this.isComplete(this._actor)&&(this._actor.x=this._end.x,this._actor.y=this._end.y,this._actor.dy=0,this._actor.dx=0)},e.prototype.stop=function(){this._actor.dy=0,this._actor.dx=0,this._stopped=!0},e.prototype.isComplete=function(){return this._stopped},e.prototype.reset=function(){this._started=!1},e}();e.Follow=o;var r=function(){function e(e,i,n){this._started=!1,this._stopped=!1,this._speedWasSpecified=!1,this._actor=e,this._actorToMeet=i,this._current=new t.Vector(this._actor.x,this._actor.y),this._end=new t.Vector(i.x,i.y),this._speed=n||0,void 0!==n&&(this._speedWasSpecified=!0)}return e.prototype.update=function(){this._started||(this._started=!0,this._distanceBetween=this._current.distance(this._end),this._dir=this._end.minus(this._current).normalize());var t=Math.sqrt(Math.pow(this._actorToMeet.dx,2)+Math.pow(this._actorToMeet.dy,2));0===t||this._speedWasSpecified||(this._speed=t),this._current.x=this._actor.x,this._current.y=this._actor.y,this._end.x=this._actorToMeet.x,this._end.y=this._actorToMeet.y,this._distanceBetween=this._current.distance(this._end),this._dir=this._end.minus(this._current).normalize();var e=this._dir.scale(this._speed);this._actor.dx=e.x,this._actor.dy=e.y,this.isComplete(this._actor)&&(this._actor.x=this._end.x,this._actor.y=this._end.y,this._actor.dy=0,this._actor.dx=0)},e.prototype.isComplete=function(){return this._stopped||1>=this._distanceBetween},e.prototype.stop=function(){this._actor.dy=0,this._actor.dx=0,this._stopped=!0},e.prototype.reset=function(){this._started=!1},e}();e.Meet=r;var h=function(){function e(e,i,n,s){this._started=!1,this._stopped=!1,this._actor=e,this._end=i,this._speed=n,this._rotationType=s||t.RotationType.ShortestPath}return e.prototype.update=function(){if(!this._started){this._started=!0,this._start=this._actor.rotation;var e=Math.abs(this._end-this._start),i=t.Util.TwoPI-e;switch(e>i?(this._shortDistance=i,this._longDistance=e):(this._shortDistance=e,this._longDistance=i),this._shortestPathIsPositive=(this._start-this._end+t.Util.TwoPI)%t.Util.TwoPI>=Math.PI,this._rotationType){case t.RotationType.ShortestPath:this._distance=this._shortDistance,this._direction=this._shortestPathIsPositive?1:-1;break;case t.RotationType.LongestPath:this._distance=this._longDistance,this._direction=this._shortestPathIsPositive?-1:1;break;case t.RotationType.Clockwise:this._direction=1,this._distance=this._shortestPathIsPositive?this._shortDistance:this._longDistance;break;case t.RotationType.CounterClockwise:this._direction=-1,this._distance=this._shortestPathIsPositive?this._longDistance:this._shortDistance}}this._actor.rx=this._direction*this._speed,this.isComplete(this._actor)&&(this._actor.rotation=this._end,this._actor.rx=0,this._stopped=!0)},e.prototype.isComplete=function(){var t=Math.abs(this._actor.rotation-this._start);return this._stopped||t>=Math.abs(this._distance)},e.prototype.stop=function(){this._actor.rx=0,this._stopped=!0},e.prototype.reset=function(){this._started=!1},e}();e.RotateTo=h;var a=function(){function e(e,i,n,s){this._started=!1,this._stopped=!1,this._actor=e,this._end=i,this._time=n,this._rotationType=s||t.RotationType.ShortestPath}return e.prototype.update=function(){if(!this._started){this._started=!0,this._start=this._actor.rotation;var e=Math.abs(this._end-this._start),i=t.Util.TwoPI-e;switch(e>i?(this._shortDistance=i,this._longDistance=e):(this._shortDistance=e,this._longDistance=i),this._shortestPathIsPositive=(this._start-this._end+t.Util.TwoPI)%t.Util.TwoPI>=Math.PI,this._rotationType){case t.RotationType.ShortestPath:this._distance=this._shortDistance,this._direction=this._shortestPathIsPositive?1:-1;break;case t.RotationType.LongestPath:this._distance=this._longDistance,this._direction=this._shortestPathIsPositive?-1:1;break;case t.RotationType.Clockwise:this._direction=1,this._distance=this._shortDistance>=0?this._shortDistance:this._longDistance;break;case t.RotationType.CounterClockwise:this._direction=-1,this._distance=0>=this._shortDistance?this._shortDistance:this._longDistance}this._speed=Math.abs(1e3*(this._distance/this._time))}this._actor.rx=this._direction*this._speed,this.isComplete(this._actor)&&(this._actor.rotation=this._end,this._actor.rx=0,this._stopped=!0)},e.prototype.isComplete=function(){var t=Math.abs(this._actor.rotation-this._start);return this._stopped||t>=Math.abs(this._distance)},e.prototype.stop=function(){this._actor.rx=0,this._stopped=!0},e.prototype.reset=function(){this._started=!1},e}();e.RotateBy=a;var c=function(){function t(t,e,i,n,s){this._started=!1,this._stopped=!1,this._actor=t,this._endX=e,this._endY=i,this._speedX=n,this._speedY=s}return t.prototype.update=function(){if(this._started||(this._started=!0,this._startX=this._actor.scale.x,this._startY=this._actor.scale.y,this._distanceX=Math.abs(this._endX-this._startX),this._distanceY=Math.abs(this._endY-this._startY)),Math.abs(this._actor.scale.x-this._startX)>=this._distanceX)this._actor.sx=0;else{var t=this._endY=this._distanceY)this._actor.sy=0;else{var e=this._endY=this._distanceX&&Math.abs(this._actor.scale.y-this._startY)>=this._distanceY},t.prototype.stop=function(){this._actor.sx=0,this._actor.sy=0,this._stopped=!0},t.prototype.reset=function(){this._started=!1},t}();e.ScaleTo=c;var u=function(){function t(t,e,i,n){this._started=!1,this._stopped=!1,this._actor=t,this._endX=e,this._endY=i,this._time=n,this._speedX=1e3*((this._endX-this._actor.scale.x)/n),this._speedY=1e3*((this._endY-this._actor.scale.y)/n)}return t.prototype.update=function(){this._started||(this._started=!0,this._startX=this._actor.scale.x,this._startY=this._actor.scale.y,this._distanceX=Math.abs(this._endX-this._startX),this._distanceY=Math.abs(this._endY-this._startY));var t=this._endX=this._distanceX&&Math.abs(this._actor.scale.y-this._startY)>=this._distanceY},t.prototype.stop=function(){this._actor.sx=0,this._actor.sy=0,this._stopped=!0},t.prototype.reset=function(){this._started=!1},t}();e.ScaleBy=u;var l=function(){function t(t,e){this._elapsedTime=0,this._started=!1,this._stopped=!1,this._actor=t,this._delay=e}return t.prototype.update=function(t){this._started||(this._started=!0),this.x=this._actor.x,this.y=this._actor.y,this._elapsedTime+=t},t.prototype.isComplete=function(){return this._stopped||this._elapsedTime>=this._delay},t.prototype.stop=function(){this._stopped=!0},t.prototype.reset=function(){this._elapsedTime=0,this._started=!1},t}();e.Delay=l;var p=function(){function t(t,e,i,n){void 0===n&&(n=1),this._timeVisible=0,this._timeNotVisible=0,this._elapsedTime=0,this._totalTime=0,this._stopped=!1,this._started=!1,this._actor=t,this._timeVisible=e,this._timeNotVisible=i,this._duration=(e+i)*n}return t.prototype.update=function(t){this._started||(this._started=!0),this._elapsedTime+=t,this._totalTime+=t,this._actor.visible&&this._elapsedTime>=this._timeVisible&&(this._actor.visible=!1,this._elapsedTime=0),!this._actor.visible&&this._elapsedTime>=this._timeNotVisible&&(this._actor.visible=!0,this._elapsedTime=0),this.isComplete(this._actor)&&(this._actor.visible=!0)},t.prototype.isComplete=function(){return this._stopped||this._totalTime>=this._duration},t.prototype.stop=function(){this._actor.visible=!0,this._stopped=!0},t.prototype.reset=function(){this._started=!1,this._elapsedTime=0,this._totalTime=0},t}();e.Blink=p;var d=function(){function e(t,e,i){this._multiplyer=1,this._started=!1,this._stopped=!1,this._actor=t,this._endOpacity=e,this._speed=i,t.opacity>e&&(this._multiplyer=-1)}return e.prototype.update=function(e){this._started||(this._started=!0),this._speed>0&&(this._actor.opacity+=this._multiplyer*Math.abs(this._actor.opacity-this._endOpacity)*e/this._speed),this._speed-=e,t.Logger.getInstance().debug("actor opacity: "+this._actor.opacity),this.isComplete(this._actor)&&(this._actor.opacity=this._endOpacity)},e.prototype.isComplete=function(){return this._stopped||.05>Math.abs(this._actor.opacity-this._endOpacity)},e.prototype.stop=function(){this._stopped=!0},e.prototype.reset=function(){this._started=!1},e}();e.Fade=d;var f=function(){function t(t){this._started=!1,this._stopped=!1,this._actor=t}return t.prototype.update=function(){this._actor.actionQueue.clearActions(),this._actor.kill(),this._stopped=!0},t.prototype.isComplete=function(){return this._stopped},t.prototype.stop=function(){},t.prototype.reset=function(){},t}();e.Die=f;var g=function(){function t(t,e){this._method=null,this._actor=null,this._hasBeenCalled=!1,this._actor=t,this._method=e}return t.prototype.update=function(){this._method.call(this._actor),this._hasBeenCalled=!0},t.prototype.isComplete=function(){return this._hasBeenCalled},t.prototype.reset=function(){this._hasBeenCalled=!1},t.prototype.stop=function(){this._hasBeenCalled=!0},t}();e.CallMethod=g;var _=function(){function t(t,e,i){this._stopped=!1,this._actor=t,this._actionQueue=new A(t),this._repeat=e,this._originalRepeat=e;var n=0,s=i.length;for(n;s>n;n++)i[n].reset(),this._actionQueue.add(i[n])}return t.prototype.update=function(t){this.x=this._actor.x,this.y=this._actor.y,this._actionQueue.hasNext()||(this._actionQueue.reset(),this._repeat--),this._actionQueue.update(t)},t.prototype.isComplete=function(){return this._stopped||0>=this._repeat},t.prototype.stop=function(){this._stopped=!0},t.prototype.reset=function(){this._repeat=this._originalRepeat},t}();e.Repeat=_;var y=function(){function t(t,e){this._stopped=!1,this._actor=t,this._actionQueue=new A(t);var i=0,n=e.length;for(i;n>i;i++)e[i].reset(),this._actionQueue.add(e[i])}return t.prototype.update=function(t){this.x=this._actor.x,this.y=this._actor.y,this._stopped||(this._actionQueue.hasNext()||this._actionQueue.reset(),this._actionQueue.update(t))},t.prototype.isComplete=function(){return this._stopped},t.prototype.stop=function(){this._stopped=!0,this._actionQueue.clearActions()},t.prototype.reset=function(){},t}();e.RepeatForever=y;var A=function(){function t(t){this._actions=[],this._completedActions=[],this._actor=t}return t.prototype.add=function(t){this._actions.push(t)},t.prototype.remove=function(t){var e=this._actions.indexOf(t);this._actions.splice(e,1)},t.prototype.clearActions=function(){this._actions.length=0,this._completedActions.length=0,this._currentAction&&this._currentAction.stop()},t.prototype.getActions=function(){return this._actions.concat(this._completedActions)},t.prototype.hasNext=function(){return this._actions.length>0},t.prototype.reset=function(){this._actions=this.getActions();var t=0,e=this._actions.length;for(t;e>t;t++)this._actions[t].reset();this._completedActions=[]},t.prototype.update=function(t){this._actions.length>0&&(this._currentAction=this._actions[0],this._currentAction.update(t),this._currentAction.isComplete(this._actor)&&this._completedActions.push(this._actions.shift()))},t}();e.ActionQueue=A})(i=e.Actions||(e.Actions={}))})(e=t.Internal||(t.Internal={}))})(ex||(ex={}));var ex;(function(t){var e=function(){function e(){this._actors=[],this._queues=[],null!==arguments&&(this._actors=Array.prototype.slice.call(arguments,0),this._queues=this._actors.map(function(t){return t.actionQueue}))}return e.prototype.clearActions=function(){var t=0,e=this._queues.length;for(t;e>t;t++)this._queues[t].clearActions()},e.prototype.addActorToContext=function(t){this._actors.push(t),this._queues.push(t.actionQueue)},e.prototype.removeActorFromContext=function(t){var e=this._actors.indexOf(t);e>-1&&(this._actors.splice(e,1),this._queues.splice(e,1))},e.prototype.easeTo=function(e,i,n,s){void 0===s&&(s=t.EasingFunctions.Linear);var o=0,r=this._queues.length;for(o;r>o;o++)this._queues[o].add(new t.Internal.Actions.EaseTo(this._actors[o],e,i,n,s));return this},e.prototype.moveTo=function(e,i,n){var s=0,o=this._queues.length;for(s;o>s;s++)this._queues[s].add(new t.Internal.Actions.MoveTo(this._actors[s],e,i,n));return this},e.prototype.moveBy=function(e,i,n){var s=0,o=this._queues.length;for(s;o>s;s++)this._queues[s].add(new t.Internal.Actions.MoveBy(this._actors[s],e,i,n));return this},e.prototype.rotateTo=function(e,i,n){var s=0,o=this._queues.length;for(s;o>s;s++)this._queues[s].add(new t.Internal.Actions.RotateTo(this._actors[s],e,i,n));return this},e.prototype.rotateBy=function(e,i,n){var s=0,o=this._queues.length;for(s;o>s;s++)this._queues[s].add(new t.Internal.Actions.RotateBy(this._actors[s],e,i,n));return this},e.prototype.scaleTo=function(e,i,n,s){var o=0,r=this._queues.length;for(o;r>o;o++)this._queues[o].add(new t.Internal.Actions.ScaleTo(this._actors[o],e,i,n,s));return this},e.prototype.scaleBy=function(e,i,n){var s=0,o=this._queues.length;for(s;o>s;s++)this._queues[s].add(new t.Internal.Actions.ScaleBy(this._actors[s],e,i,n));return this},e.prototype.blink=function(e,i,n){void 0===n&&(n=1);var s=0,o=this._queues.length;for(s;o>s;s++)this._queues[s].add(new t.Internal.Actions.Blink(this._actors[s],e,i,n));return this},e.prototype.fade=function(e,i){var n=0,s=this._queues.length;for(n;s>n;n++)this._queues[n].add(new t.Internal.Actions.Fade(this._actors[n],e,i));return this},e.prototype.delay=function(e){var i=0,n=this._queues.length;for(i;n>i;i++)this._queues[i].add(new t.Internal.Actions.Delay(this._actors[i],e));return this},e.prototype.die=function(){var e=0,i=this._queues.length;for(e;i>e;e++)this._queues[e].add(new t.Internal.Actions.Die(this._actors[e]));return this},e.prototype.callMethod=function(e){var i=0,n=this._queues.length;for(i;n>i;i++)this._queues[i].add(new t.Internal.Actions.CallMethod(this._actors[i],e));return this},e.prototype.repeat=function(e){if(!e)return this.repeatForever(),this;var i=0,n=this._queues.length;for(i;n>i;i++)this._queues[i].add(new t.Internal.Actions.Repeat(this._actors[i],e,this._actors[i].actionQueue.getActions())); -return this},e.prototype.repeatForever=function(){var e=0,i=this._queues.length;for(e;i>e;e++)this._queues[e].add(new t.Internal.Actions.RepeatForever(this._actors[e],this._actors[e].actionQueue.getActions()));return this},e.prototype.follow=function(e,i){var n=0,s=this._queues.length;for(n;s>n;n++)void 0===i?this._queues[n].add(new t.Internal.Actions.Follow(this._actors[n],e)):this._queues[n].add(new t.Internal.Actions.Follow(this._actors[n],e,i));return this},e.prototype.meet=function(e,i){var n=0,s=this._queues.length;for(n;s>n;n++)void 0===i?this._queues[n].add(new t.Internal.Actions.Meet(this._actors[n],e)):this._queues[n].add(new t.Internal.Actions.Meet(this._actors[n],e,i));return this},e.prototype.asPromise=function(){var e=this,i=this._queues.map(function(i,n){var s=new t.Promise;return i.add(new t.Internal.Actions.CallMethod(e._actors[n],function(){s.resolve()})),s});return t.Promise.join.apply(this,i)},e}();t.ActionContext=e})(ex||(ex={}));var ex;(function(t){var e=function(e){function i(i,n){if(e.call(this),this.name=i,this.scene=n,this._logger=t.Logger.getInstance(),this._members=[],this.actions=new t.ActionContext,null==n)this._logger.error("Invalid constructor arguments passed to Group: ",i,", scene must not be null!");else{var s=n.groups[i];s&&this._logger.warn("Group with name",i,"already exists. This new group will replace it."),n.groups[i]=this}}return __extends(i,e),i.prototype.add=function(e){e instanceof t.Actor&&(e=[].concat(e));var i,n=0,s=e.length;for(n;s>n;n++)i=this.getMembers().indexOf(e[n]),-1===i&&(this._members.push(e[n]),this.scene.add(e[n]),this.actions.addActorToContext(e[n]),this.eventDispatcher.wire(e[n].eventDispatcher))},i.prototype.remove=function(t){var e=this._members.indexOf(t);e>-1&&(this._members.splice(e,1),this.actions.removeActorFromContext(t),this.eventDispatcher.unwire(t.eventDispatcher))},i.prototype.move=function(e){var i=0,n=this.getMembers(),s=n.length;if(1===arguments.length&&e instanceof t.Vector)for(i;s>i;i++)n[i].x+=e.x,n[i].y+=e.y;else if("number"==typeof arguments[0]&&"number"==typeof arguments[1]){var o=arguments[0],r=arguments[1];for(i;s>i;i++)n[i].x+=o,n[i].y+=r}else this._logger.error("Invalid arguments passed to group move",this.name,"args:",arguments)},i.prototype.rotate=function(){if("number"==typeof arguments[0]){var t=arguments[0],e=0,i=this.getMembers(),n=i.length;for(e;n>e;e++)i[e].rotation+=t}else this._logger.error("Invalid arguments passed to group rotate",this.name,"args:",arguments)},i.prototype.on=function(t,e){this.eventDispatcher.subscribe(t,e)},i.prototype.off=function(t,e){this.eventDispatcher.unsubscribe(t,e)},i.prototype.emit=function(t,e){this.eventDispatcher.emit(t,e)},i.prototype.contains=function(t){return this.getMembers().indexOf(t)>-1},i.prototype.getMembers=function(){return this._members},i.prototype.getRandomMember=function(){return this._members[Math.floor(Math.random()*this._members.length)]},i.prototype.getBounds=function(){return this.getMembers().map(function(t){return t.getBounds()}).reduce(function(t,e){return t.combine(e)})},i}(t.Class);t.Group=e})(ex||(ex={}));var ex;(function(t){var e=function(){function t(t){this._getComparable=t}return t.prototype.find=function(t){return this._find(this._root,t)},t.prototype._find=function(t,e){return null==t?!1:this._getComparable.call(e)===t.getKey()?t.getData().indexOf(e)>-1?!0:!1:this._getComparable.call(e)e?this._get(t.getLeft(),e):this._get(t.getRight(),e)},t.prototype.add=function(t){return null==this._root?(this._root=new i(this._getComparable.call(t),[t],null,null),!0):this._insert(this._root,t)},t.prototype._insert=function(t,e){return null!=t?this._getComparable.call(e)===t.getKey()?t.getData().indexOf(e)>-1?!1:(t.getData().push(e),!0):this._getComparable.call(e)-1){if(t.getData().splice(i,1),0===t.getData().length){if(null==t.getLeft()&&null==t.getRight())return null;if(null==t.getLeft())return t.getRight();if(null==t.getRight())return t.getLeft();var n=this._findMinNode(t.getRight());return t.setKey(n.getKey()),t.setData(n.getData()),t.setRight(this._cleanup(t.getRight(),n)),t}return t}},t.prototype._cleanup=function(t,e){var i=e.getKey();if(null==t)return null;if(i===t.getKey()){if(null==t.getLeft()&&null==t.getRight())return null;if(null==t.getLeft())return t.getRight();if(null==t.getRight())return t.getLeft();var n=this._findMinNode(t.getRight());return t.setKey(n.getKey()),t.setData(n.getData()),t.setRight(this._cleanup(t.getRight(),n)),t}return this._getComparable.call(e)n;n++)this.uiActors[n].update(e,i);for(n=0,s=this.tileMaps.length;s>n;n++)this.tileMaps[n].update(e,i);for(n=0,s=this.children.length;s>n;n++)this.children[n].update(e,i);this._collisionResolver&&(this._collisionResolver.update(this.children),this._collisionResolver.evaluate(this.children));var o;for(n=0,s=this._killQueue.length;s>n;n++)o=this.children.indexOf(this._killQueue[n]),o>-1&&(this._sortedDrawingTree.removeByComparable(this._killQueue[n]),this.children.splice(o,1));for(this._killQueue.length=0,n=0,s=this._cancelQueue.length;s>n;n++)this.removeTimer(this._cancelQueue[n]);this._cancelQueue.length=0,this._timers=this._timers.filter(function(t){return t.update(i),!t.complete}),this.emit("postupdate",new t.PostUpdateEvent(e,i,this))},i.prototype.draw=function(e,i){this.emit("predraw",new t.PreDrawEvent(e,i,this)),e.save(),this.camera&&this.camera.update(e,i);var n,s;for(n=0,s=this.tileMaps.length;s>n;n++)this.tileMaps[n].draw(e,i);var o=this._sortedDrawingTree.list();for(n=0,s=o.length;s>n;n++)o[n].visible&&!o[n].isOffScreen&&o[n].draw(e,i);for(this.engine&&this.engine.isDebug&&(e.strokeStyle="yellow",this.debugDraw(e)),e.restore(),n=0,s=this.uiActors.length;s>n;n++)this.uiActors[n].visible&&this.uiActors[n].draw(e,i);if(this.engine&&this.engine.isDebug)for(n=0,s=this.uiActors.length;s>n;n++)this.uiActors[n].debugDraw(e);this.emit("postdraw",new t.PreDrawEvent(e,i,this))},i.prototype.debugDraw=function(e){this.emit("predebugdraw",new t.PreDebugDrawEvent(e,this));var i,n;for(i=0,n=this.tileMaps.length;n>i;i++)this.tileMaps[i].debugDraw(e);for(i=0,n=this.children.length;n>i;i++)this.children[i].debugDraw(e);this.camera.debugDraw(e),this.emit("postdebugdraw",new t.PostDebugDrawEvent(e,this))},i.prototype.contains=function(t){return this.children.indexOf(t)>-1},i.prototype.add=function(e){return e instanceof t.UIActor?(t.Util.contains(this.uiActors,e)||this.addUIActor(e),void 0):e instanceof t.Actor?(t.Util.contains(this.children,e)||(this.addChild(e),this._sortedDrawingTree.add(e)),void 0):e instanceof t.Timer?(t.Util.contains(this._timers,e)||this.addTimer(e),void 0):(e instanceof t.TileMap&&(t.Util.contains(this.tileMaps,e)||this.addTileMap(e)),void 0)},i.prototype.remove=function(e){return e instanceof t.UIActor?(this.removeUIActor(e),void 0):(e instanceof t.Actor&&(this._collisionResolver.remove(e),this.removeChild(e)),e instanceof t.Timer&&this.removeTimer(e),e instanceof t.TileMap&&this.removeTileMap(e),void 0)},i.prototype.addUIActor=function(t){this.uiActors.push(t),t.scene=this},i.prototype.removeUIActor=function(t){var e=this.uiActors.indexOf(t);e>-1&&this.uiActors.splice(e,1)},i.prototype.addChild=function(t){this._collisionResolver.register(t),t.scene=this,this.children.push(t),this._sortedDrawingTree.add(t),t.parent=this.actor},i.prototype.addTileMap=function(t){this.tileMaps.push(t)},i.prototype.removeTileMap=function(t){var e=this.tileMaps.indexOf(t);e>-1&&this.tileMaps.splice(e,1)},i.prototype.removeChild=function(t){this._collisionResolver.remove(t),this._killQueue.push(t),t.parent=null},i.prototype.addTimer=function(t){return this._timers.push(t),t.scene=this,t},i.prototype.removeTimer=function(t){var e=this._timers.indexOf(t);return-1!==e&&this._timers.splice(e,1),t},i.prototype.cancelTimer=function(t){return this._cancelQueue.push(t),t},i.prototype.isTimerActive=function(t){return this._timers.indexOf(t)>-1},i.prototype.createGroup=function(e){return new t.Group(e,this)},i.prototype.getGroup=function(t){return this.groups[t]},i.prototype.removeGroup=function(e){"string"==typeof e?delete this.groups[e]:e instanceof t.Group?delete this.groups[e.name]:this._logger.error("Invalid arguments to removeGroup",e)},i.prototype.cleanupDrawTree=function(t){this._sortedDrawingTree.removeByComparable(t)},i.prototype.updateDrawTree=function(t){this._sortedDrawingTree.add(t)},i}(t.Class);t.Scene=e})(ex||(ex={}));var ex;(function(t){var e=function(){function t(){}return t.Linear=function(t,e,i,n){return i-=e,i*t/n+e},t.EaseInQuad=function(t,e,i,n){t/=n},t.EaseOutQuad=function(t,e,i,n){return t/=n,-i*t*(t-2)+e},t.EaseInOutQuad=function(t,e,i,n){return i-=e,t/=n/2,1>t?i/2*t*t+e:(t--,-i/2*(t*(t-2)-1)+e)},t.EaseInCubic=function(t,e,i,n){return i-=e,t/=n,i*t*t*t+e},t.EaseOutCubic=function(t,e,i,n){return i-=e,t/=n,i*(t*t*t+1)+e},t.EaseInOutCubic=function(t,e,i,n){return i-=e,t/=n/2,1>t?i/2*t*t*t+e:(t-=2,i/2*(t*t*t+2)+e)},t}();t.EasingFunctions=e})(ex||(ex={}));var ex;(function(t){var e=function(e){function n(s,o,r,h,a){e.call(this),this.id=n.maxId++,this.x=0,this.y=0,this._height=0,this._width=0,this.rotation=0,this.rx=0,this.scale=new t.Vector(1,1),this.sx=0,this.sy=0,this.dx=0,this.dy=0,this.ax=0,this.ay=0,this.isOffScreen=!1,this.visible=!0,this.opacity=1,this.previousOpacity=1,this.logger=t.Logger.getInstance(),this.scene=null,this.parent=null,this.children=[],this.collisionType=i.PreventCollision,this.collisionGroups=[],this._collisionHandlers={},this._isInitialized=!1,this.frames={},this.currentDrawing=null,this.centerDrawingX=!0,this.centerDrawingY=!0,this.traits=[],this.enableCapturePointer=!1,this.capturePointer={captureMoveEvents:!1},this._zIndex=0,this._isKilled=!1,this.x=s||0,this.y=o||0,this._width=r||0,this._height=h||0,a&&(this.color=a.clone(),this.opacity=a.a),this.traits.push(new t.Traits.Movement),this.traits.push(new t.Traits.CollisionDetection),this.traits.push(new t.Traits.OffscreenCulling),this.traits.push(new t.Traits.CapturePointer),this.actionQueue=new t.Internal.Actions.ActionQueue(this),this.actions=new t.ActionContext(this),this.anchor=new t.Point(.5,.5)}return __extends(n,e),n.prototype.onInitialize=function(){},n.prototype._checkForPointerOptIn=function(t){!t||"pointerdown"!==t.toLowerCase()&&"pointerdown"!==t.toLowerCase()&&"pointermove"!==t.toLowerCase()||(this.enableCapturePointer=!0,"pointermove"===t.toLowerCase()&&(this.capturePointer.captureMoveEvents=!0))},n.prototype.addEventListener=function(t,i){this._checkForPointerOptIn(t),e.prototype.addEventListener.call(this,t,i)},n.prototype.on=function(t,e){this._checkForPointerOptIn(t),this.eventDispatcher.subscribe(t,e)},n.prototype.kill=function(){this.scene?(this.emit("kill",new t.KillEvent(this)),this.scene.remove(this),this._isKilled=!0):this.logger.warn("Cannot kill actor, it was never added to the Scene")},n.prototype.isKilled=function(){return this._isKilled},n.prototype.add=function(e){e.collisionType=i.PreventCollision,t.Util.addItemToArray(e,this.children)&&(e.parent=this)},n.prototype.remove=function(e){t.Util.removeItemToArray(e,this.children)&&(e.parent=null)},n.prototype.setDrawing=function(e){e=""+e,this.currentDrawing!==this.frames[e]&&(null!=this.frames[e]?(this.frames[e].reset(),this.currentDrawing=this.frames[e]):t.Logger.getInstance().error("the specified drawing key '"+e+"' does not exist"))},n.prototype.addDrawing=function(){2===arguments.length?(this.frames[arguments[0]]=arguments[1],this.currentDrawing||(this.currentDrawing=arguments[1])):(arguments[0]instanceof t.Sprite&&this.addDrawing("default",arguments[0]),arguments[0]instanceof t.Texture&&this.addDrawing("default",arguments[0].asSprite()))},n.prototype.getZIndex=function(){return this._zIndex},n.prototype.setZIndex=function(t){this.scene.cleanupDrawTree(this),this._zIndex=t,this.scene.updateDrawTree(this)},n.prototype.addCollisionGroup=function(t){this.collisionGroups.push(t)},n.prototype.removeCollisionGroup=function(t){var e=this.collisionGroups.indexOf(t);-1!==e&&this.collisionGroups.splice(e,1)},n.prototype.getCenter=function(){return new t.Vector(this.x+this.getWidth()/2-this.anchor.x*this.getWidth(),this.y+this.getHeight()/2-this.anchor.y*this.getHeight())},n.prototype.getWidth=function(){return this._width*this.scale.x},n.prototype.setWidth=function(t){this._width=t/this.scale.x},n.prototype.getHeight=function(){return this._height*this.scale.y},n.prototype.setHeight=function(t){this._height=t/this.scale.y},n.prototype.setCenterDrawing=function(t){this.centerDrawingY=t,this.centerDrawingX=t},n.prototype.getLeft=function(){return this.getBounds().left},n.prototype.getRight=function(){return this.getBounds().right},n.prototype.getTop=function(){return this.getBounds().top},n.prototype.getBottom=function(){return this.getBounds().bottom},n.prototype.getWorldX=function(){return this.parent?this.x*this.parent.scale.x+this.parent.getWorldX():this.x},n.prototype.getWorldY=function(){return this.parent?this.y*this.parent.scale.y+this.parent.getWorldY():this.y},n.prototype.getGlobalScale=function(){if(!this.parent)return new t.Point(this.scale.x,this.scale.y);var e=this.parent.getGlobalScale();return new t.Point(this.scale.x*e.x,this.scale.y*e.y)},n.prototype.getBounds=function(){var e=this._getCalculatedAnchor();return new t.BoundingBox(this.getWorldX()-e.x,this.getWorldY()-e.y,this.getWorldX()+this.getWidth()-e.x,this.getWorldY()+this.getHeight()-e.y)},n.prototype.contains=function(e,i,n){void 0===n&&(n=!1);var s=this.getBounds().contains(new t.Point(e,i));return n?s||this.children.some(function(t){return t.contains(e,i,!0)}):s},n.prototype.getSideFromIntersect=function(e){return e?Math.abs(e.x)>Math.abs(e.y)?0>e.x?t.Side.Right:t.Side.Left:0>e.y?t.Side.Bottom:t.Side.Top:t.Side.None},n.prototype.collidesWithSide=function(e){var i=this.collides(e);return i?Math.abs(i.x)>Math.abs(i.y)?this.x=Math.sqrt(Math.pow(this.x-t.x,2)+Math.pow(this.y-t.y,2))},n.prototype.clearActions=function(){this.actionQueue.clearActions()},n.prototype.easeTo=function(e,i,n,s){return void 0===s&&(s=t.EasingFunctions.Linear),this.actionQueue.add(new t.Internal.Actions.EaseTo(this,e,i,n,s)),this},n.prototype.moveTo=function(e,i,n){return this.actionQueue.add(new t.Internal.Actions.MoveTo(this,e,i,n)),this},n.prototype.moveBy=function(e,i,n){return this.actionQueue.add(new t.Internal.Actions.MoveBy(this,e,i,n)),this},n.prototype.rotateTo=function(e,i,n){return this.actionQueue.add(new t.Internal.Actions.RotateTo(this,e,i,n)),this},n.prototype.rotateBy=function(e,i,n){return this.actionQueue.add(new t.Internal.Actions.RotateBy(this,e,i,n)),this},n.prototype.scaleTo=function(e,i,n,s){return this.actionQueue.add(new t.Internal.Actions.ScaleTo(this,e,i,n,s)),this},n.prototype.scaleBy=function(e,i,n){return this.actionQueue.add(new t.Internal.Actions.ScaleBy(this,e,i,n)),this},n.prototype.blink=function(e,i,n){return void 0===n&&(n=1),this.actionQueue.add(new t.Internal.Actions.Blink(this,e,i,n)),this},n.prototype.fade=function(e,i){return this.actionQueue.add(new t.Internal.Actions.Fade(this,e,i)),this},n.prototype.delay=function(e){return this.actionQueue.add(new t.Internal.Actions.Delay(this,e)),this},n.prototype.die=function(){return this.actionQueue.add(new t.Internal.Actions.Die(this)),this},n.prototype.callMethod=function(e){return this.actionQueue.add(new t.Internal.Actions.CallMethod(this,e)),this},n.prototype.repeat=function(e){return e?(this.actionQueue.add(new t.Internal.Actions.Repeat(this,e,this.actionQueue.getActions())),this):(this.repeatForever(),this)},n.prototype.repeatForever=function(){return this.actionQueue.add(new t.Internal.Actions.RepeatForever(this,this.actionQueue.getActions())),this},n.prototype.follow=function(e,i){return i===void 0?this.actionQueue.add(new t.Internal.Actions.Follow(this,e)):this.actionQueue.add(new t.Internal.Actions.Follow(this,e,i)),this},n.prototype.meet=function(e,i){return i===void 0?this.actionQueue.add(new t.Internal.Actions.Meet(this,e)):this.actionQueue.add(new t.Internal.Actions.Meet(this,e,i)),this},n.prototype.asPromise=function(){var e=new t.Promise;return this.callMethod(function(){e.resolve()}),e},n.prototype._getCalculatedAnchor=function(){return new t.Point(this.getWidth()*this.anchor.x,this.getHeight()*this.anchor.y)},n.prototype.update=function(e,i){this._isInitialized||(this.onInitialize(e),this.eventDispatcher.emit("initialize",new t.InitializeEvent(e)),this._isInitialized=!0),this.emit("preupdate",new t.PreUpdateEvent(e,i,this));var n=this.eventDispatcher;this.actionQueue.update(i),this.color&&(this.color.a=this.opacity);for(var s=0;this.traits.length>s;s++)this.traits[s].update(this,e,i);n.emit("update",new t.UpdateEvent(i)),this.emit("postupdate",new t.PostUpdateEvent(e,i,this))},n.prototype.draw=function(e,i){var n=this._getCalculatedAnchor();if(e.save(),e.translate(this.x,this.y),e.scale(this.scale.x,this.scale.y),e.rotate(this.rotation),this.emit("predraw",new t.PreDrawEvent(e,i,this)),this.previousOpacity!==this.opacity){for(var s in this.frames)this.frames[s].addEffect(new t.Effects.Opacity(this.opacity));this.previousOpacity=this.opacity}if(this.currentDrawing){var o=0,r=0;this.centerDrawingX&&(o=(this.currentDrawing.naturalWidth*this.currentDrawing.scale.x-this.getWidth())/2-this.currentDrawing.naturalWidth*this.currentDrawing.scale.x*this.currentDrawing.anchor.x),this.centerDrawingY&&(r=(this.currentDrawing.naturalHeight*this.currentDrawing.scale.y-this.getHeight())/2-this.currentDrawing.naturalHeight*this.currentDrawing.scale.y*this.currentDrawing.anchor.y),this.currentDrawing.draw(e,-n.x-o,-n.y-r)}else this.color&&(e.fillStyle=""+this.color,e.fillRect(-n.x,-n.y,this._width,this._height));for(var h=0;this.children.length>h;h++)this.children[h].visible&&this.children[h].draw(e,i);this.emit("postdraw",new t.PostDrawEvent(e,i,this)),e.restore()},n.prototype.debugDraw=function(e){this.emit("predebugdraw",new t.PreDebugDrawEvent(e,this));var i=this.getBounds();i.debugDraw(e),e.fillText("id: "+this.id,i.left+3,i.top+10),e.fillStyle=""+t.Color.Yellow,e.beginPath(),e.arc(this.getWorldX(),this.getWorldY(),3,0,2*Math.PI),e.closePath(),e.fill();for(var n=0;this.traits.length>n;n++)this.traits[n]instanceof t.Traits.OffscreenCulling&&this.traits[n].cullingBox.debugDraw(e);e.strokeStyle=""+t.Color.Yellow,e.beginPath();var s=Math.min(this.getWidth(),this.getHeight());e.arc(this.getWorldX(),this.getWorldY(),s,0,2*Math.PI),e.closePath(),e.stroke();var o={"0 Pi":0,"Pi/2":Math.PI/2,Pi:Math.PI,"3/2 Pi":3*Math.PI/2},r=e.font;for(var h in o)e.fillStyle=""+t.Color.Yellow,e.font="14px",e.textAlign="center",e.fillText(h,this.getWorldX()+Math.cos(o[h])*(s+10),this.getWorldY()+Math.sin(o[h])*(s+10));e.font=r,e.save(),e.translate(this.x,this.y),e.rotate(this.rotation);for(var a=0;this.children.length>a;a++)this.children[a].debugDraw(e);e.restore(),this.emit("postdebugdraw",new t.PostDebugDrawEvent(e,this))},n.maxId=0,n}(t.Class);t.Actor=e,function(t){t[t.PreventCollision=0]="PreventCollision",t[t.Passive=1]="Passive",t[t.Active=2]="Active",t[t.Elastic=3]="Elastic",t[t.Fixed=4]="Fixed"}(t.CollisionType||(t.CollisionType={}));var i=t.CollisionType})(ex||(ex={}));var ex;(function(t){(function(t){t[t.Debug=0]="Debug",t[t.Info=1]="Info",t[t.Warn=2]="Warn",t[t.Error=3]="Error",t[t.Fatal=4]="Fatal"})(t.LogLevel||(t.LogLevel={}));var e=t.LogLevel,i=function(){function t(){if(this._appenders=[],this.defaultLevel=e.Info,t._instance)throw Error("Logger is a singleton");return t._instance=this,t._instance.addAppender(new n),t._instance}return t.getInstance=function(){return null==t._instance&&(t._instance=new t),t._instance},t.prototype.addAppender=function(t){this._appenders.push(t)},t.prototype.clearAppenders=function(){this._appenders.length=0},t.prototype._log=function(t,e){null==t&&(t=this.defaultLevel);var i=0,n=this._appenders.length;for(i;n>i;i++)t>=this.defaultLevel&&this._appenders[i].log(t,e)},t.prototype.debug=function(){for(var t=[],i=0;arguments.length>i;i++)t[i-0]=arguments[i];this._log(e.Debug,t)},t.prototype.info=function(){for(var t=[],i=0;arguments.length>i;i++)t[i-0]=arguments[i];this._log(e.Info,t)},t.prototype.warn=function(){for(var t=[],i=0;arguments.length>i;i++)t[i-0]=arguments[i];this._log(e.Warn,t)},t.prototype.error=function(){for(var t=[],i=0;arguments.length>i;i++)t[i-0]=arguments[i];this._log(e.Error,t)},t.prototype.fatal=function(){for(var t=[],i=0;arguments.length>i;i++)t[i-0]=arguments[i];this._log(e.Fatal,t)},t._instance=null,t}();t.Logger=i;var n=function(){function t(){}return t.prototype.log=function(t,i){if(console||console.log||!console.warn||!console.error){var n=[];n.unshift.apply(n,i),n.unshift("["+e[t]+"] : "),e.Warn>t?console.log.apply?console.log.apply(console,n):console.log(n.join(" ")):e.Error>t?console.warn.apply?console.warn.apply(console,n):console.warn(n.join(" ")):console.error.apply?console.error.apply(console,n):console.error(n.join(" "))}},t}();t.ConsoleAppender=n;var s=function(){function t(t,e){this._messages=[],this._canvas=document.createElement("canvas"),this._canvas.width=t||window.innerWidth,this._canvas.height=e||window.innerHeight,this._canvas.style.position="absolute",this._ctx=this._canvas.getContext("2d"),document.body.appendChild(this._canvas)}return t.prototype.log=function(t,i){var n=i.join(",");this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._messages.unshift("["+e[t]+"] : "+n);for(var s=10,o=1,r=0;this._messages.length>r;r++)this._ctx.fillStyle="rgba(255,255,255,"+o.toFixed(2)+")",this._ctx.fillText(this._messages[r],200,s),s+=10,o=o>0?o-.05:0},t}();t.ScreenAppender=s})(ex||(ex={}));var ex;(function(t){var e=function(){function t(){}return t}();t.GameEvent=e;var i=function(t){function e(e){t.call(this),this.target=e}return __extends(e,t),e}(e);t.KillEvent=i;var n=function(t){function e(e,i,n){t.call(this),this.ctx=e,this.delta=i,this.target=n}return __extends(e,t),e}(e);t.PreDrawEvent=n;var s=function(t){function e(e,i,n){t.call(this),this.ctx=e,this.delta=i,this.target=n}return __extends(e,t),e}(e);t.PostDrawEvent=s;var o=function(t){function e(e,i){t.call(this),this.ctx=e,this.target=i}return __extends(e,t),e}(e);t.PreDebugDrawEvent=o;var r=function(t){function e(e,i){t.call(this),this.ctx=e,this.target=i}return __extends(e,t),e}(e);t.PostDebugDrawEvent=r;var h=function(t){function e(e,i,n){t.call(this),this.engine=e,this.delta=i,this.target=n}return __extends(e,t),e}(e);t.PreUpdateEvent=h;var a=function(t){function e(e,i,n){t.call(this),this.engine=e,this.delta=i,this.target=n}return __extends(e,t),e}(e);t.PostUpdateEvent=a;var c=function(t){function e(e,i){t.call(this),this.index=e,this.gamepad=i}return __extends(e,t),e}(e);t.GamepadConnectEvent=c;var u=function(t){function e(e){t.call(this),this.index=e}return __extends(e,t),e}(e);t.GamepadDisconnectEvent=u;var l=function(t){function e(e,i){t.call(this),this.button=e,this.value=i}return __extends(e,t),e}(t.GameEvent);t.GamepadButtonEvent=l;var p=function(t){function e(e,i){t.call(this),this.axis=e,this.value=i}return __extends(e,t),e}(t.GameEvent);t.GamepadAxisEvent=p;var d=function(t){function e(e,i){t.call(this),this.topic=e,this.handler=i}return __extends(e,t),e}(e);t.SubscribeEvent=d;var f=function(t){function e(e,i){t.call(this),this.topic=e,this.handler=i}return __extends(e,t),e}(e);t.UnsubscribeEvent=f;var g=function(t){function e(){t.call(this)}return __extends(e,t),e}(e);t.VisibleEvent=g;var _=function(t){function e(){t.call(this)}return __extends(e,t),e}(e);t.HiddenEvent=_;var y=function(t){function e(e,i,n,s){t.call(this),this.actor=e,this.other=i,this.side=n,this.intersection=s}return __extends(e,t),e}(e);t.CollisionEvent=y;var A=function(t){function e(e){t.call(this),this.delta=e}return __extends(e,t),e}(e);t.UpdateEvent=A;var v=function(t){function e(e){t.call(this),this.engine=e}return __extends(e,t),e}(e);t.InitializeEvent=v;var m=function(t){function e(e){t.call(this),this.oldScene=e}return __extends(e,t),e}(e);t.ActivateEvent=m;var x=function(t){function e(e){t.call(this),this.newScene=e}return __extends(e,t),e}(e);t.DeactivateEvent=x;var w=function(t){function e(){t.call(this)}return __extends(e,t),e}(e);t.ExitViewPortEvent=w;var b=function(t){function e(){t.call(this)}return __extends(e,t),e}(e);t.EnterViewPortEvent=b})(ex||(ex={}));var ex;(function(t){var e=function(){function e(e){this._handlers={},this._wiredEventDispatchers=[],this._log=t.Logger.getInstance(),this._target=e}return e.prototype.publish=function(e,i){if(e){e=e.toLowerCase();var n=this._target;i||(i=new t.GameEvent),i.target=n;var s,o;if(this._handlers[e])for(s=0,o=this._handlers[e].length,s;o>s;s++)this._handlers[e][s].call(n,i);for(s=0,o=this._wiredEventDispatchers.length,s;o>s;s++)this._wiredEventDispatchers[s].emit(e,i)}},e.prototype.emit=function(t,e){this.publish(t,e)},e.prototype.subscribe=function(e,i){e=e.toLowerCase(),this._handlers[e]||(this._handlers[e]=[]),this._handlers[e].push(i),"unsubscribe"!==e&&"subscribe"!==e&&this.emit("subscribe",new t.SubscribeEvent(e,i))},e.prototype.unsubscribe=function(e,i){e=e.toLowerCase();var n=this._handlers[e];if(n)if(i){var s=n.indexOf(i);this._handlers[e].splice(s,1)}else this._handlers[e].length=0;"unsubscribe"!==e&&"subscribe"!==e&&this.emit("unsubscribe",new t.UnsubscribeEvent(e,i))},e.prototype.wire=function(t){t._wiredEventDispatchers.push(this)},e.prototype.unwire=function(t){var e=t._wiredEventDispatchers.indexOf(this);e>-1&&t._wiredEventDispatchers.splice(e,1)},e}();t.EventDispatcher=e})(ex||(ex={}));var ex;(function(t){var e=function(){function t(t,e,i,n){this.r=t,this.g=e,this.b=i,this.a=null!=n?n:1}return t.fromRGB=function(e,i,n,s){return new t(e,i,n,s)},t.fromHex=function(e){var i=/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})?$/i,n=null;if(n=e.match(i)){var s=parseInt(n[1],16),o=parseInt(n[2],16),r=parseInt(n[3],16),h=1;return n[4]&&(h=parseInt(n[4],16)/255),new t(s,o,r,h)}throw Error("Invalid hex string: "+e)},t.fromHSL=function(t,e,n,s){void 0===s&&(s=1);var o=new i(t,e,n,s);return o.toRGBA()},t.prototype.lighten=function(t){void 0===t&&(t=.1);var e=i.fromRGBA(this.r,this.g,this.b,this.a);return e.l+=e.l*t,e.toRGBA()},t.prototype.darken=function(t){void 0===t&&(t=.1);var e=i.fromRGBA(this.r,this.g,this.b,this.a);return e.l-=e.l*t,e.toRGBA()},t.prototype.saturate=function(t){void 0===t&&(t=.1);var e=i.fromRGBA(this.r,this.g,this.b,this.a);return e.s+=e.s*t,e.toRGBA()},t.prototype.desaturate=function(t){void 0===t&&(t=.1);var e=i.fromRGBA(this.r,this.g,this.b,this.a);return e.s-=e.s*t,e.toRGBA()},t.prototype.mulitiply=function(e){var i=255*(e.r/255*this.r/255),n=255*(e.g/255*this.g/255),s=255*(e.b/255*this.b/255),o=e.a*this.a;return new t(i,n,s,o)},t.prototype.screen=function(t){var e=t.invert(),i=t.invert();return e.mulitiply(i).invert()},t.prototype.invert=function(){return new t(255-this.r,255-this.g,255-this.b,1-this.a)},t.prototype.average=function(e){var i=(e.r+this.r)/2,n=(e.g+this.g)/2,s=(e.b+this.b)/2,o=(e.a+this.a)/2;return new t(i,n,s,o)},t.prototype.toString=function(){var t=this.r.toFixed(0)+""+", "+(this.g.toFixed(0)+"")+", "+(this.b.toFixed(0)+"");return void 0!==this.a||null!==this.a?"rgba("+t+", "+(this.a+"")+")":"rgb("+t+")"},t.prototype.fillStyle=function(){return""+this},t.prototype.clone=function(){return new t(this.r,this.g,this.b,this.a)},t.Black=t.fromHex("#000000"),t.White=t.fromHex("#FFFFFF"),t.Gray=t.fromHex("#808080"),t.LightGray=t.fromHex("#D3D3D3"),t.DarkGray=t.fromHex("#A9A9A9"),t.Yellow=t.fromHex("#FFFF00"),t.Orange=t.fromHex("#FFA500"),t.Red=t.fromHex("#FF0000"),t.Vermillion=t.fromHex("#FF5B31"),t.Rose=t.fromHex("#FF007F"),t.Magenta=t.fromHex("#FF00FF"),t.Violet=t.fromHex("#7F00FF"),t.Blue=t.fromHex("#0000FF"),t.Azure=t.fromHex("#007FFF"),t.Cyan=t.fromHex("#00FFFF"),t.Viridian=t.fromHex("#59978F"),t.Green=t.fromHex("#00FF00"),t.Chartreuse=t.fromHex("#7FFF00"),t.Transparent=t.fromHex("#FFFFFF00"),t}();t.Color=e;var i=function(){function t(t,e,i,n){this.h=t,this.s=e,this.l=i,this.a=n}return t.fromRGBA=function(e,i,n,s){e/=255,i/=255,n/=255;var o,r,h=Math.max(e,i,n),a=Math.min(e,i,n),c=(h+a)/2;if(h===a)o=r=0;else{var u=h-a;switch(r=c>.5?u/(2-h-a):u/(h+a),h){case e:o=(i-n)/u+(n>i?6:0);break;case i:o=(n-e)/u+2;break;case n:o=(e-i)/u+4}o/=6}return new t(o,r,c,s)},t.prototype.toRGBA=function(){function t(t,e,i){return 0>i&&(i+=1),i>1&&(i-=1),1/6>i?t+6*(e-t)*i:.5>i?e:2/3>i?t+6*(e-t)*(2/3-i):t}var i,n,s;if(0===this.s)i=n=s=this.l;else{var o=.5>this.l?this.l*(1+this.s):this.l+this.s-this.l*this.s,r=2*this.l-o;i=t(r,o,this.h+1/3),n=t(r,o,this.h),s=t(r,o,this.h-1/3)}return new e(255*i,255*n,255*s,this.a)},t}()})(ex||(ex={}));var ex;(function(t){var e=function(e){function i(i,n,s,o){e.call(this,i,n,s,o),this.traits=[],this.traits.push(new t.Traits.Movement),this.traits.push(new t.Traits.CapturePointer),this.anchor.setTo(0,0),this.collisionType=t.CollisionType.PreventCollision,this.enableCapturePointer=!0 -}return __extends(i,e),i.prototype.onInitialize=function(t){this._engine=t},i.prototype.contains=function(i,n,s){if(void 0===s&&(s=!0),s)return e.prototype.contains.call(this,i,n);var o=this._engine.worldToScreenCoordinates(new t.Point(i,n));return e.prototype.contains.call(this,o.x,o.y)},i}(t.Actor);t.UIActor=e})(ex||(ex={}));var ex;(function(t){var e=function(e){function i(i,n,s,o,r,h){e.call(this,i,n,s,o),this._action=function(){},this.repeats=1,this.target=null,this.repeats=h||this.repeats,this._action=r||this._action,this.collisionType=t.CollisionType.PreventCollision,this.eventDispatcher=new t.EventDispatcher(this),this.actionQueue=new t.Internal.Actions.ActionQueue(this)}return __extends(i,e),i.prototype.update=function(e,i){if(this.actionQueue.update(i),this.x+=this.dx*i/1e3,this.y+=this.dy*i/1e3,this.rotation+=this.rx*i/1e3,this.scale.x+=this.sx*i/1e3,this.scale.y+=this.sy*i/1e3,this.target)this.collides(this.target)&&this._dispatchAction();else for(var n=0;e.currentScene.children.length>n;n++){var s=e.currentScene.children[n];s!==this&&s.collisionType!==t.CollisionType.PreventCollision&&this.collides(s)&&this._dispatchAction()}0===this.repeats&&this.kill()},i.prototype._dispatchAction=function(){this._action.call(this),this.repeats--},i.prototype.draw=function(){},i.prototype.debugDraw=function(i){e.prototype.debugDraw.call(this,i),i.save(),i.translate(this.x,this.y);var n=this.getBounds();n.left=n.left-this.getWorldX(),n.right=n.right-this.getWorldX(),n.top=n.top-this.getWorldY(),n.bottom=n.bottom-this.getWorldY(),i.fillStyle=""+t.Color.Violet,i.strokeStyle=""+t.Color.Violet,i.fillText("Trigger",10,10),n.debugDraw(i),i.restore()},i}(t.Actor);t.Trigger=e})(ex||(ex={}));var ex;(function(t){(function(t){t[t.Circle=0]="Circle",t[t.Rectangle=1]="Rectangle"})(t.EmitterType||(t.EmitterType={}));var e=t.EmitterType,i=function(){function e(e,i,n,s,o,r,h,a,c,u){this.position=new t.Vector(0,0),this.velocity=new t.Vector(0,0),this.acceleration=new t.Vector(0,0),this.particleRotationalVelocity=0,this.currentRotation=0,this.focus=null,this.focusAccel=0,this.opacity=1,this.beginColor=t.Color.White.clone(),this.endColor=t.Color.White.clone(),this.life=300,this.fadeFlag=!1,this._rRate=1,this._gRate=1,this._bRate=1,this._aRate=0,this._currentColor=t.Color.White.clone(),this.emitter=null,this.particleSize=5,this.particleSprite=null,this.sizeRate=0,this.elapsedMultiplier=0,this.emitter=e,this.life=i||this.life,this.opacity=n||this.opacity,this.endColor=o||this.endColor.clone(),this.beginColor=s||this.beginColor.clone(),this._currentColor=this.beginColor.clone(),this.position=r||this.position,this.velocity=h||this.velocity,this.acceleration=a||this.acceleration,this._rRate=(this.endColor.r-this.beginColor.r)/this.life,this._gRate=(this.endColor.g-this.beginColor.g)/this.life,this._bRate=(this.endColor.b-this.beginColor.b)/this.life,this._aRate=this.opacity/this.life,this.startSize=c||0,this.endSize=u||0,this.endSize>0&&this.startSize>0&&(this.sizeRate=(this.endSize-this.startSize)/this.life,this.particleSize=this.startSize)}return e.prototype.kill=function(){this.emitter.removeParticle(this)},e.prototype.update=function(e){if(this.life=this.life-e,this.elapsedMultiplier=this.elapsedMultiplier+e,0>this.life&&this.kill(),this.fadeFlag&&(this.opacity=t.Util.clamp(this._aRate*this.life,1e-4,1)),this.startSize>0&&this.endSize>0&&(this.particleSize=t.Util.clamp(this.sizeRate*e+this.particleSize,Math.min(this.startSize,this.endSize),Math.max(this.startSize,this.endSize))),this._currentColor.r=t.Util.clamp(this._currentColor.r+this._rRate*e,0,255),this._currentColor.g=t.Util.clamp(this._currentColor.g+this._gRate*e,0,255),this._currentColor.b=t.Util.clamp(this._currentColor.b+this._bRate*e,0,255),this._currentColor.a=t.Util.clamp(this.opacity,1e-4,1),this.focus){var i=this.focus.minus(this.position).normalize().scale(this.focusAccel).scale(e/1e3);this.velocity=this.velocity.add(i)}else this.velocity=this.velocity.add(this.acceleration.scale(e/1e3));this.position=this.position.add(this.velocity.scale(e/1e3)),this.particleRotationalVelocity&&(this.currentRotation=(this.currentRotation+this.particleRotationalVelocity*e/1e3)%(2*Math.PI))},e.prototype.draw=function(e){return this.particleSprite?(this.particleSprite.rotation=this.currentRotation,this.particleSprite.scale.setTo(this.particleSize,this.particleSize),this.particleSprite.draw(e,this.position.x,this.position.y),void 0):(this._currentColor.a=t.Util.clamp(this.opacity,1e-4,1),e.fillStyle=""+this._currentColor,e.beginPath(),e.arc(this.position.x,this.position.y,this.particleSize,0,2*Math.PI),e.fill(),e.closePath(),void 0)},e}();t.Particle=i;var n=function(n){function s(i,s,o,r){n.call(this,i,s,o,r,t.Color.White),this._particlesToEmit=0,this.numParticles=0,this.isEmitting=!0,this.particles=null,this.deadParticles=null,this.minVel=0,this.maxVel=0,this.acceleration=new t.Vector(0,0),this.minAngle=0,this.maxAngle=0,this.emitRate=1,this.particleLife=2e3,this.opacity=1,this.fadeFlag=!1,this.focus=null,this.focusAccel=1,this.startSize=null,this.endSize=null,this.minSize=5,this.maxSize=5,this.beginColor=t.Color.White,this.endColor=t.Color.White,this.particleSprite=null,this.emitterType=e.Rectangle,this.radius=0,this.particleRotationalVelocity=0,this.randomRotation=!1,this.collisionType=t.CollisionType.PreventCollision,this.particles=new t.Util.Collection,this.deadParticles=new t.Util.Collection;for(var h in this.traits)this.traits[h]instanceof t.Traits.OffscreenCulling&&this.traits.splice(h,1)}return __extends(s,n),s.prototype.removeParticle=function(t){this.deadParticles.push(t)},s.prototype.emitParticles=function(t){for(var e=0;t>e;e++)this.particles.push(this._createParticle())},s.prototype.clearParticles=function(){this.particles.clear()},s.prototype._createParticle=function(){var n=0,s=0,o=t.Util.randomInRange(this.minAngle,this.maxAngle),r=t.Util.randomInRange(this.minVel,this.maxVel),h=this.startSize||t.Util.randomInRange(this.minSize,this.maxSize),a=r*Math.cos(o),c=r*Math.sin(o);if(this.emitterType===e.Rectangle)n=t.Util.randomInRange(this.x,this.x+this.getWidth()),s=t.Util.randomInRange(this.y,this.y+this.getHeight());else if(this.emitterType===e.Circle){var u=t.Util.randomInRange(0,this.radius);n=u*Math.cos(o)+this.x,s=u*Math.sin(o)+this.y}var l=new i(this,this.particleLife,this.opacity,this.beginColor,this.endColor,new t.Vector(n,s),new t.Vector(a,c),this.acceleration,this.startSize,this.endSize);return l.fadeFlag=this.fadeFlag,l.particleSize=h,this.particleSprite&&(l.particleSprite=this.particleSprite),l.particleRotationalVelocity=this.particleRotationalVelocity,this.randomRotation&&(l.currentRotation=t.Util.randomInRange(0,2*Math.PI)),this.focus&&(l.focus=this.focus.add(new t.Vector(this.x,this.y)),l.focusAccel=this.focusAccel),l},s.prototype.update=function(t,e){var i=this;n.prototype.update.call(this,t,e),this.isEmitting&&(this._particlesToEmit+=this.emitRate*(e/1e3),this._particlesToEmit>1&&(this.emitParticles(Math.floor(this._particlesToEmit)),this._particlesToEmit=this._particlesToEmit-Math.floor(this._particlesToEmit))),this.particles.forEach(function(t){return t.update(e)}),this.deadParticles.forEach(function(t){return i.particles.removeElement(t)}),this.deadParticles.clear()},s.prototype.draw=function(t){this.particles.forEach(function(e){return e.draw(t)})},s.prototype.debugDraw=function(e){n.prototype.debugDraw.call(this,e),e.fillStyle=""+t.Color.Black,e.fillText("Particles: "+this.particles.count(),this.x,this.y+20),this.focus&&(e.fillRect(this.focus.x+this.x,this.focus.y+this.y,3,3),t.Util.drawLine(e,"yellow",this.focus.x+this.x,this.focus.y+this.y,n.prototype.getCenter.call(this).x,n.prototype.getCenter.call(this).y),e.fillText("Focus",this.focus.x+this.x,this.focus.y+this.y))},s}(t.Actor);t.ParticleEmitter=n})(ex||(ex={}));var ex;(function(t){var e=function(){function e(e,i,n,s){this.currentFrame=0,this._oldTime=Date.now(),this.anchor=new t.Point(0,0),this.rotation=0,this.scale=new t.Point(1,1),this.loop=!1,this.freezeFrame=-1,this.flipVertical=!1,this.flipHorizontal=!1,this.width=0,this.height=0,this.naturalWidth=0,this.naturalHeight=0,this.sprites=i,this.speed=n,this._engine=e,null!=s&&(this.loop=s),i&&i[0]&&(this.height=i[0]?i[0].height:0,this.width=i[0]?i[0].width:0,this.naturalWidth=i[0]?i[0].naturalWidth:0,this.naturalHeight=i[0]?i[0].naturalHeight:0,this.freezeFrame=i.length-1)}return e.prototype.opacity=function(e){this.addEffect(new t.Effects.Opacity(e))},e.prototype.grayscale=function(){this.addEffect(new t.Effects.Grayscale)},e.prototype.invert=function(){this.addEffect(new t.Effects.Invert)},e.prototype.fill=function(e){this.addEffect(new t.Effects.Fill(e))},e.prototype.colorize=function(e){this.addEffect(new t.Effects.Colorize(e))},e.prototype.lighten=function(e){void 0===e&&(e=.1),this.addEffect(new t.Effects.Lighten(e))},e.prototype.darken=function(e){void 0===e&&(e=.1),this.addEffect(new t.Effects.Darken(e))},e.prototype.saturate=function(e){void 0===e&&(e=.1),this.addEffect(new t.Effects.Saturate(e))},e.prototype.desaturate=function(e){void 0===e&&(e=.1),this.addEffect(new t.Effects.Desaturate(e))},e.prototype.addEffect=function(t){for(var e in this.sprites)this.sprites[e].addEffect(t)},e.prototype.removeEffect=function(t){for(var e in this.sprites)this.sprites[e].removeEffect(t)},e.prototype.clearEffects=function(){for(var t in this.sprites)this.sprites[t].clearEffects()},e.prototype._setAnchor=function(t){for(var e in this.sprites)this.sprites[e].anchor.setTo(t.x,t.y)},e.prototype._setRotation=function(t){for(var e in this.sprites)this.sprites[e].rotation=t},e.prototype._setScale=function(t){for(var e in this.sprites)this.sprites[e].scale=t},e.prototype.reset=function(){this.currentFrame=0},e.prototype.isDone=function(){return!this.loop&&this.currentFrame>=this.sprites.length},e.prototype.tick=function(){var t=Date.now();t-this._oldTime>this.speed&&(this.currentFrame=this.loop?(this.currentFrame+1)%this.sprites.length:this.currentFrame+1,this._oldTime=t)},e.prototype._updateValues=function(){this._setAnchor(this.anchor),this._setRotation(this.rotation),this._setScale(this.scale)},e.prototype.skip=function(t){this.currentFrame=(this.currentFrame+t)%this.sprites.length},e.prototype.draw=function(e,i,n){this.tick(),this._updateValues();var s;this.currentFrame=this.sprites.length&&(s=this.sprites[t.Util.clamp(this.freezeFrame,0,this.sprites.length-1)],s.draw(e,i,n)),s&&(this.width=s.width,this.height=s.height)},e.prototype.play=function(t,e){this.reset(),this._engine.playAnimation(this,t,e)},e}();t.Animation=e})(ex||(ex={}));var ex;(function(t){var e;(function(e){var i=function(){function e(e,i){this.path=e,this._log=t.Logger.getInstance(),this.onload=function(){},this.onprogress=function(){},this.onerror=function(){},window.AudioContext?(this._log.debug("Using new Web Audio Api for "+e),this._soundImpl=new o(e,i)):(this._log.debug("Falling back to Audio Element for "+e),this._soundImpl=new n(e,i))}return e.prototype.setVolume=function(t){this._soundImpl.setVolume(t)},e.prototype.setLoop=function(t){this._soundImpl.setLoop(t)},e.prototype.load=function(){this._soundImpl.onload=this.onload,this._soundImpl.onprogress=this.onprogress,this._soundImpl.onerror=this.onerror,this._soundImpl.load()},e.prototype.processData=function(t){return this._soundImpl.processData(t)},e.prototype.getData=function(){return this._soundImpl.getData()},e.prototype.setData=function(t){this._soundImpl.setData(t)},e.prototype.isPlaying=function(){return this._soundImpl.isPlaying()},e.prototype.play=function(){return this._soundImpl.play()},e.prototype.pause=function(){this._soundImpl.pause()},e.prototype.stop=function(){this._soundImpl.stop()},e}();e.FallbackAudio=i;var n=function(){function e(e,i){var n=this;this.path=e,this._audioElements=Array(5),this._loadedAudio=null,this._isLoaded=!1,this._index=0,this._log=t.Logger.getInstance(),this._isPlaying=!1,this._currentOffset=0,this.onload=function(){},this.onprogress=function(){},this.onerror=function(){};for(var s=0;this._audioElements.length>s;s++)(function(t){n._audioElements[t]=new Audio})(s);i?this.setVolume(t.Util.clamp(i,0,1)):this.setVolume(1)}return e.prototype.isPlaying=function(){return this._isPlaying},e.prototype._audioLoaded=function(){this._isLoaded=!0},e.prototype.setVolume=function(t){var e=0,i=this._audioElements.length;for(e;i>e;e++)this._audioElements[e].volume=t},e.prototype.setLoop=function(t){var e=0,i=this._audioElements.length;for(e;i>e;e++)this._audioElements[e].loop=t},e.prototype.getLoop=function(){this._audioElements.some(function(t){return t.loop})},e.prototype.load=function(){var t=this;if(!this._loadedAudio){var e=new XMLHttpRequest;e.open("GET",this.path,!0),e.responseType="blob",e.onprogress=this.onprogress,e.onerror=this.onerror,e.onload=function(i){return 200!==e.status?(t._log.error("Failed to load audio resource ",t.path," server responded with error code",e.status),t.onerror(e.response),t._isLoaded=!1,void 0):(t._isLoaded=!0,t.setData(e.response),t.onload(i),void 0)},e.send()}},e.prototype.getData=function(){return this._loadedAudio},e.prototype.setData=function(t){this._isLoaded=!0,this._loadedAudio=this.processData(t)},e.prototype.processData=function(t){var e=URL.createObjectURL(t);return this._audioElements.forEach(function(t){t.src=e}),this._audioLoaded(),e},e.prototype.play=function(){var e=this;this._audioElements[this._index].load(),this._audioElements[this._index].play(),this._currentOffset=0;var i=new t.Promise;return this._isPlaying=!0,this.getLoop()||this._audioElements[this._index].addEventListener("ended",function(){e._isPlaying=!1,i.resolve(!0)}),this._index=(this._index+1)%this._audioElements.length,i},e.prototype.pause=function(){this._index=(this._index-1+this._audioElements.length)%this._audioElements.length,this._currentOffset=this._audioElements[this._index].currentTime,this._audioElements.forEach(function(t){t.pause()}),this._isPlaying=!1},e.prototype.stop=function(){this._audioElements.forEach(function(t){t.pause()}),this._isPlaying=!1},e}();if(e.AudioTag=n,window.AudioContext)var s=new window.AudioContext;var o=function(){function e(e,i){this.path=e,this._context=s,this._volume=this._context.createGain(),this._buffer=null,this._sound=null,this._isLoaded=!1,this._loop=!1,this._isPlaying=!1,this._isPaused=!1,this._currentOffset=0,this._logger=t.Logger.getInstance(),this._data=null,this.onload=function(){},this.onprogress=function(){},this.onerror=function(){},this._volume.gain.value=i?t.Util.clamp(i,0,1):1}return e.prototype.setVolume=function(t){this._volume.gain.value=t},e.prototype.load=function(){var t=this;if(null===this._data){var e=new XMLHttpRequest;e.open("GET",this.path),e.responseType="arraybuffer",e.onprogress=this.onprogress,e.onerror=this.onerror,e.onload=function(){return 200!==e.status?(t._logger.error("Failed to load audio resource ",t.path," server responded with error code",e.status),t.onerror(e.response),t._isLoaded=!1,void 0):(t.setData(e.response),void 0)};try{e.send()}catch(i){console.error("Error loading sound! If this is a cross origin error, you must host your sound with your html and javascript.")}}},e.prototype.getData=function(){return this._data},e.prototype.setData=function(t){this._data=this.processData(t)},e.prototype.processData=function(t){var e=this;return this._context.decodeAudioData(t,function(t){e._buffer=t,e._isLoaded=!0,e.onload(e)},function(){e._logger.error("Unable to decode "+e.path+" this browser may not fully support this format, or the file may be corrupt, "+"if this is an mp3 try removing id3 tags and album art from the file."),e._isLoaded=!1,e.onload(e)}),t},e.prototype.setLoop=function(t){this._loop=t},e.prototype.isPlaying=function(){return this._isPlaying},e.prototype.play=function(){var e=this;if(this._isLoaded){this._sound=this._context.createBufferSource(),this._sound.buffer=this._buffer,this._sound.loop=this._loop,this._sound.connect(this._volume),this._volume.connect(this._context.destination),this._sound.start(0,this._currentOffset%this._buffer.duration),this._currentOffset=0;var i;return i=this._isPaused&&this._playPromise?this._playPromise:new t.Promise,this._isPaused=!1,this._isPlaying=!0,this._loop||(this._sound.onended=function(){e._isPlaying=!1,e._isPaused||i.resolve(!0)}.bind(this)),this._playPromise=i,i}return t.Promise.wrap(!0)},e.prototype.pause=function(){if(this._isPlaying)try{window.clearTimeout(this._playingTimer),this._sound.stop(0),this._currentOffset=this._context.currentTime,this._isPlaying=!1,this._isPaused=!0}catch(t){this._logger.warn("The sound clip",this.path,"has already been paused!")}},e.prototype.stop=function(){if(this._sound)try{window.clearTimeout(this._playingTimer),this._currentOffset=0,this._sound.stop(0),this._isPlaying=!1,this._isPaused=!1}catch(t){this._logger.warn("The sound clip",this.path,"has already been stopped!")}},e}();e.WebAudio=o})(e=t.Internal||(t.Internal={}))})(ex||(ex={}));var ex;(function(t){(function(t){t[t.Resolved=0]="Resolved",t[t.Rejected=1]="Rejected",t[t.Pending=2]="Pending"})(t.PromiseState||(t.PromiseState={}));var e=t.PromiseState,i=function(){function i(){this._state=e.Pending,this._successCallbacks=[],this._rejectCallback=function(){},this._logger=t.Logger.getInstance()}return i.wrap=function(t){var e=(new i).resolve(t);return e},i.join=function(){for(var t=[],e=0;arguments.length>e;e++)t[e-0]=arguments[e];var n=new i;if(!t||!t.length)return n.resolve();var s=t.length,o=0,r=0,h=[];return t.forEach(function(t){t.then(function(){o+=1,o===s?n.resolve():o+r+h.length===s&&n.reject(h)},function(){r+=1,o+r+h.length===s&&n.reject(h)}).error(function(t){h.push(t),h.length+o+r===s&&n.reject(h)})}),n},i.prototype.then=function(t,i){if(t&&(this._successCallbacks.push(t),this.state()===e.Resolved))try{t.call(this,this._value)}catch(n){this._handleError(n)}if(i&&(this._rejectCallback=i,this.state()===e.Rejected))try{i.call(this,this._value)}catch(n){this._handleError(n)}return this},i.prototype.error=function(t){return t&&(this._errorCallback=t),this},i.prototype.resolve=function(t){var i=this;if(this._state!==e.Pending)throw Error("Cannot resolve a promise that is not in a pending state!");this._value=t;try{this._state=e.Resolved,this._successCallbacks.forEach(function(t){t.call(i,i._value)})}catch(n){this._handleError(n)}return this},i.prototype.reject=function(t){if(this._state!==e.Pending)throw Error("Cannot reject a promise that is not in a pending state!");this._value=t;try{this._state=e.Rejected,this._rejectCallback.call(this,this._value)}catch(i){this._handleError(i)}return this},i.prototype.state=function(){return this._state},i.prototype._handleError=function(t){if(!this._errorCallback)throw t;this._errorCallback.call(this,t)},i}();t.Promise=i})(ex||(ex={}));var ex;(function(t){var e=function(e){function i(i,n,s){void 0===s&&(s=!0),e.call(this),this.path=i,this.responseType=n,this.bustCache=s,this.data=null,this.logger=t.Logger.getInstance(),this.onprogress=function(){},this.oncomplete=function(){},this.onerror=function(){}}return __extends(i,e),i.prototype.isLoaded=function(){return null!==this.data},i.prototype.wireEngine=function(t){this._engine=t},i.prototype._cacheBust=function(t){var e=/\?\w*=\w*/;return t+=e.test(t)?"&__="+Date.now():"?__="+Date.now()},i.prototype._start=function(){this.logger.debug("Started loading resource "+this.path)},i.prototype.load=function(){var e=this,i=new t.Promise;if(null!==this.data)return this.logger.debug("Already have data for resource",this.path),i.resolve(this.data),this.oncomplete(),i;var n=new XMLHttpRequest;return n.open("GET",this.bustCache?this._cacheBust(this.path):this.path,!0),n.responseType=this.responseType,n.onloadstart=function(t){e._start(t)},n.onprogress=this.onprogress,n.onerror=this.onerror,n.onload=function(){return 200!==n.status?(e.logger.error("Failed to load resource ",e.path," server responded with error code",n.status),e.onerror(n.response),i.resolve(n.response),void 0):(e.data=e.processData(n.response),e.oncomplete(),e.logger.debug("Completed loading resource",e.path),i.resolve(e.data),void 0)},n.send(),i},i.prototype.getData=function(){return this.data},i.prototype.setData=function(t){this.data=this.processData(t)},i.prototype.processData=function(t){return URL.createObjectURL(t)},i}(t.Class);t.Resource=e})(ex||(ex={}));var ex;(function(t){var e=function(e){function i(i,n){void 0===n&&(n=!0),e.call(this,i,"blob",n),this.path=i,this.bustCache=n,this.loaded=new t.Promise,this._isLoaded=!1,this._sprite=null,this._sprite=new t.Sprite(this,0,0,0,0)}return __extends(i,e),i.prototype.isLoaded=function(){return this._isLoaded},i.prototype.load=function(){var i=this,n=new t.Promise,s=e.prototype.load.call(this);return s.then(function(){i.image=new Image,i.image.addEventListener("load",function(){i._isLoaded=!0,i.width=i._sprite.swidth=i._sprite.naturalWidth=i._sprite.width=i.image.naturalWidth,i.height=i._sprite.sheight=i._sprite.naturalHeight=i._sprite.height=i.image.naturalHeight,i.loaded.resolve(i.image),n.resolve(i.image)}),i.image.src=e.prototype.getData.call(i)},function(){n.reject("Error loading texture.")}),n},i.prototype.asSprite=function(){return this._sprite},i}(t.Resource);t.Texture=e;var i=function(){function e(){for(var i=[],n=0;arguments.length>n;n++)i[n-0]=arguments[n];this._logger=t.Logger.getInstance(),this.onprogress=function(){},this.oncomplete=function(){},this.onerror=function(){},this.onload=function(){},this._isLoaded=!1,this._wasPlayingOnHidden=!1,this.path="";for(var s=0;i.length>s;s++)if(e.canPlayFile(i[s])){this.path=i[s];break}this.path||(this._logger.warn("This browser does not support any of the audio files specified:",i.join(", ")),this._logger.warn("Attempting to use",i[0]),this.path=i[0]),this.sound=new t.Internal.FallbackAudio(this.path,1)}return e.canPlayFile=function(e){try{var i=new Audio,n=/.*\.([A-Za-z0-9]+)$/,s=e.match(n)[1];return i.canPlayType("audio/"+s)?!0:!1}catch(o){return t.Logger.getInstance().warn("Cannot determine audio support, assuming no support for the Audio Tag",o),!1}},e.prototype.wireEngine=function(t){var e=this;t&&(this._engine=t,this._engine.on("hidden",function(){t.pauseAudioWhenHidden&&e.isPlaying()&&(e._wasPlayingOnHidden=!0,e.pause())}),this._engine.on("visible",function(){t.pauseAudioWhenHidden&&e._wasPlayingOnHidden&&(e.play(),e._wasPlayingOnHidden=!1)}))},e.prototype.setVolume=function(t){this.sound&&this.sound.setVolume(t)},e.prototype.setLoop=function(t){this.sound&&this.sound.setLoop(t)},e.prototype.isPlaying=function(){return this.sound?this.sound.isPlaying():void 0},e.prototype.play=function(){return this.sound?this.sound.play():void 0},e.prototype.pause=function(){this.sound&&this.sound.pause()},e.prototype.stop=function(){this.sound&&this.sound.stop()},e.prototype.isLoaded=function(){return this._isLoaded},e.prototype.load=function(){var e=this,i=new t.Promise;return null!==this.sound.getData()?(this._logger.debug("Already have data for resource",this.path),i.resolve(this.sound),i):(this._logger.debug("Started loading sound",this.path),this.sound.onprogress=this.onprogress,this.sound.onload=function(){e.oncomplete(),e._isLoaded=!0,e._logger.debug("Completed loading sound",e.path),i.resolve(e.sound)},this.sound.onerror=function(t){e.onerror(t),i.resolve(t)},this.sound.load(),i)},e.prototype.getData=function(){return this.sound.getData()},e.prototype.setData=function(t){this.sound.setData(t)},e.prototype.processData=function(t){return this.sound.processData(t)},e}();t.Sound=i;var n=function(){function e(t){this._resourceList=[],this._index=0,this._resourceCount=0,this._numLoaded=0,this._progressCounts={},this._totalCounts={},this.getData=function(){},this.setData=function(){},this.processData=function(){},this.onprogress=function(){},this.oncomplete=function(){},this.onerror=function(){},t&&this.addResources(t)}return e.prototype.wireEngine=function(t){this._engine=t},e.prototype.addResource=function(t){var e=this._index++;this._resourceList.push(t),this._progressCounts[e]=0,this._totalCounts[e]=1,this._resourceCount++},e.prototype.addResources=function(t){var e=0,i=t.length;for(e;i>e;e++)this.addResource(t[e])},e.prototype._sumCounts=function(t){var e=0;for(var i in t)e+=0|t[i];return e},e.prototype.isLoaded=function(){return this._numLoaded===this._resourceCount},e.prototype.load=function(){function e(t,i){t[i]&&t[i].load().then(function(){e(t,i+1)})}var i=this,n=new t.Promise,s=this;if(0===this._resourceList.length)return s.oncomplete.call(s),n;var o=Array(this._resourceList.length),r=this._resourceList.length;return this._resourceList.forEach(function(t,e){i._engine&&t.wireEngine(i._engine),t.onprogress=function(t){var i=t.total,n=t.loaded;o[e]={loaded:n/i*(100/r),total:100};var h=o.reduce(function(t,e){return{loaded:t.loaded+e.loaded,total:100}},{loaded:0,total:100});s.onprogress.call(s,h)},t.oncomplete=t.onerror=function(){s._numLoaded++,s._numLoaded===s._resourceCount&&(s.onprogress.call(s,{loaded:100,total:100}),s.oncomplete.call(s),n.resolve())}}),e(this._resourceList,0),n},e}();t.Loader=n})(ex||(ex={}));var ex;(function(t){var e=function(){function e(){this.failedTests=[],this._criticalTests={canvasSupport:function(){var t=document.createElement("canvas");return!(!t.getContext||!t.getContext("2d"))},arrayBufferSupport:function(){var t=new XMLHttpRequest;t.open("GET","/");try{t.responseType="arraybuffer"}catch(e){return!1}return"arraybuffer"===t.responseType},dataUrlSupport:function(){var t=document.createElement("canvas");return 0===t.toDataURL("image/png").indexOf("data:image/png")},objectUrlSupport:function(){return"URL"in window&&"revokeObjectURL"in URL&&"createObjectURL"in URL},rgbaSupport:function(){var t=document.createElement("a").style;return t.cssText="background-color:rgba(150,255,150,.5)",(""+t.backgroundColor).indexOf("rgba")>-1}},this._warningTest={webAudioSupport:function(){return!!(window.AudioContext||window.webkitAudioContext||window.mozAudioContext||window.msAudioContext||window.oAudioContext)},webglSupport:function(){var t=document.createElement("canvas");return!(!t.getContext||!t.getContext("webgl"))}}}return e.prototype.test=function(){var e=!1;for(var i in this._criticalTests)this._criticalTests[i]()||(this.failedTests.push(i),t.Logger.getInstance().error("Critical browser feature missing, Excalibur requires:",i),e=!0);if(e)return!1;for(var n in this._warningTest)this._warningTest[n]()||t.Logger.getInstance().warn("Warning browser feature missing, Excalibur will have reduced performance:",n);return!0},e}();t.Detector=e})(ex||(ex={}));var ex;(function(t){var e=function(){function e(e){this.path=e,this._isLoaded=!1,this.logger=t.Logger.getInstance(),this.onprogress=function(){},this.oncomplete=function(){},this.onerror=function(){},this._innerElement=document.createElement("div"),this._innerElement.className="excalibur-template"}return e.prototype.wireEngine=function(t){this._engine=t},e.prototype.getTemplateString=function(){return this._isLoaded?this._htmlString:""},e.prototype._compile=function(){this._innerElement.innerHTML=this._htmlString,this._styleElements=this._innerElement.querySelectorAll("[data-style]"),this._textElements=this._innerElement.querySelectorAll("[data-text]")},e.prototype._evaluateExpresion=function(t,e){var i=Function("return "+t+";"),n=i.call(e);return n},e.prototype.apply=function(t){for(var e=this,i=0;this._styleElements.length>i;i++)(function(){var n={};e._styleElements[i].dataset.style.split(";").forEach(function(t){if(t){var e=t.split(":");n[e[0].trim()]=e[1].trim()}});for(var s in n)(function(){var o=n[s];e._styleElements[i].style[s]=e._evaluateExpresion(o,t)})()})();for(var n=0;this._textElements.length>n;n++)(function(){var i=e._textElements[n].dataset.text;e._textElements[n].innerText=e._evaluateExpresion(i,t)})();return 1===this._innerElement.children.length&&(this._innerElement=this._innerElement.firstChild),this._innerElement},e.prototype.load=function(){var e=this,i=new t.Promise,n=new XMLHttpRequest;return n.open("GET",this.path,!0),n.responseType="text",n.onprogress=this.onprogress,n.onerror=this.onerror,n.onload=function(){return 200!==n.status?(e.logger.error("Failed to load html template resource ",e.path," server responded with error code",n.status),e.onerror(n.response),e._isLoaded=!1,i.resolve("error"),void 0):(e.setData(n.response),e.oncomplete(),e.logger.debug("Completed loading template",e.path),i.resolve(e._htmlString),void 0)},n.overrideMimeType&&n.overrideMimeType("text/plain; charset=x-user-defined"),n.send(),i},e.prototype.getData=function(){return this._htmlString},e.prototype.setData=function(t){this._htmlString=this.processData(t),this._compile(),this._isLoaded=!0},e.prototype.processData=function(t){return t},e.prototype.isLoaded=function(){return this._isLoaded},e}();t.Template=e;var i=function(){function t(t,e,i){this.parent=document.getElementById(t),this.template=e,this._ctx=i,this.update()}return t.prototype.listen=function(t,e,i){var n=this;i||(i=function(){n.update()}),t.addEventListener&&e.forEach(function(e){t.addEventListener(e,i)})},t.prototype.update=function(){var t=this._applyTemplate(this.template,this._ctx);t instanceof String&&(this.parent.innerHTML=t),t instanceof Node&&this.parent.lastChild!==t&&this.parent.appendChild(t)},t.prototype._applyTemplate=function(t,e){return t.isLoaded()?t.apply(e):void 0},t}();t.Binding=i})(ex||(ex={}));var ex;(function(t){(function(t){t[t.Em=0]="Em",t[t.Rem=1]="Rem",t[t.Px=2]="Px",t[t.Pt=3]="Pt",t[t.Percent=4]="Percent"})(t.FontUnit||(t.FontUnit={}));var e=t.FontUnit;(function(t){t[t.Left=0]="Left",t[t.Right=1]="Right",t[t.Center=2]="Center",t[t.Start=3]="Start",t[t.End=4]="End"})(t.TextAlign||(t.TextAlign={}));var i=t.TextAlign;(function(t){t[t.Top=0]="Top",t[t.Hanging=1]="Hanging",t[t.Middle=2]="Middle",t[t.Alphabetic=3]="Alphabetic",t[t.Ideographic=4]="Ideographic",t[t.Bottom=5]="Bottom"})(t.BaseAlign||(t.BaseAlign={}));var n=t.BaseAlign,s=function(s){function o(o,r,h,a,c){s.call(this,r,h),this.fontSize=10,this.fontUnit=e.Px,this.textAlign=i.Left,this.baseAlign=n.Bottom,this.letterSpacing=0,this.caseInsensitive=!0,this._textShadowOn=!1,this._shadowOffsetX=0,this._shadowOffsetY=0,this._shadowColor=t.Color.Black.clone(),this._shadowColorDirty=!1,this._textSprites={},this._shadowSprites={},this._color=t.Color.Black.clone(),this.text=o||"",this.color=t.Color.Black.clone(),this.spriteFont=c,this.collisionType=t.CollisionType.PreventCollision,this.fontFamily=a||"10px sans-serif"}return __extends(o,s),o.prototype.getTextWidth=function(t){var e=t.font;t.font=this.fontFamily;var i=t.measureText(this.text).width;return t.font=e,i},o.prototype._lookupFontUnit=function(t){switch(t){case e.Em:return"em";case e.Rem:return"rem";case e.Pt:return"pt";case e.Px:return"px";case e.Percent:return"%";default:return"px"}},o.prototype._lookupTextAlign=function(t){switch(t){case i.Left:return"left";case i.Right:return"right";case i.Center:return"center";case i.End:return"end";case i.Start:return"start";default:return"start"}},o.prototype._lookupBaseAlign=function(t){switch(t){case n.Alphabetic:return"alphabetic";case n.Bottom:return"bottom";case n.Hanging:return"hangin";case n.Ideographic:return"ideographic";case n.Middle:return"middle";case n.Top:return"top";default:return"alphabetic"}},o.prototype.setTextShadow=function(t,e,i){this.spriteFont.setTextShadow(t,e,i)},o.prototype.useTextShadow=function(t){this.spriteFont.useTextShadow(t)},o.prototype.clearTextShadow=function(){this._textShadowOn=!1,this._shadowOffsetX=0,this._shadowOffsetY=0,this._shadowColor=t.Color.Black.clone()},o.prototype.update=function(t,e){s.prototype.update.call(this,t,e)},o.prototype.draw=function(t,e){t.save(),t.translate(this.x,this.y),t.scale(this.scale.x,this.scale.y),t.rotate(this.rotation),this._textShadowOn&&(t.save(),t.translate(this._shadowOffsetX,this._shadowOffsetY),this._fontDraw(t,e,this._shadowSprites),t.restore()),this._fontDraw(t,e,this._textSprites),s.prototype.draw.call(this,t,e),t.restore() -},o.prototype._fontDraw=function(t){if(this.spriteFont)this.spriteFont.draw(t,this.text,0,0,{color:this.color.clone(),baseAlign:this.baseAlign,textAlign:this.textAlign,fontSize:this.fontSize,letterSpacing:this.letterSpacing,opacity:this.opacity});else{var e=t.textAlign,i=t.textBaseline;t.textAlign=this._lookupTextAlign(this.textAlign),t.textBaseline=this._lookupBaseAlign(this.baseAlign),this.color&&(this.color.a=this.opacity),t.fillStyle=""+this.color,t.font=""+this.fontSize+this._lookupFontUnit(this.fontUnit)+" "+this.fontFamily,this.maxWidth?t.fillText(this.text,0,0,this.maxWidth):t.fillText(this.text,0,0),t.textAlign=e,t.textBaseline=i}},o.prototype.debugDraw=function(t){s.prototype.debugDraw.call(this,t)},o}(t.Actor);t.Label=s})(ex||(ex={}));var ex;(function(t){var e;(function(e){(function(t){t[t.Touch=0]="Touch",t[t.Mouse=1]="Mouse",t[t.Pen=2]="Pen",t[t.Unknown=3]="Unknown"})(e.PointerType||(e.PointerType={}));var i=e.PointerType;(function(t){t[t.Left=0]="Left",t[t.Middle=1]="Middle",t[t.Right=2]="Right",t[t.Unknown=3]="Unknown"})(e.PointerButton||(e.PointerButton={}));var n=e.PointerButton;(function(t){t[t.Canvas=0]="Canvas",t[t.Document=1]="Document"})(e.PointerScope||(e.PointerScope={}));var s=e.PointerScope,o=function(t){function e(e,i,n,s,o,r){t.call(this),this.x=e,this.y=i,this.index=n,this.pointerType=s,this.button=o,this.ev=r}return __extends(e,t),e}(t.GameEvent);e.PointerEvent=o;var r=function(e){function r(t){e.call(this),this._pointerDown=[],this._pointerUp=[],this._pointerMove=[],this._pointerCancel=[],this._pointers=[],this._activePointers=[],this._engine=t,this._pointers.push(new h),this._activePointers=[-1],this.primary=this._pointers[0]}return __extends(r,e),r.prototype.init=function(t){void 0===t&&(t=s.Document);var e=document;e=t===s.Document?document:this._engine.canvas,e.addEventListener("touchstart",this._handleTouchEvent("down",this._pointerDown)),e.addEventListener("touchend",this._handleTouchEvent("up",this._pointerUp)),e.addEventListener("touchmove",this._handleTouchEvent("move",this._pointerMove)),e.addEventListener("touchcancel",this._handleTouchEvent("cancel",this._pointerCancel)),window.PointerEvent?(this._engine.canvas.style.touchAction="none",e.addEventListener("pointerdown",this._handlePointerEvent("down",this._pointerDown)),e.addEventListener("pointerup",this._handlePointerEvent("up",this._pointerUp)),e.addEventListener("pointermove",this._handlePointerEvent("move",this._pointerMove)),e.addEventListener("pointercancel",this._handlePointerEvent("cancel",this._pointerMove))):window.MSPointerEvent?(this._engine.canvas.style.msTouchAction="none",e.addEventListener("MSPointerDown",this._handlePointerEvent("down",this._pointerDown)),e.addEventListener("MSPointerUp",this._handlePointerEvent("up",this._pointerUp)),e.addEventListener("MSPointerMove",this._handlePointerEvent("move",this._pointerMove)),e.addEventListener("MSPointerCancel",this._handlePointerEvent("cancel",this._pointerMove))):(e.addEventListener("mousedown",this._handleMouseEvent("down",this._pointerDown)),e.addEventListener("mouseup",this._handleMouseEvent("up",this._pointerUp)),e.addEventListener("mousemove",this._handleMouseEvent("move",this._pointerMove)))},r.prototype.update=function(){this._pointerUp.length=0,this._pointerDown.length=0,this._pointerMove.length=0,this._pointerCancel.length=0},r.prototype.at=function(t){if(t>=this._pointers.length)for(var e=this._pointers.length-1,i=t;i>e;e++)this._pointers.push(new h),this._activePointers.push(-1);return this._pointers[t]},r.prototype.count=function(){return this._pointers.length},r.prototype.propogate=function(e){var i=e instanceof t.UIActor,n=0,s=this._pointerUp.length;for(n;s>n;n++)e.contains(this._pointerUp[n].x,this._pointerUp[n].y,!i)&&e.eventDispatcher.emit("pointerup",this._pointerUp[n]);for(n=0,s=this._pointerDown.length,n;s>n;n++)e.contains(this._pointerDown[n].x,this._pointerDown[n].y,!i)&&e.eventDispatcher.emit("pointerdown",this._pointerDown[n]);if(e.capturePointer.captureMoveEvents)for(n=0,s=this._pointerMove.length,n;s>n;n++)e.contains(this._pointerMove[n].x,this._pointerMove[n].y,!i)&&e.eventDispatcher.emit("pointermove",this._pointerMove[n]);for(n=0,s=this._pointerCancel.length,n;s>n;n++)e.contains(this._pointerCancel[n].x,this._pointerCancel[n].y,!i)&&e.eventDispatcher.emit("pointercancel",this._pointerCancel[n])},r.prototype._handleMouseEvent=function(e,n){var s=this;return function(r){r.preventDefault();var h=r.pageX-t.Util.getPosition(s._engine.canvas).x,a=r.pageY-t.Util.getPosition(s._engine.canvas).y,c=s._engine.screenToWorldCoordinates(new t.Point(h,a)),u=new o(c.x,c.y,0,i.Mouse,r.button,r);n.push(u),s.at(0).eventDispatcher.emit(e,u)}},r.prototype._handleTouchEvent=function(e,s){var r=this;return function(h){h.preventDefault();for(var a=0,c=h.changedTouches.length;c>a;a++){var u=r._pointers.length>1?r._getPointerIndex(h.changedTouches[a].identifier):0;if(-1!==u){var l=h.changedTouches[a].pageX-t.Util.getPosition(r._engine.canvas).x,p=h.changedTouches[a].pageY-t.Util.getPosition(r._engine.canvas).y,d=r._engine.screenToWorldCoordinates(new t.Point(l,p)),f=new o(d.x,d.y,u,i.Touch,n.Unknown,h);s.push(f),r.at(u).eventDispatcher.emit(e,f),r._pointers.length>1&&("up"===e?r._activePointers[u]=-1:"down"===e&&(r._activePointers[u]=h.changedTouches[a].identifier))}}}},r.prototype._handlePointerEvent=function(e,i){var n=this;return function(s){s.preventDefault();var r=n._pointers.length>1?n._getPointerIndex(s.pointerId):0;if(-1!==r){var h=s.pageX-t.Util.getPosition(n._engine.canvas).x,a=s.pageY-t.Util.getPosition(n._engine.canvas).y,c=n._engine.screenToWorldCoordinates(new t.Point(h,a)),u=new o(c.x,c.y,r,n._stringToPointerType(s.pointerType),s.button,s);i.push(u),n.at(r).eventDispatcher.emit(e,u),n._pointers.length>1&&("up"===e?n._activePointers[r]=-1:"down"===e&&(n._activePointers[r]=s.pointerId))}}},r.prototype._getPointerIndex=function(t){var e;if((e=this._activePointers.indexOf(t))>-1)return e;for(var i=0;this._activePointers.length>i;i++)if(-1===this._activePointers[i])return i;return-1},r.prototype._stringToPointerType=function(t){switch(t){case"touch":return i.Touch;case"mouse":return i.Mouse;case"pen":return i.Pen;default:return i.Unknown}},r}(t.Class);e.Pointers=r;var h=function(t){function e(){t.apply(this,arguments)}return __extends(e,t),e}(t.Class);e.Pointer=h})(e=t.Input||(t.Input={}))})(ex||(ex={}));var ex;(function(t){var e;(function(e){(function(t){t[t.Num1=97]="Num1",t[t.Num2=98]="Num2",t[t.Num3=99]="Num3",t[t.Num4=100]="Num4",t[t.Num5=101]="Num5",t[t.Num6=102]="Num6",t[t.Num7=103]="Num7",t[t.Num8=104]="Num8",t[t.Num9=105]="Num9",t[t.Num0=96]="Num0",t[t.Numlock=144]="Numlock",t[t.Semicolon=186]="Semicolon",t[t.A=65]="A",t[t.B=66]="B",t[t.C=67]="C",t[t.D=68]="D",t[t.E=69]="E",t[t.F=70]="F",t[t.G=71]="G",t[t.H=72]="H",t[t.I=73]="I",t[t.J=74]="J",t[t.K=75]="K",t[t.L=76]="L",t[t.M=77]="M",t[t.N=78]="N",t[t.O=79]="O",t[t.P=80]="P",t[t.Q=81]="Q",t[t.R=82]="R",t[t.S=83]="S",t[t.T=84]="T",t[t.U=85]="U",t[t.V=86]="V",t[t.W=87]="W",t[t.X=88]="X",t[t.Y=89]="Y",t[t.Z=90]="Z",t[t.Shift=16]="Shift",t[t.Alt=18]="Alt",t[t.Up=38]="Up",t[t.Down=40]="Down",t[t.Left=37]="Left",t[t.Right=39]="Right",t[t.Space=32]="Space",t[t.Esc=27]="Esc"})(e.Keys||(e.Keys={})),e.Keys;var i=function(t){function e(e){t.call(this),this.key=e}return __extends(e,t),e}(t.GameEvent);e.KeyEvent=i;var n=function(t){function e(e){t.call(this),this._keys=[],this._keysUp=[],this._keysDown=[],this._engine=e}return __extends(e,t),e.prototype.init=function(){var t=this;window.addEventListener("blur",function(){t._keys.length=0}),window.addEventListener("keyup",function(e){var n=t._keys.indexOf(e.keyCode);t._keys.splice(n,1),t._keysUp.push(e.keyCode);var s=new i(e.keyCode);t.eventDispatcher.emit("up",s),t.eventDispatcher.emit("release",s)}),window.addEventListener("keydown",function(e){if(-1===t._keys.indexOf(e.keyCode)){t._keys.push(e.keyCode),t._keysDown.push(e.keyCode);var n=new i(e.keyCode);t.eventDispatcher.emit("down",n),t.eventDispatcher.emit("press",n)}})},e.prototype.update=function(){this._keysDown.length=0,this._keysUp.length=0;for(var t=0;this._keys.length>t;t++)this.eventDispatcher.emit("hold",new i(this._keys[t]))},e.prototype.getKeys=function(){return this._keys},e.prototype.wasPressed=function(t){return this._keysDown.indexOf(t)>-1},e.prototype.isHeld=function(t){return this._keys.indexOf(t)>-1},e.prototype.wasReleased=function(t){return this._keysUp.indexOf(t)>-1},e}(t.Class);e.Keyboard=n})(e=t.Input||(t.Input={}))})(ex||(ex={}));var ex;(function(t){var e;(function(e){var i=function(e){function i(t){e.call(this),this.enabled=!1,this.supported=!!navigator.getGamepads,this._gamePadTimeStamps=[0,0,0,0],this._oldPads=[],this._pads=[],this._initSuccess=!1,this._navigator=navigator,this._minimumConfiguration=null,this._engine=t}return __extends(i,e),i.prototype.init=function(){this.supported&&(this._initSuccess||(this._oldPads=this._clonePads(this._navigator.getGamepads()),this._oldPads.length&&this._oldPads[0]&&(this._initSuccess=!0)))},i.prototype.setMinimumGamepadConfiguration=function(t){this._enableAndUpdate(),this._minimumConfiguration=t},i.prototype._enableAndUpdate=function(){this.enabled||(this.enabled=!0,this.update(100))},i.prototype._isGamepadValid=function(t){if(!this._minimumConfiguration)return!0;if(!t)return!1;var e=t.axes.filter(function(t){return void 0!==typeof t}).length,i=t.buttons.filter(function(t){return void 0!==typeof t}).length;return e>=this._minimumConfiguration.axis&&i>=this._minimumConfiguration.buttons&&t.connected},i.prototype.on=function(t,i){this._enableAndUpdate(),e.prototype.on.call(this,t,i)},i.prototype.off=function(t,i){this._enableAndUpdate(),e.prototype.off.call(this,t,i)},i.prototype.update=function(){if(this.enabled&&this.supported){this.init();for(var e=this._navigator.getGamepads(),i=0;e.length>i;i++)if(e[i]){if(!this.at(i).connected&&this._isGamepadValid(e[i])&&this.eventDispatcher.emit("connect",new t.GamepadConnectEvent(i,this.at(i))),this.at(i).connected=!0,!e[i].timestamp||e[i].timestamp!==this._gamePadTimeStamps[i]){this._gamePadTimeStamps[i]=e[i].timestamp,this.at(i).navigatorGamepad=e[i];var n,r,h,a,c;for(n in s)"number"==typeof s[n]&&(a=s[n],e[i].buttons[a]&&(h=e[i].buttons[a].value,h!==this._oldPads[i].getButton(a)&&(e[i].buttons[a].pressed?(this.at(i).updateButton(a,h),this.at(i).eventDispatcher.publish("button",new t.GamepadButtonEvent(a,h))):this.at(i).updateButton(a,0))));for(r in o)"number"==typeof o[r]&&(c=o[r],h=e[i].axes[c],h!==this._oldPads[i].getAxes(c)&&(this.at(i).updateAxes(c,h),this.at(i).eventDispatcher.emit("axis",new t.GamepadAxisEvent(c,h))));this._oldPads[i]=this._clonePad(e[i])}}else this.at(i).connected&&this.eventDispatcher.emit("disconnect",new t.GamepadDisconnectEvent(i)),this.at(i).connected=!1}},i.prototype.at=function(t){if(this._enableAndUpdate(),t>=this._pads.length)for(var e=this._pads.length-1,i=t;i>e;e++)this._pads.push(new n),this._oldPads.push(new n);return this._pads[t]},i.prototype.getValidGamepads=function(){this._enableAndUpdate();for(var t=[],e=0;this._pads.length>e;e++)this._isGamepadValid(this.at(e).navigatorGamepad)&&this.at(e).connected&&t.push(this.at(e));return t},i.prototype.count=function(){return this._pads.filter(function(t){return t.connected}).length},i.prototype._clonePads=function(t){for(var e=[],i=0,n=t.length;n>i;i++)e.push(this._clonePad(t[i]));return e},i.prototype._clonePad=function(t){var e,i,s=new n;if(!t)return s;for(e=0,i=t.buttons.length;i>e;e++)t.buttons[e]&&s.updateButton(e,t.buttons[e].value);for(e=0,i=t.axes.length;i>e;e++)s.updateAxes(e,t.axes[e]);return s},i.MinAxisMoveThreshold=.05,i}(t.Class);e.Gamepads=i;var n=function(t){function e(){t.call(this),this.connected=!1,this._buttons=Array(16),this._axes=Array(4);var e;for(e=0;this._buttons.length>e;e++)this._buttons[e]=0;for(e=0;this._axes.length>e;e++)this._axes[e]=0}return __extends(e,t),e.prototype.isButtonPressed=function(t,e){return void 0===e&&(e=1),this._buttons[t]>=e},e.prototype.getButton=function(t){return this._buttons[t]},e.prototype.getAxes=function(t){var e=this._axes[t];return Math.abs(e)n;n++)this._animations[n].animation.draw(i,this._animations[n].x,this._animations[n].y);if(this.fps=1/(e/1e3),this.isDebug){this.ctx.font="Consolas",this.ctx.fillStyle=""+this.debugColor;for(var o=this.input.keyboard.getKeys(),r=0;o.length>r;r++)this.ctx.fillText(""+o[r]+" : "+(t.Input.Keys[o[r]]?t.Input.Keys[o[r]]:"Not Mapped"),100,10*r+10);this.ctx.fillText("FPS:"+(""+this.fps.toFixed(2)),10,10)}for(var h=0;this.postProcessors.length>h;h++)this.postProcessors[h].process(this.ctx.getImageData(0,0,this.width,this.height),this.ctx);this.emit("postdraw",new t.PreDrawEvent(i,e,this))},s.prototype.start=function(e){if(!this._compatible){var i=new t.Promise;return i.reject("Excalibur is incompatible with your browser")}var n;if(e?(e.wireEngine(this),n=this.load(e)):n=t.Promise.wrap(),!this._hasStarted){this._hasStarted=!0,this._logger.debug("Starting game...");var s=Date.now(),o=this;(function r(){if(o._hasStarted)try{o._requestId=window.requestAnimationFrame(r);var t=Date.now(),e=Math.floor(t-s)||1;e>200&&(e=1),o._update(e),o._draw(e),s=t}catch(i){window.cancelAnimationFrame(o._requestId),o.stop(),o.onFatalException(i)}})(),this._logger.debug("Game started")}return n},s.prototype.stop=function(){this._hasStarted&&(this._hasStarted=!1,this._logger.debug("Game stopped"))},s.prototype.screenshot=function(){var t=new Image,e=this.canvas.toDataURL("image/png");return t.src=e,t},s.prototype._drawLoadingBar=function(t,e,i){if(this._loadingDraw)return this._loadingDraw(t,e,i),void 0;var n=this.canvas.height/2,s=this.canvas.width/3,o=s,r=new Image;r.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAyAAAAEsCAYAAAA7Ldc6AAAACXBIWXMAAA7CAAAOwgEVKEqAAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGD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tSxPN6xHj552dWH29l7pwYN171O3KCIAAACgTwOI8aX7w8OHT1Wp7HVtYR49OvR5jqQFiggAAADo7wCyIDPz1N7eK5VKj7uyIFtbO/rhh0NXP76cWnwzMxcAAACAPgwgptE/5z7e2HgReQipVPb0zTc/ep8qTS1qnuIBAAAA+jyAmBBSkLTsPl5ddSILIZXKnu7fX/UOPHckzVA0AAAAQP8Zev36de2HoaG3fnnnir6VlHEfT06m9PHH72l4+GgoH761taNvvvnRP9vWjBkMDwAH3H0VAABItmMtfn9J0j03hKyuOtrc3NHvfz+h8fHRjj74wYN1/5gPwgcAAADQ55peAZGkO1eUknRbUs77/ORkSh9+eE5jY8etP2xv75XW1p7rwYP1erNrET4ANMQVEAAABiSAeILIvKTr/ufHxo7r/fdPa3z8pMbGfvVW96ytrR1tbu5oY6Piv8mgqyzpC244CIAAAgAAAcQfQjKSbsp3NaRNjmr3HFlgul0ABBAAAAggzYJITtJVSdMEDwAEEAAAEGkA8QSRlAkhn6k2UD3TIHCUJH0tqTi1qCKrHQABBACAAQ8gAAAAABC1I6wCAAAAAAQQAAAAAH3n/w8AmB1j3tEUq4sAAAAASUVORK5CYII="; +return this},e.prototype.repeatForever=function(){var e=0,i=this._queues.length;for(e;i>e;e++)this._queues[e].add(new t.Internal.Actions.RepeatForever(this._actors[e],this._actors[e].actionQueue.getActions()));return this},e.prototype.follow=function(e,i){var n=0,s=this._queues.length;for(n;s>n;n++)void 0===i?this._queues[n].add(new t.Internal.Actions.Follow(this._actors[n],e)):this._queues[n].add(new t.Internal.Actions.Follow(this._actors[n],e,i));return this},e.prototype.meet=function(e,i){var n=0,s=this._queues.length;for(n;s>n;n++)void 0===i?this._queues[n].add(new t.Internal.Actions.Meet(this._actors[n],e)):this._queues[n].add(new t.Internal.Actions.Meet(this._actors[n],e,i));return this},e.prototype.asPromise=function(){var e=this,i=this._queues.map(function(i,n){var s=new t.Promise;return i.add(new t.Internal.Actions.CallMethod(e._actors[n],function(){s.resolve()})),s});return t.Promise.join.apply(this,i)},e}();t.ActionContext=e})(ex||(ex={}));var ex;(function(t){var e=function(e){function i(i,n){if(e.call(this),this.name=i,this.scene=n,this._logger=t.Logger.getInstance(),this._members=[],this.actions=new t.ActionContext,null==n)this._logger.error("Invalid constructor arguments passed to Group: ",i,", scene must not be null!");else{var s=n.groups[i];s&&this._logger.warn("Group with name",i,"already exists. This new group will replace it."),n.groups[i]=this}}return __extends(i,e),i.prototype.add=function(e){e instanceof t.Actor&&(e=[].concat(e));var i,n=0,s=e.length;for(n;s>n;n++)i=this.getMembers().indexOf(e[n]),-1===i&&(this._members.push(e[n]),this.scene.add(e[n]),this.actions.addActorToContext(e[n]),this.eventDispatcher.wire(e[n].eventDispatcher))},i.prototype.remove=function(t){var e=this._members.indexOf(t);e>-1&&(this._members.splice(e,1),this.actions.removeActorFromContext(t),this.eventDispatcher.unwire(t.eventDispatcher))},i.prototype.move=function(e){var i=0,n=this.getMembers(),s=n.length;if(1===arguments.length&&e instanceof t.Vector)for(i;s>i;i++)n[i].x+=e.x,n[i].y+=e.y;else if("number"==typeof arguments[0]&&"number"==typeof arguments[1]){var o=arguments[0],r=arguments[1];for(i;s>i;i++)n[i].x+=o,n[i].y+=r}else this._logger.error("Invalid arguments passed to group move",this.name,"args:",arguments)},i.prototype.rotate=function(){if("number"==typeof arguments[0]){var t=arguments[0],e=0,i=this.getMembers(),n=i.length;for(e;n>e;e++)i[e].rotation+=t}else this._logger.error("Invalid arguments passed to group rotate",this.name,"args:",arguments)},i.prototype.on=function(t,e){this.eventDispatcher.subscribe(t,e)},i.prototype.off=function(t,e){this.eventDispatcher.unsubscribe(t,e)},i.prototype.emit=function(t,e){this.eventDispatcher.emit(t,e)},i.prototype.contains=function(t){return this.getMembers().indexOf(t)>-1},i.prototype.getMembers=function(){return this._members},i.prototype.getRandomMember=function(){return this._members[Math.floor(Math.random()*this._members.length)]},i.prototype.getBounds=function(){return this.getMembers().map(function(t){return t.getBounds()}).reduce(function(t,e){return t.combine(e)})},i}(t.Class);t.Group=e})(ex||(ex={}));var ex;(function(t){var e=function(){function t(t){this._getComparable=t}return t.prototype.find=function(t){return this._find(this._root,t)},t.prototype._find=function(t,e){return null==t?!1:this._getComparable.call(e)===t.getKey()?t.getData().indexOf(e)>-1?!0:!1:this._getComparable.call(e)e?this._get(t.getLeft(),e):this._get(t.getRight(),e)},t.prototype.add=function(t){return null==this._root?(this._root=new i(this._getComparable.call(t),[t],null,null),!0):this._insert(this._root,t)},t.prototype._insert=function(t,e){return null!=t?this._getComparable.call(e)===t.getKey()?t.getData().indexOf(e)>-1?!1:(t.getData().push(e),!0):this._getComparable.call(e)-1){if(t.getData().splice(i,1),0===t.getData().length){if(null==t.getLeft()&&null==t.getRight())return null;if(null==t.getLeft())return t.getRight();if(null==t.getRight())return t.getLeft();var n=this._findMinNode(t.getRight());return t.setKey(n.getKey()),t.setData(n.getData()),t.setRight(this._cleanup(t.getRight(),n)),t}return t}},t.prototype._cleanup=function(t,e){var i=e.getKey();if(null==t)return null;if(i===t.getKey()){if(null==t.getLeft()&&null==t.getRight())return null;if(null==t.getLeft())return t.getRight();if(null==t.getRight())return t.getLeft();var n=this._findMinNode(t.getRight());return t.setKey(n.getKey()),t.setData(n.getData()),t.setRight(this._cleanup(t.getRight(),n)),t}return this._getComparable.call(e)n;n++)this.uiActors[n].update(e,i);for(n=0,s=this.tileMaps.length;s>n;n++)this.tileMaps[n].update(e,i);for(n=0,s=this.children.length;s>n;n++)this.children[n].update(e,i);this._collisionResolver&&(this._collisionResolver.update(this.children),this._collisionResolver.evaluate(this.children));var o;for(n=0,s=this._killQueue.length;s>n;n++)o=this.children.indexOf(this._killQueue[n]),o>-1&&(this._sortedDrawingTree.removeByComparable(this._killQueue[n]),this.children.splice(o,1));for(this._killQueue.length=0,n=0,s=this._cancelQueue.length;s>n;n++)this.removeTimer(this._cancelQueue[n]);this._cancelQueue.length=0,this._timers=this._timers.filter(function(t){return t.update(i),!t.complete}),this.emit("postupdate",new t.PostUpdateEvent(e,i,this))},i.prototype.draw=function(e,i){this.emit("predraw",new t.PreDrawEvent(e,i,this)),e.save(),this.camera&&this.camera.update(e,i);var n,s;for(n=0,s=this.tileMaps.length;s>n;n++)this.tileMaps[n].draw(e,i);var o=this._sortedDrawingTree.list();for(n=0,s=o.length;s>n;n++)o[n].visible&&!o[n].isOffScreen&&o[n].draw(e,i);for(this.engine&&this.engine.isDebug&&(e.strokeStyle="yellow",this.debugDraw(e)),e.restore(),n=0,s=this.uiActors.length;s>n;n++)this.uiActors[n].visible&&this.uiActors[n].draw(e,i);if(this.engine&&this.engine.isDebug)for(n=0,s=this.uiActors.length;s>n;n++)this.uiActors[n].debugDraw(e);this.emit("postdraw",new t.PreDrawEvent(e,i,this))},i.prototype.debugDraw=function(e){this.emit("predebugdraw",new t.PreDebugDrawEvent(e,this));var i,n;for(i=0,n=this.tileMaps.length;n>i;i++)this.tileMaps[i].debugDraw(e);for(i=0,n=this.children.length;n>i;i++)this.children[i].debugDraw(e);this.camera.debugDraw(e),this.emit("postdebugdraw",new t.PostDebugDrawEvent(e,this))},i.prototype.contains=function(t){return this.children.indexOf(t)>-1},i.prototype.add=function(e){return e instanceof t.Actor&&e.unkill(),e instanceof t.UIActor?(t.Util.contains(this.uiActors,e)||this.addUIActor(e),void 0):e instanceof t.Actor?(t.Util.contains(this.children,e)||(this.addChild(e),this._sortedDrawingTree.add(e)),void 0):e instanceof t.Timer?(t.Util.contains(this._timers,e)||this.addTimer(e),void 0):(e instanceof t.TileMap&&(t.Util.contains(this.tileMaps,e)||this.addTileMap(e)),void 0)},i.prototype.remove=function(e){return e instanceof t.UIActor?(this.removeUIActor(e),void 0):(e instanceof t.Actor&&(this._collisionResolver.remove(e),this.removeChild(e)),e instanceof t.Timer&&this.removeTimer(e),e instanceof t.TileMap&&this.removeTileMap(e),void 0)},i.prototype.addUIActor=function(t){this.uiActors.push(t),t.scene=this},i.prototype.removeUIActor=function(t){var e=this.uiActors.indexOf(t);e>-1&&this.uiActors.splice(e,1)},i.prototype.addChild=function(t){this._collisionResolver.register(t),t.scene=this,this.children.push(t),this._sortedDrawingTree.add(t),t.parent=this.actor},i.prototype.addTileMap=function(t){this.tileMaps.push(t)},i.prototype.removeTileMap=function(t){var e=this.tileMaps.indexOf(t);e>-1&&this.tileMaps.splice(e,1)},i.prototype.removeChild=function(t){this._collisionResolver.remove(t),this._killQueue.push(t),t.parent=null},i.prototype.addTimer=function(t){return this._timers.push(t),t.scene=this,t},i.prototype.removeTimer=function(t){var e=this._timers.indexOf(t);return-1!==e&&this._timers.splice(e,1),t},i.prototype.cancelTimer=function(t){return this._cancelQueue.push(t),t},i.prototype.isTimerActive=function(t){return this._timers.indexOf(t)>-1},i.prototype.createGroup=function(e){return new t.Group(e,this)},i.prototype.getGroup=function(t){return this.groups[t]},i.prototype.removeGroup=function(e){"string"==typeof e?delete this.groups[e]:e instanceof t.Group?delete this.groups[e.name]:this._logger.error("Invalid arguments to removeGroup",e)},i.prototype.cleanupDrawTree=function(t){this._sortedDrawingTree.removeByComparable(t)},i.prototype.updateDrawTree=function(t){this._sortedDrawingTree.add(t)},i}(t.Class);t.Scene=e})(ex||(ex={}));var ex;(function(t){var e=function(){function t(){}return t.Linear=function(t,e,i,n){return i-=e,i*t/n+e},t.EaseInQuad=function(t,e,i,n){t/=n},t.EaseOutQuad=function(t,e,i,n){return t/=n,-i*t*(t-2)+e},t.EaseInOutQuad=function(t,e,i,n){return i-=e,t/=n/2,1>t?i/2*t*t+e:(t--,-i/2*(t*(t-2)-1)+e)},t.EaseInCubic=function(t,e,i,n){return i-=e,t/=n,i*t*t*t+e},t.EaseOutCubic=function(t,e,i,n){return i-=e,t/=n,i*(t*t*t+1)+e},t.EaseInOutCubic=function(t,e,i,n){return i-=e,t/=n/2,1>t?i/2*t*t*t+e:(t-=2,i/2*(t*t*t+2)+e)},t}();t.EasingFunctions=e})(ex||(ex={}));var ex;(function(t){var e=function(e){function n(s,o,r,h,a){e.call(this),this.id=n.maxId++,this.x=0,this.y=0,this._height=0,this._width=0,this.rotation=0,this.rx=0,this.scale=new t.Vector(1,1),this.sx=0,this.sy=0,this.dx=0,this.dy=0,this.ax=0,this.ay=0,this.isOffScreen=!1,this.visible=!0,this.opacity=1,this.previousOpacity=1,this.logger=t.Logger.getInstance(),this.scene=null,this.parent=null,this.children=[],this.collisionType=i.PreventCollision,this.collisionGroups=[],this._collisionHandlers={},this._isInitialized=!1,this.frames={},this.currentDrawing=null,this.centerDrawingX=!0,this.centerDrawingY=!0,this.traits=[],this.enableCapturePointer=!1,this.capturePointer={captureMoveEvents:!1},this._zIndex=0,this._isKilled=!1,this.x=s||0,this.y=o||0,this._width=r||0,this._height=h||0,a&&(this.color=a.clone(),this.opacity=a.a),this.traits.push(new t.Traits.Movement),this.traits.push(new t.Traits.CollisionDetection),this.traits.push(new t.Traits.OffscreenCulling),this.traits.push(new t.Traits.CapturePointer),this.actionQueue=new t.Internal.Actions.ActionQueue(this),this.actions=new t.ActionContext(this),this.anchor=new t.Point(.5,.5)}return __extends(n,e),n.prototype.onInitialize=function(){},n.prototype._checkForPointerOptIn=function(t){!t||"pointerdown"!==t.toLowerCase()&&"pointerdown"!==t.toLowerCase()&&"pointermove"!==t.toLowerCase()||(this.enableCapturePointer=!0,"pointermove"===t.toLowerCase()&&(this.capturePointer.captureMoveEvents=!0))},n.prototype.addEventListener=function(t,i){this._checkForPointerOptIn(t),e.prototype.addEventListener.call(this,t,i)},n.prototype.on=function(t,e){this._checkForPointerOptIn(t),this.eventDispatcher.subscribe(t,e)},n.prototype.kill=function(){this.scene?(this.emit("kill",new t.KillEvent(this)),this.scene.remove(this),this._isKilled=!0):this.logger.warn("Cannot kill actor, it was never added to the Scene")},n.prototype.unkill=function(){this._isKilled=!1},n.prototype.isKilled=function(){return this._isKilled},n.prototype.add=function(e){e.collisionType=i.PreventCollision,t.Util.addItemToArray(e,this.children)&&(e.parent=this)},n.prototype.remove=function(e){t.Util.removeItemToArray(e,this.children)&&(e.parent=null)},n.prototype.setDrawing=function(e){e=""+e,this.currentDrawing!==this.frames[e]&&(null!=this.frames[e]?(this.frames[e].reset(),this.currentDrawing=this.frames[e]):t.Logger.getInstance().error("the specified drawing key '"+e+"' does not exist"))},n.prototype.addDrawing=function(){2===arguments.length?(this.frames[arguments[0]]=arguments[1],this.currentDrawing||(this.currentDrawing=arguments[1])):(arguments[0]instanceof t.Sprite&&this.addDrawing("default",arguments[0]),arguments[0]instanceof t.Texture&&this.addDrawing("default",arguments[0].asSprite()))},n.prototype.getZIndex=function(){return this._zIndex},n.prototype.setZIndex=function(t){this.scene.cleanupDrawTree(this),this._zIndex=t,this.scene.updateDrawTree(this)},n.prototype.addCollisionGroup=function(t){this.collisionGroups.push(t)},n.prototype.removeCollisionGroup=function(t){var e=this.collisionGroups.indexOf(t);-1!==e&&this.collisionGroups.splice(e,1)},n.prototype.getCenter=function(){return new t.Vector(this.x+this.getWidth()/2-this.anchor.x*this.getWidth(),this.y+this.getHeight()/2-this.anchor.y*this.getHeight())},n.prototype.getWidth=function(){return this._width*this.scale.x},n.prototype.setWidth=function(t){this._width=t/this.scale.x},n.prototype.getHeight=function(){return this._height*this.scale.y},n.prototype.setHeight=function(t){this._height=t/this.scale.y},n.prototype.setCenterDrawing=function(t){this.centerDrawingY=t,this.centerDrawingX=t},n.prototype.getLeft=function(){return this.getBounds().left},n.prototype.getRight=function(){return this.getBounds().right},n.prototype.getTop=function(){return this.getBounds().top},n.prototype.getBottom=function(){return this.getBounds().bottom},n.prototype.getWorldX=function(){return this.parent?this.x*this.parent.scale.x+this.parent.getWorldX():this.x},n.prototype.getWorldY=function(){return this.parent?this.y*this.parent.scale.y+this.parent.getWorldY():this.y},n.prototype.getGlobalScale=function(){if(!this.parent)return new t.Point(this.scale.x,this.scale.y);var e=this.parent.getGlobalScale();return new t.Point(this.scale.x*e.x,this.scale.y*e.y)},n.prototype.getBounds=function(){var e=this._getCalculatedAnchor();return new t.BoundingBox(this.getWorldX()-e.x,this.getWorldY()-e.y,this.getWorldX()+this.getWidth()-e.x,this.getWorldY()+this.getHeight()-e.y)},n.prototype.contains=function(e,i,n){void 0===n&&(n=!1);var s=this.getBounds().contains(new t.Point(e,i));return n?s||this.children.some(function(t){return t.contains(e,i,!0)}):s},n.prototype.getSideFromIntersect=function(e){return e?Math.abs(e.x)>Math.abs(e.y)?0>e.x?t.Side.Right:t.Side.Left:0>e.y?t.Side.Bottom:t.Side.Top:t.Side.None},n.prototype.collidesWithSide=function(e){var i=this.collides(e);return i?Math.abs(i.x)>Math.abs(i.y)?this.x=Math.sqrt(Math.pow(this.x-t.x,2)+Math.pow(this.y-t.y,2))},n.prototype.clearActions=function(){this.actionQueue.clearActions()},n.prototype.easeTo=function(e,i,n,s){return void 0===s&&(s=t.EasingFunctions.Linear),this.actionQueue.add(new t.Internal.Actions.EaseTo(this,e,i,n,s)),this},n.prototype.moveTo=function(e,i,n){return this.actionQueue.add(new t.Internal.Actions.MoveTo(this,e,i,n)),this},n.prototype.moveBy=function(e,i,n){return this.actionQueue.add(new t.Internal.Actions.MoveBy(this,e,i,n)),this},n.prototype.rotateTo=function(e,i,n){return this.actionQueue.add(new t.Internal.Actions.RotateTo(this,e,i,n)),this},n.prototype.rotateBy=function(e,i,n){return this.actionQueue.add(new t.Internal.Actions.RotateBy(this,e,i,n)),this},n.prototype.scaleTo=function(e,i,n,s){return this.actionQueue.add(new t.Internal.Actions.ScaleTo(this,e,i,n,s)),this},n.prototype.scaleBy=function(e,i,n){return this.actionQueue.add(new t.Internal.Actions.ScaleBy(this,e,i,n)),this},n.prototype.blink=function(e,i,n){return void 0===n&&(n=1),this.actionQueue.add(new t.Internal.Actions.Blink(this,e,i,n)),this},n.prototype.fade=function(e,i){return this.actionQueue.add(new t.Internal.Actions.Fade(this,e,i)),this},n.prototype.delay=function(e){return this.actionQueue.add(new t.Internal.Actions.Delay(this,e)),this},n.prototype.die=function(){return this.actionQueue.add(new t.Internal.Actions.Die(this)),this},n.prototype.callMethod=function(e){return this.actionQueue.add(new t.Internal.Actions.CallMethod(this,e)),this},n.prototype.repeat=function(e){return e?(this.actionQueue.add(new t.Internal.Actions.Repeat(this,e,this.actionQueue.getActions())),this):(this.repeatForever(),this)},n.prototype.repeatForever=function(){return this.actionQueue.add(new t.Internal.Actions.RepeatForever(this,this.actionQueue.getActions())),this},n.prototype.follow=function(e,i){return i===void 0?this.actionQueue.add(new t.Internal.Actions.Follow(this,e)):this.actionQueue.add(new t.Internal.Actions.Follow(this,e,i)),this},n.prototype.meet=function(e,i){return i===void 0?this.actionQueue.add(new t.Internal.Actions.Meet(this,e)):this.actionQueue.add(new t.Internal.Actions.Meet(this,e,i)),this},n.prototype.asPromise=function(){var e=new t.Promise;return this.callMethod(function(){e.resolve()}),e},n.prototype._getCalculatedAnchor=function(){return new t.Point(this.getWidth()*this.anchor.x,this.getHeight()*this.anchor.y)},n.prototype.update=function(e,i){this._isInitialized||(this.onInitialize(e),this.eventDispatcher.emit("initialize",new t.InitializeEvent(e)),this._isInitialized=!0),this.emit("preupdate",new t.PreUpdateEvent(e,i,this));var n=this.eventDispatcher;this.actionQueue.update(i),this.color&&(this.color.a=this.opacity);for(var s=0;this.traits.length>s;s++)this.traits[s].update(this,e,i);n.emit("update",new t.UpdateEvent(i)),this.emit("postupdate",new t.PostUpdateEvent(e,i,this))},n.prototype.draw=function(e,i){var n=this._getCalculatedAnchor();if(e.save(),e.translate(this.x,this.y),e.scale(this.scale.x,this.scale.y),e.rotate(this.rotation),this.emit("predraw",new t.PreDrawEvent(e,i,this)),this.previousOpacity!==this.opacity){for(var s in this.frames)this.frames[s].addEffect(new t.Effects.Opacity(this.opacity));this.previousOpacity=this.opacity}if(this.currentDrawing){var o=0,r=0;this.centerDrawingX&&(o=(this.currentDrawing.naturalWidth*this.currentDrawing.scale.x-this.getWidth())/2-this.currentDrawing.naturalWidth*this.currentDrawing.scale.x*this.currentDrawing.anchor.x),this.centerDrawingY&&(r=(this.currentDrawing.naturalHeight*this.currentDrawing.scale.y-this.getHeight())/2-this.currentDrawing.naturalHeight*this.currentDrawing.scale.y*this.currentDrawing.anchor.y),this.currentDrawing.draw(e,-n.x-o,-n.y-r)}else this.color&&(e.fillStyle=""+this.color,e.fillRect(-n.x,-n.y,this._width,this._height));for(var h=0;this.children.length>h;h++)this.children[h].visible&&this.children[h].draw(e,i);this.emit("postdraw",new t.PostDrawEvent(e,i,this)),e.restore()},n.prototype.debugDraw=function(e){this.emit("predebugdraw",new t.PreDebugDrawEvent(e,this));var i=this.getBounds();i.debugDraw(e),e.fillText("id: "+this.id,i.left+3,i.top+10),e.fillStyle=""+t.Color.Yellow,e.beginPath(),e.arc(this.getWorldX(),this.getWorldY(),3,0,2*Math.PI),e.closePath(),e.fill();for(var n=0;this.traits.length>n;n++)this.traits[n]instanceof t.Traits.OffscreenCulling&&this.traits[n].cullingBox.debugDraw(e);e.strokeStyle=""+t.Color.Yellow,e.beginPath();var s=Math.min(this.getWidth(),this.getHeight());e.arc(this.getWorldX(),this.getWorldY(),s,0,2*Math.PI),e.closePath(),e.stroke();var o={"0 Pi":0,"Pi/2":Math.PI/2,Pi:Math.PI,"3/2 Pi":3*Math.PI/2},r=e.font;for(var h in o)e.fillStyle=""+t.Color.Yellow,e.font="14px",e.textAlign="center",e.fillText(h,this.getWorldX()+Math.cos(o[h])*(s+10),this.getWorldY()+Math.sin(o[h])*(s+10));e.font=r,e.save(),e.translate(this.x,this.y),e.rotate(this.rotation);for(var a=0;this.children.length>a;a++)this.children[a].debugDraw(e);e.restore(),this.emit("postdebugdraw",new t.PostDebugDrawEvent(e,this))},n.maxId=0,n}(t.Class);t.Actor=e,function(t){t[t.PreventCollision=0]="PreventCollision",t[t.Passive=1]="Passive",t[t.Active=2]="Active",t[t.Elastic=3]="Elastic",t[t.Fixed=4]="Fixed"}(t.CollisionType||(t.CollisionType={}));var i=t.CollisionType})(ex||(ex={}));var ex;(function(t){(function(t){t[t.Debug=0]="Debug",t[t.Info=1]="Info",t[t.Warn=2]="Warn",t[t.Error=3]="Error",t[t.Fatal=4]="Fatal"})(t.LogLevel||(t.LogLevel={}));var e=t.LogLevel,i=function(){function t(){if(this._appenders=[],this.defaultLevel=e.Info,t._instance)throw Error("Logger is a singleton");return t._instance=this,t._instance.addAppender(new n),t._instance}return t.getInstance=function(){return null==t._instance&&(t._instance=new t),t._instance},t.prototype.addAppender=function(t){this._appenders.push(t)},t.prototype.clearAppenders=function(){this._appenders.length=0},t.prototype._log=function(t,e){null==t&&(t=this.defaultLevel);var i=0,n=this._appenders.length;for(i;n>i;i++)t>=this.defaultLevel&&this._appenders[i].log(t,e)},t.prototype.debug=function(){for(var t=[],i=0;arguments.length>i;i++)t[i-0]=arguments[i];this._log(e.Debug,t)},t.prototype.info=function(){for(var t=[],i=0;arguments.length>i;i++)t[i-0]=arguments[i];this._log(e.Info,t)},t.prototype.warn=function(){for(var t=[],i=0;arguments.length>i;i++)t[i-0]=arguments[i];this._log(e.Warn,t)},t.prototype.error=function(){for(var t=[],i=0;arguments.length>i;i++)t[i-0]=arguments[i];this._log(e.Error,t)},t.prototype.fatal=function(){for(var t=[],i=0;arguments.length>i;i++)t[i-0]=arguments[i];this._log(e.Fatal,t)},t._instance=null,t}();t.Logger=i;var n=function(){function t(){}return t.prototype.log=function(t,i){if(console||console.log||!console.warn||!console.error){var n=[];n.unshift.apply(n,i),n.unshift("["+e[t]+"] : "),e.Warn>t?console.log.apply?console.log.apply(console,n):console.log(n.join(" ")):e.Error>t?console.warn.apply?console.warn.apply(console,n):console.warn(n.join(" ")):console.error.apply?console.error.apply(console,n):console.error(n.join(" "))}},t}();t.ConsoleAppender=n;var s=function(){function t(t,e){this._messages=[],this._canvas=document.createElement("canvas"),this._canvas.width=t||window.innerWidth,this._canvas.height=e||window.innerHeight,this._canvas.style.position="absolute",this._ctx=this._canvas.getContext("2d"),document.body.appendChild(this._canvas)}return t.prototype.log=function(t,i){var n=i.join(",");this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._messages.unshift("["+e[t]+"] : "+n);for(var s=10,o=1,r=0;this._messages.length>r;r++)this._ctx.fillStyle="rgba(255,255,255,"+o.toFixed(2)+")",this._ctx.fillText(this._messages[r],200,s),s+=10,o=o>0?o-.05:0},t}();t.ScreenAppender=s})(ex||(ex={}));var ex;(function(t){var e=function(){function t(){}return t}();t.GameEvent=e;var i=function(t){function e(e){t.call(this),this.target=e}return __extends(e,t),e}(e);t.KillEvent=i;var n=function(t){function e(e,i,n){t.call(this),this.ctx=e,this.delta=i,this.target=n}return __extends(e,t),e}(e);t.PreDrawEvent=n;var s=function(t){function e(e,i,n){t.call(this),this.ctx=e,this.delta=i,this.target=n}return __extends(e,t),e}(e);t.PostDrawEvent=s;var o=function(t){function e(e,i){t.call(this),this.ctx=e,this.target=i}return __extends(e,t),e}(e);t.PreDebugDrawEvent=o;var r=function(t){function e(e,i){t.call(this),this.ctx=e,this.target=i}return __extends(e,t),e}(e);t.PostDebugDrawEvent=r;var h=function(t){function e(e,i,n){t.call(this),this.engine=e,this.delta=i,this.target=n}return __extends(e,t),e}(e);t.PreUpdateEvent=h;var a=function(t){function e(e,i,n){t.call(this),this.engine=e,this.delta=i,this.target=n}return __extends(e,t),e}(e);t.PostUpdateEvent=a;var c=function(t){function e(e,i){t.call(this),this.index=e,this.gamepad=i}return __extends(e,t),e}(e);t.GamepadConnectEvent=c;var u=function(t){function e(e){t.call(this),this.index=e}return __extends(e,t),e}(e);t.GamepadDisconnectEvent=u;var l=function(t){function e(e,i){t.call(this),this.button=e,this.value=i}return __extends(e,t),e}(t.GameEvent);t.GamepadButtonEvent=l;var p=function(t){function e(e,i){t.call(this),this.axis=e,this.value=i}return __extends(e,t),e}(t.GameEvent);t.GamepadAxisEvent=p;var d=function(t){function e(e,i){t.call(this),this.topic=e,this.handler=i}return __extends(e,t),e}(e);t.SubscribeEvent=d;var f=function(t){function e(e,i){t.call(this),this.topic=e,this.handler=i}return __extends(e,t),e}(e);t.UnsubscribeEvent=f;var g=function(t){function e(){t.call(this)}return __extends(e,t),e}(e);t.VisibleEvent=g;var _=function(t){function e(){t.call(this)}return __extends(e,t),e}(e);t.HiddenEvent=_;var y=function(t){function e(e,i,n,s){t.call(this),this.actor=e,this.other=i,this.side=n,this.intersection=s}return __extends(e,t),e}(e);t.CollisionEvent=y;var A=function(t){function e(e){t.call(this),this.delta=e}return __extends(e,t),e}(e);t.UpdateEvent=A;var v=function(t){function e(e){t.call(this),this.engine=e}return __extends(e,t),e}(e);t.InitializeEvent=v;var m=function(t){function e(e){t.call(this),this.oldScene=e}return __extends(e,t),e}(e);t.ActivateEvent=m;var x=function(t){function e(e){t.call(this),this.newScene=e}return __extends(e,t),e}(e);t.DeactivateEvent=x;var w=function(t){function e(){t.call(this)}return __extends(e,t),e}(e);t.ExitViewPortEvent=w;var b=function(t){function e(){t.call(this)}return __extends(e,t),e}(e);t.EnterViewPortEvent=b})(ex||(ex={}));var ex;(function(t){var e=function(){function e(e){this._handlers={},this._wiredEventDispatchers=[],this._log=t.Logger.getInstance(),this._target=e}return e.prototype.publish=function(e,i){if(e){e=e.toLowerCase();var n=this._target;i||(i=new t.GameEvent),i.target=n;var s,o;if(this._handlers[e])for(s=0,o=this._handlers[e].length,s;o>s;s++)this._handlers[e][s].call(n,i);for(s=0,o=this._wiredEventDispatchers.length,s;o>s;s++)this._wiredEventDispatchers[s].emit(e,i)}},e.prototype.emit=function(t,e){this.publish(t,e)},e.prototype.subscribe=function(e,i){e=e.toLowerCase(),this._handlers[e]||(this._handlers[e]=[]),this._handlers[e].push(i),"unsubscribe"!==e&&"subscribe"!==e&&this.emit("subscribe",new t.SubscribeEvent(e,i))},e.prototype.unsubscribe=function(e,i){e=e.toLowerCase();var n=this._handlers[e];if(n)if(i){var s=n.indexOf(i);this._handlers[e].splice(s,1)}else this._handlers[e].length=0;"unsubscribe"!==e&&"subscribe"!==e&&this.emit("unsubscribe",new t.UnsubscribeEvent(e,i))},e.prototype.wire=function(t){t._wiredEventDispatchers.push(this)},e.prototype.unwire=function(t){var e=t._wiredEventDispatchers.indexOf(this);e>-1&&t._wiredEventDispatchers.splice(e,1)},e}();t.EventDispatcher=e})(ex||(ex={}));var ex;(function(t){var e=function(){function t(t,e,i,n){this.r=t,this.g=e,this.b=i,this.a=null!=n?n:1}return t.fromRGB=function(e,i,n,s){return new t(e,i,n,s)},t.fromHex=function(e){var i=/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})?$/i,n=null;if(n=e.match(i)){var s=parseInt(n[1],16),o=parseInt(n[2],16),r=parseInt(n[3],16),h=1;return n[4]&&(h=parseInt(n[4],16)/255),new t(s,o,r,h)}throw Error("Invalid hex string: "+e)},t.fromHSL=function(t,e,n,s){void 0===s&&(s=1);var o=new i(t,e,n,s);return o.toRGBA()},t.prototype.lighten=function(t){void 0===t&&(t=.1);var e=i.fromRGBA(this.r,this.g,this.b,this.a);return e.l+=e.l*t,e.toRGBA()},t.prototype.darken=function(t){void 0===t&&(t=.1);var e=i.fromRGBA(this.r,this.g,this.b,this.a);return e.l-=e.l*t,e.toRGBA()},t.prototype.saturate=function(t){void 0===t&&(t=.1);var e=i.fromRGBA(this.r,this.g,this.b,this.a);return e.s+=e.s*t,e.toRGBA()},t.prototype.desaturate=function(t){void 0===t&&(t=.1);var e=i.fromRGBA(this.r,this.g,this.b,this.a);return e.s-=e.s*t,e.toRGBA()},t.prototype.mulitiply=function(e){var i=255*(e.r/255*this.r/255),n=255*(e.g/255*this.g/255),s=255*(e.b/255*this.b/255),o=e.a*this.a;return new t(i,n,s,o)},t.prototype.screen=function(t){var e=t.invert(),i=t.invert();return e.mulitiply(i).invert()},t.prototype.invert=function(){return new t(255-this.r,255-this.g,255-this.b,1-this.a)},t.prototype.average=function(e){var i=(e.r+this.r)/2,n=(e.g+this.g)/2,s=(e.b+this.b)/2,o=(e.a+this.a)/2;return new t(i,n,s,o)},t.prototype.toString=function(){var t=this.r.toFixed(0)+""+", "+(this.g.toFixed(0)+"")+", "+(this.b.toFixed(0)+"");return void 0!==this.a||null!==this.a?"rgba("+t+", "+(this.a+"")+")":"rgb("+t+")"},t.prototype.fillStyle=function(){return""+this},t.prototype.clone=function(){return new t(this.r,this.g,this.b,this.a)},t.Black=t.fromHex("#000000"),t.White=t.fromHex("#FFFFFF"),t.Gray=t.fromHex("#808080"),t.LightGray=t.fromHex("#D3D3D3"),t.DarkGray=t.fromHex("#A9A9A9"),t.Yellow=t.fromHex("#FFFF00"),t.Orange=t.fromHex("#FFA500"),t.Red=t.fromHex("#FF0000"),t.Vermillion=t.fromHex("#FF5B31"),t.Rose=t.fromHex("#FF007F"),t.Magenta=t.fromHex("#FF00FF"),t.Violet=t.fromHex("#7F00FF"),t.Blue=t.fromHex("#0000FF"),t.Azure=t.fromHex("#007FFF"),t.Cyan=t.fromHex("#00FFFF"),t.Viridian=t.fromHex("#59978F"),t.Green=t.fromHex("#00FF00"),t.Chartreuse=t.fromHex("#7FFF00"),t.Transparent=t.fromHex("#FFFFFF00"),t}();t.Color=e;var i=function(){function t(t,e,i,n){this.h=t,this.s=e,this.l=i,this.a=n}return t.fromRGBA=function(e,i,n,s){e/=255,i/=255,n/=255;var o,r,h=Math.max(e,i,n),a=Math.min(e,i,n),c=(h+a)/2;if(h===a)o=r=0;else{var u=h-a;switch(r=c>.5?u/(2-h-a):u/(h+a),h){case e:o=(i-n)/u+(n>i?6:0);break;case i:o=(n-e)/u+2;break;case n:o=(e-i)/u+4}o/=6}return new t(o,r,c,s)},t.prototype.toRGBA=function(){function t(t,e,i){return 0>i&&(i+=1),i>1&&(i-=1),1/6>i?t+6*(e-t)*i:.5>i?e:2/3>i?t+6*(e-t)*(2/3-i):t}var i,n,s;if(0===this.s)i=n=s=this.l;else{var o=.5>this.l?this.l*(1+this.s):this.l+this.s-this.l*this.s,r=2*this.l-o;i=t(r,o,this.h+1/3),n=t(r,o,this.h),s=t(r,o,this.h-1/3)}return new e(255*i,255*n,255*s,this.a)},t}() +})(ex||(ex={}));var ex;(function(t){var e=function(e){function i(i,n,s,o){e.call(this,i,n,s,o),this.traits=[],this.traits.push(new t.Traits.Movement),this.traits.push(new t.Traits.CapturePointer),this.anchor.setTo(0,0),this.collisionType=t.CollisionType.PreventCollision,this.enableCapturePointer=!0}return __extends(i,e),i.prototype.onInitialize=function(t){this._engine=t},i.prototype.contains=function(i,n,s){if(void 0===s&&(s=!0),s)return e.prototype.contains.call(this,i,n);var o=this._engine.worldToScreenCoordinates(new t.Point(i,n));return e.prototype.contains.call(this,o.x,o.y)},i}(t.Actor);t.UIActor=e})(ex||(ex={}));var ex;(function(t){var e=function(e){function i(i,n,s,o,r,h){e.call(this,i,n,s,o),this._action=function(){},this.repeats=1,this.target=null,this.repeats=h||this.repeats,this._action=r||this._action,this.collisionType=t.CollisionType.PreventCollision,this.eventDispatcher=new t.EventDispatcher(this),this.actionQueue=new t.Internal.Actions.ActionQueue(this)}return __extends(i,e),i.prototype.update=function(e,i){if(this.actionQueue.update(i),this.x+=this.dx*i/1e3,this.y+=this.dy*i/1e3,this.rotation+=this.rx*i/1e3,this.scale.x+=this.sx*i/1e3,this.scale.y+=this.sy*i/1e3,this.target)this.collides(this.target)&&this._dispatchAction();else for(var n=0;e.currentScene.children.length>n;n++){var s=e.currentScene.children[n];s!==this&&s.collisionType!==t.CollisionType.PreventCollision&&this.collides(s)&&this._dispatchAction()}0===this.repeats&&this.kill()},i.prototype._dispatchAction=function(){this._action.call(this),this.repeats--},i.prototype.draw=function(){},i.prototype.debugDraw=function(i){e.prototype.debugDraw.call(this,i),i.save(),i.translate(this.x,this.y);var n=this.getBounds();n.left=n.left-this.getWorldX(),n.right=n.right-this.getWorldX(),n.top=n.top-this.getWorldY(),n.bottom=n.bottom-this.getWorldY(),i.fillStyle=""+t.Color.Violet,i.strokeStyle=""+t.Color.Violet,i.fillText("Trigger",10,10),n.debugDraw(i),i.restore()},i}(t.Actor);t.Trigger=e})(ex||(ex={}));var ex;(function(t){(function(t){t[t.Circle=0]="Circle",t[t.Rectangle=1]="Rectangle"})(t.EmitterType||(t.EmitterType={}));var e=t.EmitterType,i=function(){function e(e,i,n,s,o,r,h,a,c,u){this.position=new t.Vector(0,0),this.velocity=new t.Vector(0,0),this.acceleration=new t.Vector(0,0),this.particleRotationalVelocity=0,this.currentRotation=0,this.focus=null,this.focusAccel=0,this.opacity=1,this.beginColor=t.Color.White.clone(),this.endColor=t.Color.White.clone(),this.life=300,this.fadeFlag=!1,this._rRate=1,this._gRate=1,this._bRate=1,this._aRate=0,this._currentColor=t.Color.White.clone(),this.emitter=null,this.particleSize=5,this.particleSprite=null,this.sizeRate=0,this.elapsedMultiplier=0,this.emitter=e,this.life=i||this.life,this.opacity=n||this.opacity,this.endColor=o||this.endColor.clone(),this.beginColor=s||this.beginColor.clone(),this._currentColor=this.beginColor.clone(),this.position=r||this.position,this.velocity=h||this.velocity,this.acceleration=a||this.acceleration,this._rRate=(this.endColor.r-this.beginColor.r)/this.life,this._gRate=(this.endColor.g-this.beginColor.g)/this.life,this._bRate=(this.endColor.b-this.beginColor.b)/this.life,this._aRate=this.opacity/this.life,this.startSize=c||0,this.endSize=u||0,this.endSize>0&&this.startSize>0&&(this.sizeRate=(this.endSize-this.startSize)/this.life,this.particleSize=this.startSize)}return e.prototype.kill=function(){this.emitter.removeParticle(this)},e.prototype.update=function(e){if(this.life=this.life-e,this.elapsedMultiplier=this.elapsedMultiplier+e,0>this.life&&this.kill(),this.fadeFlag&&(this.opacity=t.Util.clamp(this._aRate*this.life,1e-4,1)),this.startSize>0&&this.endSize>0&&(this.particleSize=t.Util.clamp(this.sizeRate*e+this.particleSize,Math.min(this.startSize,this.endSize),Math.max(this.startSize,this.endSize))),this._currentColor.r=t.Util.clamp(this._currentColor.r+this._rRate*e,0,255),this._currentColor.g=t.Util.clamp(this._currentColor.g+this._gRate*e,0,255),this._currentColor.b=t.Util.clamp(this._currentColor.b+this._bRate*e,0,255),this._currentColor.a=t.Util.clamp(this.opacity,1e-4,1),this.focus){var i=this.focus.minus(this.position).normalize().scale(this.focusAccel).scale(e/1e3);this.velocity=this.velocity.add(i)}else this.velocity=this.velocity.add(this.acceleration.scale(e/1e3));this.position=this.position.add(this.velocity.scale(e/1e3)),this.particleRotationalVelocity&&(this.currentRotation=(this.currentRotation+this.particleRotationalVelocity*e/1e3)%(2*Math.PI))},e.prototype.draw=function(e){return this.particleSprite?(this.particleSprite.rotation=this.currentRotation,this.particleSprite.scale.setTo(this.particleSize,this.particleSize),this.particleSprite.draw(e,this.position.x,this.position.y),void 0):(this._currentColor.a=t.Util.clamp(this.opacity,1e-4,1),e.fillStyle=""+this._currentColor,e.beginPath(),e.arc(this.position.x,this.position.y,this.particleSize,0,2*Math.PI),e.fill(),e.closePath(),void 0)},e}();t.Particle=i;var n=function(n){function s(i,s,o,r){n.call(this,i,s,o,r,t.Color.White),this._particlesToEmit=0,this.numParticles=0,this.isEmitting=!0,this.particles=null,this.deadParticles=null,this.minVel=0,this.maxVel=0,this.acceleration=new t.Vector(0,0),this.minAngle=0,this.maxAngle=0,this.emitRate=1,this.particleLife=2e3,this.opacity=1,this.fadeFlag=!1,this.focus=null,this.focusAccel=1,this.startSize=null,this.endSize=null,this.minSize=5,this.maxSize=5,this.beginColor=t.Color.White,this.endColor=t.Color.White,this.particleSprite=null,this.emitterType=e.Rectangle,this.radius=0,this.particleRotationalVelocity=0,this.randomRotation=!1,this.collisionType=t.CollisionType.PreventCollision,this.particles=new t.Util.Collection,this.deadParticles=new t.Util.Collection;for(var h in this.traits)this.traits[h]instanceof t.Traits.OffscreenCulling&&this.traits.splice(h,1)}return __extends(s,n),s.prototype.removeParticle=function(t){this.deadParticles.push(t)},s.prototype.emitParticles=function(t){for(var e=0;t>e;e++)this.particles.push(this._createParticle())},s.prototype.clearParticles=function(){this.particles.clear()},s.prototype._createParticle=function(){var n=0,s=0,o=t.Util.randomInRange(this.minAngle,this.maxAngle),r=t.Util.randomInRange(this.minVel,this.maxVel),h=this.startSize||t.Util.randomInRange(this.minSize,this.maxSize),a=r*Math.cos(o),c=r*Math.sin(o);if(this.emitterType===e.Rectangle)n=t.Util.randomInRange(this.x,this.x+this.getWidth()),s=t.Util.randomInRange(this.y,this.y+this.getHeight());else if(this.emitterType===e.Circle){var u=t.Util.randomInRange(0,this.radius);n=u*Math.cos(o)+this.x,s=u*Math.sin(o)+this.y}var l=new i(this,this.particleLife,this.opacity,this.beginColor,this.endColor,new t.Vector(n,s),new t.Vector(a,c),this.acceleration,this.startSize,this.endSize);return l.fadeFlag=this.fadeFlag,l.particleSize=h,this.particleSprite&&(l.particleSprite=this.particleSprite),l.particleRotationalVelocity=this.particleRotationalVelocity,this.randomRotation&&(l.currentRotation=t.Util.randomInRange(0,2*Math.PI)),this.focus&&(l.focus=this.focus.add(new t.Vector(this.x,this.y)),l.focusAccel=this.focusAccel),l},s.prototype.update=function(t,e){var i=this;n.prototype.update.call(this,t,e),this.isEmitting&&(this._particlesToEmit+=this.emitRate*(e/1e3),this._particlesToEmit>1&&(this.emitParticles(Math.floor(this._particlesToEmit)),this._particlesToEmit=this._particlesToEmit-Math.floor(this._particlesToEmit))),this.particles.forEach(function(t){return t.update(e)}),this.deadParticles.forEach(function(t){return i.particles.removeElement(t)}),this.deadParticles.clear()},s.prototype.draw=function(t){this.particles.forEach(function(e){return e.draw(t)})},s.prototype.debugDraw=function(e){n.prototype.debugDraw.call(this,e),e.fillStyle=""+t.Color.Black,e.fillText("Particles: "+this.particles.count(),this.x,this.y+20),this.focus&&(e.fillRect(this.focus.x+this.x,this.focus.y+this.y,3,3),t.Util.drawLine(e,"yellow",this.focus.x+this.x,this.focus.y+this.y,n.prototype.getCenter.call(this).x,n.prototype.getCenter.call(this).y),e.fillText("Focus",this.focus.x+this.x,this.focus.y+this.y))},s}(t.Actor);t.ParticleEmitter=n})(ex||(ex={}));var ex;(function(t){var e=function(){function e(e,i,n,s){this.currentFrame=0,this._oldTime=Date.now(),this.anchor=new t.Point(0,0),this.rotation=0,this.scale=new t.Point(1,1),this.loop=!1,this.freezeFrame=-1,this.flipVertical=!1,this.flipHorizontal=!1,this.width=0,this.height=0,this.naturalWidth=0,this.naturalHeight=0,this.sprites=i,this.speed=n,this._engine=e,null!=s&&(this.loop=s),i&&i[0]&&(this.height=i[0]?i[0].height:0,this.width=i[0]?i[0].width:0,this.naturalWidth=i[0]?i[0].naturalWidth:0,this.naturalHeight=i[0]?i[0].naturalHeight:0,this.freezeFrame=i.length-1)}return e.prototype.opacity=function(e){this.addEffect(new t.Effects.Opacity(e))},e.prototype.grayscale=function(){this.addEffect(new t.Effects.Grayscale)},e.prototype.invert=function(){this.addEffect(new t.Effects.Invert)},e.prototype.fill=function(e){this.addEffect(new t.Effects.Fill(e))},e.prototype.colorize=function(e){this.addEffect(new t.Effects.Colorize(e))},e.prototype.lighten=function(e){void 0===e&&(e=.1),this.addEffect(new t.Effects.Lighten(e))},e.prototype.darken=function(e){void 0===e&&(e=.1),this.addEffect(new t.Effects.Darken(e))},e.prototype.saturate=function(e){void 0===e&&(e=.1),this.addEffect(new t.Effects.Saturate(e))},e.prototype.desaturate=function(e){void 0===e&&(e=.1),this.addEffect(new t.Effects.Desaturate(e))},e.prototype.addEffect=function(t){for(var e in this.sprites)this.sprites[e].addEffect(t)},e.prototype.removeEffect=function(t){for(var e in this.sprites)this.sprites[e].removeEffect(t)},e.prototype.clearEffects=function(){for(var t in this.sprites)this.sprites[t].clearEffects()},e.prototype._setAnchor=function(t){for(var e in this.sprites)this.sprites[e].anchor.setTo(t.x,t.y)},e.prototype._setRotation=function(t){for(var e in this.sprites)this.sprites[e].rotation=t},e.prototype._setScale=function(t){for(var e in this.sprites)this.sprites[e].scale=t},e.prototype.reset=function(){this.currentFrame=0},e.prototype.isDone=function(){return!this.loop&&this.currentFrame>=this.sprites.length},e.prototype.tick=function(){var t=Date.now();t-this._oldTime>this.speed&&(this.currentFrame=this.loop?(this.currentFrame+1)%this.sprites.length:this.currentFrame+1,this._oldTime=t)},e.prototype._updateValues=function(){this._setAnchor(this.anchor),this._setRotation(this.rotation),this._setScale(this.scale)},e.prototype.skip=function(t){this.currentFrame=(this.currentFrame+t)%this.sprites.length},e.prototype.draw=function(e,i,n){this.tick(),this._updateValues();var s;this.currentFrame=this.sprites.length&&(s=this.sprites[t.Util.clamp(this.freezeFrame,0,this.sprites.length-1)],s.draw(e,i,n)),s&&(this.width=s.width,this.height=s.height)},e.prototype.play=function(t,e){this.reset(),this._engine.playAnimation(this,t,e)},e}();t.Animation=e})(ex||(ex={}));var ex;(function(t){var e;(function(e){var i=function(){function e(e,i){this.path=e,this._log=t.Logger.getInstance(),this.onload=function(){},this.onprogress=function(){},this.onerror=function(){},window.AudioContext?(this._log.debug("Using new Web Audio Api for "+e),this._soundImpl=new o(e,i)):(this._log.debug("Falling back to Audio Element for "+e),this._soundImpl=new n(e,i))}return e.prototype.setVolume=function(t){this._soundImpl.setVolume(t)},e.prototype.setLoop=function(t){this._soundImpl.setLoop(t)},e.prototype.load=function(){this._soundImpl.onload=this.onload,this._soundImpl.onprogress=this.onprogress,this._soundImpl.onerror=this.onerror,this._soundImpl.load()},e.prototype.processData=function(t){return this._soundImpl.processData(t)},e.prototype.getData=function(){return this._soundImpl.getData()},e.prototype.setData=function(t){this._soundImpl.setData(t)},e.prototype.isPlaying=function(){return this._soundImpl.isPlaying()},e.prototype.play=function(){return this._soundImpl.play()},e.prototype.pause=function(){this._soundImpl.pause()},e.prototype.stop=function(){this._soundImpl.stop()},e}();e.FallbackAudio=i;var n=function(){function e(e,i){var n=this;this.path=e,this._audioElements=Array(5),this._loadedAudio=null,this._isLoaded=!1,this._index=0,this._log=t.Logger.getInstance(),this._isPlaying=!1,this._currentOffset=0,this.onload=function(){},this.onprogress=function(){},this.onerror=function(){};for(var s=0;this._audioElements.length>s;s++)(function(t){n._audioElements[t]=new Audio})(s);i?this.setVolume(t.Util.clamp(i,0,1)):this.setVolume(1)}return e.prototype.isPlaying=function(){return this._isPlaying},e.prototype._audioLoaded=function(){this._isLoaded=!0},e.prototype.setVolume=function(t){var e=0,i=this._audioElements.length;for(e;i>e;e++)this._audioElements[e].volume=t},e.prototype.setLoop=function(t){var e=0,i=this._audioElements.length;for(e;i>e;e++)this._audioElements[e].loop=t},e.prototype.getLoop=function(){this._audioElements.some(function(t){return t.loop})},e.prototype.load=function(){var t=this;if(!this._loadedAudio){var e=new XMLHttpRequest;e.open("GET",this.path,!0),e.responseType="blob",e.onprogress=this.onprogress,e.onerror=this.onerror,e.onload=function(i){return 200!==e.status?(t._log.error("Failed to load audio resource ",t.path," server responded with error code",e.status),t.onerror(e.response),t._isLoaded=!1,void 0):(t._isLoaded=!0,t.setData(e.response),t.onload(i),void 0)},e.send()}},e.prototype.getData=function(){return this._loadedAudio},e.prototype.setData=function(t){this._isLoaded=!0,this._loadedAudio=this.processData(t)},e.prototype.processData=function(t){var e=URL.createObjectURL(t);return this._audioElements.forEach(function(t){t.src=e}),this._audioLoaded(),e},e.prototype.play=function(){var e=this;this._audioElements[this._index].load(),this._audioElements[this._index].play(),this._currentOffset=0;var i=new t.Promise;return this._isPlaying=!0,this.getLoop()||this._audioElements[this._index].addEventListener("ended",function(){e._isPlaying=!1,i.resolve(!0)}),this._index=(this._index+1)%this._audioElements.length,i},e.prototype.pause=function(){this._index=(this._index-1+this._audioElements.length)%this._audioElements.length,this._currentOffset=this._audioElements[this._index].currentTime,this._audioElements.forEach(function(t){t.pause()}),this._isPlaying=!1},e.prototype.stop=function(){this._audioElements.forEach(function(t){t.pause()}),this._isPlaying=!1},e}();if(e.AudioTag=n,window.AudioContext)var s=new window.AudioContext;var o=function(){function e(e,i){this.path=e,this._context=s,this._volume=this._context.createGain(),this._buffer=null,this._sound=null,this._isLoaded=!1,this._loop=!1,this._isPlaying=!1,this._isPaused=!1,this._currentOffset=0,this._logger=t.Logger.getInstance(),this._data=null,this.onload=function(){},this.onprogress=function(){},this.onerror=function(){},this._volume.gain.value=i?t.Util.clamp(i,0,1):1}return e.prototype.setVolume=function(t){this._volume.gain.value=t},e.prototype.load=function(){var t=this;if(null===this._data){var e=new XMLHttpRequest;e.open("GET",this.path),e.responseType="arraybuffer",e.onprogress=this.onprogress,e.onerror=this.onerror,e.onload=function(){return 200!==e.status?(t._logger.error("Failed to load audio resource ",t.path," server responded with error code",e.status),t.onerror(e.response),t._isLoaded=!1,void 0):(t.setData(e.response),void 0)};try{e.send()}catch(i){console.error("Error loading sound! If this is a cross origin error, you must host your sound with your html and javascript.")}}},e.prototype.getData=function(){return this._data},e.prototype.setData=function(t){this._data=this.processData(t)},e.prototype.processData=function(t){var e=this;return this._context.decodeAudioData(t,function(t){e._buffer=t,e._isLoaded=!0,e.onload(e)},function(){e._logger.error("Unable to decode "+e.path+" this browser may not fully support this format, or the file may be corrupt, "+"if this is an mp3 try removing id3 tags and album art from the file."),e._isLoaded=!1,e.onload(e)}),t},e.prototype.setLoop=function(t){this._loop=t},e.prototype.isPlaying=function(){return this._isPlaying},e.prototype.play=function(){var e=this;if(this._isLoaded){this._sound=this._context.createBufferSource(),this._sound.buffer=this._buffer,this._sound.loop=this._loop,this._sound.connect(this._volume),this._volume.connect(this._context.destination),this._sound.start(0,this._currentOffset%this._buffer.duration),this._currentOffset=0;var i;return i=this._isPaused&&this._playPromise?this._playPromise:new t.Promise,this._isPaused=!1,this._isPlaying=!0,this._loop||(this._sound.onended=function(){e._isPlaying=!1,e._isPaused||i.resolve(!0)}.bind(this)),this._playPromise=i,i}return t.Promise.wrap(!0)},e.prototype.pause=function(){if(this._isPlaying)try{window.clearTimeout(this._playingTimer),this._sound.stop(0),this._currentOffset=this._context.currentTime,this._isPlaying=!1,this._isPaused=!0}catch(t){this._logger.warn("The sound clip",this.path,"has already been paused!")}},e.prototype.stop=function(){if(this._sound)try{window.clearTimeout(this._playingTimer),this._currentOffset=0,this._sound.stop(0),this._isPlaying=!1,this._isPaused=!1}catch(t){this._logger.warn("The sound clip",this.path,"has already been stopped!")}},e}();e.WebAudio=o})(e=t.Internal||(t.Internal={}))})(ex||(ex={}));var ex;(function(t){(function(t){t[t.Resolved=0]="Resolved",t[t.Rejected=1]="Rejected",t[t.Pending=2]="Pending"})(t.PromiseState||(t.PromiseState={}));var e=t.PromiseState,i=function(){function i(){this._state=e.Pending,this._successCallbacks=[],this._rejectCallback=function(){},this._logger=t.Logger.getInstance()}return i.wrap=function(t){var e=(new i).resolve(t);return e},i.join=function(){for(var t=[],e=0;arguments.length>e;e++)t[e-0]=arguments[e];var n=new i;if(!t||!t.length)return n.resolve();var s=t.length,o=0,r=0,h=[];return t.forEach(function(t){t.then(function(){o+=1,o===s?n.resolve():o+r+h.length===s&&n.reject(h)},function(){r+=1,o+r+h.length===s&&n.reject(h)}).error(function(t){h.push(t),h.length+o+r===s&&n.reject(h)})}),n},i.prototype.then=function(t,i){if(t&&(this._successCallbacks.push(t),this.state()===e.Resolved))try{t.call(this,this._value)}catch(n){this._handleError(n)}if(i&&(this._rejectCallback=i,this.state()===e.Rejected))try{i.call(this,this._value)}catch(n){this._handleError(n)}return this},i.prototype.error=function(t){return t&&(this._errorCallback=t),this},i.prototype.resolve=function(t){var i=this;if(this._state!==e.Pending)throw Error("Cannot resolve a promise that is not in a pending state!");this._value=t;try{this._state=e.Resolved,this._successCallbacks.forEach(function(t){t.call(i,i._value)})}catch(n){this._handleError(n)}return this},i.prototype.reject=function(t){if(this._state!==e.Pending)throw Error("Cannot reject a promise that is not in a pending state!");this._value=t;try{this._state=e.Rejected,this._rejectCallback.call(this,this._value)}catch(i){this._handleError(i)}return this},i.prototype.state=function(){return this._state},i.prototype._handleError=function(t){if(!this._errorCallback)throw t;this._errorCallback.call(this,t)},i}();t.Promise=i})(ex||(ex={}));var ex;(function(t){var e=function(e){function i(i,n,s){void 0===s&&(s=!0),e.call(this),this.path=i,this.responseType=n,this.bustCache=s,this.data=null,this.logger=t.Logger.getInstance(),this.onprogress=function(){},this.oncomplete=function(){},this.onerror=function(){}}return __extends(i,e),i.prototype.isLoaded=function(){return null!==this.data},i.prototype.wireEngine=function(t){this._engine=t},i.prototype._cacheBust=function(t){var e=/\?\w*=\w*/;return t+=e.test(t)?"&__="+Date.now():"?__="+Date.now()},i.prototype._start=function(){this.logger.debug("Started loading resource "+this.path)},i.prototype.load=function(){var e=this,i=new t.Promise;if(null!==this.data)return this.logger.debug("Already have data for resource",this.path),i.resolve(this.data),this.oncomplete(),i;var n=new XMLHttpRequest;return n.open("GET",this.bustCache?this._cacheBust(this.path):this.path,!0),n.responseType=this.responseType,n.onloadstart=function(t){e._start(t)},n.onprogress=this.onprogress,n.onerror=this.onerror,n.onload=function(){return 200!==n.status?(e.logger.error("Failed to load resource ",e.path," server responded with error code",n.status),e.onerror(n.response),i.resolve(n.response),void 0):(e.data=e.processData(n.response),e.oncomplete(),e.logger.debug("Completed loading resource",e.path),i.resolve(e.data),void 0)},n.send(),i},i.prototype.getData=function(){return this.data},i.prototype.setData=function(t){this.data=this.processData(t)},i.prototype.processData=function(t){return URL.createObjectURL(t)},i}(t.Class);t.Resource=e})(ex||(ex={}));var ex;(function(t){var e=function(e){function i(i,n){void 0===n&&(n=!0),e.call(this,i,"blob",n),this.path=i,this.bustCache=n,this.loaded=new t.Promise,this._isLoaded=!1,this._sprite=null,this._sprite=new t.Sprite(this,0,0,0,0)}return __extends(i,e),i.prototype.isLoaded=function(){return this._isLoaded},i.prototype.load=function(){var i=this,n=new t.Promise,s=e.prototype.load.call(this);return s.then(function(){i.image=new Image,i.image.addEventListener("load",function(){i._isLoaded=!0,i.width=i._sprite.swidth=i._sprite.naturalWidth=i._sprite.width=i.image.naturalWidth,i.height=i._sprite.sheight=i._sprite.naturalHeight=i._sprite.height=i.image.naturalHeight,i.loaded.resolve(i.image),n.resolve(i.image)}),i.image.src=e.prototype.getData.call(i)},function(){n.reject("Error loading texture.")}),n},i.prototype.asSprite=function(){return this._sprite},i}(t.Resource);t.Texture=e;var i=function(){function e(){for(var i=[],n=0;arguments.length>n;n++)i[n-0]=arguments[n];this._logger=t.Logger.getInstance(),this.onprogress=function(){},this.oncomplete=function(){},this.onerror=function(){},this.onload=function(){},this._isLoaded=!1,this._wasPlayingOnHidden=!1,this.path="";for(var s=0;i.length>s;s++)if(e.canPlayFile(i[s])){this.path=i[s];break}this.path||(this._logger.warn("This browser does not support any of the audio files specified:",i.join(", ")),this._logger.warn("Attempting to use",i[0]),this.path=i[0]),this.sound=new t.Internal.FallbackAudio(this.path,1)}return e.canPlayFile=function(e){try{var i=new Audio,n=/.*\.([A-Za-z0-9]+)$/,s=e.match(n)[1];return i.canPlayType("audio/"+s)?!0:!1}catch(o){return t.Logger.getInstance().warn("Cannot determine audio support, assuming no support for the Audio Tag",o),!1}},e.prototype.wireEngine=function(t){var e=this;t&&(this._engine=t,this._engine.on("hidden",function(){t.pauseAudioWhenHidden&&e.isPlaying()&&(e._wasPlayingOnHidden=!0,e.pause())}),this._engine.on("visible",function(){t.pauseAudioWhenHidden&&e._wasPlayingOnHidden&&(e.play(),e._wasPlayingOnHidden=!1)}))},e.prototype.setVolume=function(t){this.sound&&this.sound.setVolume(t)},e.prototype.setLoop=function(t){this.sound&&this.sound.setLoop(t)},e.prototype.isPlaying=function(){return this.sound?this.sound.isPlaying():void 0},e.prototype.play=function(){return this.sound?this.sound.play():void 0},e.prototype.pause=function(){this.sound&&this.sound.pause()},e.prototype.stop=function(){this.sound&&this.sound.stop()},e.prototype.isLoaded=function(){return this._isLoaded},e.prototype.load=function(){var e=this,i=new t.Promise;return null!==this.sound.getData()?(this._logger.debug("Already have data for resource",this.path),i.resolve(this.sound),i):(this._logger.debug("Started loading sound",this.path),this.sound.onprogress=this.onprogress,this.sound.onload=function(){e.oncomplete(),e._isLoaded=!0,e._logger.debug("Completed loading sound",e.path),i.resolve(e.sound)},this.sound.onerror=function(t){e.onerror(t),i.resolve(t)},this.sound.load(),i)},e.prototype.getData=function(){return this.sound.getData()},e.prototype.setData=function(t){this.sound.setData(t)},e.prototype.processData=function(t){return this.sound.processData(t)},e}();t.Sound=i;var n=function(){function e(t){this._resourceList=[],this._index=0,this._resourceCount=0,this._numLoaded=0,this._progressCounts={},this._totalCounts={},this.getData=function(){},this.setData=function(){},this.processData=function(){},this.onprogress=function(){},this.oncomplete=function(){},this.onerror=function(){},t&&this.addResources(t)}return e.prototype.wireEngine=function(t){this._engine=t},e.prototype.addResource=function(t){var e=this._index++;this._resourceList.push(t),this._progressCounts[e]=0,this._totalCounts[e]=1,this._resourceCount++},e.prototype.addResources=function(t){var e=0,i=t.length;for(e;i>e;e++)this.addResource(t[e])},e.prototype._sumCounts=function(t){var e=0;for(var i in t)e+=0|t[i];return e},e.prototype.isLoaded=function(){return this._numLoaded===this._resourceCount},e.prototype.load=function(){function e(t,i){t[i]&&t[i].load().then(function(){e(t,i+1)})}var i=this,n=new t.Promise,s=this;if(0===this._resourceList.length)return s.oncomplete.call(s),n;var o=Array(this._resourceList.length),r=this._resourceList.length;return this._resourceList.forEach(function(t,e){i._engine&&t.wireEngine(i._engine),t.onprogress=function(t){var i=t.total,n=t.loaded;o[e]={loaded:n/i*(100/r),total:100};var h=o.reduce(function(t,e){return{loaded:t.loaded+e.loaded,total:100}},{loaded:0,total:100});s.onprogress.call(s,h)},t.oncomplete=t.onerror=function(){s._numLoaded++,s._numLoaded===s._resourceCount&&(s.onprogress.call(s,{loaded:100,total:100}),s.oncomplete.call(s),n.resolve())}}),e(this._resourceList,0),n},e}();t.Loader=n})(ex||(ex={}));var ex;(function(t){var e=function(){function e(){this.failedTests=[],this._criticalTests={canvasSupport:function(){var t=document.createElement("canvas");return!(!t.getContext||!t.getContext("2d"))},arrayBufferSupport:function(){var t=new XMLHttpRequest;t.open("GET","/");try{t.responseType="arraybuffer"}catch(e){return!1}return"arraybuffer"===t.responseType},dataUrlSupport:function(){var t=document.createElement("canvas");return 0===t.toDataURL("image/png").indexOf("data:image/png")},objectUrlSupport:function(){return"URL"in window&&"revokeObjectURL"in URL&&"createObjectURL"in URL},rgbaSupport:function(){var t=document.createElement("a").style;return t.cssText="background-color:rgba(150,255,150,.5)",(""+t.backgroundColor).indexOf("rgba")>-1}},this._warningTest={webAudioSupport:function(){return!!(window.AudioContext||window.webkitAudioContext||window.mozAudioContext||window.msAudioContext||window.oAudioContext)},webglSupport:function(){var t=document.createElement("canvas");return!(!t.getContext||!t.getContext("webgl"))}}}return e.prototype.test=function(){var e=!1;for(var i in this._criticalTests)this._criticalTests[i]()||(this.failedTests.push(i),t.Logger.getInstance().error("Critical browser feature missing, Excalibur requires:",i),e=!0);if(e)return!1;for(var n in this._warningTest)this._warningTest[n]()||t.Logger.getInstance().warn("Warning browser feature missing, Excalibur will have reduced performance:",n);return!0},e}();t.Detector=e})(ex||(ex={}));var ex;(function(t){var e=function(){function e(e){this.path=e,this._isLoaded=!1,this.logger=t.Logger.getInstance(),this.onprogress=function(){},this.oncomplete=function(){},this.onerror=function(){},this._innerElement=document.createElement("div"),this._innerElement.className="excalibur-template"}return e.prototype.wireEngine=function(t){this._engine=t},e.prototype.getTemplateString=function(){return this._isLoaded?this._htmlString:""},e.prototype._compile=function(){this._innerElement.innerHTML=this._htmlString,this._styleElements=this._innerElement.querySelectorAll("[data-style]"),this._textElements=this._innerElement.querySelectorAll("[data-text]")},e.prototype._evaluateExpresion=function(t,e){var i=Function("return "+t+";"),n=i.call(e);return n},e.prototype.apply=function(t){for(var e=this,i=0;this._styleElements.length>i;i++)(function(){var n={};e._styleElements[i].dataset.style.split(";").forEach(function(t){if(t){var e=t.split(":");n[e[0].trim()]=e[1].trim()}});for(var s in n)(function(){var o=n[s];e._styleElements[i].style[s]=e._evaluateExpresion(o,t)})()})();for(var n=0;this._textElements.length>n;n++)(function(){var i=e._textElements[n].dataset.text;e._textElements[n].innerText=e._evaluateExpresion(i,t)})();return 1===this._innerElement.children.length&&(this._innerElement=this._innerElement.firstChild),this._innerElement},e.prototype.load=function(){var e=this,i=new t.Promise,n=new XMLHttpRequest;return n.open("GET",this.path,!0),n.responseType="text",n.onprogress=this.onprogress,n.onerror=this.onerror,n.onload=function(){return 200!==n.status?(e.logger.error("Failed to load html template resource ",e.path," server responded with error code",n.status),e.onerror(n.response),e._isLoaded=!1,i.resolve("error"),void 0):(e.setData(n.response),e.oncomplete(),e.logger.debug("Completed loading template",e.path),i.resolve(e._htmlString),void 0)},n.overrideMimeType&&n.overrideMimeType("text/plain; charset=x-user-defined"),n.send(),i},e.prototype.getData=function(){return this._htmlString},e.prototype.setData=function(t){this._htmlString=this.processData(t),this._compile(),this._isLoaded=!0},e.prototype.processData=function(t){return t},e.prototype.isLoaded=function(){return this._isLoaded},e}();t.Template=e;var i=function(){function t(t,e,i){this.parent=document.getElementById(t),this.template=e,this._ctx=i,this.update()}return t.prototype.listen=function(t,e,i){var n=this;i||(i=function(){n.update()}),t.addEventListener&&e.forEach(function(e){t.addEventListener(e,i)})},t.prototype.update=function(){var t=this._applyTemplate(this.template,this._ctx);t instanceof String&&(this.parent.innerHTML=t),t instanceof Node&&this.parent.lastChild!==t&&this.parent.appendChild(t)},t.prototype._applyTemplate=function(t,e){return t.isLoaded()?t.apply(e):void 0},t}();t.Binding=i})(ex||(ex={}));var ex;(function(t){(function(t){t[t.Em=0]="Em",t[t.Rem=1]="Rem",t[t.Px=2]="Px",t[t.Pt=3]="Pt",t[t.Percent=4]="Percent"})(t.FontUnit||(t.FontUnit={}));var e=t.FontUnit;(function(t){t[t.Left=0]="Left",t[t.Right=1]="Right",t[t.Center=2]="Center",t[t.Start=3]="Start",t[t.End=4]="End"})(t.TextAlign||(t.TextAlign={}));var i=t.TextAlign;(function(t){t[t.Top=0]="Top",t[t.Hanging=1]="Hanging",t[t.Middle=2]="Middle",t[t.Alphabetic=3]="Alphabetic",t[t.Ideographic=4]="Ideographic",t[t.Bottom=5]="Bottom"})(t.BaseAlign||(t.BaseAlign={}));var n=t.BaseAlign,s=function(s){function o(o,r,h,a,c){s.call(this,r,h),this.fontSize=10,this.fontUnit=e.Px,this.textAlign=i.Left,this.baseAlign=n.Bottom,this.letterSpacing=0,this.caseInsensitive=!0,this._textShadowOn=!1,this._shadowOffsetX=0,this._shadowOffsetY=0,this._shadowColor=t.Color.Black.clone(),this._shadowColorDirty=!1,this._textSprites={},this._shadowSprites={},this._color=t.Color.Black.clone(),this.text=o||"",this.color=t.Color.Black.clone(),this.spriteFont=c,this.collisionType=t.CollisionType.PreventCollision,this.fontFamily=a||"10px sans-serif"}return __extends(o,s),o.prototype.getTextWidth=function(t){var e=t.font;t.font=this.fontFamily;var i=t.measureText(this.text).width;return t.font=e,i},o.prototype._lookupFontUnit=function(t){switch(t){case e.Em:return"em";case e.Rem:return"rem";case e.Pt:return"pt";case e.Px:return"px";case e.Percent:return"%";default:return"px"}},o.prototype._lookupTextAlign=function(t){switch(t){case i.Left:return"left";case i.Right:return"right";case i.Center:return"center";case i.End:return"end";case i.Start:return"start";default:return"start"}},o.prototype._lookupBaseAlign=function(t){switch(t){case n.Alphabetic:return"alphabetic";case n.Bottom:return"bottom";case n.Hanging:return"hangin";case n.Ideographic:return"ideographic";case n.Middle:return"middle";case n.Top:return"top";default:return"alphabetic"}},o.prototype.setTextShadow=function(t,e,i){this.spriteFont.setTextShadow(t,e,i)},o.prototype.useTextShadow=function(t){this.spriteFont.useTextShadow(t)},o.prototype.clearTextShadow=function(){this._textShadowOn=!1,this._shadowOffsetX=0,this._shadowOffsetY=0,this._shadowColor=t.Color.Black.clone() +},o.prototype.update=function(t,e){s.prototype.update.call(this,t,e)},o.prototype.draw=function(t,e){t.save(),t.translate(this.x,this.y),t.scale(this.scale.x,this.scale.y),t.rotate(this.rotation),this._textShadowOn&&(t.save(),t.translate(this._shadowOffsetX,this._shadowOffsetY),this._fontDraw(t,e,this._shadowSprites),t.restore()),this._fontDraw(t,e,this._textSprites),s.prototype.draw.call(this,t,e),t.restore()},o.prototype._fontDraw=function(t){if(this.spriteFont)this.spriteFont.draw(t,this.text,0,0,{color:this.color.clone(),baseAlign:this.baseAlign,textAlign:this.textAlign,fontSize:this.fontSize,letterSpacing:this.letterSpacing,opacity:this.opacity});else{var e=t.textAlign,i=t.textBaseline;t.textAlign=this._lookupTextAlign(this.textAlign),t.textBaseline=this._lookupBaseAlign(this.baseAlign),this.color&&(this.color.a=this.opacity),t.fillStyle=""+this.color,t.font=""+this.fontSize+this._lookupFontUnit(this.fontUnit)+" "+this.fontFamily,this.maxWidth?t.fillText(this.text,0,0,this.maxWidth):t.fillText(this.text,0,0),t.textAlign=e,t.textBaseline=i}},o.prototype.debugDraw=function(t){s.prototype.debugDraw.call(this,t)},o}(t.Actor);t.Label=s})(ex||(ex={}));var ex;(function(t){var e;(function(e){(function(t){t[t.Touch=0]="Touch",t[t.Mouse=1]="Mouse",t[t.Pen=2]="Pen",t[t.Unknown=3]="Unknown"})(e.PointerType||(e.PointerType={}));var i=e.PointerType;(function(t){t[t.Left=0]="Left",t[t.Middle=1]="Middle",t[t.Right=2]="Right",t[t.Unknown=3]="Unknown"})(e.PointerButton||(e.PointerButton={}));var n=e.PointerButton;(function(t){t[t.Canvas=0]="Canvas",t[t.Document=1]="Document"})(e.PointerScope||(e.PointerScope={}));var s=e.PointerScope,o=function(t){function e(e,i,n,s,o,r){t.call(this),this.x=e,this.y=i,this.index=n,this.pointerType=s,this.button=o,this.ev=r}return __extends(e,t),e}(t.GameEvent);e.PointerEvent=o;var r=function(e){function r(t){e.call(this),this._pointerDown=[],this._pointerUp=[],this._pointerMove=[],this._pointerCancel=[],this._pointers=[],this._activePointers=[],this._engine=t,this._pointers.push(new h),this._activePointers=[-1],this.primary=this._pointers[0]}return __extends(r,e),r.prototype.init=function(t){void 0===t&&(t=s.Document);var e=document;e=t===s.Document?document:this._engine.canvas,e.addEventListener("touchstart",this._handleTouchEvent("down",this._pointerDown)),e.addEventListener("touchend",this._handleTouchEvent("up",this._pointerUp)),e.addEventListener("touchmove",this._handleTouchEvent("move",this._pointerMove)),e.addEventListener("touchcancel",this._handleTouchEvent("cancel",this._pointerCancel)),window.PointerEvent?(this._engine.canvas.style.touchAction="none",e.addEventListener("pointerdown",this._handlePointerEvent("down",this._pointerDown)),e.addEventListener("pointerup",this._handlePointerEvent("up",this._pointerUp)),e.addEventListener("pointermove",this._handlePointerEvent("move",this._pointerMove)),e.addEventListener("pointercancel",this._handlePointerEvent("cancel",this._pointerMove))):window.MSPointerEvent?(this._engine.canvas.style.msTouchAction="none",e.addEventListener("MSPointerDown",this._handlePointerEvent("down",this._pointerDown)),e.addEventListener("MSPointerUp",this._handlePointerEvent("up",this._pointerUp)),e.addEventListener("MSPointerMove",this._handlePointerEvent("move",this._pointerMove)),e.addEventListener("MSPointerCancel",this._handlePointerEvent("cancel",this._pointerMove))):(e.addEventListener("mousedown",this._handleMouseEvent("down",this._pointerDown)),e.addEventListener("mouseup",this._handleMouseEvent("up",this._pointerUp)),e.addEventListener("mousemove",this._handleMouseEvent("move",this._pointerMove)))},r.prototype.update=function(){this._pointerUp.length=0,this._pointerDown.length=0,this._pointerMove.length=0,this._pointerCancel.length=0},r.prototype.at=function(t){if(t>=this._pointers.length)for(var e=this._pointers.length-1,i=t;i>e;e++)this._pointers.push(new h),this._activePointers.push(-1);return this._pointers[t]},r.prototype.count=function(){return this._pointers.length},r.prototype.propogate=function(e){var i=e instanceof t.UIActor,n=0,s=this._pointerUp.length;for(n;s>n;n++)e.contains(this._pointerUp[n].x,this._pointerUp[n].y,!i)&&e.eventDispatcher.emit("pointerup",this._pointerUp[n]);for(n=0,s=this._pointerDown.length,n;s>n;n++)e.contains(this._pointerDown[n].x,this._pointerDown[n].y,!i)&&e.eventDispatcher.emit("pointerdown",this._pointerDown[n]);if(e.capturePointer.captureMoveEvents)for(n=0,s=this._pointerMove.length,n;s>n;n++)e.contains(this._pointerMove[n].x,this._pointerMove[n].y,!i)&&e.eventDispatcher.emit("pointermove",this._pointerMove[n]);for(n=0,s=this._pointerCancel.length,n;s>n;n++)e.contains(this._pointerCancel[n].x,this._pointerCancel[n].y,!i)&&e.eventDispatcher.emit("pointercancel",this._pointerCancel[n])},r.prototype._handleMouseEvent=function(e,n){var s=this;return function(r){r.preventDefault();var h=r.pageX-t.Util.getPosition(s._engine.canvas).x,a=r.pageY-t.Util.getPosition(s._engine.canvas).y,c=s._engine.screenToWorldCoordinates(new t.Point(h,a)),u=new o(c.x,c.y,0,i.Mouse,r.button,r);n.push(u),s.at(0).eventDispatcher.emit(e,u)}},r.prototype._handleTouchEvent=function(e,s){var r=this;return function(h){h.preventDefault();for(var a=0,c=h.changedTouches.length;c>a;a++){var u=r._pointers.length>1?r._getPointerIndex(h.changedTouches[a].identifier):0;if(-1!==u){var l=h.changedTouches[a].pageX-t.Util.getPosition(r._engine.canvas).x,p=h.changedTouches[a].pageY-t.Util.getPosition(r._engine.canvas).y,d=r._engine.screenToWorldCoordinates(new t.Point(l,p)),f=new o(d.x,d.y,u,i.Touch,n.Unknown,h);s.push(f),r.at(u).eventDispatcher.emit(e,f),r._pointers.length>1&&("up"===e?r._activePointers[u]=-1:"down"===e&&(r._activePointers[u]=h.changedTouches[a].identifier))}}}},r.prototype._handlePointerEvent=function(e,i){var n=this;return function(s){s.preventDefault();var r=n._pointers.length>1?n._getPointerIndex(s.pointerId):0;if(-1!==r){var h=s.pageX-t.Util.getPosition(n._engine.canvas).x,a=s.pageY-t.Util.getPosition(n._engine.canvas).y,c=n._engine.screenToWorldCoordinates(new t.Point(h,a)),u=new o(c.x,c.y,r,n._stringToPointerType(s.pointerType),s.button,s);i.push(u),n.at(r).eventDispatcher.emit(e,u),n._pointers.length>1&&("up"===e?n._activePointers[r]=-1:"down"===e&&(n._activePointers[r]=s.pointerId))}}},r.prototype._getPointerIndex=function(t){var e;if((e=this._activePointers.indexOf(t))>-1)return e;for(var i=0;this._activePointers.length>i;i++)if(-1===this._activePointers[i])return i;return-1},r.prototype._stringToPointerType=function(t){switch(t){case"touch":return i.Touch;case"mouse":return i.Mouse;case"pen":return i.Pen;default:return i.Unknown}},r}(t.Class);e.Pointers=r;var h=function(t){function e(){t.apply(this,arguments)}return __extends(e,t),e}(t.Class);e.Pointer=h})(e=t.Input||(t.Input={}))})(ex||(ex={}));var ex;(function(t){var e;(function(e){(function(t){t[t.Num1=97]="Num1",t[t.Num2=98]="Num2",t[t.Num3=99]="Num3",t[t.Num4=100]="Num4",t[t.Num5=101]="Num5",t[t.Num6=102]="Num6",t[t.Num7=103]="Num7",t[t.Num8=104]="Num8",t[t.Num9=105]="Num9",t[t.Num0=96]="Num0",t[t.Numlock=144]="Numlock",t[t.Semicolon=186]="Semicolon",t[t.A=65]="A",t[t.B=66]="B",t[t.C=67]="C",t[t.D=68]="D",t[t.E=69]="E",t[t.F=70]="F",t[t.G=71]="G",t[t.H=72]="H",t[t.I=73]="I",t[t.J=74]="J",t[t.K=75]="K",t[t.L=76]="L",t[t.M=77]="M",t[t.N=78]="N",t[t.O=79]="O",t[t.P=80]="P",t[t.Q=81]="Q",t[t.R=82]="R",t[t.S=83]="S",t[t.T=84]="T",t[t.U=85]="U",t[t.V=86]="V",t[t.W=87]="W",t[t.X=88]="X",t[t.Y=89]="Y",t[t.Z=90]="Z",t[t.Shift=16]="Shift",t[t.Alt=18]="Alt",t[t.Up=38]="Up",t[t.Down=40]="Down",t[t.Left=37]="Left",t[t.Right=39]="Right",t[t.Space=32]="Space",t[t.Esc=27]="Esc"})(e.Keys||(e.Keys={})),e.Keys;var i=function(t){function e(e){t.call(this),this.key=e}return __extends(e,t),e}(t.GameEvent);e.KeyEvent=i;var n=function(t){function e(e){t.call(this),this._keys=[],this._keysUp=[],this._keysDown=[],this._engine=e}return __extends(e,t),e.prototype.init=function(){var t=this;window.addEventListener("blur",function(){t._keys.length=0}),window.addEventListener("keyup",function(e){var n=t._keys.indexOf(e.keyCode);t._keys.splice(n,1),t._keysUp.push(e.keyCode);var s=new i(e.keyCode);t.eventDispatcher.emit("up",s),t.eventDispatcher.emit("release",s)}),window.addEventListener("keydown",function(e){if(-1===t._keys.indexOf(e.keyCode)){t._keys.push(e.keyCode),t._keysDown.push(e.keyCode);var n=new i(e.keyCode);t.eventDispatcher.emit("down",n),t.eventDispatcher.emit("press",n)}})},e.prototype.update=function(){this._keysDown.length=0,this._keysUp.length=0;for(var t=0;this._keys.length>t;t++)this.eventDispatcher.emit("hold",new i(this._keys[t]))},e.prototype.getKeys=function(){return this._keys},e.prototype.wasPressed=function(t){return this._keysDown.indexOf(t)>-1},e.prototype.isHeld=function(t){return this._keys.indexOf(t)>-1},e.prototype.wasReleased=function(t){return this._keysUp.indexOf(t)>-1},e}(t.Class);e.Keyboard=n})(e=t.Input||(t.Input={}))})(ex||(ex={}));var ex;(function(t){var e;(function(e){var i=function(e){function i(t){e.call(this),this.enabled=!1,this.supported=!!navigator.getGamepads,this._gamePadTimeStamps=[0,0,0,0],this._oldPads=[],this._pads=[],this._initSuccess=!1,this._navigator=navigator,this._minimumConfiguration=null,this._engine=t}return __extends(i,e),i.prototype.init=function(){this.supported&&(this._initSuccess||(this._oldPads=this._clonePads(this._navigator.getGamepads()),this._oldPads.length&&this._oldPads[0]&&(this._initSuccess=!0)))},i.prototype.setMinimumGamepadConfiguration=function(t){this._enableAndUpdate(),this._minimumConfiguration=t},i.prototype._enableAndUpdate=function(){this.enabled||(this.enabled=!0,this.update(100))},i.prototype._isGamepadValid=function(t){if(!this._minimumConfiguration)return!0;if(!t)return!1;var e=t.axes.filter(function(t){return void 0!==typeof t}).length,i=t.buttons.filter(function(t){return void 0!==typeof t}).length;return e>=this._minimumConfiguration.axis&&i>=this._minimumConfiguration.buttons&&t.connected},i.prototype.on=function(t,i){this._enableAndUpdate(),e.prototype.on.call(this,t,i)},i.prototype.off=function(t,i){this._enableAndUpdate(),e.prototype.off.call(this,t,i)},i.prototype.update=function(){if(this.enabled&&this.supported){this.init();for(var e=this._navigator.getGamepads(),i=0;e.length>i;i++)if(e[i]){if(!this.at(i).connected&&this._isGamepadValid(e[i])&&this.eventDispatcher.emit("connect",new t.GamepadConnectEvent(i,this.at(i))),this.at(i).connected=!0,!e[i].timestamp||e[i].timestamp!==this._gamePadTimeStamps[i]){this._gamePadTimeStamps[i]=e[i].timestamp,this.at(i).navigatorGamepad=e[i];var n,r,h,a,c;for(n in s)"number"==typeof s[n]&&(a=s[n],e[i].buttons[a]&&(h=e[i].buttons[a].value,h!==this._oldPads[i].getButton(a)&&(e[i].buttons[a].pressed?(this.at(i).updateButton(a,h),this.at(i).eventDispatcher.publish("button",new t.GamepadButtonEvent(a,h))):this.at(i).updateButton(a,0))));for(r in o)"number"==typeof o[r]&&(c=o[r],h=e[i].axes[c],h!==this._oldPads[i].getAxes(c)&&(this.at(i).updateAxes(c,h),this.at(i).eventDispatcher.emit("axis",new t.GamepadAxisEvent(c,h))));this._oldPads[i]=this._clonePad(e[i])}}else this.at(i).connected&&this.eventDispatcher.emit("disconnect",new t.GamepadDisconnectEvent(i)),this.at(i).connected=!1}},i.prototype.at=function(t){if(this._enableAndUpdate(),t>=this._pads.length)for(var e=this._pads.length-1,i=t;i>e;e++)this._pads.push(new n),this._oldPads.push(new n);return this._pads[t]},i.prototype.getValidGamepads=function(){this._enableAndUpdate();for(var t=[],e=0;this._pads.length>e;e++)this._isGamepadValid(this.at(e).navigatorGamepad)&&this.at(e).connected&&t.push(this.at(e));return t},i.prototype.count=function(){return this._pads.filter(function(t){return t.connected}).length},i.prototype._clonePads=function(t){for(var e=[],i=0,n=t.length;n>i;i++)e.push(this._clonePad(t[i]));return e},i.prototype._clonePad=function(t){var e,i,s=new n;if(!t)return s;for(e=0,i=t.buttons.length;i>e;e++)t.buttons[e]&&s.updateButton(e,t.buttons[e].value);for(e=0,i=t.axes.length;i>e;e++)s.updateAxes(e,t.axes[e]);return s},i.MinAxisMoveThreshold=.05,i}(t.Class);e.Gamepads=i;var n=function(t){function e(){t.call(this),this.connected=!1,this._buttons=Array(16),this._axes=Array(4);var e;for(e=0;this._buttons.length>e;e++)this._buttons[e]=0;for(e=0;this._axes.length>e;e++)this._axes[e]=0}return __extends(e,t),e.prototype.isButtonPressed=function(t,e){return void 0===e&&(e=1),this._buttons[t]>=e},e.prototype.getButton=function(t){return this._buttons[t]},e.prototype.getAxes=function(t){var e=this._axes[t];return Math.abs(e)n;n++)this._animations[n].animation.draw(i,this._animations[n].x,this._animations[n].y);if(this.fps=1/(e/1e3),this.isDebug){this.ctx.font="Consolas",this.ctx.fillStyle=""+this.debugColor;for(var o=this.input.keyboard.getKeys(),r=0;o.length>r;r++)this.ctx.fillText(""+o[r]+" : "+(t.Input.Keys[o[r]]?t.Input.Keys[o[r]]:"Not Mapped"),100,10*r+10);this.ctx.fillText("FPS:"+(""+this.fps.toFixed(2)),10,10)}for(var h=0;this.postProcessors.length>h;h++)this.postProcessors[h].process(this.ctx.getImageData(0,0,this.width,this.height),this.ctx);this.emit("postdraw",new t.PreDrawEvent(i,e,this))},s.prototype.start=function(e){if(!this._compatible){var i=new t.Promise;return i.reject("Excalibur is incompatible with your browser")}var n;if(e?(e.wireEngine(this),n=this.load(e)):n=t.Promise.wrap(),!this._hasStarted){this._hasStarted=!0,this._logger.debug("Starting game...");var s=Date.now(),o=this;(function r(){if(o._hasStarted)try{o._requestId=window.requestAnimationFrame(r);var t=Date.now(),e=Math.floor(t-s)||1;e>200&&(e=1),o._update(e),o._draw(e),s=t}catch(i){window.cancelAnimationFrame(o._requestId),o.stop(),o.onFatalException(i)}})(),this._logger.debug("Game started")}return n},s.prototype.stop=function(){this._hasStarted&&(this._hasStarted=!1,this._logger.debug("Game stopped"))},s.prototype.screenshot=function(){var t=new Image,e=this.canvas.toDataURL("image/png");return t.src=e,t},s.prototype._drawLoadingBar=function(t,e,i){if(this._loadingDraw)return this._loadingDraw(t,e,i),void 0;var n=this.canvas.height/2,s=this.canvas.width/3,o=s,r=new Image;r.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAyAAAAEsCAYAAAA7Ldc6AAAACXBIWXMAAA7CAAAOwgEVKEqAAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZ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ACAAAAAAQQAAAAAH0cQPb2XrFmAAAAAEQaQIruD5ubv/R0oTY2Kt6HZYoJAAAA6L8A4rg/bG3t9HShKpVdAggAAADQzwFkalElN4Ts7b3qaQhZW3vuffg1xQQAAAD0WQAxiu4Pq6tOTxZob++VvwtWgWICAAAA+jOAfPUmgGz2ZDD62tpz7+eWzZUZAAAAAP0WQKYWtSxPN6xHj552dWH29l7pwYN171O3KCIAAACgTwOI8aX7w8OHT1Wp7HVtYR49OvR5jqQFiggAAADo7wCyIDPz1N7eK5VKj7uyIFtbO/rhh0NXP76cWnwzMxcAAACAPgwgptE/5z7e2HgReQipVPb0zTc/ep8qTS1qnuIBAAAA+jyAmBBSkLTsPl5ddSILIZXKnu7fX/UOPHckzVA0AAAAQP8Zev36de2HoaG3fnnnir6VlHEfT06m9PHH72l4+GgoH761taNvvvnRP9vWjBkMDwAH3H0VAABItmMtfn9J0j03hKyuOtrc3NHvfz+h8fHRjj74wYN1/5gPwgcAAADQ55peAZGkO1eUknRbUs77/ORkSh9+eE5jY8etP2xv75XW1p7rwYP1erNrET4ANMQVEAAABiSAeILIvKTr/ufHxo7r/fdPa3z8pMbGfvVW96ytrR1tbu5oY6Piv8mgqyzpC244CIAAAgAAAcQfQjKSbsp3NaRNjmr3HFlgul0ABBAAAAggzYJITtJVSdMEDwAEEAAAEGkA8QSRlAkhn6k2UD3TIHCUJH0tqTi1qCKrHQABBACAAQ8gAAAAABC1I6wCAAAAAAQQAAAAAH3n/w8AmB1j3tEUq4sAAAAASUVORK5CYII="; var h=3*s/8,a=this.getAntialiasing();this.setAntialiasing(!0),t.drawImage(r,0,0,800,300,o,n-h-20,s,h),t.strokeStyle="white",t.lineWidth=2,t.strokeRect(o,n,s,20);var c=s*(e/i);t.fillStyle="white";var u=5,l=c-2*u,p=20-2*u;t.fillRect(o+u,n+u,l>0?l:0,p),this.setAntialiasing(a)},s.prototype.setLoadingDrawFunction=function(t){this._loadingDraw=t},s.prototype.load=function(e){var i=this,n=new t.Promise;return this._isLoading=!0,e.onprogress=function(t){i._progress=t.loaded,i._total=t.total,i._logger.debug("Loading "+(100*i._progress/i._total).toFixed(0))},e.oncomplete=function(){setTimeout(function(){i._isLoading=!1,n.resolve()},500)},e.load(),n},s}(t.Class);t.Engine=e,function(t){t[t.FullScreen=0]="FullScreen",t[t.Container=1]="Container",t[t.Fixed=2]="Fixed"}(t.DisplayMode||(t.DisplayMode={}));var i=t.DisplayMode,n=function(){function t(t,e,i){this.animation=t,this.x=e,this.y=i}return t}()})(ex||(ex={})); ; // Concatenated onto excalibur after build diff --git a/sandbox/web/Excalibur.js b/sandbox/web/Excalibur.js index d6ebaa53a..b62b46962 100644 --- a/sandbox/web/Excalibur.js +++ b/sandbox/web/Excalibur.js @@ -1,4 +1,4 @@ -/*! excalibur - v0.6.0 - 2016-05-16 +/*! excalibur - v0.6.0 - 2016-05-25 * https://github.com/excaliburjs/Excalibur * Copyright (c) 2016 Excalibur.js ; Licensed BSD-2-Clause*/ if (typeof window === 'undefined') { @@ -5650,6 +5650,9 @@ var ex; return this.children.indexOf(actor) > -1; }; Scene.prototype.add = function (entity) { + if (entity instanceof ex.Actor) { + entity.unkill(); + } if (entity instanceof ex.UIActor) { if (!ex.Util.contains(this.uiActors, entity)) { this.addUIActor(entity); @@ -6386,6 +6389,12 @@ var ex; this.logger.warn('Cannot kill actor, it was never added to the Scene'); } }; + /** + * If the current actor is killed, it will now not be killed. + */ + Actor.prototype.unkill = function () { + this._isKilled = false; + }; /** * Indicates wether the actor has been killed. */ diff --git a/src/engine/Actor.ts b/src/engine/Actor.ts index 9fa914e2f..43c11fa13 100644 --- a/src/engine/Actor.ts +++ b/src/engine/Actor.ts @@ -518,6 +518,14 @@ module ex { this.logger.warn('Cannot kill actor, it was never added to the Scene'); } } + + /** + * If the current actor is killed, it will now not be killed. + */ + public unkill() { + this._isKilled = false; + } + /** * Indicates wether the actor has been killed. */ diff --git a/src/engine/Scene.ts b/src/engine/Scene.ts index 1fae00323..ec91c17e4 100644 --- a/src/engine/Scene.ts +++ b/src/engine/Scene.ts @@ -378,6 +378,9 @@ module ex { */ public add(uiActor: UIActor): void; public add(entity: any): void { + if(entity instanceof Actor) { + (entity).unkill(); + } if (entity instanceof UIActor) { if (!Util.contains(this.uiActors, entity)) { this.addUIActor(entity); diff --git a/src/spec/ActorSpec.ts b/src/spec/ActorSpec.ts index eead9ee75..f376792ef 100644 --- a/src/spec/ActorSpec.ts +++ b/src/spec/ActorSpec.ts @@ -951,4 +951,15 @@ describe('A game actor', () => { expect(killed).toBe(true); }); + it('is no longer killed when re-added to the game', () => { + var actor = new ex.Actor(); + scene.add(actor); + expect(actor.isKilled()).toBeFalsy(); + actor.kill(); + scene.update(engine, 100); + expect(actor.isKilled()).toBeTruthy(); + scene.add(actor); + expect(actor.isKilled()).toBeFalsy(); + }); + });