UNPKG

phaser-ce

Version:

Phaser CE (Community Edition) is a fast, free and fun HTML5 Game Framework for Desktop and Mobile web browsers.

3 lines (2 loc) 622 kB
/* Phaser v2.9.2 - http://phaser.io - @photonstorm - (c) 2016 Photon Storm Ltd. */ (function(){function t(t,e){this._scaleFactor=t,this._deltaMode=e,this.originalEvent=null}var e=this,i=i||{VERSION:"2.9.2",GAMES:[],AUTO:0,CANVAS:1,WEBGL:2,HEADLESS:3,WEBGL_MULTI:4,NONE:0,LEFT:1,RIGHT:2,UP:3,DOWN:4,SPRITE:0,BUTTON:1,IMAGE:2,GRAPHICS:3,TEXT:4,TILESPRITE:5,BITMAPTEXT:6,GROUP:7,RENDERTEXTURE:8,TILEMAP:9,TILEMAPLAYER:10,EMITTER:11,POLYGON:12,BITMAPDATA:13,CANVAS_FILTER:14,WEBGL_FILTER:15,ELLIPSE:16,SPRITEBATCH:17,RETROFONT:18,POINTER:19,ROPE:20,CIRCLE:21,RECTANGLE:22,LINE:23,MATRIX:24,POINT:25,ROUNDEDRECTANGLE:26,CREATURE:27,VIDEO:28,PENDING_ATLAS:-1,HORIZONTAL:0,VERTICAL:1,LANDSCAPE:0,PORTRAIT:1,ANGLE_UP:270,ANGLE_DOWN:90,ANGLE_LEFT:180,ANGLE_RIGHT:0,ANGLE_NORTH_EAST:315,ANGLE_NORTH_WEST:225,ANGLE_SOUTH_EAST:45,ANGLE_SOUTH_WEST:135,TOP_LEFT:0,TOP_CENTER:1,TOP_RIGHT:2,LEFT_TOP:3,LEFT_CENTER:4,LEFT_BOTTOM:5,CENTER:6,RIGHT_TOP:7,RIGHT_CENTER:8,RIGHT_BOTTOM:9,BOTTOM_LEFT:10,BOTTOM_CENTER:11,BOTTOM_RIGHT:12,blendModes:{NORMAL:0,ADD:1,MULTIPLY:2,SCREEN:3,OVERLAY:4,DARKEN:5,LIGHTEN:6,COLOR_DODGE:7,COLOR_BURN:8,HARD_LIGHT:9,SOFT_LIGHT:10,DIFFERENCE:11,EXCLUSION:12,HUE:13,SATURATION:14,COLOR:15,LUMINOSITY:16},scaleModes:{DEFAULT:0,LINEAR:0,NEAREST:1},PIXI:PIXI||{},_UID:0};if(Math.trunc||(Math.trunc=function(t){return t<0?Math.ceil(t):Math.floor(t)}),Function.prototype.bind||(Function.prototype.bind=function(){var t=Array.prototype.slice;return function(e){function i(){var o=n.concat(t.call(arguments));s.apply(this instanceof i?this:e,o)}var s=this,n=t.call(arguments,1);if("function"!=typeof s)throw new TypeError;return i.prototype=function t(e){if(e&&(t.prototype=e),!(this instanceof t))return new t}(s.prototype),i}}()),Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),Array.prototype.forEach||(Array.prototype.forEach=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 s=arguments.length>=2?arguments[1]:void 0,n=0;n<i;n++)n in e&&t.call(s,e[n],n,e)}),"function"!=typeof window.Uint32Array&&"object"!=typeof window.Uint32Array){var s=function(t){var e=new Array;window[t]=function(t){if("number"==typeof t){Array.call(this,t),this.length=t;for(e=0;e<this.length;e++)this[e]=0}else{Array.call(this,t.length),this.length=t.length;for(var e=0;e<this.length;e++)this[e]=t[e]}},window[t].prototype=e,window[t].constructor=window[t]};s("Float32Array"),s("Uint32Array"),s("Uint16Array"),s("Int16Array"),s("ArrayBuffer")}window.console||(window.console={},window.console.log=window.console.assert=function(){},window.console.warn=window.console.assert=function(){}),Object.assign||(Object.assign=function(t,e){"use strict";if(null==t)throw new TypeError("Cannot convert undefined or null to object");for(var i=Object(t),s=Object.prototype.hasOwnProperty,n=1;n<arguments.length;n++){var o=arguments[n];if(null!=o)for(var r in o)s.call(o,r)&&(i[r]=o[r])}return i}),i.Utils={reverseString:function(t){return t.split("").reverse().join("")},getProperty:function(t,e){for(var i=e.split("."),s=i.length,n=0,o=t;n<s;){var r=i[n];if(null==o)return;o=o[r],n++}return o},setProperties:function(t,e){for(var i in e)this.setProperty(t,i,e[i]);return t},setProperty:function(t,e,i){var s=e.split(".");switch(s.length){case 1:t[e]=i;break;case 2:t[s[0]][s[1]]=i;break;case 3:t[s[0]][s[1]][s[2]]=i;break;case 4:t[s[0]][s[1]][s[2]][s[3]]=i;break;default:this._setProperty(t,e,i)}},_setProperty:function(t,e,i){var s=e.split("."),n=s.length,o=0,r=t,a=s[0];if(1===n)t[e]=i;else{for(;o<n-1;)r=r[a],a=s[++o];r[a]=i}return t},chanceRoll:function(t){return void 0===t&&(t=50),t>0&&100*Math.random()<=t},randomChoice:function(t,e){return Math.random()<.5?t:e},parseDimension:function(t,e){var i=0,s=0;return"string"==typeof t?"%"===t.substr(-1)?(i=parseInt(t,10)/100,s=0===e?window.innerWidth*i:window.innerHeight*i):s=parseInt(t,10):s=t,s},pad:function(t,e,i,s){if(void 0===e)var e=0;if(void 0===i)var i=" ";if(void 0===s)var s=3;var n=0;if(e+1>=(t=t.toString()).length)switch(s){case 1:t=new Array(e+1-t.length).join(i)+t;break;case 3:var o=Math.ceil((n=e-t.length)/2),r=n-o;t=new Array(r+1).join(i)+t+new Array(o+1).join(i);break;default:t+=new Array(e+1-t.length).join(i)}return t},isPlainObject:function(t){if("object"!=typeof t||t.nodeType||t===t.window)return!1;try{if(t.constructor&&!{}.hasOwnProperty.call(t.constructor.prototype,"isPrototypeOf"))return!1}catch(t){return!1}return!0},extend:function(){var t,e,s,n,o,r,a=arguments[0]||{},h=1,l=arguments.length,c=!1;for("boolean"==typeof a&&(c=a,a=arguments[1]||{},h=2),l===h&&(a=this,--h);h<l;h++)if(null!=(t=arguments[h]))for(e in t)s=a[e],a!==(n=t[e])&&(c&&n&&(i.Utils.isPlainObject(n)||(o=Array.isArray(n)))?(o?(o=!1,r=s&&Array.isArray(s)?s:[]):r=s&&i.Utils.isPlainObject(s)?s:{},a[e]=i.Utils.extend(c,r,n)):void 0!==n&&(a[e]=n));return a},mixinPrototype:function(t,e,i){void 0===i&&(i=!1);for(var s=Object.keys(e),n=0;n<s.length;n++){var o=s[n],r=e[o];!i&&o in t||(!r||"function"!=typeof r.get&&"function"!=typeof r.set?t[o]=r:"function"==typeof r.clone?t[o]=r.clone():Object.defineProperty(t,o,r))}},mixin:function(t,e){if(!t||"object"!=typeof t)return e;for(var s in t){var n=t[s];if(!n.childNodes&&!n.cloneNode){var o=typeof t[s];t[s]&&"object"===o?typeof e[s]===o?e[s]=i.Utils.mixin(t[s],e[s]):e[s]=i.Utils.mixin(t[s],new n.constructor):e[s]=t[s]}}return e}},i.Circle=function(t,e,s){t=t||0,e=e||0,s=s||0,this.x=t,this.y=e,this._diameter=s,this._radius=0,s>0&&(this._radius=.5*s),this.type=i.CIRCLE},i.Circle.prototype={circumference:function(){return Math.PI*this._radius*2},random:function(t){void 0===t&&(t=new i.Point);var e=2*Math.PI*Math.random(),s=Math.random()+Math.random(),n=s>1?2-s:s,o=n*Math.cos(e),r=n*Math.sin(e);return t.x=this.x+o*this.radius,t.y=this.y+r*this.radius,t},getBounds:function(){return new i.Rectangle(this.x-this.radius,this.y-this.radius,this.diameter,this.diameter)},setTo:function(t,e,i){return this.x=t,this.y=e,this._diameter=i,this._radius=.5*i,this},copyFrom:function(t){return this.setTo(t.x,t.y,t.diameter)},copyTo:function(t){return t.x=this.x,t.y=this.y,t.diameter=this._diameter,t},distance:function(t,e){var s=i.Math.distance(this.x,this.y,t.x,t.y);return e?Math.round(s):s},clone:function(t){return void 0===t||null===t?t=new i.Circle(this.x,this.y,this.diameter):t.setTo(this.x,this.y,this.diameter),t},contains:function(t,e){return i.Circle.contains(this,t,e)},circumferencePoint:function(t,e,s){return i.Circle.circumferencePoint(this,t,e,s)},sample:function(t,e,s,n,o){t||(t=60),null==e&&(e=0),null==s&&(s=i.Math.PI2),o||(o=[]);for(var r=0;r<t;)this.circumferencePoint(i.Math.linear(e,s,r/t),n,o[r]||(o[r]=new i.Point)),r+=1;return o},offset:function(t,e){return this.x+=t,this.y+=e,this},offsetPoint:function(t){return this.offset(t.x,t.y)},toString:function(){return"[{Phaser.Circle (x="+this.x+" y="+this.y+" diameter="+this.diameter+" radius="+this.radius+")}]"}},i.Circle.prototype.constructor=i.Circle,Object.defineProperty(i.Circle.prototype,"diameter",{get:function(){return this._diameter},set:function(t){t>0&&(this._diameter=t,this._radius=.5*t)}}),Object.defineProperty(i.Circle.prototype,"radius",{get:function(){return this._radius},set:function(t){t>0&&(this._radius=t,this._diameter=2*t)}}),Object.defineProperty(i.Circle.prototype,"left",{get:function(){return this.x-this._radius},set:function(t){t>this.x?(this._radius=0,this._diameter=0):this.radius=this.x-t}}),Object.defineProperty(i.Circle.prototype,"right",{get:function(){return this.x+this._radius},set:function(t){t<this.x?(this._radius=0,this._diameter=0):this.radius=t-this.x}}),Object.defineProperty(i.Circle.prototype,"top",{get:function(){return this.y-this._radius},set:function(t){t>this.y?(this._radius=0,this._diameter=0):this.radius=this.y-t}}),Object.defineProperty(i.Circle.prototype,"bottom",{get:function(){return this.y+this._radius},set:function(t){t<this.y?(this._radius=0,this._diameter=0):this.radius=t-this.y}}),Object.defineProperty(i.Circle.prototype,"area",{get:function(){return this._radius>0?Math.PI*this._radius*this._radius:0}}),Object.defineProperty(i.Circle.prototype,"empty",{get:function(){return 0===this._diameter},set:function(t){!0===t&&this.setTo(0,0,0)}}),i.Circle.contains=function(t,e,i){return t.radius>0&&e>=t.left&&e<=t.right&&i>=t.top&&i<=t.bottom&&(t.x-e)*(t.x-e)+(t.y-i)*(t.y-i)<=t.radius*t.radius},i.Circle.equals=function(t,e){return t.x===e.x&&t.y===e.y&&t.diameter===e.diameter},i.Circle.intersects=function(t,e){return i.Math.distance(t.x,t.y,e.x,e.y)<=t.radius+e.radius},i.Circle.circumferencePoint=function(t,e,s,n){return void 0===s&&(s=!1),void 0===n&&(n=new i.Point),!0===s&&(e=i.Math.degToRad(e)),n.x=t.x+t.radius*Math.cos(e),n.y=t.y+t.radius*Math.sin(e),n},i.Circle.intersectsRectangle=function(t,e){var i=Math.abs(t.x-e.x-e.halfWidth);if(i>e.halfWidth+t.radius)return!1;var s=Math.abs(t.y-e.y-e.halfHeight);if(s>e.halfHeight+t.radius)return!1;if(i<=e.halfWidth||s<=e.halfHeight)return!0;var n=i-e.halfWidth,o=s-e.halfHeight;return n*n+o*o<=t.radius*t.radius},i.Circle.intersectsLine=function(t,e,s){var n=t.x,o=t.y,r=(e.end.y-e.start.y)/(e.end.x-e.start.x),a=e.end.y-r*e.end.x,h=t.radius,l=t.radius,c=a+r*n,u=(n*(l*l)-r*(h*h)*(a-o)+h*l*Math.sqrt(h*h*(r*r)+l*l-c*c-o*o+2*c*o))/(h*h*(r*r)+l*l),d=(n*(l*l)-r*(h*h)*(a-o)-h*l*Math.sqrt(h*h*(r*r)+l*l-c*c-o*o+2*c*o))/(h*h*(r*r)+l*l),p=r*u+a,f=r*d+a,m=new i.Point(u,p),g=new i.Point(d,f),y=e.pointOnSegment(m.x,m.y,.01),v=e.pointOnSegment(g.x,g.y,.01);return y&&v?!s||[m,g]:y?!s||[m]:v?!s||[g]:!!s&&[]},PIXI.Circle=i.Circle,i.Ellipse=function(t,e,s,n){t=t||0,e=e||0,s=s||0,n=n||0,this.x=t,this.y=e,this.width=s,this.height=n,this.type=i.ELLIPSE},i.Ellipse.prototype={setTo:function(t,e,i,s){return this.x=t,this.y=e,this.width=i,this.height=s,this},getBounds:function(){return new i.Rectangle(this.x-this.width,this.y-this.height,this.width,this.height)},copyFrom:function(t){return this.setTo(t.x,t.y,t.width,t.height)},copyTo:function(t){return t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t},clone:function(t){return void 0===t||null===t?t=new i.Ellipse(this.x,this.y,this.width,this.height):t.setTo(this.x,this.y,this.width,this.height),t},contains:function(t,e){return i.Ellipse.contains(this,t,e)},random:function(t){void 0===t&&(t=new i.Point);var e=Math.random()*Math.PI*2,s=Math.random();return t.x=Math.sqrt(s)*Math.cos(e),t.y=Math.sqrt(s)*Math.sin(e),t.x=this.x+t.x*this.width/2,t.y=this.y+t.y*this.height/2,t},toString:function(){return"[{Phaser.Ellipse (x="+this.x+" y="+this.y+" width="+this.width+" height="+this.height+")}]"}},i.Ellipse.prototype.constructor=i.Ellipse,Object.defineProperty(i.Ellipse.prototype,"left",{get:function(){return this.x},set:function(t){this.x=t}}),Object.defineProperty(i.Ellipse.prototype,"right",{get:function(){return this.x+this.width},set:function(t){t<this.x?this.width=0:this.width=t-this.x}}),Object.defineProperty(i.Ellipse.prototype,"top",{get:function(){return this.y},set:function(t){this.y=t}}),Object.defineProperty(i.Ellipse.prototype,"bottom",{get:function(){return this.y+this.height},set:function(t){t<this.y?this.height=0:this.height=t-this.y}}),Object.defineProperty(i.Ellipse.prototype,"empty",{get:function(){return 0===this.width||0===this.height},set:function(t){!0===t&&this.setTo(0,0,0,0)}}),i.Ellipse.contains=function(t,e,i){if(t.width<=0||t.height<=0)return!1;var s=(e-t.x)/t.width-.5,n=(i-t.y)/t.height-.5;return s*=s,n*=n,s+n<.25},i.Ellipse.intersectsLine=function(t,e,s){var n=t.x,o=t.y,r=(e.end.y-e.start.y)/(e.end.x-e.start.x),a=e.end.y-r*e.end.x,h=t.width/2,l=t.height/2,c=a+r*n,u=(n*(l*l)-r*(h*h)*(a-o)+h*l*Math.sqrt(h*h*(r*r)+l*l-c*c-o*o+2*c*o))/(h*h*(r*r)+l*l),d=(n*(l*l)-r*(h*h)*(a-o)-h*l*Math.sqrt(h*h*(r*r)+l*l-c*c-o*o+2*c*o))/(h*h*(r*r)+l*l),p=r*u+a,f=r*d+a,m=new i.Point(u,p),g=new i.Point(d,f),y=e.pointOnSegment(m.x,m.y,.01),v=e.pointOnSegment(g.x,g.y,.01);return y&&v?!s||[m,g]:y?!s||[m]:v?!s||[g]:!!s&&[]},PIXI.Ellipse=i.Ellipse,i.Line=function(t,e,s,n){t=t||0,e=e||0,s=s||0,n=n||0,this.start=new i.Point(t,e),this.end=new i.Point(s,n),this.type=i.LINE},i.Line.prototype={setTo:function(t,e,i,s){return this.start.setTo(t,e),this.end.setTo(i,s),this},fromSprite:function(t,e,i){return void 0===i&&(i=!1),i?this.setTo(t.centerX,t.centerY,e.centerX,e.centerY):this.setTo(t.x,t.y,e.x,e.y)},fromAngle:function(t,e,i,s){return this.start.setTo(t,e),this.end.setTo(t+Math.cos(i)*s,e+Math.sin(i)*s),this},rotate:function(t,e){var i=(this.start.x+this.end.x)/2,s=(this.start.y+this.end.y)/2;return this.start.rotate(i,s,t,e),this.end.rotate(i,s,t,e),this},rotateAround:function(t,e,i,s){return this.start.rotate(t,e,i,s),this.end.rotate(t,e,i,s),this},intersects:function(t,e,s){return i.Line.intersectsPoints(this.start,this.end,t.start,t.end,e,s)},reflect:function(t){return i.Line.reflect(this,t)},midPoint:function(t){return void 0===t&&(t=new i.Point),t.x=(this.start.x+this.end.x)/2,t.y=(this.start.y+this.end.y)/2,t},centerOn:function(t,e){var i=t-(this.start.x+this.end.x)/2,s=e-(this.start.y+this.end.y)/2;this.start.add(i,s),this.end.add(i,s)},pointOnLine:function(t,e,s){return i.Math.fuzzyEqual((t-this.start.x)*(this.end.y-this.start.y),(this.end.x-this.start.x)*(e-this.start.y),s||0)},pointOnSegment:function(t,e,i){var s=Math.min(this.start.x,this.end.x),n=Math.max(this.start.x,this.end.x),o=Math.min(this.start.y,this.end.y),r=Math.max(this.start.y,this.end.y);return this.pointOnLine(t,e,i)&&t>=s&&t<=n&&e>=o&&e<=r},random:function(t){void 0===t&&(t=new i.Point);var e=Math.random();return t.x=this.start.x+e*(this.end.x-this.start.x),t.y=this.start.y+e*(this.end.y-this.start.y),t},coordinatesOnLine:function(t,e){void 0===t&&(t=1),void 0===e&&(e=[]);var i=Math.round(this.start.x),s=Math.round(this.start.y),n=Math.round(this.end.x),o=Math.round(this.end.y),r=Math.abs(n-i),a=Math.abs(o-s),h=i<n?1:-1,l=s<o?1:-1,c=r-a;e.push([i,s]);for(var u=1;i!==n||s!==o;){var d=c<<1;d>-a&&(c-=a,i+=h),d<r&&(c+=r,s+=l),u%t==0&&e.push([i,s]),u++}return e},clone:function(t){return void 0===t||null===t?t=new i.Line(this.start.x,this.start.y,this.end.x,this.end.y):t.setTo(this.start.x,this.start.y,this.end.x,this.end.y),t}},Object.defineProperty(i.Line.prototype,"length",{get:function(){return Math.sqrt((this.end.x-this.start.x)*(this.end.x-this.start.x)+(this.end.y-this.start.y)*(this.end.y-this.start.y))}}),Object.defineProperty(i.Line.prototype,"angle",{get:function(){return Math.atan2(this.end.y-this.start.y,this.end.x-this.start.x)}}),Object.defineProperty(i.Line.prototype,"slope",{get:function(){return(this.end.y-this.start.y)/(this.end.x-this.start.x)}}),Object.defineProperty(i.Line.prototype,"perpSlope",{get:function(){return-(this.end.x-this.start.x)/(this.end.y-this.start.y)}}),Object.defineProperty(i.Line.prototype,"x",{get:function(){return Math.min(this.start.x,this.end.x)}}),Object.defineProperty(i.Line.prototype,"y",{get:function(){return Math.min(this.start.y,this.end.y)}}),Object.defineProperty(i.Line.prototype,"left",{get:function(){return Math.min(this.start.x,this.end.x)}}),Object.defineProperty(i.Line.prototype,"right",{get:function(){return Math.max(this.start.x,this.end.x)}}),Object.defineProperty(i.Line.prototype,"top",{get:function(){return Math.min(this.start.y,this.end.y)}}),Object.defineProperty(i.Line.prototype,"bottom",{get:function(){return Math.max(this.start.y,this.end.y)}}),Object.defineProperty(i.Line.prototype,"width",{get:function(){return Math.abs(this.start.x-this.end.x)}}),Object.defineProperty(i.Line.prototype,"height",{get:function(){return Math.abs(this.start.y-this.end.y)}}),Object.defineProperty(i.Line.prototype,"normalX",{get:function(){return Math.cos(this.angle-1.5707963267948966)}}),Object.defineProperty(i.Line.prototype,"normalY",{get:function(){return Math.sin(this.angle-1.5707963267948966)}}),Object.defineProperty(i.Line.prototype,"normalAngle",{get:function(){return i.Math.wrap(this.angle-1.5707963267948966,-Math.PI,Math.PI)}}),i.Line.intersectsPoints=function(t,e,s,n,o,r){void 0===o&&(o=!0),void 0===r&&(r=new i.Point);var a=e.y-t.y,h=n.y-s.y,l=t.x-e.x,c=s.x-n.x,u=e.x*t.y-t.x*e.y,d=n.x*s.y-s.x*n.y,p=a*c-h*l;if(0===p)return null;if(r.x=(l*d-c*u)/p,r.y=(h*u-a*d)/p,o){var f=(n.y-s.y)*(e.x-t.x)-(n.x-s.x)*(e.y-t.y),m=((n.x-s.x)*(t.y-s.y)-(n.y-s.y)*(t.x-s.x))/f,g=((e.x-t.x)*(t.y-s.y)-(e.y-t.y)*(t.x-s.x))/f;return m>=0&&m<=1&&g>=0&&g<=1?r:null}return r},i.Line.intersects=function(t,e,s,n){return i.Line.intersectsPoints(t.start,t.end,e.start,e.end,s,n)},i.Line.intersectsRectangle=function(t,e){if(0===t.length||e.empty)return!1;var i=t.start.x,s=t.start.y,n=t.end.x,o=t.end.y,r=e.x,a=e.y,h=e.right,l=e.bottom,c=0;if(i>=r&&i<=h&&s>=a&&s<=l||n>=r&&n<=h&&o>=a&&o<=l)return!0;if(i<r&&n>=r){if((c=s+(o-s)*(r-i)/(n-i))>a&&c<=l)return!0}else if(i>h&&n<=h&&(c=s+(o-s)*(h-i)/(n-i))>=a&&c<=l)return!0;if(s<a&&o>=a){if((c=i+(n-i)*(a-s)/(o-s))>=r&&c<=h)return!0}else if(s>l&&o<=l&&(c=i+(n-i)*(l-s)/(o-s))>=r&&c<=h)return!0;return!1},i.Line.intersectionWithRectangle=function(t,e,s){var n=i.Line.intersectionWithRectangle;s||(s=new i.Point),n.edges||(n.edges=[new i.Line,new i.Line,new i.Line,new i.Line]),n.edgeIntersection||(n.edgeIntersection=new i.Point);var o=n.edges,r=n.edgeIntersection.set(0),a=e.x,h=e.y,l=e.right,c=e.bottom,u=1/0;o[0].setTo(a,h,l,h),o[1].setTo(a,c,l,c),o[2].setTo(a,h,a,c),o[3].setTo(l,h,l,c);for(var d,p=0;d=o[p];p++)if(t.intersects(d,!0,r)){var f=t.start.distance(r);f<u&&(u=f,s.copyFrom(r))}return null!=f?s:null},i.Line.reflect=function(t,e){return 2*e.normalAngle-3.141592653589793-t.angle},i.Matrix=function(t,e,s,n,o,r){void 0!==t&&null!==t||(t=1),void 0!==e&&null!==e||(e=0),void 0!==s&&null!==s||(s=0),void 0!==n&&null!==n||(n=1),void 0!==o&&null!==o||(o=0),void 0!==r&&null!==r||(r=0),this.a=t,this.b=e,this.c=s,this.d=n,this.tx=o,this.ty=r,this.type=i.MATRIX},i.Matrix.prototype={fromArray:function(t){return this.setTo(t[0],t[1],t[3],t[4],t[2],t[5])},setTo:function(t,e,i,s,n,o){return this.a=t,this.b=e,this.c=i,this.d=s,this.tx=n,this.ty=o,this},clone:function(t){return void 0===t||null===t?t=new i.Matrix(this.a,this.b,this.c,this.d,this.tx,this.ty):(t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty),t},copyTo:function(t){return t.copyFrom(this),t},copyFrom:function(t){return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty,this},toArray:function(t,e){return void 0===e&&(e=new Float32Array(9)),t?(e[0]=this.a,e[1]=this.b,e[2]=0,e[3]=this.c,e[4]=this.d,e[5]=0,e[6]=this.tx,e[7]=this.ty,e[8]=1):(e[0]=this.a,e[1]=this.c,e[2]=this.tx,e[3]=this.b,e[4]=this.d,e[5]=this.ty,e[6]=0,e[7]=0,e[8]=1),e},apply:function(t,e){return void 0===e&&(e=new i.Point),e.x=this.a*t.x+this.c*t.y+this.tx,e.y=this.b*t.x+this.d*t.y+this.ty,e},applyInverse:function(t,e){void 0===e&&(e=new i.Point);var s=1/(this.a*this.d+this.c*-this.b),n=t.x,o=t.y;return e.x=this.d*s*n+-this.c*s*o+(this.ty*this.c-this.tx*this.d)*s,e.y=this.a*s*o+-this.b*s*n+(-this.ty*this.a+this.tx*this.b)*s,e},translate:function(t,e){return this.tx+=t,this.ty+=e,this},scale:function(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this},rotate:function(t){var e=Math.cos(t),i=Math.sin(t),s=this.a,n=this.c,o=this.tx;return this.a=s*e-this.b*i,this.b=s*i+this.b*e,this.c=n*e-this.d*i,this.d=n*i+this.d*e,this.tx=o*e-this.ty*i,this.ty=o*i+this.ty*e,this},append:function(t){var e=this.a,i=this.b,s=this.c,n=this.d;return this.a=t.a*e+t.b*s,this.b=t.a*i+t.b*n,this.c=t.c*e+t.d*s,this.d=t.c*i+t.d*n,this.tx=t.tx*e+t.ty*s+this.tx,this.ty=t.tx*i+t.ty*n+this.ty,this},identity:function(){return this.setTo(1,0,0,1,0,0)}},i.identityMatrix=new i.Matrix,i.Point=function(t,e){t=t||0,e=e||0,this.x=t,this.y=e,this.type=i.POINT},i.Point.prototype={copyFrom:function(t){return this.setTo(t.x,t.y)},invert:function(){return this.setTo(this.y,this.x)},setTo:function(t,e){return i.Point.set(this,t,e)},set:function(t,e){return i.Point.set(this,t,e)},setToPolar:function(t,e,s){return null==e&&(e=1),s&&(t=i.Math.degToRad(t)),this.setTo(Math.cos(t)*e,Math.sin(t)*e)},add:function(t,e){return this.x+=t,this.y+=e,this},subtract:function(t,e){return this.x-=t,this.y-=e,this},multiply:function(t,e){return this.x*=t,this.y*=e,this},divide:function(t,e){return this.x/=t,this.y/=e,this},clampX:function(t,e){return this.x=i.Math.clamp(this.x,t,e),this},clampY:function(t,e){return this.y=i.Math.clamp(this.y,t,e),this},clamp:function(t,e){return this.x=i.Math.clamp(this.x,t,e),this.y=i.Math.clamp(this.y,t,e),this},clip:function(t){var e=t.left,i=t.top,s=t.right,n=t.bottom;return this.x<e?this.x=e:this.x>s&&(this.x=s),this.y<i?this.y=i:this.y>n&&(this.y=n),this},clone:function(t){return void 0===t||null===t?t=new i.Point(this.x,this.y):t.setTo(this.x,this.y),t},copyTo:function(t){return t.x=this.x,t.y=this.y,t},distance:function(t,e){return i.Point.distance(this,t,e)},equals:function(t){return t.x===this.x&&t.y===this.y},equalsXY:function(t,e){return this.x===t&&this.y===e},fuzzyEquals:function(t,e){return i.Point.fuzzyEquals(this,t,e)},fuzzyEqualsXY:function(t,e,s){return i.Point.fuzzyEqualsXY(this,t,e,s)},angle:function(t,e){return void 0===e&&(e=!1),e?i.Math.radToDeg(Math.atan2(t.y-this.y,t.x-this.x)):Math.atan2(t.y-this.y,t.x-this.x)},rotate:function(t,e,s,n,o){return i.Point.rotate(this,t,e,s,n,o)},getMagnitude:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},getMagnitudeSq:function(){return this.x*this.x+this.y*this.y},setMagnitude:function(t){return this.normalize().multiply(t,t)},normalize:function(){if(!this.isZero()){var t=this.getMagnitude();this.x/=t,this.y/=t}return this},limit:function(t){return this.getMagnitudeSq()>t*t&&this.setMagnitude(t),this},isZero:function(){return 0===this.x&&0===this.y},dot:function(t){return this.x*t.x+this.y*t.y},cross:function(t){return this.x*t.y-this.y*t.x},perp:function(){return this.setTo(-this.y,this.x)},rperp:function(){return this.setTo(this.y,-this.x)},normalRightHand:function(){return this.setTo(-1*this.y,this.x)},floor:function(){return this.setTo(Math.floor(this.x),Math.floor(this.y))},ceil:function(){return this.setTo(Math.ceil(this.x),Math.ceil(this.y))},toString:function(){return"[{Point (x="+this.x+" y="+this.y+")}]"}},i.Point.prototype.constructor=i.Point,i.Point.add=function(t,e,s){return void 0===s&&(s=new i.Point),s.x=t.x+e.x,s.y=t.y+e.y,s},i.Point.subtract=function(t,e,s){return void 0===s&&(s=new i.Point),s.x=t.x-e.x,s.y=t.y-e.y,s},i.Point.multiply=function(t,e,s){return void 0===s&&(s=new i.Point),s.x=t.x*e.x,s.y=t.y*e.y,s},i.Point.divide=function(t,e,s){return void 0===s&&(s=new i.Point),s.x=t.x/e.x,s.y=t.y/e.y,s},i.Point.equals=function(t,e){return t.x===e.x&&t.y===e.y},i.Point.equalsXY=function(t,e,i){return t.x===e&&t.y===i},i.Point.fuzzyEquals=function(t,e,s){return i.Math.fuzzyEquals(t.x,e.x,s)&&i.Math.fuzzyEquals(t.y,e.y,s)},i.Point.fuzzyEqualsXY=function(t,e,s,n){return i.Math.fuzzyEquals(t.x,e,n)&&i.Math.fuzzyEquals(t.y,s,n)},i.Point.angle=function(t,e){return Math.atan2(t.y-e.y,t.x-e.x)},i.Point.negative=function(t,e){return void 0===e&&(e=new i.Point),e.setTo(-t.x,-t.y)},i.Point.multiplyAdd=function(t,e,s,n){return void 0===n&&(n=new i.Point),n.setTo(t.x+e.x*s,t.y+e.y*s)},i.Point.interpolate=function(t,e,s,n){return void 0===n&&(n=new i.Point),n.setTo(t.x+(e.x-t.x)*s,t.y+(e.y-t.y)*s)},i.Point.perp=function(t,e){return void 0===e&&(e=new i.Point),e.setTo(-t.y,t.x)},i.Point.rperp=function(t,e){return void 0===e&&(e=new i.Point),e.setTo(t.y,-t.x)},i.Point.distance=function(t,e,s){var n=i.Math.distance(t.x,t.y,e.x,e.y);return s?Math.round(n):n},i.Point.project=function(t,e,s){void 0===s&&(s=new i.Point);var n=t.dot(e)/e.getMagnitudeSq();return 0!==n&&s.setTo(n*e.x,n*e.y),s},i.Point.projectUnit=function(t,e,s){void 0===s&&(s=new i.Point);var n=t.dot(e);return 0!==n&&s.setTo(n*e.x,n*e.y),s},i.Point.normalRightHand=function(t,e){return void 0===e&&(e=new i.Point),e.setTo(-1*t.y,t.x)},i.Point.normalize=function(t,e){void 0===e&&(e=new i.Point);var s=t.getMagnitude();return 0!==s&&e.setTo(t.x/s,t.y/s),e},i.Point.rotate=function(t,e,s,n,o,r){if(o&&(n=i.Math.degToRad(n)),void 0===r){t.subtract(e,s);var a=Math.sin(n),h=Math.cos(n),l=h*t.x-a*t.y,c=a*t.x+h*t.y;t.x=l+e,t.y=c+s}else{var u=n+Math.atan2(t.y-s,t.x-e);t.x=e+r*Math.cos(u),t.y=s+r*Math.sin(u)}return t},i.Point.centroid=function(t,e){if(void 0===e&&(e=new i.Point),"[object Array]"!==Object.prototype.toString.call(t))throw new Error("Phaser.Point. Parameter 'points' must be an array");var s=t.length;if(s<1)throw new Error("Phaser.Point. Parameter 'points' array must not be empty");if(1===s)return e.copyFrom(t[0]),e;for(var n=0;n<s;n++)i.Point.add(e,t[n],e);return e.divide(s,s),e},i.Point.parse=function(t,e,s){e=e||"x",s=s||"y";var n=new i.Point;return t[e]&&(n.x=parseInt(t[e],10)),t[s]&&(n.y=parseInt(t[s],10)),n},i.Point.isPoint=function(t){return null!=t&&"number"==typeof t.x&&"number"==typeof t.y},i.Point.set=function(t,e,i){return t.x=e||0,t.y=i||(0!==i?t.x:0),t},PIXI.Point=i.Point,i.Polygon=function(){this.area=0,this._points=[],arguments.length>0&&this.setTo.apply(this,arguments),this.closed=!0,this.flattened=!1,this.type=i.POLYGON},i.Polygon.prototype={toNumberArray:function(t){void 0===t&&(t=[]);for(var e=0;e<this._points.length;e++)"number"==typeof this._points[e]?(t.push(this._points[e]),t.push(this._points[e+1]),e++):(t.push(this._points[e].x),t.push(this._points[e].y));return t},flatten:function(){return this._points=this.toNumberArray(),this.flattened=!0,this},clone:function(t){var e=this._points.slice();return void 0===t||null===t?t=new i.Polygon(e):t.setTo(e),t},contains:function(t,e){var i=!1;if(this.flattened)for(var s=-2,n=this._points.length-2;(s+=2)<this._points.length;n=s){var o=this._points[s],r=this._points[s+1],a=this._points[n],h=this._points[n+1];(r<=e&&e<h||h<=e&&e<r)&&t<(a-o)*(e-r)/(h-r)+o&&(i=!i)}else for(var s=-1,n=this._points.length-1;++s<this._points.length;n=s){var o=this._points[s].x,r=this._points[s].y,a=this._points[n].x,h=this._points[n].y;(r<=e&&e<h||h<=e&&e<r)&&t<(a-o)*(e-r)/(h-r)+o&&(i=!i)}return i},setTo:function(t){if(this.area=0,this._points=[],arguments.length>0){Array.isArray(t)||(t=Array.prototype.slice.call(arguments));for(var e=Number.MAX_VALUE,i=0,s=t.length;i<s;i++){if("number"==typeof t[i]){n=new PIXI.Point(t[i],t[i+1]);i++}else if(Array.isArray(t[i]))n=new PIXI.Point(t[i][0],t[i][1]);else var n=new PIXI.Point(t[i].x,t[i].y);this._points.push(n),n.y<e&&(e=n.y)}this.calculateArea(e)}return this},calculateArea:function(t){for(var e,i,s,n,o=0,r=this._points.length;o<r;o++)e=this._points[o],i=o===r-1?this._points[0]:this._points[o+1],s=(e.y-t+(i.y-t))/2,n=e.x-i.x,this.area+=s*n;return this.area}},i.Polygon.prototype.constructor=i.Polygon,Object.defineProperty(i.Polygon.prototype,"points",{get:function(){return this._points},set:function(t){null!=t?this.setTo(t):this.setTo()}}),PIXI.Polygon=i.Polygon,i.Rectangle=function(t,e,s,n){t=t||0,e=e||0,s=s||0,n=n||0,this.x=t,this.y=e,this.width=s,this.height=n,this.type=i.RECTANGLE},i.Rectangle.prototype={offset:function(t,e){return this.x+=t,this.y+=e,this},offsetPoint:function(t){return this.offset(t.x,t.y)},setTo:function(t,e,i,s){return this.x=t,this.y=e,this.width=i,this.height=s,this},scale:function(t,e){return void 0===e&&(e=t),this.width*=t,this.height*=e,this},centerOn:function(t,e){return this.centerX=t,this.centerY=e,this},floor:function(){this.x=Math.floor(this.x),this.y=Math.floor(this.y)},floorAll:function(){this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.width=Math.floor(this.width),this.height=Math.floor(this.height)},ceil:function(){this.x=Math.ceil(this.x),this.y=Math.ceil(this.y)},ceilAll:function(){this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.width=Math.ceil(this.width),this.height=Math.ceil(this.height)},copyFrom:function(t){return this.setTo(t.x,t.y,t.width,t.height)},copyFromBounds:function(t){return this.setTo(t.left,t.top,t.width,t.height)},copyTo:function(t){return t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t},inflate:function(t,e){return i.Rectangle.inflate(this,t,e)},size:function(t){return i.Rectangle.size(this,t)},resize:function(t,e){return this.width=t,this.height=e,this},clone:function(t){return i.Rectangle.clone(this,t)},contains:function(t,e){return i.Rectangle.contains(this,t,e)},containsRect:function(t){return i.Rectangle.containsRect(t,this)},equals:function(t){return i.Rectangle.equals(this,t)},intersection:function(t,e){return i.Rectangle.intersection(this,t,e)},intersects:function(t){return i.Rectangle.intersects(this,t)},intersectsRaw:function(t,e,s,n,o){return i.Rectangle.intersectsRaw(this,t,e,s,n,o)},union:function(t,e){return i.Rectangle.union(this,t,e)},random:function(t){return void 0===t&&(t=new i.Point),t.x=this.randomX,t.y=this.randomY,t},getPoint:function(t,e){switch(void 0===e&&(e=new i.Point),t){default:case i.TOP_LEFT:return e.set(this.x,this.y);case i.TOP_CENTER:return e.set(this.centerX,this.y);case i.TOP_RIGHT:return e.set(this.right,this.y);case i.LEFT_CENTER:return e.set(this.x,this.centerY);case i.CENTER:return e.set(this.centerX,this.centerY);case i.RIGHT_CENTER:return e.set(this.right,this.centerY);case i.BOTTOM_LEFT:return e.set(this.x,this.bottom);case i.BOTTOM_CENTER:return e.set(this.centerX,this.bottom);case i.BOTTOM_RIGHT:return e.set(this.right,this.bottom)}},sides:function(t,e,s,n){arguments.length||(t=new i.Line,e=new i.Line,s=new i.Line,n=new i.Line);var o=this.x,r=this.y,a=this.right,h=this.bottom;return t.setTo(o,r,a,r),e.setTo(a,r,a,h),s.setTo(o,h,a,h),n.setTo(o,r,o,h),arguments.length?null:[t,e,s,n]},toString:function(){return"[{Rectangle (x="+this.x+" y="+this.y+" width="+this.width+" height="+this.height+" empty="+this.empty+")}]"}},Object.defineProperty(i.Rectangle.prototype,"halfWidth",{get:function(){return Math.round(this.width/2)}}),Object.defineProperty(i.Rectangle.prototype,"halfHeight",{get:function(){return Math.round(this.height/2)}}),Object.defineProperty(i.Rectangle.prototype,"bottom",{get:function(){return this.y+this.height},set:function(t){t<=this.y?this.height=0:this.height=t-this.y}}),Object.defineProperty(i.Rectangle.prototype,"bottomLeft",{get:function(){return new i.Point(this.x,this.bottom)},set:function(t){this.x=t.x,this.bottom=t.y}}),Object.defineProperty(i.Rectangle.prototype,"bottomRight",{get:function(){return new i.Point(this.right,this.bottom)},set:function(t){this.right=t.x,this.bottom=t.y}}),Object.defineProperty(i.Rectangle.prototype,"left",{get:function(){return this.x},set:function(t){t>=this.right?this.width=0:this.width=this.right-t,this.x=t}}),Object.defineProperty(i.Rectangle.prototype,"right",{get:function(){return this.x+this.width},set:function(t){t<=this.x?this.width=0:this.width=t-this.x}}),Object.defineProperty(i.Rectangle.prototype,"volume",{get:function(){return this.width*this.height}}),Object.defineProperty(i.Rectangle.prototype,"perimeter",{get:function(){return 2*this.width+2*this.height}}),Object.defineProperty(i.Rectangle.prototype,"centerX",{get:function(){return this.x+this.halfWidth},set:function(t){this.x=t-this.halfWidth}}),Object.defineProperty(i.Rectangle.prototype,"centerY",{get:function(){return this.y+this.halfHeight},set:function(t){this.y=t-this.halfHeight}}),Object.defineProperty(i.Rectangle.prototype,"randomX",{get:function(){return this.x+Math.random()*this.width}}),Object.defineProperty(i.Rectangle.prototype,"randomY",{get:function(){return this.y+Math.random()*this.height}}),Object.defineProperty(i.Rectangle.prototype,"top",{get:function(){return this.y},set:function(t){t>=this.bottom?(this.height=0,this.y=t):this.height=this.bottom-t}}),Object.defineProperty(i.Rectangle.prototype,"topLeft",{get:function(){return new i.Point(this.x,this.y)},set:function(t){this.x=t.x,this.y=t.y}}),Object.defineProperty(i.Rectangle.prototype,"topRight",{get:function(){return new i.Point(this.x+this.width,this.y)},set:function(t){this.right=t.x,this.y=t.y}}),Object.defineProperty(i.Rectangle.prototype,"empty",{get:function(){return!this.width||!this.height},set:function(t){!0===t&&this.setTo(0,0,0,0)}}),i.Rectangle.prototype.constructor=i.Rectangle,i.Rectangle.inflate=function(t,e,i){return t.x-=e,t.width+=2*e,t.y-=i,t.height+=2*i,t},i.Rectangle.inflatePoint=function(t,e){return i.Rectangle.inflate(t,e.x,e.y)},i.Rectangle.size=function(t,e){return void 0===e||null===e?e=new i.Point(t.width,t.height):e.setTo(t.width,t.height),e},i.Rectangle.clone=function(t,e){return void 0===e||null===e?e=new i.Rectangle(t.x,t.y,t.width,t.height):e.setTo(t.x,t.y,t.width,t.height),e},i.Rectangle.createFromBounds=function(t,e){return void 0!==e&&null!==e||(e=new i.Rectangle(t.x,t.y,t.width,t.height)),e.copyFromBounds(t)},i.Rectangle.contains=function(t,e,i){return!(t.width<=0||t.height<=0)&&(e>=t.x&&e<t.right&&i>=t.y&&i<t.bottom)},i.Rectangle.containsRaw=function(t,e,i,s,n,o){return n>=t&&n<t+i&&o>=e&&o<e+s},i.Rectangle.containsPoint=function(t,e){return i.Rectangle.contains(t,e.x,e.y)},i.Rectangle.containsRect=function(t,e){return!(t.volume>e.volume)&&(t.x>=e.x&&t.y>=e.y&&t.right<e.right&&t.bottom<e.bottom)},i.Rectangle.equals=function(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height},i.Rectangle.sameDimensions=function(t,e){return t.width===e.width&&t.height===e.height},i.Rectangle.intersection=function(t,e,s){return void 0===s&&(s=new i.Rectangle),i.Rectangle.intersects(t,e)&&(s.x=Math.max(t.x,e.x),s.y=Math.max(t.y,e.y),s.width=Math.min(t.right,e.right)-s.x,s.height=Math.min(t.bottom,e.bottom)-s.y),s},i.Rectangle.intersects=function(t,e){return!(t.width<=0||t.height<=0||e.width<=0||e.height<=0)&&!(t.right<e.x||t.bottom<e.y||t.x>e.right||t.y>e.bottom)},i.Rectangle.intersectsRaw=function(t,e,i,s,n,o){return void 0===o&&(o=0),!(e>t.right+o||i<t.left-o||s>t.bottom+o||n<t.top-o)},i.Rectangle.union=function(t,e,s){return void 0===s&&(s=new i.Rectangle),s.setTo(Math.min(t.x,e.x),Math.min(t.y,e.y),Math.max(t.right,e.right)-Math.min(t.left,e.left),Math.max(t.bottom,e.bottom)-Math.min(t.top,e.top))},i.Rectangle.aabb=function(t,e){void 0===e&&(e=new i.Rectangle);var s=Number.NEGATIVE_INFINITY,n=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,r=Number.POSITIVE_INFINITY;return t.forEach(function(t){t.x>s&&(s=t.x),t.x<n&&(n=t.x),t.y>o&&(o=t.y),t.y<r&&(r=t.y)}),e.setTo(n,r,s-n,o-r),e},PIXI.Rectangle=i.Rectangle,PIXI.EmptyRectangle=new i.Rectangle(0,0,0,0),i.RoundedRectangle=function(t,e,s,n,o){void 0===t&&(t=0),void 0===e&&(e=0),void 0===s&&(s=0),void 0===n&&(n=0),void 0===o&&(o=20),this.x=t,this.y=e,this.width=s,this.height=n,this.radius=o||20,this.type=i.ROUNDEDRECTANGLE},i.RoundedRectangle.prototype={clone:function(){return new i.RoundedRectangle(this.x,this.y,this.width,this.height,this.radius)},contains:function(t,e){if(this.width<=0||this.height<=0)return!1;var i=this.x;if(t>=i&&t<=i+this.width){var s=this.y;if(e>=s&&e<=s+this.height)return!0}return!1}},i.RoundedRectangle.prototype.constructor=i.RoundedRectangle,PIXI.RoundedRectangle=i.RoundedRectangle,i.Camera=function(t,e,s,n,o,r){this.game=t,this.world=t.world,this.id=0,this.view=new i.Rectangle(s,n,o,r),this.bounds=new i.Rectangle(s,n,o,r),this.deadzone=null,this.visible=!0,this.roundPx=!0,this.atLimit={x:!1,y:!1},this.target=null,this.displayObject=null,this.scale=null,this.totalInView=0,this.lerp=new i.Point(1,1),this.onShakeComplete=new i.Signal,this.onFlashComplete=new i.Signal,this.onFadeComplete=new i.Signal,this.fx=null,this._targetPosition=new i.Point,this._edge=0,this._position=new i.Point,this._shake={intensity:0,duration:0,horizontal:!1,vertical:!1,shakeBounds:!0,x:0,y:0},this._fxDuration=0,this._fxType=0,this._fixedView=new i.Rectangle},i.Camera.FOLLOW_LOCKON=0,i.Camera.FOLLOW_PLATFORMER=1,i.Camera.FOLLOW_TOPDOWN=2,i.Camera.FOLLOW_TOPDOWN_TIGHT=3,i.Camera.SHAKE_BOTH=4,i.Camera.SHAKE_HORIZONTAL=5,i.Camera.SHAKE_VERTICAL=6,i.Camera.ENABLE_FX=!0,i.Camera.prototype={boot:function(){this.displayObject=this.game.world,this.scale=this.game.world.scale,this.game.camera=this,i.Graphics&&i.Camera.ENABLE_FX&&(this.fx=new i.Graphics(this.game),this.game.stage.addChild(this.fx))},preUpdate:function(){this.totalInView=0},follow:function(t,e,s,n){void 0===e&&(e=i.Camera.FOLLOW_LOCKON),void 0===s&&(s=1),void 0===n&&(n=1),this.target=t,this.lerp.set(s,n);var o;switch(e){case i.Camera.FOLLOW_PLATFORMER:var r=this.width/8,a=this.height/3;this.deadzone=new i.Rectangle((this.width-r)/2,(this.height-a)/2-.25*a,r,a);break;case i.Camera.FOLLOW_TOPDOWN:o=Math.max(this.width,this.height)/4,this.deadzone=new i.Rectangle((this.width-o)/2,(this.height-o)/2,o,o);break;case i.Camera.FOLLOW_TOPDOWN_TIGHT:o=Math.max(this.width,this.height)/8,this.deadzone=new i.Rectangle((this.width-o)/2,(this.height-o)/2,o,o);break;case i.Camera.FOLLOW_LOCKON:default:this.deadzone=null}},unfollow:function(){this.target=null},focusOn:function(t){this.setPosition(Math.round(t.x-this.view.halfWidth),Math.round(t.y-this.view.halfHeight))},focusOnXY:function(t,e){this.setPosition(Math.round(t-this.view.halfWidth),Math.round(e-this.view.halfHeight))},shake:function(t,e,s,n,o){return void 0===t&&(t=.05),void 0===e&&(e=500),void 0===s&&(s=!0),void 0===n&&(n=i.Camera.SHAKE_BOTH),void 0===o&&(o=!0),!(!s&&this._shake.duration>0)&&(this._shake.intensity=t,this._shake.duration=e,this._shake.shakeBounds=o,this._shake.x=0,this._shake.y=0,this._shake.horizontal=n===i.Camera.SHAKE_BOTH||n===i.Camera.SHAKE_HORIZONTAL,this._shake.vertical=n===i.Camera.SHAKE_BOTH||n===i.Camera.SHAKE_VERTICAL,!0)},flash:function(t,e,i,s){return void 0===t&&(t=16777215),void 0===e&&(e=500),void 0===i&&(i=!1),void 0===s&&(s=1),!(!this.fx||!i&&this._fxDuration>0)&&(this.fx.clear(),this.fx.beginFill(t,s),this.fx.drawRect(0,0,this.width,this.height),this.fx.endFill(),this.fx.alpha=1,this._fxDuration=e,this._fxType=0,!0)},fade:function(t,e,i,s){return void 0===t&&(t=0),void 0===e&&(e=500),void 0===i&&(i=!1),void 0===s&&(s=1),!(!this.fx||!i&&this._fxDuration>0)&&(this.fx.clear(),this.fx.beginFill(t,s),this.fx.drawRect(0,0,this.width,this.height),this.fx.endFill(),this.fx.alpha=0,this._fxDuration=e,this._fxType=1,!0)},update:function(){this._fxDuration>0&&this.updateFX(),this._shake.duration>0&&this.updateShake(),this.bounds&&this.checkBounds(),this.roundPx&&(this.view.floor(),this._shake.x=Math.floor(this._shake.x),this._shake.y=Math.floor(this._shake.y)),this.displayObject.position.x=-this.view.x,this.displayObject.position.y=-this.view.y},updateFX:function(){0===this._fxType?(this.fx.alpha-=this.game.time.elapsedMS/this._fxDuration,this.fx.alpha<=0&&(this._fxDuration=0,this.fx.alpha=0,this.onFlashComplete.dispatch())):(this.fx.alpha+=this.game.time.elapsedMS/this._fxDuration,this.fx.alpha>=1&&(this._fxDuration=0,this.fx.alpha=1,this.onFadeComplete.dispatch()))},updateShake:function(){this._shake.duration-=this.game.time.elapsedMS,this._shake.duration<=0?(this.onShakeComplete.dispatch(),this._shake.x=0,this._shake.y=0):(this._shake.horizontal&&(this._shake.x=this.game.rnd.frac()*this._shake.intensity*this.view.width*2-this._shake.intensity*this.view.width),this._shake.vertical&&(this._shake.y=this.game.rnd.frac()*this._shake.intensity*this.view.height*2-this._shake.intensity*this.view.height))},updateTarget:function(){this._targetPosition.x=this.view.x+this.target.worldPosition.x,this._targetPosition.y=this.view.y+this.target.worldPosition.y,this.deadzone?(this._edge=this._targetPosition.x-this.view.x,this._edge<this.deadzone.left?this.view.x=this.game.math.linear(this.view.x,this._targetPosition.x-this.deadzone.left,this.lerp.x):this._edge>this.deadzone.right&&(this.view.x=this.game.math.linear(this.view.x,this._targetPosition.x-this.deadzone.right,this.lerp.x)),this._edge=this._targetPosition.y-this.view.y,this._edge<this.deadzone.top?this.view.y=this.game.math.linear(this.view.y,this._targetPosition.y-this.deadzone.top,this.lerp.y):this._edge>this.deadzone.bottom&&(this.view.y=this.game.math.linear(this.view.y,this._targetPosition.y-this.deadzone.bottom,this.lerp.y))):(this.view.x=this.game.math.linear(this.view.x,this._targetPosition.x-this.view.halfWidth,this.lerp.x),this.view.y=this.game.math.linear(this.view.y,this._targetPosition.y-this.view.halfHeight,this.lerp.y)),this.bounds&&this.checkBounds(),this.roundPx&&this.view.floor(),this.displayObject.position.x=-this.view.x,this.displayObject.position.y=-this.view.y},setBoundsToWorld:function(){this.bounds&&this.bounds.copyFrom(this.game.world.bounds)},checkBounds:function(){this.atLimit.x=!1,this.atLimit.y=!1;var t=this.view.x+this._shake.x,e=this.view.right+this._shake.x,i=this.view.y+this._shake.y,s=this.view.bottom+this._shake.y;t<=this.bounds.x*this.scale.x?(this.atLimit.x=!0,this.view.x=this.bounds.x*this.scale.x,this._shake.shakeBounds||(this._shake.x=0)):e>=this.bounds.right*this.scale.x&&(this.atLimit.x=!0,this.view.x=this.bounds.right*this.scale.x-this.width,this._shake.shakeBounds||(this._shake.x=0)),i<=this.bounds.top*this.scale.y?(this.atLimit.y=!0,this.view.y=this.bounds.top*this.scale.y,this._shake.shakeBounds||(this._shake.y=0)):s>=this.bounds.bottom*this.scale.y&&(this.atLimit.y=!0,this.view.y=this.bounds.bottom*this.scale.y-this.height,this._shake.shakeBounds||(this._shake.y=0))},setPosition:function(t,e){this.view.x=t,this.view.y=e,this.bounds&&this.checkBounds()},setSize:function(t,e){this.view.width=t,this.view.height=e},reset:function(){this.target=null,this.view.x=0,this.view.y=0,this._shake.duration=0,this._shake.x=0,this._shake.y=0,this.resetFX()},resetFX:function(){this.fx&&(this.fx.clear(),this.fx.alpha=0),this._fxDuration=0}},i.Camera.prototype.constructor=i.Camera,Object.defineProperty(i.Camera.prototype,"x",{get:function(){return this.view.x},set:function(t){this.view.x=t,this.bounds&&this.checkBounds()}}),Object.defineProperty(i.Camera.prototype,"y",{get:function(){return this.view.y},set:function(t){this.view.y=t,this.bounds&&this.checkBounds()}}),Object.defineProperty(i.Camera.prototype,"position",{get:function(){return this._position.set(this.view.x,this.view.y),this._position},set:function(t){void 0!==t.x&&(this.view.x=t.x),void 0!==t.y&&(this.view.y=t.y),this.bounds&&this.checkBounds()}}),Object.defineProperty(i.Camera.prototype,"width",{get:function(){return this.view.width},set:function(t){this.view.width=t}}),Object.defineProperty(i.Camera.prototype,"height",{get:function(){return this.view.height},set:function(t){this.view.height=t}}),Object.defineProperty(i.Camera.prototype,"shakeIntensity",{get:function(){return this._shake.intensity},set:function(t){this._shake.intensity=t}}),Object.defineProperty(i.Camera.prototype,"fixedView",{get:function(){return this._fixedView.setTo(0,0,this.view.width,this.view.height),this._fixedView}}),i.State=function(){this.game=null,this.key="",this.add=null,this.make=null,this.camera=null,this.cache=null,this.input=null,this.load=null,this.math=null,this.sound=null,this.scale=null,this.stage=null,this.state=null,this.time=null,this.tweens=null,this.world=null,this.particles=null,this.physics=null,this.rnd=null},i.State.prototype={init:function(){},preload:function(){},loadUpdate:function(){},loadRender:function(){},create:function(){},update:function(){},preRender:function(){},render:function(){},resize:function(){},paused:function(){},resumed:function(){},pauseUpdate:function(){},shutdown:function(){}},i.State.prototype.constructor=i.State,i.StateManager=function(t,e){this.game=t,this.states={},this._pendingState=null,void 0!==e&&null!==e&&(this._pendingState=e),this._clearWorld=!1,this._clearCache=!1,this._created=!1,this._args=[],this.current="",this.onStateChange=new i.Signal,this.onInitCallback=null,this.onPreloadCallback=null,this.onCreateCallback=null,this.onUpdateCallback=null,this.onRenderCallback=null,this.onResizeCallback=null,this.onPreRenderCallback=null,this.onLoadUpdateCallback=null,this.onLoadRenderCallback=null,this.onPausedCallback=null,this.onResumedCallback=null,this.onPauseUpdateCallback=null,this.onShutDownCallback=null},i.StateManager.prototype={boot:function(){this.game.onPause.add(this.pause,this),this.game.onResume.add(this.resume,this),null!==this._pendingState&&"string"!=typeof this._pendingState&&this.add("default",this._pendingState,!0)},add:function(t,e,s){void 0===s&&(s=!1);var n;return e instanceof i.State?n=e:"object"==typeof e?(n=e).game=this.game:"function"==typeof e&&(n=new e(this.game)),this.states[t]=n,s&&(this.game.isBooted?this.start(t):this._pendingState=t),n},remove:function(t){this.current===t&&(this.callbackContext=null,this.onInitCallback=null,this.onShutDownCallback=null,this.onPreloadCallback=null,this.onLoadRenderCallback=null,this.onLoadUpdateCallback=null,this.onCreateCallback=null,this.onUpdateCallback=null,this.onPreRenderCallback=null,this.onRenderCallback=null,this.onResizeCallback=null,this.onPausedCallback=null,this.onResumedCallback=null,this.onPauseUpdateCallback=null),delete this.states[t]},start:function(t,e,i){void 0===e&&(e=!0),void 0===i&&(i=!1),this.checkState(t)&&(this._pendingState=t,this._clearWorld=e,this._clearCache=i,arguments.length>3&&(this._args=Array.prototype.splice.call(arguments,3)))},restart:function(t,e){void 0===t&&(t=!0),void 0===e&&(e=!1),this._pendingState=this.current,this._clearWorld=t,this._clearCache=e,arguments.length>2&&(this._args=Array.prototype.slice.call(arguments,2))},dummy:function(){},preUpdate:function(){if(this._pendingState&&this.game.isBooted){var t=this.current;if(this.clearCurrentState(),this.setCurrentState(this._pendingState),this.onStateChange.dispatch(this.current,t),this.current!==this._pendingState)return;this._pendingState=null,this.onPreloadCallback?(this.game.load.reset(!0),this.onPreloadCallback.call(this.callbackContext,this.game),0===this.game.load.totalQueuedFiles()&&0===this.game.load.totalQueuedPacks()?this.loadComplete():this.game.load.start()):this.loadComplete()}},clearCurrentState:function(){this.current&&(this.onShutDownCallback&&this.onShutDownCallback.call(this.callbackContext,this.game),this.game.tweens.removeAll(),this.game.camera.reset(),this.game.input.reset(!0),this.game.physics.clear(),this.game.time.removeAll(),this.game.scale.reset(this._clearWorld),this.game.debug&&this.game.debug.reset(),this._clearWorld&&(this.game.world.shutdown(),this._clearCache&&this.game.cache.destroy()))},checkState:function(t){var e=this.states[t];return e?!!(e.preload||e.create||e.update||e.render)||(console.warn("Invalid Phaser State object given. Must contain at least one of the required functions: preload, create, update or render"),!1):(console.warn("Phaser.StateManager - No state found with the key: "+t),!1)},link:function(t){this.states[t].game=this.game,this.states[t].add=this.game.add,this.states[t].make=this.game.make,this.states[t].camera=this.game.camera,this.states[t].cache=this.game.cache,this.states[t].input=this.game.input,this.states[t].load=this.game.load,this.states[t].math=this.game.math,this.states[t].sound=this.game.sound,this.states[t].scale=this.game.scale,this.states[t].state=this,this.states[t].stage=this.game.stage,this.states[t].time=this.game.time,this.states[t].tweens=this.game.tweens,this.states[t].world=this.game.world,this.states[t].particles=this.game.particles,this.states[t].rnd=this.game.rnd,this.states[t].physics=this.game.physics,this.states[t].key=t},unlink:function(t){this.states[t]&&(this.states[t].game=null,this.states[t].add=null,this.states[t].make=null,this.states[t].camera=null,this.states[t].cache=null,this.states[t].input=null,this.states[t].load=null,this.states[t].math=null,this.states[t].sound=null,this.states[t].scale=null,this.states[t].state=null,this.states[t].stage=null,this.states[t].time=null,this.states[t].tweens=null,this.states[t].world=null,this.states[t].particles=null,this.states[t].rnd=null,this.states[t].physics=null)},setCurrentState:function(t){this.callbackContext=this.states[t],this.link(t),this.onInitCallback=this.states[t].init||this.dummy,this.onPreloadCallback=this.states[t].preload||null,this.onLoadRenderCallback=this.states[t].loadRender||null,this.onLoadUpdateCallback=this.states[t].loadUpdate||null,this.onCreateCallback=this.states[t].create||null,this.onUpdateCallback=this.states[t].update||null,this.onPreRenderCallback=this.states[t].preRender||null,this.onRenderCallback=this.states[t].render||null,this.onResizeCallback=this.states[t].resize||null,this.onPausedCallback=this.states[t].paused||null,this.onResumedCallback=this.states[t].resumed||null,this.onPauseUpdateCallback=this.states[t].pauseUpdate||null,this.onShutDownCallback=this.states[t].shutdown||this.dummy,""!==this.current&&this.game.physics.reset(),this.current=t,this._created=!1,this.onInitCallback.apply(this.callbackContext,this._args),t===this._pendingState&&(this._args=[]),this.game._kickstart=!0},getCurrentState:function(){return this.states[this.current]},loadComplete:function(){!1===this._created&&this.onLoadUpdateCallback&&this.onLoadUpdateCallback.call(this.callbackContext,this.game),!1===this._created&&this.onCreateCallback?(this._created=!0,this.onCreateCallback.call(this.callbackContext,this.game)):this._created=!0},pause:function(){this._created&&this.onPausedCallback&&this.onPausedCallback.call(this.callbackContext,this.game)},resume:function(){this._created&&this.onResumedCallback&&this.onResumedCallback.call(this.callbackContext,this.game)},update:function(){this._created?this.onUpdateCallback&&this.onUpdateCallback.call(this.callbackContext,this.game):this.onLoadUpdateCallback&&this.onLoadUpdateCallback.call(this.callbackContext,this.game)},pauseUpdate:function(){this._created?this.onPauseUpdateCallback&&this.onPauseUpdateCallback.call(this.callbackContext,this.game):this.onLoadUpdateCallback&&this.onLoadUpdateCallback.call(this.callbackContext,this.game)},preRender:function(t){this._created&&this.onPreRenderCallback&&this.onPreRenderCallback.call(this.callbackContext,this.game,t)},resize:function(t,e)