var PIXI=PIXI||{};var Phaser=Phaser||{VERSION:"1.0.0",GAMES:[],AUTO:0,CANVAS:1,WEBGL:2,SPRITE:0,BUTTON:1,BULLET:2,GRAPHICS:3,TEXT:4,TILESPRITE:5,BITMAPTEXT:6,GROUP:7,RENDERTEXTURE:8,TILEMAP:9,TILEMAPLAYER:10,EMITTER:11};PIXI.InteractionManager=function(b){};Phaser.Utils={pad:function(g,b,f,c){if(typeof(b)=="undefined"){var b=0}if(typeof(f)=="undefined"){var f=" "}if(typeof(c)=="undefined"){var c=3}if(b+1>=g.length){switch(c){case 1:g=Array(b+1-g.length).join(f)+g;break;case 3:var d=Math.ceil((padlen=b-g.length)/2);var e=padlen-d;g=Array(e+1).join(f)+g+Array(d+1).join(f);break;default:g=g+Array(b+1-g.length).join(f);break}}return g},isPlainObject:function(c){if(typeof(c)!=="object"||c.nodeType||c===c.window){return false}try{if(c.constructor&&!hasOwn.call(c.constructor.prototype,"isPrototypeOf")){return false}}catch(b){return false}return true},extend:function(){var l,d,b,c,h,j,g=arguments[0]||{},f=1,e=arguments.length,k=false;if(typeof g==="boolean"){k=g;g=arguments[1]||{};f=2}if(e===f){g=this;--f}for(;f>16&255)/255,(b>>8&255)/255,(b&255)/255]}if(typeof Function.prototype.bind!="function"){Function.prototype.bind=(function(){var b=Array.prototype.slice;return function(c){var f=this,g=b.call(arguments,1);if(typeof f!="function"){throw new TypeError()}function d(){var h=g.concat(b.call(arguments));f.apply(this instanceof d?this:c,h)}d.prototype=(function e(h){h&&(e.prototype=h);if(!(this instanceof e)){return new e}})(f.prototype);return d}})()}function determineMatrixArrayType(){PIXI.Matrix=(typeof Float32Array!=="undefined")?Float32Array:Array;return PIXI.Matrix}determineMatrixArrayType();PIXI.mat3={};PIXI.mat3.create=function(){var b=new PIXI.Matrix(9);b[0]=1;b[1]=0;b[2]=0;b[3]=0;b[4]=1;b[5]=0;b[6]=0;b[7]=0;b[8]=1;return b};PIXI.mat3.identity=function(b){b[0]=1;b[1]=0;b[2]=0;b[3]=0;b[4]=1;b[5]=0;b[6]=0;b[7]=0;b[8]=1;return b};PIXI.mat4={};PIXI.mat4.create=function(){var b=new PIXI.Matrix(16);b[0]=1;b[1]=0;b[2]=0;b[3]=0;b[4]=0;b[5]=1;b[6]=0;b[7]=0;b[8]=0;b[9]=0;b[10]=1;b[11]=0;b[12]=0;b[13]=0;b[14]=0;b[15]=1;return b};PIXI.mat3.multiply=function(q,h,i){if(!i){i=q}var v=q[0],u=q[1],t=q[2],g=q[3],f=q[4],e=q[5],o=q[6],n=q[7],m=q[8],l=h[0],k=h[1],j=h[2],s=h[3],r=h[4],p=h[5],d=h[6],c=h[7],b=h[8];i[0]=l*v+k*g+j*o;i[1]=l*u+k*f+j*n;i[2]=l*t+k*e+j*m;i[3]=s*v+r*g+p*o;i[4]=s*u+r*f+p*n;i[5]=s*t+r*e+p*m;i[6]=d*v+c*g+b*o;i[7]=d*u+c*f+b*n;i[8]=d*t+c*e+b*m;return i};PIXI.mat3.clone=function(c){var b=new PIXI.Matrix(9);b[0]=c[0];b[1]=c[1];b[2]=c[2];b[3]=c[3];b[4]=c[4];b[5]=c[5];b[6]=c[6];b[7]=c[7];b[8]=c[8];return b};PIXI.mat3.transpose=function(d,c){if(!c||d===c){var f=d[1],e=d[2],b=d[5];d[1]=d[3];d[2]=d[6];d[3]=f;d[5]=d[7];d[6]=e;d[7]=b;return d}c[0]=d[0];c[1]=d[3];c[2]=d[6];c[3]=d[1];c[4]=d[4];c[5]=d[7];c[6]=d[2];c[7]=d[5];c[8]=d[8];return c};PIXI.mat3.toMat4=function(c,b){if(!b){b=PIXI.mat4.create()}b[15]=1;b[14]=0;b[13]=0;b[12]=0;b[11]=0;b[10]=c[8];b[9]=c[7];b[8]=c[6];b[7]=0;b[6]=c[5];b[5]=c[4];b[4]=c[3];b[3]=0;b[2]=c[2];b[1]=c[1];b[0]=c[0];return b};PIXI.mat4.create=function(){var b=new PIXI.Matrix(16);b[0]=1;b[1]=0;b[2]=0;b[3]=0;b[4]=0;b[5]=1;b[6]=0;b[7]=0;b[8]=0;b[9]=0;b[10]=1;b[11]=0;b[12]=0;b[13]=0;b[14]=0;b[15]=1;return b};PIXI.mat4.transpose=function(e,d){if(!d||e===d){var i=e[1],g=e[2],f=e[3],b=e[6],h=e[7],c=e[11];e[1]=e[4];e[2]=e[8];e[3]=e[12];e[4]=i;e[6]=e[9];e[7]=e[13];e[8]=g;e[9]=b;e[11]=e[14];e[12]=f;e[13]=h;e[14]=c;return e}d[0]=e[0];d[1]=e[4];d[2]=e[8];d[3]=e[12];d[4]=e[1];d[5]=e[5];d[6]=e[9];d[7]=e[13];d[8]=e[2];d[9]=e[6];d[10]=e[10];d[11]=e[14];d[12]=e[3];d[13]=e[7];d[14]=e[11];d[15]=e[15];return d};PIXI.mat4.multiply=function(p,i,k){if(!k){k=p}var v=p[0],u=p[1],s=p[2],q=p[3];var h=p[4],f=p[5],d=p[6],b=p[7];var o=p[8],n=p[9],m=p[10],l=p[11];var z=p[12],w=p[13],t=p[14],r=p[15];var j=i[0],g=i[1],e=i[2],c=i[3];k[0]=j*v+g*h+e*o+c*z;k[1]=j*u+g*f+e*n+c*w;k[2]=j*s+g*d+e*m+c*t;k[3]=j*q+g*b+e*l+c*r;j=i[4];g=i[5];e=i[6];c=i[7];k[4]=j*v+g*h+e*o+c*z;k[5]=j*u+g*f+e*n+c*w;k[6]=j*s+g*d+e*m+c*t;k[7]=j*q+g*b+e*l+c*r;j=i[8];g=i[9];e=i[10];c=i[11];k[8]=j*v+g*h+e*o+c*z;k[9]=j*u+g*f+e*n+c*w;k[10]=j*s+g*d+e*m+c*t;k[11]=j*q+g*b+e*l+c*r;j=i[12];g=i[13];e=i[14];c=i[15];k[12]=j*v+g*h+e*o+c*z;k[13]=j*u+g*f+e*n+c*w;k[14]=j*s+g*d+e*m+c*t;k[15]=j*q+g*b+e*l+c*r;return k};PIXI.Point=function(b,c){this.x=b||0;this.y=c||0};PIXI.Point.prototype.clone=function(){return new PIXI.Point(this.x,this.y)};PIXI.Point.prototype.constructor=PIXI.Point;PIXI.Rectangle=function(c,e,d,b){this.x=c||0;this.y=e||0;this.width=d||0;this.height=b||0};PIXI.Rectangle.prototype.clone=function(){return new PIXI.Rectangle(this.x,this.y,this.width,this.height)};PIXI.Rectangle.prototype.contains=function(b,e){if(this.width<=0||this.height<=0){return false}var c=this.x;if(b>=c&&b<=c+this.width){var d=this.y;if(e>=d&&e<=d+this.height){return true}}return false};PIXI.Rectangle.prototype.constructor=PIXI.Rectangle;PIXI.DisplayObject=function(){this.last=this;this.first=this;this.position=new PIXI.Point();this.scale=new PIXI.Point(1,1);this.pivot=new PIXI.Point(0,0);this.rotation=0;this.alpha=1;this.visible=true;this.hitArea=null;this.buttonMode=false;this.renderable=false;this.parent=null;this.stage=null;this.worldAlpha=1;this._interactive=false;this.worldTransform=PIXI.mat3.create();this.localTransform=PIXI.mat3.create();this.color=[];this.dynamic=true;this._sr=0;this._cr=1};PIXI.DisplayObject.prototype.constructor=PIXI.DisplayObject;PIXI.DisplayObject.prototype.setInteractive=function(b){this.interactive=b};Object.defineProperty(PIXI.DisplayObject.prototype,"interactive",{get:function(){return this._interactive},set:function(b){this._interactive=b;if(this.stage){this.stage.dirty=true}}});Object.defineProperty(PIXI.DisplayObject.prototype,"mask",{get:function(){return this._mask},set:function(b){this._mask=b;if(b){this.addFilter(b)}else{this.removeFilter()}}});PIXI.DisplayObject.prototype.addFilter=function(j){if(this.filter){return}this.filter=true;var b=new PIXI.FilterBlock();var e=new PIXI.FilterBlock();b.mask=j;e.mask=j;b.first=b.last=this;e.first=e.last=this;b.open=true;var d=b;var f=b;var i;var h;h=this.first._iPrev;if(h){i=h._iNext;d._iPrev=h;h._iNext=d}else{i=this}if(i){i._iPrev=f;f._iNext=i}var d=e;var f=e;var i=null;var h=null;h=this.last;i=h._iNext;if(i){i._iPrev=f;f._iNext=i}d._iPrev=h;h._iNext=d;var c=this;var g=this.last;while(c){if(c.last==g){c.last=e}c=c.parent}this.first=b;if(this.__renderGroup){this.__renderGroup.addFilterBlocks(b,e)}j.renderable=false};PIXI.DisplayObject.prototype.removeFilter=function(){if(!this.filter){return}this.filter=false;var d=this.first;var g=d._iNext;var h=d._iPrev;if(g){g._iPrev=h}if(h){h._iNext=g}this.first=d._iNext;var e=this.last;var g=e._iNext;var h=e._iPrev;if(g){g._iPrev=h}h._iNext=g;var f=e._iPrev;var c=this;while(c.last==e){c.last=f;c=c.parent;if(!c){break}}var b=d.mask;b.renderable=true;if(this.__renderGroup){this.__renderGroup.removeFilterBlocks(d,e)}};PIXI.DisplayObject.prototype.updateTransform=function(){if(this.rotation!==this.rotationCache){this.rotationCache=this.rotation;this._sr=Math.sin(this.rotation);this._cr=Math.cos(this.rotation)}var r=this.localTransform;var f=this.parent.worldTransform;var b=this.worldTransform;r[0]=this._cr*this.scale.x;r[1]=-this._sr*this.scale.y;r[3]=this._sr*this.scale.x;r[4]=this._cr*this.scale.y;var n=this.pivot.x;var m=this.pivot.y;var i=r[0],h=r[1],g=this.position.x-r[0]*n-m*r[1],q=r[3],p=r[4],o=this.position.y-r[4]*m-n*r[3],l=f[0],k=f[1],j=f[2],e=f[3],d=f[4],c=f[5];r[2]=g;r[5]=o;b[0]=l*i+k*q;b[1]=l*h+k*p;b[2]=l*g+k*o+j;b[3]=e*i+d*q;b[4]=e*h+d*p;b[5]=e*g+d*o+c;this.worldAlpha=this.alpha*this.parent.worldAlpha;this.vcount=PIXI.visibleCount};PIXI.visibleCount=0;PIXI.DisplayObjectContainer=function(){PIXI.DisplayObject.call(this);this.children=[]};PIXI.DisplayObjectContainer.prototype=Object.create(PIXI.DisplayObject.prototype);PIXI.DisplayObjectContainer.prototype.constructor=PIXI.DisplayObjectContainer;PIXI.DisplayObjectContainer.prototype.addChild=function(i){if(i.parent!=undefined){i.parent.removeChild(i)}i.parent=this;this.children.push(i);if(this.stage){var f=i;do{if(f.interactive){this.stage.dirty=true}f.stage=this.stage;f=f._iNext}while(f)}var e=i.first;var d=i.last;var g;var h;if(this.filter){h=this.last._iPrev}else{h=this.last}g=h._iNext;var c=this;var b=h;while(c){if(c.last==b){c.last=i.last}c=c.parent}if(g){g._iPrev=d;d._iNext=g}e._iPrev=h;h._iNext=e;if(this.__renderGroup){if(i.__renderGroup){i.__renderGroup.removeDisplayObjectAndChildren(i)}this.__renderGroup.addDisplayObjectAndChildren(i)}};PIXI.DisplayObjectContainer.prototype.addChildAt=function(c,f){if(f>=0&&f<=this.children.length){if(c.parent!=undefined){c.parent.removeChild(c)}c.parent=this;if(this.stage){var e=c;do{if(e.interactive){this.stage.dirty=true}e.stage=this.stage;e=e._iNext}while(e)}var d=c.first;var g=c.last;var j;var i;if(f==this.children.length){i=this.last;var b=this;var h=this.last;while(b){if(b.last==h){b.last=c.last}b=b.parent}}else{if(f==0){i=this}else{i=this.children[f-1].last}}j=i._iNext;if(j){j._iPrev=g;g._iNext=j}d._iPrev=i;i._iNext=d;this.children.splice(f,0,c);if(this.__renderGroup){if(c.__renderGroup){c.__renderGroup.removeDisplayObjectAndChildren(c)}this.__renderGroup.addDisplayObjectAndChildren(c)}}else{throw new Error(c+" The index "+f+" supplied is out of bounds "+this.children.length)}};PIXI.DisplayObjectContainer.prototype.swapChildren=function(c,b){return};PIXI.DisplayObjectContainer.prototype.getChildAt=function(b){if(b>=0&&b1){h=1}var d=Math.sqrt(c.x*c.x+c.y*c.y);var f=this.texture.height/2;c.x/=d;c.y/=d;c.x*=f;c.y*=f;b[g]=m.x+c.x;b[g+1]=m.y+c.y;b[g+2]=m.x-c.x;b[g+3]=m.y-c.y;l=m}PIXI.DisplayObjectContainer.prototype.updateTransform.call(this)};PIXI.Rope.prototype.setTexture=function(b){this.texture=b;this.updateFrame=true};PIXI.TilingSprite=function(d,c,b){PIXI.DisplayObjectContainer.call(this);this.texture=d;this.width=c;this.height=b;this.tileScale=new PIXI.Point(1,1);this.tilePosition=new PIXI.Point(0,0);this.renderable=true;this.blendMode=PIXI.blendModes.NORMAL};PIXI.TilingSprite.prototype=Object.create(PIXI.DisplayObjectContainer.prototype);PIXI.TilingSprite.prototype.constructor=PIXI.TilingSprite;PIXI.TilingSprite.prototype.setTexture=function(b){this.texture=b;this.updateFrame=true};PIXI.TilingSprite.prototype.onTextureUpdate=function(b){this.updateFrame=true};PIXI.FilterBlock=function(b){this.graphics=b;this.visible=true;this.renderable=true};PIXI.MaskFilter=function(b){this.graphics};PIXI.Graphics=function(){PIXI.DisplayObjectContainer.call(this);this.renderable=true;this.fillAlpha=1;this.lineWidth=0;this.lineColor="black";this.graphicsData=[];this.currentPath={points:[]}};PIXI.Graphics.prototype=Object.create(PIXI.DisplayObjectContainer.prototype);PIXI.Graphics.prototype.constructor=PIXI.Graphics;PIXI.Graphics.prototype.lineStyle=function(b,c,d){if(this.currentPath.points.length==0){this.graphicsData.pop()}this.lineWidth=b||0;this.lineColor=c||0;this.lineAlpha=(d==undefined)?1:d;this.currentPath={lineWidth:this.lineWidth,lineColor:this.lineColor,lineAlpha:this.lineAlpha,fillColor:this.fillColor,fillAlpha:this.fillAlpha,fill:this.filling,points:[],type:PIXI.Graphics.POLY};this.graphicsData.push(this.currentPath)};PIXI.Graphics.prototype.moveTo=function(b,c){if(this.currentPath.points.length==0){this.graphicsData.pop()}this.currentPath=this.currentPath={lineWidth:this.lineWidth,lineColor:this.lineColor,lineAlpha:this.lineAlpha,fillColor:this.fillColor,fillAlpha:this.fillAlpha,fill:this.filling,points:[],type:PIXI.Graphics.POLY};this.currentPath.points.push(b,c);this.graphicsData.push(this.currentPath)};PIXI.Graphics.prototype.lineTo=function(b,c){this.currentPath.points.push(b,c);this.dirty=true};PIXI.Graphics.prototype.beginFill=function(b,c){this.filling=true;this.fillColor=b||0;this.fillAlpha=(c==undefined)?1:c};PIXI.Graphics.prototype.endFill=function(){this.filling=false;this.fillColor=null;this.fillAlpha=1};PIXI.Graphics.prototype.drawRect=function(c,e,d,b){if(this.currentPath.points.length==0){this.graphicsData.pop()}this.currentPath={lineWidth:this.lineWidth,lineColor:this.lineColor,lineAlpha:this.lineAlpha,fillColor:this.fillColor,fillAlpha:this.fillAlpha,fill:this.filling,points:[c,e,d,b],type:PIXI.Graphics.RECT};this.graphicsData.push(this.currentPath);this.dirty=true};PIXI.Graphics.prototype.drawCircle=function(c,d,b){if(this.currentPath.points.length==0){this.graphicsData.pop()}this.currentPath={lineWidth:this.lineWidth,lineColor:this.lineColor,lineAlpha:this.lineAlpha,fillColor:this.fillColor,fillAlpha:this.fillAlpha,fill:this.filling,points:[c,d,b,b],type:PIXI.Graphics.CIRC};this.graphicsData.push(this.currentPath);this.dirty=true};PIXI.Graphics.prototype.drawElipse=function(c,e,d,b){if(this.currentPath.points.length==0){this.graphicsData.pop()}this.currentPath={lineWidth:this.lineWidth,lineColor:this.lineColor,lineAlpha:this.lineAlpha,fillColor:this.fillColor,fillAlpha:this.fillAlpha,fill:this.filling,points:[c,e,d,b],type:PIXI.Graphics.ELIP};this.graphicsData.push(this.currentPath);this.dirty=true};PIXI.Graphics.prototype.clear=function(){this.lineWidth=0;this.filling=false;this.dirty=true;this.clearDirty=true;this.graphicsData=[]};PIXI.Graphics.POLY=0;PIXI.Graphics.RECT=1;PIXI.Graphics.CIRC=2;PIXI.Graphics.ELIP=3;PIXI.CanvasGraphics=function(){};PIXI.CanvasGraphics.renderGraphics=function(u,c){var p=u.worldAlpha;for(var s=0;s1){t=1;console.log("Pixi.js warning: masks in canvas can only mask using the first path in the graphics object")}for(var s=0;s<1;s++){var A=v.graphicsData[s];var r=A.points;if(A.type==PIXI.Graphics.POLY){c.beginPath();c.moveTo(r[0],r[1]);for(var q=1;q0){PIXI.Texture.frameUpdates=[]}};PIXI.CanvasRenderer.prototype.resize=function(c,b){this.width=c;this.height=b;this.view.width=c;this.view.height=b};PIXI.CanvasRenderer.prototype.renderDisplayObject=function(h){var e;var f=this.context;f.globalCompositeOperation="source-over";var d=h.last._iNext;h=h.first;do{e=h.worldTransform;if(!h.visible){h=h.last._iNext;continue}if(!h.renderable){h=h._iNext;continue}if(h instanceof PIXI.Sprite){var g=h.texture.frame;if(g){f.globalAlpha=h.worldAlpha;f.setTransform(e[0],e[3],e[1],e[4],e[2],e[5]);f.drawImage(h.texture.baseTexture.source,g.x,g.y,g.width,g.height,(h.anchor.x)*-g.width,(h.anchor.y)*-g.height,g.width,g.height)}}else{if(h instanceof PIXI.Strip){f.setTransform(e[0],e[3],e[1],e[4],e[2],e[5]);this.renderStrip(h)}else{if(h instanceof PIXI.TilingSprite){f.setTransform(e[0],e[3],e[1],e[4],e[2],e[5]);this.renderTilingSprite(h)}else{if(h instanceof PIXI.CustomRenderable){h.renderCanvas(this)}else{if(h instanceof PIXI.Graphics){f.setTransform(e[0],e[3],e[1],e[4],e[2],e[5]);PIXI.CanvasGraphics.renderGraphics(h,f)}else{if(h instanceof PIXI.FilterBlock){if(h.open){f.save();var c=h.mask.alpha;var b=h.mask.worldTransform;f.setTransform(b[0],b[3],b[1],b[4],b[2],b[5]);h.mask.worldAlpha=0.5;f.worldAlpha=0;PIXI.CanvasGraphics.renderGraphicsMask(h.mask,f);f.clip();h.mask.worldAlpha=c}else{f.restore()}}}}}}}h=h._iNext}while(h!=d)};PIXI.CanvasRenderer.prototype.renderStripFlat=function(d){var e=this.context;var f=d.verticies;var j=d.uvs;var g=f.length/2;this.count++;e.beginPath();for(var k=1;k3){PIXI.WebGLGraphics.buildPoly(d,b._webGL)}}if(d.lineWidth>0){PIXI.WebGLGraphics.buildLine(d,b._webGL)}}else{if(d.type==PIXI.Graphics.RECT){PIXI.WebGLGraphics.buildRectangle(d,b._webGL)}else{if(d.type==PIXI.Graphics.CIRC||d.type==PIXI.Graphics.ELIP){PIXI.WebGLGraphics.buildCircle(d,b._webGL)}}}}b._webGL.lastIndex=b.graphicsData.length;var e=PIXI.gl;b._webGL.glPoints=new Float32Array(b._webGL.points);e.bindBuffer(e.ARRAY_BUFFER,b._webGL.buffer);e.bufferData(e.ARRAY_BUFFER,b._webGL.glPoints,e.STATIC_DRAW);b._webGL.glIndicies=new Uint16Array(b._webGL.indices);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,b._webGL.indexBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,b._webGL.glIndicies,e.STATIC_DRAW)};PIXI.WebGLGraphics.buildRectangle=function(s,i){var f=s.points;var n=f[0];var m=f[1];var d=f[2];var q=f[3];if(s.fill){var h=HEXtoRGB(s.fillColor);var e=s.fillAlpha;var c=h[0]*e;var j=h[1]*e;var l=h[2]*e;var o=i.points;var p=i.indices;var k=o.length/6;o.push(n,m);o.push(c,j,l,e);o.push(n+d,m);o.push(c,j,l,e);o.push(n,m+q);o.push(c,j,l,e);o.push(n+d,m+q);o.push(c,j,l,e);p.push(k,k,k+1,k+2,k+3,k+3)}if(s.lineWidth){s.points=[n,m,n+d,m,n+d,m+q,n,m+q,n,m];PIXI.WebGLGraphics.buildLine(s,i)}};PIXI.WebGLGraphics.buildCircle=function(k,w){var f=k.points;var j=f[0];var h=f[1];var o=f[2];var n=f[3];var l=40;var t=(Math.PI*2)/l;if(k.fill){var p=HEXtoRGB(k.fillColor);var d=k.fillAlpha;var m=p[0]*d;var s=p[1]*d;var u=p[2]*d;var v=w.points;var e=w.indices;var c=v.length/6;e.push(c);for(var q=0;q140*140){h=L-z;f=K-w;m=Math.sqrt(h*h+f*f);h/=m;f/=m;h*=c;f*=c;S.push(B-h,A-f);S.push(M,T,W,Q);S.push(B+h,A+f);S.push(M,T,W,Q);S.push(B-h,A-f);S.push(M,T,W,Q);q++}else{S.push(px,py);S.push(M,T,W,Q);S.push(B-(px-B),A-(py-A));S.push(M,T,W,Q)}}J=H[(u-2)*2];I=H[(u-2)*2+1];B=H[(u-1)*2];A=H[(u-1)*2+1];L=-(I-A);K=J-B;m=Math.sqrt(L*L+K*K);L/=m;K/=m;L*=c;K*=c;S.push(B-L,A-K);S.push(M,T,W,Q);S.push(B+L,A+K);S.push(M,T,W,Q);l.push(U);for(var R=0;R>16&255)/255,(b>>8&255)/255,(b&255)/255]}PIXI._defaultFrame=new PIXI.Rectangle(0,0,1,1);PIXI.gl;PIXI.WebGLRenderer=function(g,b,d,j,c){this.transparent=!!j;this.width=g||800;this.height=b||600;this.view=d||document.createElement("canvas");this.view.width=this.width;this.view.height=this.height;var f=this;this.view.addEventListener("webglcontextlost",function(e){f.handleContextLost(e)},false);this.view.addEventListener("webglcontextrestored",function(e){f.handleContextRestored(e)},false);this.batchs=[];try{PIXI.gl=this.gl=this.view.getContext("experimental-webgl",{alpha:this.transparent,antialias:!!c,premultipliedAlpha:false,stencil:true})}catch(h){throw new Error(" This browser does not support webGL. Try using the canvas renderer"+this)}PIXI.initPrimitiveShader();PIXI.initDefaultShader();PIXI.initDefaultStripShader();PIXI.activateDefaultShader();var i=this.gl;PIXI.WebGLRenderer.gl=i;this.batch=new PIXI.WebGLBatch(i);i.disable(i.DEPTH_TEST);i.disable(i.CULL_FACE);i.enable(i.BLEND);i.colorMask(true,true,true,this.transparent);PIXI.projection=new PIXI.Point(400,300);this.resize(this.width,this.height);this.contextLost=false;this.stageRenderGroup=new PIXI.WebGLRenderGroup(this.gl)};PIXI.WebGLRenderer.prototype.constructor=PIXI.WebGLRenderer;PIXI.WebGLRenderer.getBatch=function(){if(PIXI._batchs.length==0){return new PIXI.WebGLBatch(PIXI.WebGLRenderer.gl)}else{return PIXI._batchs.pop()}};PIXI.WebGLRenderer.returnBatch=function(b){b.clean();PIXI._batchs.push(b)};PIXI.WebGLRenderer.prototype.render=function(b){if(this.contextLost){return}if(this.__stage!==b){this.__stage=b;this.stageRenderGroup.setRenderable(b)}PIXI.WebGLRenderer.updateTextures();PIXI.visibleCount++;b.updateTransform();var d=this.gl;d.colorMask(true,true,true,this.transparent);d.viewport(0,0,this.width,this.height);d.bindFramebuffer(d.FRAMEBUFFER,null);d.clearColor(b.backgroundColorSplit[0],b.backgroundColorSplit[1],b.backgroundColorSplit[2],!this.transparent);d.clear(d.COLOR_BUFFER_BIT);this.stageRenderGroup.backgroundColor=b.backgroundColorSplit;this.stageRenderGroup.render(PIXI.projection);if(b.interactive){if(!b._interactiveEventsAdded){b._interactiveEventsAdded=true;b.interactionManager.setTarget(this)}}if(PIXI.Texture.frameUpdates.length>0){for(var c=0;c0){n=n.children[n.children.length-1];if(n.renderable){b=n}}if(b instanceof PIXI.Sprite){c=b.batch;var l=c.head;if(l==b){h=0}else{h=1;while(l.__next!=b){h++;l=l.__next}}}else{c=b}if(m==c){if(m instanceof PIXI.WebGLBatch){m.render(p,h+1)}else{this.renderSpecial(m,j)}return}d=this.batchs.indexOf(m);q=this.batchs.indexOf(c);if(m instanceof PIXI.WebGLBatch){m.render(p)}else{this.renderSpecial(m,j)}for(var e=d+1;e=2?parseInt(b[b.length-2],10):PIXI.BitmapText.fonts[this.fontName].size;this.dirty=true};PIXI.BitmapText.prototype.updateText=function(){var h=PIXI.BitmapText.fonts[this.fontName];var m=new PIXI.Point();var j=null;var l=[];var q=0;var e=[];var p=0;var f=this.fontSize/h.size;for(var g=0;g0){this.removeChild(this.getChildAt(0))}this.updateText();this.dirty=false}PIXI.DisplayObjectContainer.prototype.updateTransform.call(this)};PIXI.BitmapText.fonts={};PIXI.Text=function(c,b){this.canvas=document.createElement("canvas");this.context=this.canvas.getContext("2d");PIXI.Sprite.call(this,PIXI.Texture.fromCanvas(this.canvas));this.setText(c);this.setStyle(b);this.updateText();this.dirty=false};PIXI.Text.prototype=Object.create(PIXI.Sprite.prototype);PIXI.Text.prototype.constructor=PIXI.Text;PIXI.Text.prototype.setStyle=function(b){b=b||{};b.font=b.font||"bold 20pt Arial";b.fill=b.fill||"black";b.align=b.align||"left";b.stroke=b.stroke||"black";b.strokeThickness=b.strokeThickness||0;b.wordWrap=b.wordWrap||false;b.wordWrapWidth=b.wordWrapWidth||100;this.style=b;this.dirty=true};PIXI.Sprite.prototype.setText=function(b){this.text=b.toString()||" ";this.dirty=true};PIXI.Text.prototype.updateText=function(){this.context.font=this.style.font;var g=this.text;if(this.style.wordWrap){g=this.wordWrap(this.text)}var f=g.split(/(?:\r\n|\r|\n)/);var d=[];var c=0;for(var h=0;hj){return k}else{return arguments.callee(i,l,k,h,j)}}else{return arguments.callee(i,l,m,k,j)}};var f=function(h,j,i){if(h.measureText(j).width<=i||j.length<1){return j}var k=e(h,j,0,j.length,i);return j.substring(0,k)+"\n"+arguments.callee(h,j.substring(k),i)};var b="";var c=g.split("\n");for(var d=0;dthis.baseTexture.width||b.y+b.height>this.baseTexture.height){throw new Error("Texture Error: frame does not fit inside the base Texture dimensions "+this)}this.updateFrame=true;PIXI.Texture.frameUpdates.push(this)};PIXI.Texture.fromImage=function(c,b){var d=PIXI.TextureCache[c];if(!d){d=new PIXI.Texture(PIXI.BaseTexture.fromImage(c,b));PIXI.TextureCache[c]=d}return d};PIXI.Texture.fromFrame=function(c){var b=PIXI.TextureCache[c];if(!b){throw new Error("The frameId '"+c+"' does not exist in the texture cache "+this)}return b};PIXI.Texture.fromCanvas=function(b){var c=new PIXI.BaseTexture(b);return new PIXI.Texture(c)};PIXI.Texture.addTextureToCache=function(b,c){PIXI.TextureCache[c]=b};PIXI.Texture.removeTextureFromCache=function(c){var b=PIXI.TextureCache[c];PIXI.TextureCache[c]=null;return b};PIXI.Texture.frameUpdates=[];PIXI.RenderTexture=function(c,b){PIXI.EventTarget.call(this);this.width=c||100;this.height=b||100;this.indetityMatrix=PIXI.mat3.create();this.frame=new PIXI.Rectangle(0,0,this.width,this.height);if(PIXI.gl){this.initWebGL()}else{this.initCanvas()}};PIXI.RenderTexture.prototype=Object.create(PIXI.Texture.prototype);PIXI.RenderTexture.prototype.constructor=PIXI.RenderTexture;PIXI.RenderTexture.prototype.initWebGL=function(){var b=PIXI.gl;this.glFramebuffer=b.createFramebuffer();b.bindFramebuffer(b.FRAMEBUFFER,this.glFramebuffer);this.glFramebuffer.width=this.width;this.glFramebuffer.height=this.height;this.baseTexture=new PIXI.BaseTexture();this.baseTexture.width=this.width;this.baseTexture.height=this.height;this.baseTexture._glTexture=b.createTexture();b.bindTexture(b.TEXTURE_2D,this.baseTexture._glTexture);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,this.width,this.height,0,b.RGBA,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.LINEAR);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.LINEAR);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);this.baseTexture.isRender=true;b.bindFramebuffer(b.FRAMEBUFFER,this.glFramebuffer);b.framebufferTexture2D(b.FRAMEBUFFER,b.COLOR_ATTACHMENT0,b.TEXTURE_2D,this.baseTexture._glTexture,0);this.projection=new PIXI.Point(this.width/2,this.height/2);this.render=this.renderWebGL};PIXI.RenderTexture.prototype.resize=function(c,b){this.width=c;this.height=b;if(PIXI.gl){this.projection.x=this.width/2;this.projection.y=this.height/2;var d=PIXI.gl;d.bindTexture(d.TEXTURE_2D,this.baseTexture._glTexture);d.texImage2D(d.TEXTURE_2D,0,d.RGBA,this.width,this.height,0,d.RGBA,d.UNSIGNED_BYTE,null)}else{this.frame.width=this.width;this.frame.height=this.height;this.renderer.resize(this.width,this.height)}};PIXI.RenderTexture.prototype.initCanvas=function(){this.renderer=new PIXI.CanvasRenderer(this.width,this.height,null,0);this.baseTexture=new PIXI.BaseTexture(this.renderer.view);this.frame=new PIXI.Rectangle(0,0,this.width,this.height);this.render=this.renderCanvas};PIXI.RenderTexture.prototype.renderWebGL=function(k,g,h){var f=PIXI.gl;f.colorMask(true,true,true,true);f.viewport(0,0,this.width,this.height);f.bindFramebuffer(f.FRAMEBUFFER,this.glFramebuffer);if(h){f.clearColor(0,0,0,0);f.clear(f.COLOR_BUFFER_BIT)}var c=k.children;var b=k.worldTransform;k.worldTransform=PIXI.mat3.create();k.worldTransform[4]=-1;k.worldTransform[5]=this.projection.y*2;if(g){k.worldTransform[2]=g.x;k.worldTransform[5]-=g.y}PIXI.visibleCount++;k.vcount=PIXI.visibleCount;for(var e=0,d=c.length;e>1;if(k<3){return[]}var u=[];var g=[];for(var s=0;s3){var q=g[(s+0)%o];var m=g[(s+1)%o];var l=g[(s+2)%o];var f=h[2*q],d=h[2*q+1];var v=h[2*m],t=h[2*m+1];var c=h[2*l],b=h[2*l+1];var e=false;if(PIXI.PolyK._convex(f,d,v,t,c,b,z)){e=true;for(var r=0;r3*o){if(z){var u=[];g=[];for(var s=0;s=0)&&(m>=0)&&(n+m<1)};PIXI.PolyK._convex=function(e,d,g,f,b,h,c){return((d-f)*(b-g)+(g-e)*(h-f)>=0)==c};Phaser.Camera=function(d,g,c,f,e,b){this.game=d;this.world=d.world;this.id=0;this.view=new Phaser.Rectangle(c,f,e,b);this.screenView=new Phaser.Rectangle(c,f,e,b);this.deadzone=null;this.visible=true;this.atLimit={x:false,y:false};this.target=null;this._edge=0};Phaser.Camera.FOLLOW_LOCKON=0;Phaser.Camera.FOLLOW_PLATFORMER=1;Phaser.Camera.FOLLOW_TOPDOWN=2;Phaser.Camera.FOLLOW_TOPDOWN_TIGHT=3;Phaser.Camera.prototype={follow:function(f,d){if(typeof d==="undefined"){d=Phaser.Camera.FOLLOW_LOCKON}this.target=f;var e;switch(d){case Phaser.Camera.FOLLOW_PLATFORMER:var b=this.width/8;var c=this.height/3;this.deadzone=new Phaser.Rectangle((this.width-b)/2,(this.height-c)/2-c*0.25,b,c);break;case Phaser.Camera.FOLLOW_TOPDOWN:e=Math.max(this.width,this.height)/4;this.deadzone=new Phaser.Rectangle((this.width-e)/2,(this.height-e)/2,e,e);break;case Phaser.Camera.FOLLOW_TOPDOWN_TIGHT:e=Math.max(this.width,this.height)/8;this.deadzone=new Phaser.Rectangle((this.width-e)/2,(this.height-e)/2,e,e);break;case Phaser.Camera.FOLLOW_LOCKON:default:this.deadzone=null;break}},focusOnXY:function(b,c){this.view.x=Math.round(b-this.view.halfWidth);this.view.y=Math.round(c-this.view.halfHeight)},update:function(){if(this.target!==null){if(this.deadzone){this._edge=this.target.x-this.deadzone.x;if(this.view.x>this._edge){this.view.x=this._edge}this._edge=this.target.x+this.target.width-this.deadzone.x-this.deadzone.width;if(this.view.xthis._edge){this.view.y=this._edge}this._edge=this.target.y+this.target.height-this.deadzone.y-this.deadzone.height;if(this.view.ythis.world.bounds.right-this.width){this.atLimit.x=true;this.view.x=(this.world.bounds.right-this.width)+1}if(this.view.ythis.world.bounds.bottom-this.height){this.atLimit.y=true;this.view.y=(this.world.bounds.bottom-this.height)+1}this.view.floor()},setPosition:function(b,c){this.view.x=b;this.view.y=c;this.checkWorldBounds()},setSize:function(c,b){this.view.width=c;this.view.height=b}};Object.defineProperty(Phaser.Camera.prototype,"x",{get:function(){return this.view.x},set:function(b){this.view.x=b;this.checkWorldBounds()}});Object.defineProperty(Phaser.Camera.prototype,"y",{get:function(){return this.view.y},set:function(b){this.view.y=b;this.checkWorldBounds()}});Object.defineProperty(Phaser.Camera.prototype,"width",{get:function(){return this.view.width},set:function(b){this.view.width=b}});Object.defineProperty(Phaser.Camera.prototype,"height",{get:function(){return this.view.height},set:function(b){this.view.height=b}});Phaser.State=function(){this.game=null;this.add=null;this.camera=null;this.cache=null;this.input=null;this.load=null;this.sound=null;this.stage=null;this.time=null;this.tweens=null;this.world=null;this.particles=null;this.physics=null};Phaser.State.prototype={link:function(b){this.game=b;this.add=b.add;this.camera=b.camera;this.cache=b.cache;this.input=b.input;this.load=b.load;this.sound=b.sound;this.stage=b.stage;this.time=b.time;this.tweens=b.tweens;this.world=b.world;this.particles=b.particles;this.physics=b.physics},preload:function(){},create:function(){},update:function(){},render:function(){},paused:function(){},destroy:function(){}};Phaser.StateManager=function(c,b){this.game=c;this.states={};if(b!==null){this._pendingState=b}};Phaser.StateManager.prototype={game:null,_pendingState:null,_created:false,states:{},current:"",onInitCallback:null,onPreloadCallback:null,onCreateCallback:null,onUpdateCallback:null,onRenderCallback:null,onPreRenderCallback:null,onLoadUpdateCallback:null,onLoadRenderCallback:null,onPausedCallback:null,onShutDownCallback:null,boot:function(){if(this._pendingState!==null){if(typeof this._pendingState==="string"){this.start(this._pendingState,false,false)}else{this.add("default",this._pendingState,true)}}},add:function(c,d,b){if(typeof b==="undefined"){b=false}var e;if(d instanceof Phaser.State){e=d;e.link(this.game)}else{if(typeof d==="object"){e=d}else{if(typeof d==="function"){e=new d(this.game)}}}this.states[c]=e;if(b){if(this.game.isBooted){this.start(c)}else{this._pendingState=c}}return e},remove:function(b){if(this.current==b){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.onRenderCallback=null;this.onPausedCallback=null;this.onDestroyCallback=null}delete this.states[b]},start:function(c,b,d){if(typeof b==="undefined"){b=true}if(typeof d==="undefined"){d=false}if(this.game.isBooted==false){this._pendingState=c;return}if(this.checkState(c)==false){return}else{if(this.current){this.onShutDownCallback.call(this.callbackContext)}if(b){if(d==true){this.game.cache.destroy()}}this.setCurrentState(c)}if(this.onPreloadCallback){this.game.load.reset();this.onPreloadCallback.call(this.callbackContext);if(this.game.load.queueSize==0){this.game.loadComplete();if(this.onCreateCallback){this.onCreateCallback.call(this.callbackContext)}this._created=true}else{this.game.load.start()}}else{if(this.onCreateCallback){this.onCreateCallback.call(this.callbackContext)}this._created=true;this.game.loadComplete()}},dummy:function(){},checkState:function(b){if(this.states[b]){var c=false;if(this.states[b]["preload"]){c=true}if(c==false&&this.states[b]["loadRender"]){c=true}if(c==false&&this.states[b]["loadUpdate"]){c=true}if(c==false&&this.states[b]["create"]){c=true}if(c==false&&this.states[b]["update"]){c=true}if(c==false&&this.states[b]["preRender"]){c=true}if(c==false&&this.states[b]["render"]){c=true}if(c==false&&this.states[b]["paused"]){c=true}if(c==false){console.warn("Invalid Phaser State object given. Must contain at least a one of the required functions.");return false}return true}else{console.warn("Phaser.StateManager - No state found with the key: "+b);return false}},setCurrentState:function(b){this.callbackContext=this.states[b];this.onInitCallback=this.states[b]["init"]||this.dummy;this.onPreloadCallback=this.states[b]["preload"]||null;this.onLoadRenderCallback=this.states[b]["loadRender"]||null;this.onLoadUpdateCallback=this.states[b]["loadUpdate"]||null;this.onCreateCallback=this.states[b]["create"]||null;this.onUpdateCallback=this.states[b]["update"]||null;this.onPreRenderCallback=this.states[b]["preRender"]||null;this.onRenderCallback=this.states[b]["render"]||null;this.onPausedCallback=this.states[b]["paused"]||null;this.onShutDownCallback=this.states[b]["shutdown"]||this.dummy;this.current=b;this._created=false;this.onInitCallback.call(this.callbackContext)},loadComplete:function(){if(this._created==false&&this.onCreateCallback){this.onCreateCallback.call(this.callbackContext);this._created=true}},update:function(){if(this._created&&this.onUpdateCallback){this.onUpdateCallback.call(this.callbackContext)}else{if(this.onLoadUpdateCallback){this.onLoadUpdateCallback.call(this.callbackContext)}}},preRender:function(){if(this.onPreRenderCallback){this.onPreRenderCallback.call(this.callbackContext)}},render:function(){if(this._created&&this.onRenderCallback){this.onRenderCallback.call(this.callbackContext)}else{if(this.onLoadRenderCallback){this.onLoadRenderCallback.call(this.callbackContext)}}},destroy:function(){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.onRenderCallback=null;this.onPausedCallback=null;this.onDestroyCallback=null;this.game=null;this.states={};this._pendingState=null}};Phaser.LinkedList=function(){this.next=null;this.prev=null;this.first=null;this.last=null;this.total=0};Phaser.LinkedList.prototype={add:function(b){if(this.total==0&&this.first==null&&this.last==null){this.first=b;this.last=b;this.next=b;b.prev=this;this.total++;return}this.last.next=b;b.prev=this.last;this.last=b;this.total++;return b},remove:function(c){if(this.first==null&&this.last==null){return}this.total--;if(this.first==c&&this.last==c){this.first=null;this.last=null;this.next=null;c.next=null;c.prev=null;return}var b=c.prev;if(c.next){c.next.prev=c.prev}b.next=c.next},callAll:function(c){var b=this.first;do{if(b[c]){b[c].call(b)}b=b.next}while(b!=this.last.next)},dump:function(){var j=20;var e="\n"+Phaser.Utils.pad("Node",j)+"|"+Phaser.Utils.pad("Next",j)+"|"+Phaser.Utils.pad("Previous",j)+"|"+Phaser.Utils.pad("First",j)+"|"+Phaser.Utils.pad("Last",j);console.log(e);var e=Phaser.Utils.pad("----------",j)+"|"+Phaser.Utils.pad("----------",j)+"|"+Phaser.Utils.pad("----------",j)+"|"+Phaser.Utils.pad("----------",j)+"|"+Phaser.Utils.pad("----------",j);console.log(e);var g=this;var c=g.last.next;g=g.first;do{var d=g.sprite.name||"*";var f="-";var b="-";var h="-";var i="-";if(g.next){f=g.next.sprite.name}if(g.prev){b=g.prev.sprite.name}if(g.first){h=g.first.sprite.name}if(g.last){i=g.last.sprite.name}if(typeof f==="undefined"){f="-"}if(typeof b==="undefined"){b="-"}if(typeof h==="undefined"){h="-"}if(typeof i==="undefined"){i="-"}var e=Phaser.Utils.pad(d,j)+"|"+Phaser.Utils.pad(f,j)+"|"+Phaser.Utils.pad(b,j)+"|"+Phaser.Utils.pad(h,j)+"|"+Phaser.Utils.pad(i,j);console.log(e);g=g.next}while(g!=c)}};Phaser.Signal=function(){this._bindings=[];this._prevParams=null;var b=this;this.dispatch=function(){Phaser.Signal.prototype.dispatch.apply(b,arguments)}};Phaser.Signal.prototype={memorize:false,_shouldPropagate:true,active:true,validateListener:function(b,c){if(typeof b!=="function"){throw new Error("listener is a required param of {fn}() and should be a Function.".replace("{fn}",c))}},_registerListener:function(f,d,e,c){var b=this._indexOfListener(f,e),g;if(b!==-1){g=this._bindings[b];if(g.isOnce()!==d){throw new Error("You cannot add"+(d?"":"Once")+"() then add"+(!d?"":"Once")+"() the same listener without removing the relationship first.")}}else{g=new Phaser.SignalBinding(this,f,d,e,c);this._addBinding(g)}if(this.memorize&&this._prevParams){g.execute(this._prevParams)}return g},_addBinding:function(b){var c=this._bindings.length;do{--c}while(this._bindings[c]&&b._priority<=this._bindings[c]._priority);this._bindings.splice(c+1,0,b)},_indexOfListener:function(c,b){var e=this._bindings.length,d;while(e--){d=this._bindings[e];if(d._listener===c&&d.context===b){return e}}return -1},has:function(c,b){return this._indexOfListener(c,b)!==-1},add:function(d,c,b){this.validateListener(d,"add");return this._registerListener(d,false,c,b)},addOnce:function(d,c,b){this.validateListener(d,"addOnce");return this._registerListener(d,true,c,b)},remove:function(d,c){this.validateListener(d,"remove");var b=this._indexOfListener(d,c);if(b!==-1){this._bindings[b]._destroy();this._bindings.splice(b,1)}return d},removeAll:function(){var b=this._bindings.length;while(b--){this._bindings[b]._destroy()}this._bindings.length=0},getNumListeners:function(){return this._bindings.length},halt:function(){this._shouldPropagate=false},dispatch:function(c){if(!this.active){return}var b=Array.prototype.slice.call(arguments),e=this._bindings.length,d;if(this.memorize){this._prevParams=b}if(!e){return}d=this._bindings.slice();this._shouldPropagate=true;do{e--}while(d[e]&&this._shouldPropagate&&d[e].execute(b)!==false)},forget:function(){this._prevParams=null},dispose:function(){this.removeAll();delete this._bindings;delete this._prevParams},toString:function(){return"[Phaser.Signal active:"+this.active+" numListeners:"+this.getNumListeners()+"]"}};Phaser.SignalBinding=function(f,e,c,d,b){this._listener=e;this._isOnce=c;this.context=d;this._signal=f;this._priority=b||0};Phaser.SignalBinding.prototype={active:true,params:null,execute:function(b){var d,c;if(this.active&&!!this._listener){c=this.params?this.params.concat(b):b;d=this._listener.apply(this.context,c);if(this._isOnce){this.detach()}}return d},detach:function(){return this.isBound()?this._signal.remove(this._listener,this.context):null},isBound:function(){return(!!this._signal&&!!this._listener)},isOnce:function(){return this._isOnce},getListener:function(){return this._listener},getSignal:function(){return this._signal},_destroy:function(){delete this._signal;delete this._listener;delete this.context},toString:function(){return"[Phaser.SignalBinding isOnce:"+this._isOnce+", isBound:"+this.isBound()+", active:"+this.active+"]"}};Phaser.Plugin=function(b,c){this.game=b;this.parent=c;this.active=false;this.visible=false;this.hasPreUpdate=false;this.hasUpdate=false;this.hasRender=false;this.hasPostRender=false};Phaser.Plugin.prototype={preUpdate:function(){},update:function(){},render:function(){},postRender:function(){},destroy:function(){this.game=null;this.parent=null;this.active=false;this.visible=false}};Phaser.PluginManager=function(b,c){this.game=b;this._parent=c;this.plugins=[];this._pluginsLength=0};Phaser.PluginManager.prototype={add:function(c){var b=false;if(typeof c==="function"){c=new c(this.game,this._parent)}else{c.game=this.game;c.parent=this._parent}if(typeof c.preUpdate==="function"){c.hasPreUpdate=true;b=true}if(typeof c.update==="function"){c.hasUpdate=true;b=true}if(typeof c.render==="function"){c.hasRender=true;b=true}if(typeof c.postRender==="function"){c.hasPostRender=true;b=true}if(b){if(c.hasPreUpdate||c.hasUpdate){c.active=true}if(c.hasRender||c.hasPostRender){c.visible=true}this._pluginsLength=this.plugins.push(c);return c}else{return null}},remove:function(b){this._pluginsLength--},preUpdate:function(){if(this._pluginsLength==0){return}for(this._p=0;this._p0)},removeBetween:function(d,c){if(d>c||d<0||c>this._container.children.length){return false}for(var b=d;b=this.game.width){this.bounds.width=c}if(b>=this.game.height){this.bounds.height=b}}};Object.defineProperty(Phaser.World.prototype,"width",{get:function(){return this.bounds.width},set:function(b){this.bounds.width=b}});Object.defineProperty(Phaser.World.prototype,"height",{get:function(){return this.bounds.height},set:function(b){this.bounds.height=b}});Object.defineProperty(Phaser.World.prototype,"centerX",{get:function(){return this.bounds.halfWidth}});Object.defineProperty(Phaser.World.prototype,"centerY",{get:function(){return this.bounds.halfHeight}});Object.defineProperty(Phaser.World.prototype,"randomX",{get:function(){return Math.round(Math.random()*this.bounds.width)}});Object.defineProperty(Phaser.World.prototype,"randomY",{get:function(){return Math.round(Math.random()*this.bounds.height)}});Phaser.Game=function(e,b,g,d,f,h,c){e=e||800;b=b||600;g=g||Phaser.AUTO;d=d||"";f=f||null;h=h||false;c=c||true;this.id=Phaser.GAMES.push(this)-1;this.parent=d;this.width=e;this.height=b;this.transparent=h;this.antialias=c;this.renderer=null;this.state=new Phaser.StateManager(this,f);this._paused=false;this.renderType=g;this._loadComplete=false;this.isBooted=false;this.isRunning=false;this.raf=null;this.add=null;this.cache=null;this.input=null;this.load=null;this.math=null;this.net=null;this.sound=null;this.stage=null;this.time=null;this.tweens=null;this.world=null;this.physics=null;this.rnd=null;this.device=null;this.camera=null;this.canvas=null;this.context=null;this.debug=null;this.particles=null;var i=this;this._onBoot=function(){return i.boot()};if(document.readyState==="complete"||document.readyState==="interactive"){window.setTimeout(this._onBoot,0)}else{document.addEventListener("DOMContentLoaded",this._onBoot,false);window.addEventListener("load",this._onBoot,false)}return this};Phaser.Game.prototype={boot:function(){if(this.isBooted){return}if(!document.body){window.setTimeout(this._onBoot,20)}else{document.removeEventListener("DOMContentLoaded",this._onBoot);window.removeEventListener("load",this._onBoot);this.onPause=new Phaser.Signal;this.onResume=new Phaser.Signal;this.isBooted=true;this.device=new Phaser.Device();this.math=Phaser.Math;this.rnd=new Phaser.RandomDataGenerator([(Date.now()*Math.random()).toString()]);this.stage=new Phaser.Stage(this,this.width,this.height);this.setUpRenderer();this.world=new Phaser.World(this);this.add=new Phaser.GameObjectFactory(this);this.cache=new Phaser.Cache(this);this.load=new Phaser.Loader(this);this.time=new Phaser.Time(this);this.tweens=new Phaser.TweenManager(this);this.input=new Phaser.Input(this);this.sound=new Phaser.SoundManager(this);this.physics=new Phaser.Physics.Arcade(this);this.particles=new Phaser.Particles(this);this.plugins=new Phaser.PluginManager(this,this);this.net=new Phaser.Net(this);this.debug=new Phaser.Utils.Debug(this);this.load.onLoadComplete.add(this.loadComplete,this);this.stage.boot();this.world.boot();this.state.boot();this.input.boot();this.sound.boot();if(this.renderType==Phaser.CANVAS){console.log("%cPhaser "+Phaser.VERSION+" initialized. Rendering to Canvas","color: #ffff33; background: #000000")}else{console.log("%cPhaser "+Phaser.VERSION+" initialized. Rendering to WebGL","color: #ffff33; background: #000000")}this.isRunning=true;this._loadComplete=false;this.raf=new Phaser.RequestAnimationFrame(this);this.raf.start()}},setUpRenderer:function(){if(this.renderType===Phaser.CANVAS||(this.renderType===Phaser.AUTO&&this.device.webGL==false)){if(this.device.canvas){this.renderType=Phaser.CANVAS;this.renderer=new PIXI.CanvasRenderer(this.width,this.height,this.stage.canvas,this.transparent);Phaser.Canvas.setSmoothingEnabled(this.renderer.context,this.antialias);this.canvas=this.renderer.view;this.context=this.renderer.context}else{throw new Error("Phaser.Game - cannot create Canvas or WebGL context, aborting.")}}else{this.renderType=Phaser.WEBGL;this.renderer=new PIXI.WebGLRenderer(this.width,this.height,this.stage.canvas,this.transparent,this.antialias);this.canvas=this.renderer.view;this.context=null}Phaser.Canvas.addToDOM(this.renderer.view,this.parent,true);Phaser.Canvas.setTouchAction(this.renderer.view)},loadComplete:function(){this._loadComplete=true;this.state.loadComplete()},update:function(b){this.time.update(b);if(!this._paused){this.plugins.preUpdate();this.physics.preUpdate();this.input.update();this.tweens.update();this.sound.update();this.world.update();this.particles.update();this.state.update();this.plugins.update();this.renderer.render(this.stage._stage);this.plugins.render();this.state.render();this.plugins.postRender()}},destroy:function(){this.state.destroy();this.state=null;this.cache=null;this.input=null;this.load=null;this.sound=null;this.stage=null;this.time=null;this.world=null;this.isBooted=false}};Object.defineProperty(Phaser.Game.prototype,"paused",{get:function(){return this._paused},set:function(b){if(b===true){if(this._paused==false){this._paused=true;this.onPause.dispatch(this)}}else{if(this._paused){this._paused=false;this.onResume.dispatch(this)}}}});Phaser.Input=function(b){this.game=b;this.hitCanvas=null;this.hitContext=null};Phaser.Input.MOUSE_OVERRIDES_TOUCH=0;Phaser.Input.TOUCH_OVERRIDES_MOUSE=1;Phaser.Input.MOUSE_TOUCH_COMBINE=2;Phaser.Input.prototype={game:null,pollRate:0,_pollCounter:0,_oldPosition:null,_x:0,_y:0,disabled:false,multiInputOverride:Phaser.Input.MOUSE_TOUCH_COMBINE,position:null,speed:null,circle:null,scale:null,maxPointers:10,currentPointers:0,tapRate:200,doubleTapRate:300,holdRate:2000,justPressedRate:200,justReleasedRate:200,recordPointerHistory:false,recordRate:100,recordLimit:100,pointer1:null,pointer2:null,pointer3:null,pointer4:null,pointer5:null,pointer6:null,pointer7:null,pointer8:null,pointer9:null,pointer10:null,activePointer:null,mousePointer:null,mouse:null,keyboard:null,touch:null,mspointer:null,onDown:null,onUp:null,onTap:null,onHold:null,interactiveItems:new Phaser.LinkedList(),boot:function(){this.mousePointer=new Phaser.Pointer(this.game,0);this.pointer1=new Phaser.Pointer(this.game,1);this.pointer2=new Phaser.Pointer(this.game,2);this.mouse=new Phaser.Mouse(this.game);this.keyboard=new Phaser.Keyboard(this.game);this.touch=new Phaser.Touch(this.game);this.mspointer=new Phaser.MSPointer(this.game);this.onDown=new Phaser.Signal();this.onUp=new Phaser.Signal();this.onTap=new Phaser.Signal();this.onHold=new Phaser.Signal();this.scale=new Phaser.Point(1,1);this.speed=new Phaser.Point();this.position=new Phaser.Point();this._oldPosition=new Phaser.Point();this.circle=new Phaser.Circle(0,0,44);this.activePointer=this.mousePointer;this.currentPointers=0;this.hitCanvas=document.createElement("canvas");this.hitCanvas.width=1;this.hitCanvas.height=1;this.hitContext=this.hitCanvas.getContext("2d");this.mouse.start();this.keyboard.start();this.touch.start();this.mspointer.start();this.mousePointer.active=true},addPointer:function(){var c=0;for(var b=10;b>0;b--){if(this["pointer"+b]===null){c=b}}if(c==0){console.warn("You can only have 10 Pointer objects");return null}else{this["pointer"+c]=new Phaser.Pointer(this.game,c);return this["pointer"+c]}},update:function(){if(this.pollRate>0&&this._pollCounter0&&this._pollCounter=this.game.input.holdRate){if(this.game.input.multiInputOverride==Phaser.Input.MOUSE_OVERRIDES_TOUCH||this.game.input.multiInputOverride==Phaser.Input.MOUSE_TOUCH_COMBINE||(this.game.input.multiInputOverride==Phaser.Input.TOUCH_OVERRIDES_MOUSE&&this.game.input.currentPointers==0)){this.game.input.onHold.dispatch(this)}this._holdSent=true}if(this.game.input.recordPointerHistory&&this.game.time.now>=this._nextDrop){this._nextDrop=this.game.time.now+this.game.input.recordRate;this._history.push({x:this.position.x,y:this.position.y});if(this._history.length>this.game.input.recordLimit){this._history.shift()}}}},move:function(c){if(this.game.input.pollLocked){return}if(c.button){this.button=c.button}this.clientX=c.clientX;this.clientY=c.clientY;this.pageX=c.pageX;this.pageY=c.pageY;this.screenX=c.screenX;this.screenY=c.screenY;this.x=(this.pageX-this.game.stage.offset.x)*this.game.input.scale.x;this.y=(this.pageY-this.game.stage.offset.y)*this.game.input.scale.y;this.position.setTo(this.x,this.y);this.circle.x=this.x;this.circle.y=this.y;if(this.game.input.multiInputOverride==Phaser.Input.MOUSE_OVERRIDES_TOUCH||this.game.input.multiInputOverride==Phaser.Input.MOUSE_TOUCH_COMBINE||(this.game.input.multiInputOverride==Phaser.Input.TOUCH_OVERRIDES_MOUSE&&this.game.input.currentPointers==0)){this.game.input.activePointer=this;this.game.input.x=this.x;this.game.input.y=this.y;this.game.input.position.setTo(this.game.input.x,this.game.input.y);this.game.input.circle.x=this.game.input.x;this.game.input.circle.y=this.game.input.y}if(this.game.paused){return this}if(this.targetObject!==null&&this.targetObject.isDragged==true){if(this.targetObject.update(this)==false){this.targetObject=null}return this}this._highestRenderOrderID=-1;this._highestRenderObject=null;this._highestInputPriorityID=-1;if(this.game.input.interactiveItems.total>0){var b=this.game.input.interactiveItems.next;do{if(b.priorityID>this._highestInputPriorityID||(b.priorityID==this._highestInputPriorityID&&b.sprite.renderOrderID>this._highestRenderOrderID)){if(b.checkPointerOver(this)){this._highestRenderOrderID=b.sprite.renderOrderID;this._highestInputPriorityID=b.priorityID;this._highestRenderObject=b}}b=b.next}while(b!=null)}if(this._highestRenderObject==null){if(this.targetObject){this.targetObject._pointerOutHandler(this);this.targetObject=null}}else{if(this.targetObject==null){this.targetObject=this._highestRenderObject;this._highestRenderObject._pointerOverHandler(this)}else{if(this.targetObject==this._highestRenderObject){if(this._highestRenderObject.update(this)==false){this.targetObject=null}}else{this.targetObject._pointerOutHandler(this);this.targetObject=this._highestRenderObject;this.targetObject._pointerOverHandler(this)}}}return this},leave:function(b){this.withinGame=false;this.move(b)},stop:function(c){if(this._stateReset){c.preventDefault();return}this.timeUp=this.game.time.now;if(this.game.input.multiInputOverride==Phaser.Input.MOUSE_OVERRIDES_TOUCH||this.game.input.multiInputOverride==Phaser.Input.MOUSE_TOUCH_COMBINE||(this.game.input.multiInputOverride==Phaser.Input.TOUCH_OVERRIDES_MOUSE&&this.game.input.currentPointers==0)){this.game.input.onUp.dispatch(this);if(this.duration>=0&&this.duration<=this.game.input.tapRate){if(this.timeUp-this.previousTapTime0){this.active=false}this.withinGame=false;this.isDown=false;this.isUp=true;if(this.isMouse==false){this.game.input.currentPointers--}if(this.game.input.interactiveItems.total>0){var b=this.game.input.interactiveItems.next;do{if(b){b._releasedHandler(this)}b=b.next}while(b!=null)}if(this.targetObject){this.targetObject._releasedHandler(this)}this.targetObject=null;return this},justPressed:function(b){b=b||this.game.input.justPressedRate;return(this.isDown===true&&(this.timeDown+b)>this.game.time.now)},justReleased:function(b){b=b||this.game.input.justReleasedRate;return(this.isUp===true&&(this.timeUp+b)>this.game.time.now)},reset:function(){if(this.isMouse==false){this.active=false}this.identifier=null;this.isDown=false;this.isUp=true;this.totalTouches=0;this._holdSent=false;this._history.length=0;this._stateReset=true;if(this.targetObject){this.targetObject._releasedHandler(this)}this.targetObject=null},toString:function(){return"[{Pointer (id="+this.id+" identifer="+this.identifier+" active="+this.active+" duration="+this.duration+" withinGame="+this.withinGame+" x="+this.x+" y="+this.y+" clientX="+this.clientX+" clientY="+this.clientY+" screenX="+this.screenX+" screenY="+this.screenY+" pageX="+this.pageX+" pageY="+this.pageY+")}]"}};Object.defineProperty(Phaser.Pointer.prototype,"duration",{get:function(){if(this.isUp){return -1}return this.game.time.now-this.timeDown}});Object.defineProperty(Phaser.Pointer.prototype,"worldX",{get:function(){return this.game.world.camera.x+this.x}});Object.defineProperty(Phaser.Pointer.prototype,"worldY",{get:function(){return this.game.world.camera.y+this.y}});Phaser.Touch=function(b){this.game=b;this.callbackContext=this.game;this.touchStartCallback=null;this.touchMoveCallback=null;this.touchEndCallback=null;this.touchEnterCallback=null;this.touchLeaveCallback=null;this.touchCancelCallback=null;this.preventDefault=true};Phaser.Touch.prototype={game:null,disabled:false,_onTouchStart:null,_onTouchMove:null,_onTouchEnd:null,_onTouchEnter:null,_onTouchLeave:null,_onTouchCancel:null,_onTouchMove:null,start:function(){var b=this;if(this.game.device.touch){this._onTouchStart=function(c){return b.onTouchStart(c)};this._onTouchMove=function(c){return b.onTouchMove(c)};this._onTouchEnd=function(c){return b.onTouchEnd(c)};this._onTouchEnter=function(c){return b.onTouchEnter(c)};this._onTouchLeave=function(c){return b.onTouchLeave(c)};this._onTouchCancel=function(c){return b.onTouchCancel(c)};this.game.renderer.view.addEventListener("touchstart",this._onTouchStart,false);this.game.renderer.view.addEventListener("touchmove",this._onTouchMove,false);this.game.renderer.view.addEventListener("touchend",this._onTouchEnd,false);this.game.renderer.view.addEventListener("touchenter",this._onTouchEnter,false);this.game.renderer.view.addEventListener("touchleave",this._onTouchLeave,false);this.game.renderer.view.addEventListener("touchcancel",this._onTouchCancel,false)}},consumeDocumentTouches:function(){this._documentTouchMove=function(b){b.preventDefault()};document.addEventListener("touchmove",this._documentTouchMove,false)},onTouchStart:function(c){if(this.touchStartCallback){this.touchStartCallback.call(this.callbackContext,c)}if(this.game.input.disabled||this.disabled){return}if(this.preventDefault){c.preventDefault()}for(var b=0;bb&&this._tempPoint.xc&&this._tempPoint.y=this.pixelPerfectAlpha){return true}}return false},update:function(b){if(this.enabled==false||this.sprite.visible==false){this._pointerOutHandler(b);return false}if(this.draggable&&this._draggedPointerID==b.id){return this.updateDrag(b)}else{if(this._pointerData[b.id].isOver==true){if(this.checkPointerOver(b)){this._pointerData[b.id].x=b.x-this.sprite.x;this._pointerData[b.id].y=b.y-this.sprite.y;return true}else{this._pointerOutHandler(b);return false}}}},_pointerOverHandler:function(b){if(this._pointerData[b.id].isOver==false){this._pointerData[b.id].isOver=true;this._pointerData[b.id].isOut=false;this._pointerData[b.id].timeOver=this.game.time.now;this._pointerData[b.id].x=b.x-this.sprite.x;this._pointerData[b.id].y=b.y-this.sprite.y;if(this.useHandCursor&&this._pointerData[b.id].isDragged==false){this.game.stage.canvas.style.cursor="pointer"}this.sprite.events.onInputOver.dispatch(this.sprite,b)}},_pointerOutHandler:function(b){this._pointerData[b.id].isOver=false;this._pointerData[b.id].isOut=true;this._pointerData[b.id].timeOut=this.game.time.now;if(this.useHandCursor&&this._pointerData[b.id].isDragged==false){this.game.stage.canvas.style.cursor="default"}this.sprite.events.onInputOut.dispatch(this.sprite,b)},_touchedHandler:function(b){if(this._pointerData[b.id].isDown==false&&this._pointerData[b.id].isOver==true){this._pointerData[b.id].isDown=true;this._pointerData[b.id].isUp=false;this._pointerData[b.id].timeDown=this.game.time.now;this.sprite.events.onInputDown.dispatch(this.sprite,b);if(this.draggable&&this.isDragged==false){this.startDrag(b)}if(this.bringToTop){this.sprite.bringToTop()}}return this.consumePointerEvent},_releasedHandler:function(b){if(this._pointerData[b.id].isDown&&b.isUp){this._pointerData[b.id].isDown=false;this._pointerData[b.id].isUp=true;this._pointerData[b.id].timeUp=this.game.time.now;this._pointerData[b.id].downDuration=this._pointerData[b.id].timeUp-this._pointerData[b.id].timeDown;if(this.checkPointerOver(b)){this.sprite.events.onInputUp.dispatch(this.sprite,b)}else{if(this.useHandCursor){this.game.stage.canvas.style.cursor="default"}}if(this.draggable&&this.isDragged&&this._draggedPointerID==b.id){this.stopDrag(b)}}},updateDrag:function(b){if(b.isUp){this.stopDrag(b);return false}if(this.allowHorizontalDrag){this.sprite.x=b.x+this._dragPoint.x+this.dragOffset.x}if(this.allowVerticalDrag){this.sprite.y=b.y+this._dragPoint.y+this.dragOffset.y}if(this.boundsRect){this.checkBoundsRect()}if(this.boundsSprite){this.checkBoundsSprite()}if(this.snapOnDrag){this.sprite.x=Math.floor(this.sprite.x/this.snapX)*this.snapX;this.sprite.y=Math.floor(this.sprite.y/this.snapY)*this.snapY}return true},justOver:function(c,b){c=c||0;b=b||500;return(this._pointerData[c].isOver&&this.overDuration(c)this.boundsRect.right){this.sprite.x=this.boundsRect.right-this.sprite.width}}if(this.sprite.ythis.boundsRect.bottom){this.sprite.y=this.boundsRect.bottom-this.sprite.height}}},checkBoundsSprite:function(){if(this.sprite.x(this.boundsSprite.x+this.boundsSprite.width)){this.sprite.x=(this.boundsSprite.x+this.boundsSprite.width)-this.sprite.width}}if(this.sprite.y(this.boundsSprite.y+this.boundsSprite.height)){this.sprite.y=(this.boundsSprite.y+this.boundsSprite.height)-this.sprite.height}}}};Phaser.Canvas={create:function(d,b){d=d||256;b=b||256;var c=document.createElement("canvas");c.width=d;c.height=b;c.style.display="block";return c},getOffset:function(c,b){b=b||new Phaser.Point;var d=c.getBoundingClientRect();var h=c.clientTop||document.body.clientTop||0;var g=c.clientLeft||document.body.clientLeft||0;var e=window.pageYOffset||c.scrollTop||document.body.scrollTop;var f=window.pageXOffset||c.scrollLeft||document.body.scrollLeft;b.x=d.left+f-g;b.y=d.top+e-h;return b},getAspectRatio:function(b){return b.width/b.height},setBackgroundColor:function(c,b){b=b||"rgb(0,0,0)";c.style.backgroundColor=b;return c},setTouchAction:function(b,c){c=c||"none";b.style.msTouchAction=c;b.style["ms-touch-action"]=c;b.style["touch-action"]=c;return b},addToDOM:function(b,c,d){c=c||"";d=d||true;if(c!==""){if(document.getElementById(c)){document.getElementById(c).appendChild(b)}else{document.body.appendChild(b)}if(d){document.getElementById(c).style.overflow="hidden"}}else{document.body.appendChild(b)}return b},setTransform:function(f,h,g,d,b,e,c){f.setTransform(d,e,c,b,h,g);return f},setSmoothingEnabled:function(b,c){b.imageSmoothingEnabled=c;b.mozImageSmoothingEnabled=c;b.oImageSmoothingEnabled=c;b.webkitImageSmoothingEnabled=c;b.msImageSmoothingEnabled=c;return b},setImageRenderingCrisp:function(b){b.style["image-rendering"]="crisp-edges";b.style["image-rendering"]="-moz-crisp-edges";b.style["image-rendering"]="-webkit-optimize-contrast";b.style.msInterpolationMode="nearest-neighbor";return b},setImageRenderingBicubic:function(b){b.style["image-rendering"]="auto";b.style.msInterpolationMode="bicubic";return b}};Phaser.Events=function(b){this.parent=b;this.onAddedToGroup=new Phaser.Signal;this.onRemovedFromGroup=new Phaser.Signal;this.onKilled=new Phaser.Signal;this.onRevived=new Phaser.Signal;this.onOutOfBounds=new Phaser.Signal;this.onInputOver=null;this.onInputOut=null;this.onInputDown=null;this.onInputUp=null;this.onDragStart=null;this.onDragStop=null;this.onAnimationStart=null;this.onAnimationComplete=null;this.onAnimationLoop=null};Phaser.GameObjectFactory=function(b){this.game=b;this.world=this.game.world};Phaser.GameObjectFactory.prototype={game:null,world:null,existing:function(b){return this.world.group.add(b)},sprite:function(b,e,c,d){return this.world.group.add(new Phaser.Sprite(this.game,b,e,c,d))},child:function(d,b,g,c,e){var f=this.world.group.add(new Phaser.Sprite(this.game,b,g,c,e));d.addChild(f);return f},tween:function(b){return this.game.tweens.create(b)},group:function(c,b){return new Phaser.Group(this.game,c,b)},audio:function(c,d,b){return this.game.sound.add(c,d,b)},tileSprite:function(c,g,e,b,d,f){return this.world.group.add(new Phaser.TileSprite(this.game,c,g,e,b,d,f))},text:function(b,e,d,c){return this.world.group.add(new Phaser.Text(this.game,b,e,d,c))},button:function(b,i,g,h,e,d,f,c){return this.world.group.add(new Phaser.Button(this.game,b,i,g,h,e,d,f,c))},graphics:function(b,c){return this.world.group.add(new Phaser.Graphics(this.game,b,c))},emitter:function(b,d,c){return this.game.particles.add(new Phaser.Particles.Arcade.Emitter(this.game,b,d,c))},bitmapText:function(b,e,d,c){return this.world.group.add(new Phaser.BitmapText(this.game,b,e,d,c))},tilemap:function(b,g,d,e,f,c){return this.world.group.add(new Phaser.Tilemap(this.game,d,b,g,e,f,c))},renderTexture:function(c,d,b){var e=new Phaser.RenderTexture(this.game,c,d,b);this.game.cache.addRenderTexture(c,e);return e}};Phaser.Sprite=function(c,b,f,d,e){b=b||0;f=f||0;d=d||null;e=e||null;this.game=c;this.exists=true;this.alive=true;this.group=null;this.name="";this.type=Phaser.SPRITE;this.renderOrderID=-1;this.lifespan=0;this.events=new Phaser.Events(this);this.animations=new Phaser.AnimationManager(this);this.input=new Phaser.InputHandler(this);this.key=d;if(d instanceof Phaser.RenderTexture){PIXI.Sprite.call(this,d);this.currentFrame=this.game.cache.getTextureFrame(d.name)}else{if(d==null||this.game.cache.checkImageKey(d)==false){d="__default"}PIXI.Sprite.call(this,PIXI.TextureCache[d]);if(this.game.cache.isSpriteSheet(d)){this.animations.loadFrameData(this.game.cache.getFrameData(d));if(e!==null){if(typeof e==="string"){this.frameName=e}else{this.frame=e}}}else{this.currentFrame=this.game.cache.getFrame(d)}}this.anchor=new Phaser.Point();this._cropUUID=null;this._cropRect=null;this.x=b;this.y=f;this.position.x=b;this.position.y=f;this.autoCull=false;this.scale=new Phaser.Point(1,1);this.scrollFactor=new Phaser.Point(1,1);this._cache={dirty:false,a00:1,a01:0,a02:b,a10:0,a11:1,a12:f,id:1,i01:0,i10:0,idi:1,left:null,right:null,top:null,bottom:null,x:-1,y:-1,scaleX:1,scaleY:1,width:this.currentFrame.sourceSizeW,height:this.currentFrame.sourceSizeH,halfWidth:Math.floor(this.currentFrame.sourceSizeW/2),halfHeight:Math.floor(this.currentFrame.sourceSizeH/2),frameID:this.currentFrame.uuid,frameWidth:this.currentFrame.width,frameHeight:this.currentFrame.height,boundsX:0,boundsY:0,cameraVisible:true};this.offset=new Phaser.Point;this.center=new Phaser.Point(b+Math.floor(this._cache.width/2),f+Math.floor(this._cache.height/2));this.topLeft=new Phaser.Point(b,f);this.topRight=new Phaser.Point(b+this._cache.width,f);this.bottomRight=new Phaser.Point(b+this._cache.width,f+this._cache.height);this.bottomLeft=new Phaser.Point(b,f+this._cache.height);this.bounds=new Phaser.Rectangle(b,f,this._cache.width,this._cache.height);this.body=new Phaser.Physics.Arcade.Body(this);this.velocity=this.body.velocity;this.acceleration=this.body.acceleration;this.inWorld=Phaser.Rectangle.intersects(this.bounds,this.game.world.bounds);this.inWorldThreshold=0;this._outOfBoundsFired=false};Phaser.Sprite.prototype=Object.create(PIXI.Sprite.prototype);Phaser.Sprite.prototype.constructor=Phaser.Sprite;Phaser.Sprite.prototype.preUpdate=function(){if(!this.exists){this.renderOrderID=-1;return}if(this.lifespan>0){this.lifespan-=this.game.time.elapsed;if(this.lifespan<=0){this.kill();return}}this._cache.dirty=false;if(this.animations.update()){this._cache.dirty=true}this._cache.x=this.x-(this.game.world.camera.x*this.scrollFactor.x);this._cache.y=this.y-(this.game.world.camera.y*this.scrollFactor.y);if(this.position.x!=this._cache.x||this.position.y!=this._cache.y){this.position.x=this._cache.x;this.position.y=this._cache.y;this._cache.dirty=true}if(this.visible){this.renderOrderID=this.game.world.currentRenderOrderID++;if(this.worldTransform[0]!=this._cache.a00||this.worldTransform[1]!=this._cache.a01){this._cache.a00=this.worldTransform[0];this._cache.a01=this.worldTransform[1];this._cache.i01=this.worldTransform[1];this._cache.scaleX=Math.sqrt((this._cache.a00*this._cache.a00)+(this._cache.a01*this._cache.a01));this._cache.a01*=-1;this._cache.dirty=true}if(this.worldTransform[3]!=this._cache.a10||this.worldTransform[4]!=this._cache.a11){this._cache.a10=this.worldTransform[3];this._cache.i10=this.worldTransform[3];this._cache.a11=this.worldTransform[4];this._cache.scaleY=Math.sqrt((this._cache.a10*this._cache.a10)+(this._cache.a11*this._cache.a11));this._cache.a10*=-1;this._cache.dirty=true}if(this.worldTransform[2]!=this._cache.a02||this.worldTransform[5]!=this._cache.a12){this._cache.a02=this.worldTransform[2];this._cache.a12=this.worldTransform[5];this._cache.dirty=true}if(this.currentFrame.uuid!=this._cache.frameID){this._cache.frameWidth=this.texture.frame.width;this._cache.frameHeight=this.texture.frame.height;this._cache.frameID=this.currentFrame.uuid;this._cache.dirty=true}if(this._cache.dirty){this._cache.width=Math.floor(this.currentFrame.sourceSizeW*this._cache.scaleX);this._cache.height=Math.floor(this.currentFrame.sourceSizeH*this._cache.scaleY);this._cache.halfWidth=Math.floor(this._cache.width/2);this._cache.halfHeight=Math.floor(this._cache.height/2);this._cache.id=1/(this._cache.a00*this._cache.a11+this._cache.a01*-this._cache.a10);this._cache.idi=1/(this._cache.a00*this._cache.a11+this._cache.i01*-this._cache.i10);this.updateBounds()}}else{if(this._cache.dirty&&this.visible==false){this.bounds.x-=this._cache.boundsX-this._cache.x;this._cache.boundsX=this._cache.x;this.bounds.y-=this._cache.boundsy-this._cache.y;this._cache.boundsY=this._cache.y}}if(this._cache.dirty){this._cache.cameraVisible=Phaser.Rectangle.intersects(this.game.world.camera.screenView,this.bounds,0);if(this.autoCull==true){this.visible=this._cache.cameraVisible}this.body.updateBounds(this.center.x,this.center.y,this._cache.scaleX,this._cache.scaleY)}this.body.update()};Phaser.Sprite.prototype.revive=function(){this.alive=true;this.exists=true;this.visible=true;this.events.onRevived.dispatch(this)};Phaser.Sprite.prototype.kill=function(){this.alive=false;this.exists=false;this.visible=false;this.events.onKilled.dispatch(this)};Phaser.Sprite.prototype.reset=function(b,c){this.x=b;this.y=c;this.position.x=b;this.position.y=c;this.alive=true;this.exists=true;this.visible=true;this._outOfBoundsFired=false;this.body.reset()};Phaser.Sprite.prototype.updateBounds=function(){this.offset.setTo(this._cache.a02-(this.anchor.x*this._cache.width),this._cache.a12-(this.anchor.y*this._cache.height));this.getLocalPosition(this.center,this.offset.x+this._cache.halfWidth,this.offset.y+this._cache.halfHeight);this.getLocalPosition(this.topLeft,this.offset.x,this.offset.y);this.getLocalPosition(this.topRight,this.offset.x+this._cache.width,this.offset.y);this.getLocalPosition(this.bottomLeft,this.offset.x,this.offset.y+this._cache.height);this.getLocalPosition(this.bottomRight,this.offset.x+this._cache.width,this.offset.y+this._cache.height);this._cache.left=Phaser.Math.min(this.topLeft.x,this.topRight.x,this.bottomLeft.x,this.bottomRight.x);this._cache.right=Phaser.Math.max(this.topLeft.x,this.topRight.x,this.bottomLeft.x,this.bottomRight.x);this._cache.top=Phaser.Math.min(this.topLeft.y,this.topRight.y,this.bottomLeft.y,this.bottomRight.y);this._cache.bottom=Phaser.Math.max(this.topLeft.y,this.topRight.y,this.bottomLeft.y,this.bottomRight.y);this.bounds.setTo(this._cache.left,this._cache.top,this._cache.right-this._cache.left,this._cache.bottom-this._cache.top);this._cache.boundsX=this._cache.x;this._cache.boundsY=this._cache.y;if(this.inWorld==false){this.inWorld=Phaser.Rectangle.intersects(this.bounds,this.game.world.bounds,this.inWorldThreshold);if(this.inWorld){this._outOfBoundsFired=false}}else{this.inWorld=Phaser.Rectangle.intersects(this.bounds,this.game.world.bounds,this.inWorldThreshold);if(this.inWorld==false){this.events.onOutOfBounds.dispatch(this);this._outOfBoundsFired=true}}};Phaser.Sprite.prototype.getLocalPosition=function(c,b,d){c.x=((this._cache.a11*this._cache.id*b+-this._cache.a01*this._cache.id*d+(this._cache.a12*this._cache.a01-this._cache.a02*this._cache.a11)*this._cache.id)*this._cache.scaleX)+this._cache.a02;c.y=((this._cache.a00*this._cache.id*d+-this._cache.a10*this._cache.id*b+(-this._cache.a12*this._cache.a00+this._cache.a02*this._cache.a10)*this._cache.id)*this._cache.scaleY)+this._cache.a12;return c};Phaser.Sprite.prototype.getLocalUnmodifiedPosition=function(c,b,d){c.x=this._cache.a11*this._cache.idi*b+-this._cache.i01*this._cache.idi*d+(this._cache.a12*this._cache.i01-this._cache.a02*this._cache.a11)*this._cache.idi;c.y=this._cache.a00*this._cache.idi*d+-this._cache.i10*this._cache.idi*b+(-this._cache.a12*this._cache.a00+this._cache.a02*this._cache.i10)*this._cache.idi;return c};Phaser.Sprite.prototype.bringToTop=function(){if(this.group){this.group.bringToTop(this)}else{this.game.world.bringToTop(this)}};Phaser.Sprite.prototype.getBounds=function(d){d=d||new Phaser.Rectangle;var f=Phaser.Math.min(this.topLeft.x,this.topRight.x,this.bottomLeft.x,this.bottomRight.x);var c=Phaser.Math.max(this.topLeft.x,this.topRight.x,this.bottomLeft.x,this.bottomRight.x);var e=Phaser.Math.min(this.topLeft.y,this.topRight.y,this.bottomLeft.y,this.bottomRight.y);var b=Phaser.Math.max(this.topLeft.y,this.topRight.y,this.bottomLeft.y,this.bottomRight.y);d.x=f;d.y=e;d.width=c-f;d.height=b-e;return d};Object.defineProperty(Phaser.Sprite.prototype,"angle",{get:function(){return Phaser.Math.radToDeg(this.rotation)},set:function(b){this.rotation=Phaser.Math.degToRad(b)}});Object.defineProperty(Phaser.Sprite.prototype,"frame",{get:function(){return this.animations.frame},set:function(b){this.animations.frame=b}});Object.defineProperty(Phaser.Sprite.prototype,"frameName",{get:function(){return this.animations.frameName},set:function(b){this.animations.frameName=b}});Object.defineProperty(Phaser.Sprite.prototype,"inCamera",{get:function(){return this._cache.cameraVisible}});Object.defineProperty(Phaser.Sprite.prototype,"crop",{get:function(){return this._cropRect},set:function(b){if(b instanceof Phaser.Rectangle){if(this._cropUUID==null){this._cropUUID=this.game.rnd.uuid();PIXI.TextureCache[this._cropUUID]=new PIXI.Texture(PIXI.BaseTextureCache[this.key],{x:b.x,y:b.y,width:b.width,height:b.height})}else{PIXI.TextureCache[this._cropUUID].frame=b}this._cropRect=b;this.setTexture(PIXI.TextureCache[this._cropUUID])}}});Object.defineProperty(Phaser.Sprite.prototype,"inputEnabled",{get:function(){return(this.input.enabled)},set:function(b){if(b){if(this.input.enabled==false){this.input.start()}}else{if(this.input.enabled){this.input.stop()}}}});Phaser.TileSprite=function(d,c,h,f,b,e,g){c=c||0;h=h||0;f=f||256;b=b||256;e=e||null;g=g||null;Phaser.Sprite.call(this,d,c,h,e,g);this.texture=PIXI.TextureCache[e];PIXI.TilingSprite.call(this,this.texture,f,b);this.type=Phaser.TILESPRITE;this.tileScale=new Phaser.Point(1,1);this.tilePosition=new Phaser.Point(0,0)};Phaser.TileSprite.prototype=Phaser.Utils.extend(true,PIXI.TilingSprite.prototype,Phaser.Sprite.prototype);Phaser.TileSprite.prototype.constructor=Phaser.TileSprite;Phaser.Text=function(c,b,g,f,d){b=b||0;g=g||0;f=f||"";d=d||"";this.canvas=document.createElement("canvas");this.context=this.canvas.getContext("2d");var e=c.rnd.uuid();PIXI.TextureCache[e]=new PIXI.Texture(new PIXI.BaseTexture(this.canvas));Phaser.Sprite.call(this,c,b,g,e);this.type=Phaser.TEXT;this.setText(f);this.setStyle(d);this.updateText();this.dirty=false};Phaser.Text.prototype=Phaser.Utils.extend(true,Phaser.Sprite.prototype,PIXI.Text.prototype);Phaser.Text.prototype.constructor=Phaser.Text;Phaser.Button=function(j,g,f,h,i,c,d,b,e){g=g||0;f=f||0;h=h||null;i=i||null;c=c||this;Phaser.Sprite.call(this,j,g,f,h,b);this.type=Phaser.BUTTON;this._onOverFrameName=null;this._onOutFrameName=null;this._onDownFrameName=null;this._onUpFrameName=null;this._onOverFrameID=null;this._onOutFrameID=null;this._onDownFrameID=null;this._onUpFrameID=null;this.onInputOver=new Phaser.Signal;this.onInputOut=new Phaser.Signal;this.onInputDown=new Phaser.Signal;this.onInputUp=new Phaser.Signal;this.setFrames(d,b,e);if(i!==null){this.onInputUp.add(i,c)}this.input.start(0,false,true);this.events.onInputOver.add(this.onInputOverHandler,this);this.events.onInputOut.add(this.onInputOutHandler,this);this.events.onInputDown.add(this.onInputDownHandler,this);this.events.onInputUp.add(this.onInputUpHandler,this)};Phaser.Button.prototype=Phaser.Utils.extend(true,Phaser.Sprite.prototype,PIXI.Sprite.prototype);Phaser.Button.prototype.constructor=Phaser.Button;Phaser.Button.prototype.setFrames=function(c,d,b){if(c!==null){if(typeof c==="string"){this._onOverFrameName=c}else{this._onOverFrameID=c}}if(d!==null){if(typeof d==="string"){this._onOutFrameName=d;this._onUpFrameName=d}else{this._onOutFrameID=d;this._onUpFrameID=d}}if(b!==null){if(typeof b==="string"){this._onDownFrameName=b}else{this._onDownFrameID=b}}};Phaser.Button.prototype.onInputOverHandler=function(b){if(this._onOverFrameName!=null){this.frameName=this._onOverFrameName}else{if(this._onOverFrameID!=null){this.frame=this._onOverFrameID}}if(this.onInputOver){this.onInputOver.dispatch(this,b)}};Phaser.Button.prototype.onInputOutHandler=function(b){if(this._onOutFrameName!=null){this.frameName=this._onOutFrameName}else{if(this._onOutFrameID!=null){this.frame=this._onOutFrameID}}if(this.onInputOut){this.onInputOut.dispatch(this,b)}};Phaser.Button.prototype.onInputDownHandler=function(b){if(this._onDownFrameName!=null){this.frameName=this._onDownFrameName}else{if(this._onDownFrameID!=null){this.frame=this._onDownFrameID}}if(this.onInputDown){this.onInputDown.dispatch(this,b)}};Phaser.Button.prototype.onInputUpHandler=function(b){if(this._onUpFrameName!=null){this.frameName=this._onUpFrameName}else{if(this._onUpFrameID!=null){this.frame=this._onUpFrameID}}if(this.onInputUp){this.onInputUp.dispatch(this,b)}};Phaser.Graphics=function(c,b,d){this.exists=true;this.alive=true;this.group=null;this.name="";this.game=c;PIXI.DisplayObjectContainer.call(this);this.type=Phaser.GRAPHICS;this.position.x=b;this.position.y=d;this.scale=new Phaser.Point(1,1);this.scrollFactor=new Phaser.Point(1,1);this._cache={dirty:false,a00:1,a01:0,a02:b,a10:0,a11:1,a12:d,id:1,x:-1,y:-1,scaleX:1,scaleY:1};this._cache.x=this.x-(this.game.world.camera.x*this.scrollFactor.x);this._cache.y=this.y-(this.game.world.camera.y*this.scrollFactor.y);this.renderable=true;this.fillAlpha=1;this.lineWidth=0;this.lineColor="black";this.graphicsData=[];this.currentPath={points:[]}};Phaser.Graphics.prototype=Phaser.Utils.extend(true,PIXI.Graphics.prototype,PIXI.DisplayObjectContainer.prototype,Phaser.Sprite.prototype);Phaser.Graphics.prototype.constructor=Phaser.Graphics;Phaser.Graphics.prototype.update=function(){if(!this.exists){return}this._cache.dirty=false;this._cache.x=this.x-(this.game.world.camera.x*this.scrollFactor.x);this._cache.y=this.y-(this.game.world.camera.y*this.scrollFactor.y);if(this.position.x!=this._cache.x||this.position.y!=this._cache.y){this.position.x=this._cache.x;this.position.y=this._cache.y;this._cache.dirty=true}};Object.defineProperty(Phaser.Graphics.prototype,"angle",{get:function(){return Phaser.Math.radToDeg(this.rotation)},set:function(b){this.rotation=Phaser.Math.degToRad(b)}});Object.defineProperty(Phaser.Graphics.prototype,"x",{get:function(){return this.position.x},set:function(b){this.position.x=b}});Object.defineProperty(Phaser.Graphics.prototype,"y",{get:function(){return this.position.y},set:function(b){this.position.y=b}});Phaser.RenderTexture=function(c,d,e,b){this.game=c;this.name=d;PIXI.EventTarget.call(this);this.width=e||100;this.height=b||100;this.indetityMatrix=PIXI.mat3.create();this.frame=new PIXI.Rectangle(0,0,this.width,this.height);this.type=Phaser.RENDERTEXTURE;if(PIXI.gl){this.initWebGL()}else{this.initCanvas()}};Phaser.RenderTexture.prototype=Phaser.Utils.extend(true,PIXI.RenderTexture.prototype);Phaser.RenderTexture.prototype.constructor=Phaser.RenderTexture;Phaser.BitmapText=function(c,b,f,e,d){b=b||0;f=f||0;e=e||"";d=d||"";this.exists=true;this.alive=true;this.group=null;this.name="";this.game=c;PIXI.BitmapText.call(this,e,d);this.position.x=b;this.position.y=f;this.scale=new Phaser.Point(1,1);this.scrollFactor=new Phaser.Point(1,1);this._cache={dirty:false,a00:1,a01:0,a02:b,a10:0,a11:1,a12:f,id:1,x:-1,y:-1,scaleX:1,scaleY:1};this._cache.x=this.x-(this.game.world.camera.x*this.scrollFactor.x);this._cache.y=this.y-(this.game.world.camera.y*this.scrollFactor.y);this.renderable=true};Phaser.BitmapText.prototype=Phaser.Utils.extend(true,PIXI.BitmapText.prototype);Phaser.BitmapText.prototype.constructor=Phaser.BitmapText;Phaser.BitmapText.prototype.update=function(){if(!this.exists){return}this._cache.dirty=false;this._cache.x=this.x-(this.game.world.camera.x*this.scrollFactor.x);this._cache.y=this.y-(this.game.world.camera.y*this.scrollFactor.y);if(this.position.x!=this._cache.x||this.position.y!=this._cache.y){this.position.x=this._cache.x;this.position.y=this._cache.y;this._cache.dirty=true}};Object.defineProperty(Phaser.BitmapText.prototype,"angle",{get:function(){return Phaser.Math.radToDeg(this.rotation)},set:function(b){this.rotation=Phaser.Math.degToRad(b)}});Object.defineProperty(Phaser.BitmapText.prototype,"x",{get:function(){return this.position.x},set:function(b){this.position.x=b}});Object.defineProperty(Phaser.BitmapText.prototype,"y",{get:function(){return this.position.y},set:function(b){this.position.y=b}});Phaser.Canvas={create:function(d,b){d=d||256;b=b||256;var c=document.createElement("canvas");c.width=d;c.height=b;c.style.display="block";return c},getOffset:function(c,b){b=b||new Phaser.Point;var d=c.getBoundingClientRect();var h=c.clientTop||document.body.clientTop||0;var g=c.clientLeft||document.body.clientLeft||0;var e=window.pageYOffset||c.scrollTop||document.body.scrollTop;var f=window.pageXOffset||c.scrollLeft||document.body.scrollLeft;b.x=d.left+f-g;b.y=d.top+e-h;return b},getAspectRatio:function(b){return b.width/b.height},setBackgroundColor:function(c,b){b=b||"rgb(0,0,0)";c.style.backgroundColor=b;return c},setTouchAction:function(b,c){c=c||"none";b.style.msTouchAction=c;b.style["ms-touch-action"]=c;b.style["touch-action"]=c;return b},addToDOM:function(b,c,d){c=c||"";d=d||true;if(c!==""){if(document.getElementById(c)){document.getElementById(c).appendChild(b)}else{document.body.appendChild(b)}if(d){document.getElementById(c).style.overflow="hidden"}}else{document.body.appendChild(b)}return b},setTransform:function(f,h,g,d,b,e,c){f.setTransform(d,e,c,b,h,g);return f},setSmoothingEnabled:function(b,c){b.imageSmoothingEnabled=c;b.mozImageSmoothingEnabled=c;b.oImageSmoothingEnabled=c;b.webkitImageSmoothingEnabled=c;b.msImageSmoothingEnabled=c;return b},setImageRenderingCrisp:function(b){b.style["image-rendering"]="crisp-edges";b.style["image-rendering"]="-moz-crisp-edges";b.style["image-rendering"]="-webkit-optimize-contrast";b.style.msInterpolationMode="nearest-neighbor";return b},setImageRenderingBicubic:function(b){b.style["image-rendering"]="auto";b.style.msInterpolationMode="bicubic";return b}};Phaser.StageScaleMode=function(c,d,b){this._startHeight=0;this.forceLandscape=false;this.forcePortrait=false;this.incorrectOrientation=false;this.pageAlignHorizontally=false;this.pageAlignVeritcally=false;this.minWidth=null;this.maxWidth=null;this.minHeight=null;this.maxHeight=null;this.width=0;this.height=0;this.maxIterations=5;this.game=c;this.enterLandscape=new Phaser.Signal();this.enterPortrait=new Phaser.Signal();if(window.orientation){this.orientation=window.orientation}else{if(window.outerWidth>window.outerHeight){this.orientation=90}else{this.orientation=0}}this.scaleFactor=new Phaser.Point(1,1);this.aspectRatio=0;var e=this;window.addEventListener("orientationchange",function(f){return e.checkOrientation(f)},false);window.addEventListener("resize",function(f){return e.checkResize(f)},false)};Phaser.StageScaleMode.EXACT_FIT=0;Phaser.StageScaleMode.NO_SCALE=1;Phaser.StageScaleMode.SHOW_ALL=2;Phaser.StageScaleMode.prototype={startFullScreen:function(){if(this.isFullScreen){return}var b=this.game.canvas;if(b.requestFullScreen){b.requestFullScreen()}else{if(b.mozRequestFullScreen){b.mozRequestFullScreen()}else{if(b.webkitRequestFullScreen){b.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT)}}}this.game.stage.canvas.style.width="100%";this.game.stage.canvas.style.height="100%"},stopFullScreen:function(){if(document.cancelFullScreen){document.cancelFullScreen()}else{if(document.mozCancelFullScreen){document.mozCancelFullScreen()}else{if(document.webkitCancelFullScreen){document.webkitCancelFullScreen()}}}},checkOrientationState:function(){if(this.incorrectOrientation){if((this.forceLandscape&&window.innerWidth>window.innerHeight)||(this.forcePortrait&&window.innerHeight>window.innerWidth)){this.game.paused=false;this.incorrectOrientation=false;this.refresh()}}else{if((this.forceLandscape&&window.innerWidthwindow.outerHeight){this.orientation=90}else{this.orientation=0}if(this.isLandscape){this.enterLandscape.dispatch(this.orientation,true,false)}else{this.enterPortrait.dispatch(this.orientation,false,true)}if(this.game.stage.scaleMode!==Phaser.StageScaleMode.NO_SCALE){this.refresh()}},refresh:function(){var b=this;if(this.game.device.iPad==false&&this.game.device.webApp==false&&this.game.device.desktop==false){if(this.game.device.android&&this.game.device.chrome==false){window.scrollTo(0,1)}else{window.scrollTo(0,0)}}if(this._check==null&&this.maxIterations>0){this._iterations=this.maxIterations;this._check=window.setInterval(function(){return b.setScreenSize()},10);this.setScreenSize()}},setScreenSize:function(b){if(typeof b=="undefined"){b=false}if(this.game.device.iPad==false&&this.game.device.webApp==false&&this.game.device.desktop==false){if(this.game.device.android&&this.game.device.chrome==false){window.scrollTo(0,1)}else{window.scrollTo(0,0)}}this._iterations--;if(b||window.innerHeight>this._startHeight||this._iterations<0){document.documentElement.style.minHeight=window.innerHeight+"px";if(this.incorrectOrientation==true){this.setMaximum()}else{if(this.game.stage.scaleMode==Phaser.StageScaleMode.EXACT_FIT){this.setExactFit()}else{if(this.game.stage.scaleMode==Phaser.StageScaleMode.SHOW_ALL){this.setShowAll()}}}this.setSize();clearInterval(this._check);this._check=null}},setSize:function(){if(this.incorrectOrientation==false){if(this.maxWidth&&this.width>this.maxWidth){this.width=this.maxWidth}if(this.maxHeight&&this.height>this.maxHeight){this.height=this.maxHeight}if(this.minWidth&&this.widththis.maxWidth){this.width=this.maxWidth}else{this.width=b}if(this.maxHeight&&c>this.maxHeight){this.height=this.maxHeight}else{this.height=c}console.log("setExactFit",this.width,this.height,this.game.stage.offset)}};Object.defineProperty(Phaser.StageScaleMode.prototype,"isFullScreen",{get:function(){if(document.fullscreenElement===null||document.mozFullScreenElement===null||document.webkitFullscreenElement===null){return false}return true}});Object.defineProperty(Phaser.StageScaleMode.prototype,"isPortrait",{get:function(){return this.orientation==0||this.orientation==180}});Object.defineProperty(Phaser.StageScaleMode.prototype,"isLandscape",{get:function(){return this.orientation===90||this.orientation===-90}});Phaser.Device=function(){this.patchAndroidClearRectBug=false;this.desktop=false;this.iOS=false;this.android=false;this.chromeOS=false;this.linux=false;this.macOS=false;this.windows=false;this.canvas=false;this.file=false;this.fileSystem=false;this.localStorage=false;this.webGL=false;this.worker=false;this.touch=false;this.mspointer=false;this.css3D=false;this.pointerLock=false;this.arora=false;this.chrome=false;this.epiphany=false;this.firefox=false;this.ie=false;this.ieVersion=0;this.mobileSafari=false;this.midori=false;this.opera=false;this.safari=false;this.webApp=false;this.audioData=false;this.webAudio=false;this.ogg=false;this.opus=false;this.mp3=false;this.wav=false;this.m4a=false;this.webm=false;this.iPhone=false;this.iPhone4=false;this.iPad=false;this.pixelRatio=0;this._checkAudio();this._checkBrowser();this._checkCSS3D();this._checkDevice();this._checkFeatures();this._checkOS()};Phaser.Device.prototype={_checkOS:function(){var b=navigator.userAgent;if(/Android/.test(b)){this.android=true}else{if(/CrOS/.test(b)){this.chromeOS=true}else{if(/iP[ao]d|iPhone/i.test(b)){this.iOS=true}else{if(/Linux/.test(b)){this.linux=true}else{if(/Mac OS/.test(b)){this.macOS=true}else{if(/Windows/.test(b)){this.windows=true}}}}}}if(this.windows||this.macOS||this.linux){this.desktop=true}},_checkFeatures:function(){this.canvas=!!window.CanvasRenderingContext2D;try{this.localStorage=!!localStorage.getItem}catch(b){this.localStorage=false}this.file=!!window.File&&!!window.FileReader&&!!window.FileList&&!!window.Blob;this.fileSystem=!!window.requestFileSystem;this.webGL=(function(){try{return !!window.WebGLRenderingContext&&!!document.createElement("canvas").getContext("experimental-webgl")}catch(c){return false}})();this.worker=!!window.Worker;if("ontouchstart" in document.documentElement||window.navigator.msPointerEnabled){this.touch=true}if(window.navigator.msPointerEnabled){this.mspointer=true}this.pointerLock="pointerLockElement" in document||"mozPointerLockElement" in document||"webkitPointerLockElement" in document},_checkBrowser:function(){var b=navigator.userAgent;if(/Arora/.test(b)){this.arora=true}else{if(/Chrome/.test(b)){this.chrome=true}else{if(/Epiphany/.test(b)){this.epiphany=true}else{if(/Firefox/.test(b)){this.firefox=true}else{if(/Mobile Safari/.test(b)){this.mobileSafari=true}else{if(/MSIE (\d+\.\d+);/.test(b)){this.ie=true;this.ieVersion=parseInt(RegExp.$1)}else{if(/Midori/.test(b)){this.midori=true}else{if(/Opera/.test(b)){this.opera=true}else{if(/Safari/.test(b)){this.safari=true}}}}}}}}}if(navigator.standalone){this.webApp=true}},_checkAudio:function(){this.audioData=!!(window.Audio);this.webAudio=!!(window.webkitAudioContext||window.AudioContext);var d=document.createElement("audio");var b=false;try{if(b=!!d.canPlayType){if(d.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,"")){this.ogg=true}if(d.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/,"")){this.opus=true}if(d.canPlayType("audio/mpeg;").replace(/^no$/,"")){this.mp3=true}if(d.canPlayType('audio/wav; codecs="1"').replace(/^no$/,"")){this.wav=true}if(d.canPlayType("audio/x-m4a;")||d.canPlayType("audio/aac;").replace(/^no$/,"")){this.m4a=true}if(d.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")){this.webm=true}}}catch(c){}},_checkDevice:function(){this.pixelRatio=window.devicePixelRatio||1;this.iPhone=navigator.userAgent.toLowerCase().indexOf("iphone")!=-1;this.iPhone4=(this.pixelRatio==2&&this.iPhone);this.iPad=navigator.userAgent.toLowerCase().indexOf("ipad")!=-1},_checkCSS3D:function(){var d=document.createElement("p");var e;var c={webkitTransform:"-webkit-transform",OTransform:"-o-transform",msTransform:"-ms-transform",MozTransform:"-moz-transform",transform:"transform"};document.body.insertBefore(d,null);for(var b in c){if(d.style[b]!==undefined){d.style[b]="translate3d(1px,1px,1px)";e=window.getComputedStyle(d).getPropertyValue(c[b])}}document.body.removeChild(d);this.css3D=(e!==undefined&&e.length>0&&e!=="none")},canPlayAudio:function(b){if(b=="mp3"&&this.mp3){return true}else{if(b=="ogg"&&(this.ogg||this.opus)){return true}else{if(b=="m4a"&&this.m4a){return true}else{if(b=="wav"&&this.wav){return true}else{if(b=="webm"&&this.webm){return true}}}}}return false},isConsoleOpen:function(){if(window.console&&window.console.firebug){return true}if(window.console){console.profile();console.profileEnd();if(console.clear){console.clear()}return console.profiles.length>0}return false}};Phaser.RequestAnimationFrame=function(c){this.game=c;this._isSetTimeOut=false;this.isRunning=false;var d=["ms","moz","webkit","o"];for(var b=0;b>>0;c-=e;c*=e;e=c>>>0;c-=e;e+=c*4294967296}return(e>>>0)*2.3283064365386963e-10},integer:function(){return this.rnd.apply(this)*4294967296},frac:function(){return this.rnd.apply(this)+(this.rnd.apply(this)*2097152|0)*1.1102230246251565e-16},real:function(){return this.integer()+this.frac()},integerInRange:function(c,b){return Math.floor(this.realInRange(c,b))},realInRange:function(c,b){c=c||0;b=b||0;return this.frac()*(b-c)+c},normal:function(){return 1-2*this.frac()},uuid:function(){var d,c;for(c=d="";d++<36;c+=~d%5|d*3&4?(d^15?8^this.frac()*(d^20?16:4):4).toString(16):"-"){}return c},pick:function(b){return b[this.integerInRange(0,b.length)]},weightedPick:function(b){return b[~~(Math.pow(this.frac(),2)*b.length)]},timestamp:function(d,c){return this.realInRange(d||946684800000,c||1577862000000)},angle:function(){return this.integerInRange(-180,180)}};Phaser.Math={PI2:Math.PI*2,fuzzyEqual:function(d,c,e){if(typeof e==="undefined"){e=0.0001}return Math.abs(d-c)c-e},fuzzyCeil:function(b,c){if(typeof c==="undefined"){c=0.0001}return Math.ceil(b-c)},fuzzyFloor:function(b,c){if(typeof c==="undefined"){c=0.0001}return Math.floor(b+c)},average:function(){var b=[];for(var d=0;d<(arguments.length-0);d++){b[d]=arguments[d+0]}var e=0;for(var c=0;c0)?Math.floor(b):Math.ceil(b)},shear:function(b){return b%1},snapTo:function(b,d,c){if(typeof c==="undefined"){c=0}if(d==0){return b}b-=c;b=d*Math.round(b/d);return c+b},snapToFloor:function(b,d,c){if(typeof c==="undefined"){c=0}if(d==0){return b}b-=c;b=d*Math.floor(b/d);return c+b},snapToCeil:function(b,d,c){if(typeof c==="undefined"){c=0}if(d==0){return b}b-=c;b=d*Math.ceil(b/d);return c+b},snapToInArray:function(d,c,f){if(typeof f==="undefined"){f=true}if(f){c.sort()}if(dd/2){c+=d*2}if(b<-d/2&&c>d/2){b+=d*2}return b-c},interpolateAngles:function(c,b,d,e,f){if(typeof e==="undefined"){e=true}if(typeof f==="undefined"){f=null}c=this.normalizeAngle(c,e);b=this.normalizeAngleToAnother(b,c,e);return(typeof f==="function")?f(d,c,b-c,1):this.interpolateFloat(c,b,d)},chanceRoll:function(b){if(typeof b==="undefined"){b=50}if(b<=0){return false}else{if(b>=100){return true}else{if(Math.random()*100>=b){return false}else{return true}}}},maxAdd:function(d,c,b){d+=c;if(d>b){d=b}return d},minSub:function(d,c,b){d-=c;if(d0.5)?1:-1},isOdd:function(b){return(b&1)},isEven:function(b){if(b&1){return false}else{return true}},max:function(){for(var d=1,c=0,b=arguments.length;d=-180&&c<=180){return c}b=(c+180)%360;if(b<0){b+=360}return b-180},angleLimit:function(e,d,c){var b=e;if(e>c){b=c}else{if(e1){return this.linear(d[b],d[b-1],b-g)}return this.linear(d[e],d[e+1>b?b:e+1],g-e)},bezierInterpolation:function(e,d){var c=0;var g=e.length-1;for(var f=0;f<=g;f++){c+=Math.pow(1-d,g-f)*Math.pow(d,f)*e[f]*this.bernstein(g,f)}return c},catmullRomInterpolation:function(d,c){var b=d.length-1;var g=b*c;var e=Math.floor(g);if(d[0]===d[b]){if(c<0){e=Math.floor(g=b*(1+c))}return this.catmullRom(d[(e-1+b)%b],d[e],d[(e+1)%b],d[(e+2)%b],g-e)}else{if(c<0){return d[0]-(this.catmullRom(d[0],d[0],d[1],d[1],-g)-d[0])}if(c>1){return d[b]-(this.catmullRom(d[b],d[b],d[b-1],d[b-1],g-b)-d[b])}return this.catmullRom(d[e?e-1:0],d[e],d[bd.length-e)){b=d.length-e}if(b>0){return d[e+Math.floor(Math.random()*b)]}}return null},floor:function(b){var c=b|0;return(b>0)?(c):((c!=b)?(c-1):(c))},ceil:function(b){var c=b|0;return(b>0)?((c!=b)?(c+1):(c)):(c)},sinCosGenerator:function(b,j,d,h){if(typeof j==="undefined"){j=1}if(typeof d==="undefined"){d=1}if(typeof h==="undefined"){h=1}var i=j;var l=d;var f=h*Math.PI/b;var e=[];var k=[];for(var g=0;g0;d--){var c=Math.floor(Math.random()*(d+1));var b=e[d];e[d]=e[c];e[c]=b}return e},distance:function(e,g,d,f){var c=e-d;var b=g-f;return Math.sqrt(c*c+b*b)},distanceRounded:function(c,e,b,d){return Math.round(Phaser.Math.distance(c,e,b,d))},clamp:function(d,e,c){return(dc)?c:d)},clampBottom:function(b,c){return b=b){return 1}c=(c-d)/(b-d);return c*c*(3-2*c)},smootherstep:function(c,d,b){if(c<=d){return 0}if(c>=b){return 1}c=(c-d)/(b-d);return c*c*c*(c*(c*6-15)+10)},sign:function(b){return(b<0)?-1:((b>0)?1:0)},degToRad:function(){var b=Math.PI/180;return function(c){return c*b}}(),radToDeg:function(){var b=180/Math.PI;return function(c){return c*b}}()};Phaser.QuadTree=function(g,c,i,f,b,e,d,h){this.physicsManager=g;this.ID=g.quadTreeID;g.quadTreeID++;this.maxObjects=e||10;this.maxLevels=d||4;this.level=h||0;this.bounds={x:Math.round(c),y:Math.round(i),width:f,height:b,subWidth:Math.floor(f/2),subHeight:Math.floor(b/2),right:Math.round(c)+Math.floor(f/2),bottom:Math.round(i)+Math.floor(b/2)};this.objects=[];this.nodes=[]};Phaser.QuadTree.prototype={split:function(){this.level++;this.nodes[0]=new Phaser.QuadTree(this.physicsManager,this.bounds.right,this.bounds.y,this.bounds.subWidth,this.bounds.subHeight,this.maxObjects,this.maxLevels,this.level);this.nodes[1]=new Phaser.QuadTree(this.physicsManager,this.bounds.x,this.bounds.y,this.bounds.subWidth,this.bounds.subHeight,this.maxObjects,this.maxLevels,this.level);this.nodes[2]=new Phaser.QuadTree(this.physicsManager,this.bounds.x,this.bounds.bottom,this.bounds.subWidth,this.bounds.subHeight,this.maxObjects,this.maxLevels,this.level);this.nodes[3]=new Phaser.QuadTree(this.physicsManager,this.bounds.right,this.bounds.bottom,this.bounds.subWidth,this.bounds.subHeight,this.maxObjects,this.maxLevels,this.level)},insert:function(b){var d=0;var c;if(this.nodes[0]!=null){c=this.getIndex(b);if(c!==-1){this.nodes[c].insert(b);return}}this.objects.push(b);if(this.objects.length>this.maxObjects&&this.levelthis.bounds.bottom)){b=2}}}else{if(c.x>this.bounds.right){if((c.ythis.bounds.bottom)){b=3}}}}return b},retrieve:function(b){var c=this.objects;b.body.quadTreeIndex=this.getIndex(b.body);b.body.quadTreeIDs.push(this.ID);if(this.nodes[0]){if(b.body.quadTreeIndex!==-1){c=c.concat(this.nodes[b.body.quadTreeIndex].retrieve(b))}else{c=c.concat(this.nodes[0].retrieve(b));c=c.concat(this.nodes[1].retrieve(b));c=c.concat(this.nodes[2].retrieve(b));c=c.concat(this.nodes[3].retrieve(b))}}return c},clear:function(){this.objects=[];for(var c=0,b=this.nodes.length;c0){this._radius=c*0.5}else{this._radius=0}};Phaser.Circle.prototype={circumference:function(){return 2*(Math.PI*this._radius)},setTo:function(b,d,c){this.x=b;this.y=d;this._diameter=c;this._radius=c*0.5;return this},copyFrom:function(b){return this.setTo(b.x,b.y,b.diameter)},copyTo:function(b){b[x]=this.x;b[y]=this.y;b[diameter]=this._diameter;return b},distance:function(c,b){if(typeof b==="undefined"){b=false}if(b){return Phaser.Math.distanceRound(this.x,this.y,c.x,c.y)}else{return Phaser.Math.distance(this.x,this.y,c.x,c.y)}},clone:function(b){if(typeof b==="undefined"){b=new Phaser.Circle()}return b.setTo(a.x,a.y,a.diameter)},contains:function(b,c){return Phaser.Circle.contains(this,b,c)},circumferencePoint:function(d,c,b){return Phaser.Circle.circumferencePoint(this,d,c,b)},offset:function(c,b){this.x+=c;this.y+=b;return this},offsetPoint:function(b){return this.offset(b.x,b.y)},toString:function(){return"[{Phaser.Circle (x="+this.x+" y="+this.y+" diameter="+this.diameter+" radius="+this.radius+")}]"}};Object.defineProperty(Phaser.Circle.prototype,"diameter",{get:function(){return this._diameter},set:function(b){if(b>0){this._diameter=b;this._radius=b*0.5}}});Object.defineProperty(Phaser.Circle.prototype,"radius",{get:function(){return this._radius},set:function(b){if(b>0){this._radius=b;this._diameter=b*2}}});Object.defineProperty(Phaser.Circle.prototype,"left",{get:function(){return this.x-this._radius},set:function(b){if(b>this.x){this._radius=0;this._diameter=0}else{this.radius=this.x-b}}});Object.defineProperty(Phaser.Circle.prototype,"right",{get:function(){return this.x+this._radius},set:function(b){if(bthis.y){this._radius=0;this._diameter=0}else{this.radius=this.y-b}}});Object.defineProperty(Phaser.Circle.prototype,"bottom",{get:function(){return this.y+this._radius},set:function(b){if(b0){return Math.PI*this._radius*this._radius}else{return 0}}});Object.defineProperty(Phaser.Circle.prototype,"empty",{get:function(){return(this._diameter==0)},set:function(b){this.setTo(0,0,0)}});Phaser.Circle.contains=function(d,b,f){if(b>=d.left&&b<=d.right&&f>=d.top&&f<=d.bottom){var e=(d.x-b)*(d.x-b);var c=(d.y-f)*(d.y-f);return(e+c)<=(d.radius*d.radius)}return false};Phaser.Circle.equals=function(d,c){return(d.x==c.x&&d.y==c.y&&d.diameter==c.diameter)};Phaser.Circle.intersects=function(d,c){return(Phaser.Math.distance(d.x,d.y,c.x,c.y)<=(d.radius+c.radius))};Phaser.Circle.circumferencePoint=function(b,e,d,c){if(typeof d==="undefined"){d=false}if(typeof c==="undefined"){c=new Phaser.Point()}if(d===true){e=Phaser.Math.radToDeg(e)}c.x=b.x+b.radius*Math.cos(e);c.y=b.y+b.radius*Math.sin(e);return c};Phaser.Circle.intersectsRectangle=function(m,d){var g=Math.abs(m.x-d.x-d.halfWidth);var l=d.halfWidth+m.radius;if(g>l){return false}var f=Math.abs(m.y-d.y-d.halfHeight);var j=d.halfHeight+m.radius;if(f>j){return false}if(g<=d.halfWidth||f<=d.halfHeight){return true}var h=g-d.halfWidth;var e=f-d.halfHeight;var k=h*h;var b=e*e;var i=m.radius*m.radius;return k+b<=i};Phaser.Point=function(b,c){b=b||0;c=c||0;this.x=b;this.y=c};Phaser.Point.prototype={copyFrom:function(b){return this.setTo(b.x,b.y)},invert:function(){return this.setTo(this.y,this.x)},setTo:function(b,c){this.x=b;this.y=c;return this},add:function(b,c){this.x+=b;this.y+=c;return this},subtract:function(b,c){this.x-=b;this.y-=c;return this},multiply:function(b,c){this.x*=b;this.y*=c;return this},divide:function(b,c){this.x/=b;this.y/=c;return this},clampX:function(c,b){this.x=Phaser.Math.clamp(this.x,c,b);return this},clampY:function(c,b){this.y=Phaser.Math.clamp(this.y,c,b);return this},clamp:function(c,b){this.x=Phaser.Math.clamp(this.x,c,b);this.y=Phaser.Math.clamp(this.y,c,b);return this},clone:function(b){if(typeof b==="undefined"){b=new Phaser.Point}return b.setTo(this.x,this.y)},copyFrom:function(b){return this.setTo(b.x,b.y)},copyTo:function(b){b[x]=this.x;b[y]=this.y;return b},distance:function(c,b){return Phaser.Point.distance(this,c,b)},equals:function(b){return(b.x==this.x&&b.y==this.y)},rotate:function(b,f,d,c,e){return Phaser.Point.rotate(this,b,f,d,c,e)},toString:function(){return"[{Point (x="+this.x+" y="+this.y+")}]"}};Phaser.Point.add=function(d,c,e){if(typeof e==="undefined"){e=new Phaser.Point()}e.x=d.x+c.x;e.y=d.y+c.y;return e};Phaser.Point.subtract=function(d,c,e){if(typeof e==="undefined"){e=new Phaser.Point()}e.x=d.x-c.x;e.y=d.y-c.y;return e};Phaser.Point.multiply=function(d,c,e){if(typeof e==="undefined"){e=new Phaser.Point()}e.x=d.x*c.x;e.y=d.y*c.y;return e};Phaser.Point.divide=function(d,c,e){if(typeof e==="undefined"){e=new Phaser.Point()}e.x=d.x/c.x;e.y=d.y/c.y;return e};Phaser.Point.equals=function(d,c){return(d.x==c.x&&d.y==c.y)};Phaser.Point.distance=function(d,c,e){if(typeof e==="undefined"){e=false}if(e){return Phaser.Math.distanceRound(d.x,d.y,c.x,c.y)}else{return Phaser.Math.distance(d.x,d.y,c.x,c.y)}},Phaser.Point.rotate=function(c,b,g,e,d,f){d=d||false;f=f||null;if(d){e=Phaser.Math.radToDeg(e)}if(f===null){f=Math.sqrt(((b-c.x)*(b-c.x))+((g-c.y)*(g-c.y)))}return c.setTo(b+f*Math.cos(e),g+f*Math.sin(e))};Phaser.Rectangle=function(c,e,d,b){c=c||0;e=e||0;d=d||0;b=b||0;this.x=c;this.y=e;this.width=d;this.height=b};Phaser.Rectangle.prototype={offset:function(c,b){this.x+=c;this.y+=b;return this},offsetPoint:function(b){return this.offset(b.x,b.y)},setTo:function(c,e,d,b){this.x=c;this.y=e;this.width=d;this.height=b;return this},floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y)},copyFrom:function(b){return this.setTo(b.x,b.y,b.width,b.height)},copyTo:function(b){b.x=this.x;b.y=this.y;b.width=this.width;b.height=this.height;return b},inflate:function(c,b){return Phaser.Rectangle.inflate(this,c,b)},size:function(b){return Phaser.Rectangle.size(this,b)},clone:function(b){return Phaser.Rectangle.clone(this,b)},contains:function(b,c){return Phaser.Rectangle.contains(this,b,c)},containsRect:function(c){return Phaser.Rectangle.containsRect(this,c)},equals:function(c){return Phaser.Rectangle.equals(this,c)},intersection:function(c,d){return Phaser.Rectangle.intersection(this,c,output)},intersects:function(c,d){return Phaser.Rectangle.intersects(this,c,d)},intersectsRaw:function(f,d,e,c,b){return Phaser.Rectangle.intersectsRaw(this,f,d,e,c,b)},union:function(c,d){return Phaser.Rectangle.union(this,c,d)},toString:function(){return"[{Rectangle (x="+this.x+" y="+this.y+" width="+this.width+" height="+this.height+" empty="+this.empty+")}]"}};Object.defineProperty(Phaser.Rectangle.prototype,"halfWidth",{get:function(){return Math.round(this.width/2)}});Object.defineProperty(Phaser.Rectangle.prototype,"halfHeight",{get:function(){return Math.round(this.height/2)}});Object.defineProperty(Phaser.Rectangle.prototype,"bottom",{get:function(){return this.y+this.height},set:function(b){if(b<=this.y){this.height=0}else{this.height=(this.y-b)}}});Object.defineProperty(Phaser.Rectangle.prototype,"bottomRight",{get:function(){return new Phaser.Point(this.right,this.bottom)},set:function(b){this.right=b.x;this.bottom=b.y}});Object.defineProperty(Phaser.Rectangle.prototype,"left",{get:function(){return this.x},set:function(b){if(b>=this.right){this.width=0}else{this.width=this.right-b}this.x=b}});Object.defineProperty(Phaser.Rectangle.prototype,"right",{get:function(){return this.x+this.width},set:function(b){if(b<=this.x){this.width=0}else{this.width=this.x+b}}});Object.defineProperty(Phaser.Rectangle.prototype,"volume",{get:function(){return this.width*this.height}});Object.defineProperty(Phaser.Rectangle.prototype,"perimeter",{get:function(){return(this.width*2)+(this.height*2)}});Object.defineProperty(Phaser.Rectangle.prototype,"centerX",{get:function(){return this.x+this.halfWidth},set:function(b){this.x=b-this.halfWidth}});Object.defineProperty(Phaser.Rectangle.prototype,"centerY",{get:function(){return this.y+this.halfHeight},set:function(b){this.y=b-this.halfHeight}});Object.defineProperty(Phaser.Rectangle.prototype,"top",{get:function(){return this.y},set:function(b){if(b>=this.bottom){this.height=0;this.y=b}else{this.height=(this.bottom-b)}}});Object.defineProperty(Phaser.Rectangle.prototype,"topLeft",{get:function(){return new Phaser.Point(this.x,this.y)},set:function(b){this.x=b.x;this.y=b.y}});Object.defineProperty(Phaser.Rectangle.prototype,"empty",{get:function(){return(!this.width||!this.height)},set:function(b){this.setTo(0,0,0,0)}});Phaser.Rectangle.inflate=function(c,d,b){c.x-=d;c.width+=2*d;c.y-=b;c.height+=2*b;return c};Phaser.Rectangle.inflatePoint=function(c,b){return Phaser.Phaser.Rectangle.inflate(c,b.x,b.y)};Phaser.Rectangle.size=function(b,c){if(typeof c==="undefined"){c=new Phaser.Point()}return c.setTo(b.width,b.height)};Phaser.Rectangle.clone=function(b,c){if(typeof c==="undefined"){c=new Phaser.Rectangle()}return c.setTo(b.x,b.y,b.width,b.height)};Phaser.Rectangle.contains=function(c,b,d){return(b>=c.x&&b<=c.right&&d>=c.y&&d<=c.bottom)};Phaser.Rectangle.containsPoint=function(c,b){return Phaser.Phaser.Rectangle.contains(c,b.x,b.y)};Phaser.Rectangle.containsRect=function(d,c){if(d.volume>c.volume){return false}return(d.x>=c.x&&d.y>=c.y&&d.right<=c.right&&d.bottom<=c.bottom)};Phaser.Rectangle.equals=function(d,c){return(d.x==c.x&&d.y==c.y&&d.width==c.width&&d.height==c.height)};Phaser.Rectangle.intersection=function(d,c,e){e=e||new Phaser.Rectangle;if(Phaser.Rectangle.intersects(d,c)){e.x=Math.max(d.x,c.x);e.y=Math.max(d.y,c.y);e.width=Math.min(d.right,c.right)-e.x;e.height=Math.min(d.bottom,c.bottom)-e.y}return e};Phaser.Rectangle.intersects=function(d,c,e){e=e||0;return !(d.left>c.right+e||d.rightc.bottom+e||d.bottomb.right+c||eb.bottom+c||d1){if(f&&f==this.decodeURI(d[0])){return this.decodeURI(d[1])}else{c[this.decodeURI(d[0])]=this.decodeURI(d[1])}}}return c},decodeURI:function(b){return decodeURIComponent(b.replace(/\+/g," "))}};Phaser.TweenManager=function(b){this.game=b;this._tweens=[];this.game.onPause.add(this.pauseAll,this);this.game.onResume.add(this.resumeAll,this)};Phaser.TweenManager.prototype={REVISION:"11dev",getAll:function(){return this._tweens},removeAll:function(){this._tweens=[]},add:function(b){this._tweens.push(b)},create:function(b){return new Phaser.Tween(b,this.game)},remove:function(c){var b=this._tweens.indexOf(c);if(b!==-1){this._tweens.splice(b,1)}},update:function(){if(this._tweens.length===0){return false}var b=0,c=this._tweens.length;while(b=0;b--){this._tweens[b].pause()}},resumeAll:function(){for(var b=this._tweens.length-1;b>=0;b--){this._tweens[b].resume()}}};Phaser.Tween=function(c,b){this._object=c;this.game=b;this._manager=this.game.tweens;this._valuesStart={};this._valuesEnd={};this._valuesStartRepeat={};this._duration=1000;this._repeat=0;this._yoyo=false;this._reversed=false;this._delayTime=0;this._startTime=null;this._easingFunction=Phaser.Easing.Linear.None;this._interpolationFunction=Phaser.Math.linearInterpolation;this._chainedTweens=[];this._onStartCallback=null;this._onStartCallbackFired=false;this._onUpdateCallback=null;this._onCompleteCallback=null;this._pausedTime=0;for(var d in c){this._valuesStart[d]=parseFloat(c[d],10)}this.onStart=new Phaser.Signal();this.onComplete=new Phaser.Signal();this.isRunning=false};Phaser.Tween.prototype={to:function(d,g,h,c,b,f,e){g=g||1000;h=h||null;c=c||false;b=b||0;f=f||0;e=e||false;this._repeat=f;this._duration=g;this._valuesEnd=d;if(h!==null){this._easingFunction=h}if(b>0){this._delayTime=b}this._yoyo=e;if(c){return this.start()}else{return this}},start:function(c){if(this.game===null||this._object===null){return}this._manager.add(this);this.onStart.dispatch(this._object);this.isRunning=true;this._onStartCallbackFired=false;this._startTime=this.game.time.now+this._delayTime;for(var b in this._valuesEnd){if(this._valuesEnd[b] instanceof Array){if(this._valuesEnd[b].length===0){continue}this._valuesEnd[b]=[this._object[b]].concat(this._valuesEnd[b])}this._valuesStart[b]=this._object[b];if((this._valuesStart[b] instanceof Array)===false){this._valuesStart[b]*=1}this._valuesStartRepeat[b]=this._valuesStart[b]||0}return this},stop:function(){this._manager.remove(this);this.isRunning=false;return this},delay:function(b){this._delayTime=b;return this},repeat:function(b){this._repeat=b;return this},yoyo:function(b){this._yoyo=b;return this},easing:function(b){this._easingFunction=b;return this},interpolation:function(b){this._interpolationFunction=b;return this},chain:function(){this._chainedTweens=arguments;return this},onStart:function(b){this._onStartCallback=b;return this},onUpdate:function(b){this._onUpdateCallback=b;return this},onComplete:function(b){this._onCompleteCallback=b;return this},pause:function(){this._paused=true},resume:function(){this._paused=false;this._startTime+=this.game.time.pauseDuration},update:function(c){if(this._paused||c1?1:k;var h=this._easingFunction(k);for(j in this._valuesEnd){var b=this._valuesStart[j]||0;var d=this._valuesEnd[j];if(d instanceof Array){this._object[j]=this._interpolationFunction(d,h)}else{if(typeof(d)==="string"){d=b+parseFloat(d,10)}if(typeof(d)==="number"){this._object[j]=b+(d-b)*h}}}if(this._onUpdateCallback!==null){this._onUpdateCallback.call(this._object,h)}if(k==1){if(this._repeat>0){if(isFinite(this._repeat)){this._repeat--}for(j in this._valuesStartRepeat){if(typeof(this._valuesEnd[j])==="string"){this._valuesStartRepeat[j]=this._valuesStartRepeat[j]+parseFloat(this._valuesEnd[j],10)}if(this._yoyo){var e=this._valuesStartRepeat[j];this._valuesStartRepeat[j]=this._valuesEnd[j];this._valuesEnd[j]=e;this._reversed=!this._reversed}this._valuesStart[j]=this._valuesStartRepeat[j]}this._startTime=c+this._delayTime;this.onComplete.dispatch(this._object);if(this._onCompleteCallback!==null){this._onCompleteCallback.call(this._object)}return true}else{this.onComplete.dispatch(this._object);if(this._onCompleteCallback!==null){this._onCompleteCallback.call(this._object)}for(var f=0,g=this._chainedTweens.length;fthis._timeLastSecond+1000){this.fps=Math.round((this.frames*1000)/(this.now-this._timeLastSecond));this.fpsMin=this.game.math.min(this.fpsMin,this.fps);this.fpsMax=this.game.math.max(this.fpsMax,this.fps);this._timeLastSecond=this.now;this.frames=0}this.time=this.now;this.lastTime=b+this.timeToCall;this.physicsElapsed=1*(this.elapsed/1000);if(this.game.paused){this.pausedTime=this.now-this._pauseStarted}},gamePaused:function(){this._pauseStarted=this.now},gameResumed:function(){this.time=Date.now();this.pauseDuration=this.pausedTime;this._justResumed=true},elapsedSince:function(b){return this.now-b},elapsedSecondsSince:function(b){return(this.now-b)*0.001},reset:function(){this._started=this.now}};Phaser.AnimationManager=function(b){this._frameData=null;this.currentFrame=null;this.sprite=b;this.game=b.game;this._anims={};this.updateIfVisible=true};Phaser.AnimationManager.prototype={loadFrameData:function(b){this._frameData=b;this.frame=0},add:function(e,f,d,c,b){f=f||null;d=d||60;c=c||false;b=b||true;if(this._frameData==null){console.warn("No frameData available for Phaser.Animation "+e);return}if(this.sprite.events.onAnimationStart==null){this.sprite.events.onAnimationStart=new Phaser.Signal();this.sprite.events.onAnimationComplete=new Phaser.Signal();this.sprite.events.onAnimationLoop=new Phaser.Signal()}if(f==null){f=this._frameData.getFrameIndexes()}else{if(this.validateFrames(f,b)==false){console.warn("Invalid frames given to Phaser.Animation "+e);return}}if(b==false){f=this._frameData.getFrameIndexesByName(f)}this._anims[e]=new Phaser.Animation(this.game,this.sprite,this._frameData,e,f,d,c);this.currentAnim=this._anims[e];this.currentFrame=this.currentAnim.currentFrame;this.sprite.setTexture(PIXI.TextureCache[this.currentFrame.uuid]);return this._anims[e]},validateFrames:function(d,b){for(var c=0;cthis._frameData.total){return false}}else{if(this._frameData.checkFrameName(d[c])==false){return false}}}return true},play:function(d,c,b){c=c||null;b=b||null;if(this._anims[d]){if(this.currentAnim==this._anims[d]){if(this.currentAnim.isPlaying==false){return this.currentAnim.play(c,b)}}else{this.currentAnim=this._anims[d];return this.currentAnim.play(c,b)}}},stop:function(b){if(this._anims[b]){this.currentAnim=this._anims[b];this.currentAnim.stop()}},update:function(){if(this.updateIfVisible&&this.sprite.visible==false){return false}if(this.currentAnim&&this.currentAnim.update()==true){this.currentFrame=this.currentAnim.currentFrame;this.sprite.currentFrame=this.currentFrame;return true}return false},destroy:function(){this._anims={};this._frameData=null;this._frameIndex=0;this.currentAnim=null;this.currentFrame=null}};Object.defineProperty(Phaser.AnimationManager.prototype,"frameData",{get:function(){return this._frameData}});Object.defineProperty(Phaser.AnimationManager.prototype,"frameTotal",{get:function(){if(this._frameData){return this._frameData.total}else{return -1}}});Object.defineProperty(Phaser.AnimationManager.prototype,"frame",{get:function(){if(this.currentFrame){return this._frameIndex}},set:function(b){if(this._frameData&&this._frameData.getFrame(b)!==null){this.currentFrame=this._frameData.getFrame(b);this._frameIndex=b;this.sprite.currentFrame=this.currentFrame;this.sprite.setTexture(PIXI.TextureCache[this.currentFrame.uuid])}}});Object.defineProperty(Phaser.AnimationManager.prototype,"frameName",{get:function(){if(this.currentFrame){return this.currentFrame.name}},set:function(b){if(this._frameData&&this._frameData.getFrameByName(b)){this.currentFrame=this._frameData.getFrameByName(b);this._frameIndex=this.currentFrame.index;this.sprite.currentFrame=this.currentFrame;this.sprite.setTexture(PIXI.TextureCache[this.currentFrame.uuid])}else{console.warn("Cannot set frameName: "+b)}}});Phaser.Animation=function(c,g,f,e,h,d,b){this.game=c;this._parent=g;this._frames=h;this._frameData=f;this.name=e;this.delay=1000/d;this.looped=b;this.isFinished=false;this.isPlaying=false;this._frameIndex=0;this.currentFrame=this._frameData.getFrame(this._frames[this._frameIndex])};Phaser.Animation.prototype={play:function(c,b){c=c||null;b=b||null;if(c!==null){this.delay=1000/c}if(b!==null){this.looped=b}this.isPlaying=true;this.isFinished=false;this._timeLastFrame=this.game.time.now;this._timeNextFrame=this.game.time.now+this.delay;this._frameIndex=0;this.currentFrame=this._frameData.getFrame(this._frames[this._frameIndex]);this._parent.setTexture(PIXI.TextureCache[this.currentFrame.uuid]);this._parent.events.onAnimationStart.dispatch(this._parent,this);return this},restart:function(){this.isPlaying=true;this.isFinished=false;this._timeLastFrame=this.game.time.now;this._timeNextFrame=this.game.time.now+this.delay;this._frameIndex=0;this.currentFrame=this._frameData.getFrame(this._frames[this._frameIndex])},stop:function(){this.isPlaying=false;this.isFinished=true},update:function(){if(this.isPlaying==true&&this.game.time.now>=this._timeNextFrame){this._frameIndex++;if(this._frameIndex==this._frames.length){if(this.looped){this._frameIndex=0;this.currentFrame=this._frameData.getFrame(this._frames[this._frameIndex]);this._parent.setTexture(PIXI.TextureCache[this.currentFrame.uuid]);this._parent.events.onAnimationLoop.dispatch(this._parent,this)}else{this.onComplete()}}else{this.currentFrame=this._frameData.getFrame(this._frames[this._frameIndex]);this._parent.setTexture(PIXI.TextureCache[this.currentFrame.uuid])}this._timeLastFrame=this.game.time.now;this._timeNextFrame=this.game.time.now+this.delay;return true}return false},destroy:function(){this.game=null;this._parent=null;this._frames=null;this._frameData=null;this.currentFrame=null;this.isPlaying=false},onComplete:function(){this.isPlaying=false;this.isFinished=true;this._parent.events.onAnimationComplete.dispatch(this._parent,this)}};Object.defineProperty(Phaser.Animation.prototype,"frameTotal",{get:function(){return this._frames.length}});Object.defineProperty(Phaser.Animation.prototype,"frame",{get:function(){if(this.currentFrame!==null){return this.currentFrame.index}else{return this._frameIndex}},set:function(b){this.currentFrame=this._frameData.getFrame(b);if(this.currentFrame!==null){this._frameIndex=b;this._parent.setTexture(PIXI.TextureCache[this.currentFrame.uuid])}}});Phaser.Animation.Frame=function(c,g,f,b,d,e){this.x=c;this.y=g;this.width=f;this.height=b;this.centerX=Math.floor(f/2);this.centerY=Math.floor(b/2);this.index=0;this.name=d;this.uuid=e;this.distance=Phaser.Math.distance(0,0,f,b);this.rotated=false;this.rotationDirection="cw";this.trimmed=false;this.sourceSizeW=f;this.sourceSizeH=b;this.spriteSourceSizeX=0;this.spriteSourceSizeY=0;this.spriteSourceSizeW=0;this.spriteSourceSizeH=0};Phaser.Animation.Frame.prototype={setTrim:function(f,e,h,c,b,d,g){this.trimmed=f;if(f){this.width=e;this.height=h;this.sourceSizeW=e;this.sourceSizeH=h;this.centerX=Math.floor(e/2);this.centerY=Math.floor(h/2);this.spriteSourceSizeX=c;this.spriteSourceSizeY=b;this.spriteSourceSizeW=d;this.spriteSourceSizeH=g}}};Phaser.Animation.FrameData=function(){this._frames=[];this._frameNames=[]};Phaser.Animation.FrameData.prototype={addFrame:function(b){b.index=this._frames.length;this._frames.push(b);if(b.name!==""){this._frameNames[b.name]=b.index}return b},getFrame:function(b){if(this._frames[b]){return this._frames[b]}return null},getFrameByName:function(b){if(this._frameNames[b]!==""){return this._frames[this._frameNames[b]]}return null},checkFrameName:function(b){if(this._frameNames[b]==null){return false}return true},getFrameRange:function(e,b,c){if(typeof c==="undefined"){c=[]}for(var d=e;d<=b;d++){c.push(this._frames[d])}return c},getFrameIndexes:function(b){if(typeof b==="undefined"){b=[]}for(var c=0;c tag");return}var d=new Phaser.Animation.FrameData();var j=g.getElementsByTagName("SubTexture");var f;for(var e=0;e0){this._progressChunk=100/this._keys.length;this.loadFile()}else{this.progress=100;this.hasLoaded=true;this.onLoadComplete.dispatch()}},loadFile:function(){var b=this._fileList[this._keys.shift()];var c=this;switch(b.type){case"image":case"spritesheet":case"textureatlas":case"bitmapfont":case"tilemap":b.data=new Image();b.data.name=b.key;b.data.onload=function(){return c.fileComplete(b.key)};b.data.onerror=function(){return c.fileError(b.key)};b.data.crossOrigin=this.crossOrigin;b.data.src=this.baseURL+b.url;break;case"audio":b.url=this.getAudioURL(b.url);if(b.url!==null){if(this.game.sound.usingWebAudio){this._xhr.open("GET",this.baseURL+b.url,true);this._xhr.responseType="arraybuffer";this._xhr.onload=function(){return c.fileComplete(b.key)};this._xhr.onerror=function(){return c.fileError(b.key)};this._xhr.send()}else{if(this.game.sound.usingAudioTag){if(this.game.sound.touchLocked){b.data=new Audio();b.data.name=b.key;b.data.preload="auto";b.data.src=this.baseURL+b.url;this.fileComplete(b.key)}else{b.data=new Audio();b.data.name=b.key;b.data.onerror=function(){return c.fileError(b.key)};b.data.preload="auto";b.data.src=this.baseURL+b.url;b.data.addEventListener("canplaythrough",Phaser.GAMES[this.game.id].load.fileComplete(b.key),false);b.data.load()}}}}else{this.fileError(b.key)}break;case"text":this._xhr.open("GET",this.baseURL+b.url,true);this._xhr.responseType="text";this._xhr.onload=function(){return c.fileComplete(b.key)};this._xhr.onerror=function(){return c.fileError(b.key)};this._xhr.send();break}},getAudioURL:function(c){var d;for(var b=0;b100){this.progress=100}this.onFileComplete.dispatch(this.progress,b,c,this.queueSize-this._keys.length,this.queueSize);if(this._keys.length>0){this.loadFile()}else{this.hasLoaded=true;this.isLoading=false;this.removeAll();this.onLoadComplete.dispatch()}}};Phaser.Loader.Parser={bitmapFont:function(q,h,l){if(!h.getElementsByTagName("font")){console.warn("Phaser.Loader.Parser.bitmapFont: Invalid XML given, missing tag");return}var m=PIXI.TextureCache[l];var e={};var c=h.getElementsByTagName("info")[0];var j=h.getElementsByTagName("common")[0];e.font=c.attributes.getNamedItem("face").nodeValue;e.size=parseInt(c.attributes.getNamedItem("size").nodeValue,10);e.lineHeight=parseInt(j.attributes.getNamedItem("lineHeight").nodeValue,10);e.chars={};var k=h.getElementsByTagName("char");for(var d=0;d=this.duration){if(this.usingWebAudio){if(this.loop){this.onLoop.dispatch(this);if(this.currentMarker==""){this.currentTime=0;this.startTime=this.game.time.now}else{this.play(this.currentMarker,0,this.volume,true,true)}}else{this.stop()}}else{if(this.loop){this.onLoop.dispatch(this);this.play(this.currentMarker,0,this.volume,true,true)}else{this.stop()}}}}},play:function(d,b,f,c,e){d=d||"";b=b||0;f=f||1;c=c||false;e=e||false;if(this.isPlaying==true&&e==false&&this.override==false){return}if(this.isPlaying&&this.override){if(this.usingWebAudio){if(typeof this._sound.stop==="undefined"){this._sound.noteOff(0)}else{this._sound.stop(0)}}else{if(this.usingAudioTag){this._sound.pause();this._sound.currentTime=0}}}this.currentMarker=d;if(d!==""&&this.markers[d]){this.position=this.markers[d].start;this.volume=this.markers[d].volume;this.loop=this.markers[d].loop;this.duration=this.markers[d].duration*1000;this._tempMarker=d;this._tempPosition=this.position;this._tempVolume=this.volume;this._tempLoop=this.loop}else{this.position=b;this.volume=f;this.loop=c;this.duration=0;this._tempMarker=d;this._tempPosition=b;this._tempVolume=f;this._tempLoop=c}if(this.usingWebAudio){if(this.game.cache.isSoundDecoded(this.key)){if(this._buffer==null){this._buffer=this.game.cache.getSoundData(this.key)}this._sound=this.context.createBufferSource();this._sound.buffer=this._buffer;this._sound.connect(this.gainNode);this.totalDuration=this._sound.buffer.duration;if(this.duration==0){this.duration=this.totalDuration*1000}if(this.loop&&d==""){this._sound.loop=true}if(typeof this._sound.start==="undefined"){this._sound.noteGrainOn(0,this.position,this.duration/1000)}else{this._sound.start(0,this.position,this.duration/1000)}this.isPlaying=true;this.startTime=this.game.time.now;this.currentTime=0;this.stopTime=this.startTime+this.duration;this.onPlay.dispatch(this)}else{this.pendingPlayback=true;if(this.game.cache.getSound(this.key)&&this.game.cache.getSound(this.key).isDecoding==false){this.game.sound.decode(this.key,this)}}}else{if(this.game.cache.getSound(this.key)&&this.game.cache.getSound(this.key).locked){this.game.cache.reloadSound(this.key);this.pendingPlayback=true}else{if(this._sound&&this._sound.readyState==4){this._sound.play();this.totalDuration=this._sound.duration;if(this.duration==0){this.duration=this.totalDuration*1000}this._sound.currentTime=this.position;this._sound.muted=this._muted;if(this._muted){this._sound.volume=0}else{this._sound.volume=this._volume}this.isPlaying=true;this.startTime=this.game.time.now;this.currentTime=0;this.stopTime=this.startTime+this.duration;this.onPlay.dispatch(this)}else{this.pendingPlayback=true}}}},restart:function(d,b,e,c){d=d||"";b=b||0;e=e||1;c=c||false;this.play(d,b,e,c,true)},pause:function(){if(this.isPlaying&&this._sound){this.stop();this.isPlaying=false;this.paused=true;this.onPause.dispatch(this)}},resume:function(){if(this.paused&&this._sound){if(this.usingWebAudio){if(typeof this._sound.start==="undefined"){this._sound.noteGrainOn(0,this.position,this.duration)}else{this._sound.start(0,this.position,this.duration)}}else{this._sound.play()}this.isPlaying=true;this.paused=false;this.onResume.dispatch(this)}},stop:function(){if(this.isPlaying&&this._sound){if(this.usingWebAudio){if(typeof this._sound.stop==="undefined"){this._sound.noteOff(0)}else{this._sound.stop(0)}}else{if(this.usingAudioTag){this._sound.pause();this._sound.currentTime=0}}}this.isPlaying=false;var b=this.currentMarker;this.currentMarker="";this.onStop.dispatch(this,b)}};Object.defineProperty(Phaser.Sound.prototype,"isDecoding",{get:function(){return this.game.cache.getSound(this.key).isDecoding}});Object.defineProperty(Phaser.Sound.prototype,"isDecoded",{get:function(){return this.game.cache.isSoundDecoded(this.key)}});Object.defineProperty(Phaser.Sound.prototype,"mute",{get:function(){return this._muted},set:function(b){b=b||null;if(b){this._muted=true;if(this.usingWebAudio){this._muteVolume=this.gainNode.gain.value;this.gainNode.gain.value=0}else{if(this.usingAudioTag&&this._sound){this._muteVolume=this._sound.volume;this._sound.volume=0}}}else{this._muted=false;if(this.usingWebAudio){this.gainNode.gain.value=this._muteVolume}else{if(this.usingAudioTag&&this._sound){this._sound.volume=this._muteVolume}}}this.onMute.dispatch(this)}});Object.defineProperty(Phaser.Sound.prototype,"volume",{get:function(){return this._volume},set:function(b){if(this.usingWebAudio){this._volume=b;this.gainNode.gain.value=b}else{if(this.usingAudioTag&&this._sound){if(b>=0&&b<=1){this._volume=b;this._sound.volume=b}}}}});Phaser.SoundManager=function(b){this.game=b;this.onSoundDecode=new Phaser.Signal;this._muted=false;this._unlockSource=null;this._volume=1;this._muted=false;this._sounds=[];this.context=null;this.usingWebAudio=true;this.usingAudioTag=false;this.noAudio=false;this.touchLocked=false;this.channels=32};Phaser.SoundManager.prototype={boot:function(){if(this.game.device.iOS&&this.game.device.webAudio==false){this.channels=1}if(this.game.device.iOS||(window.PhaserGlobal&&window.PhaserGlobal.fakeiOSTouchLock)){this.game.input.touch.callbackContext=this;this.game.input.touch.touchStartCallback=this.unlock;this.game.input.mouse.callbackContext=this;this.game.input.mouse.mouseDownCallback=this.unlock;this.touchLocked=true}else{this.touchLocked=false}if(window.PhaserGlobal){if(window.PhaserGlobal.disableAudio==true){this.usingWebAudio=false;this.noAudio=true;return}if(window.PhaserGlobal.disableWebAudio==true){this.usingWebAudio=false;this.usingAudioTag=true;this.noAudio=false;return}}if(!!window.AudioContext){this.context=new window.AudioContext()}else{if(!!window.webkitAudioContext){this.context=new window.webkitAudioContext()}else{if(!!window.Audio){this.usingWebAudio=false;this.usingAudioTag=true}else{this.usingWebAudio=false;this.noAudio=true}}}if(this.context!==null){if(typeof this.context.createGain==="undefined"){this.masterGain=this.context.createGainNode()}else{this.masterGain=this.context.createGain()}this.masterGain.gain.value=1;this.masterGain.connect(this.context.destination)}},unlock:function(){if(this.touchLocked==false){return}if(this.game.device.webAudio==false||(window.PhaserGlobal&&window.PhaserGlobal.disableWebAudio==true)){this.touchLocked=false;this._unlockSource=null;this.game.input.touch.callbackContext=null;this.game.input.touch.touchStartCallback=null;this.game.input.mouse.callbackContext=null;this.game.input.mouse.mouseDownCallback=null}else{var b=this.context.createBuffer(1,1,22050);this._unlockSource=this.context.createBufferSource();this._unlockSource.buffer=b;this._unlockSource.connect(this.context.destination);this._unlockSource.noteOn(0)}},stopAll:function(){for(var b=0;b255){return Phaser.Color.getColor(255,255,255)}if(d>c){return Phaser.Color.getColor(255,255,255)}var f=d+Math.round(Math.random()*(c-d));var e=d+Math.round(Math.random()*(c-d));var b=d+Math.round(Math.random()*(c-d));return Phaser.Color.getColor32(g,f,e,b)},getRGB:function(b){return{alpha:b>>>24,red:b>>16&255,green:b>>8&255,blue:b&255}},getWebRGB:function(c){var f=(c>>>24)/255;var e=c>>16&255;var d=c>>8&255;var b=c&255;return"rgba("+e.toString()+","+d.toString()+","+b.toString()+","+f.toString()+")"},getAlpha:function(b){return b>>>24},getAlphaFloat:function(b){return(b>>>24)/255},getRed:function(b){return b>>16&255},getGreen:function(b){return b>>8&255},getBlue:function(b){return b&255}};Phaser.Physics={};Phaser.Physics.Arcade=function(b){this.game=b;this.gravity=new Phaser.Point;this.bounds=new Phaser.Rectangle(0,0,b.world.width,b.world.height);this.maxObjects=10;this.maxLevels=4;this.OVERLAP_BIAS=4;this.TILE_OVERLAP=false;this.quadTree=new Phaser.QuadTree(this,this.game.world.bounds.x,this.game.world.bounds.y,this.game.world.bounds.width,this.game.world.bounds.height,this.maxObjects,this.maxLevels);this.quadTreeID=0;this._bounds1=new Phaser.Rectangle;this._bounds2=new Phaser.Rectangle;this._overlap=0;this._maxOverlap=0;this._velocity1=0;this._velocity2=0;this._newVelocity1=0;this._newVelocity2=0;this._average=0;this._mapData=[];this._result=false;this._total=0};Phaser.Physics.Arcade.prototype={updateMotion:function(b){this._velocityDelta=(this.computeVelocity(0,false,b.angularVelocity,b.angularAcceleration,b.angularDrag,b.maxAngular)-b.angularVelocity)/2;b.angularVelocity+=this._velocityDelta;b.rotation+=b.angularVelocity*this.game.time.physicsElapsed;this._velocityDelta=(this.computeVelocity(1,b,b.velocity.x,b.acceleration.x,b.drag.x)-b.velocity.x)/2;b.velocity.x+=this._velocityDelta;this._delta=b.velocity.x*this.game.time.physicsElapsed;b.x+=this._delta;this._velocityDelta=(this.computeVelocity(2,b,b.velocity.y,b.acceleration.y,b.drag.y)-b.velocity.y)/2;b.velocity.y+=this._velocityDelta;this._delta=b.velocity.y*this.game.time.physicsElapsed;b.y+=this._delta},computeVelocity:function(e,c,g,f,d,b){b=b||10000;if(e==1&&c.allowGravity){g+=this.gravity.x+c.gravity.x}else{if(e==2&&c.allowGravity){g+=this.gravity.y+c.gravity.y}}if(f!==0){g+=f*this.game.time.physicsElapsed}else{if(d!==0){this._drag=d*this.game.time.physicsElapsed;if(g-this._drag>0){g=g-this._drag}else{if(g+this._drag<0){g+=this._drag}else{g=0}}}}if(g!=0){if(g>b){g=b}else{if(g<-b){g=-b}}}return g},preUpdate:function(){this.quadTree.clear();this.quadTreeID=0;this.quadTree=new Phaser.QuadTree(this,this.game.world.bounds.x,this.game.world.bounds.y,this.game.world.bounds.width,this.game.world.bounds.height,this.maxObjects,this.maxLevels)},postUpdate:function(){this.quadTree.clear()},collide:function(f,e,d,c,b){d=d||null;c=c||null;b=b||d;this._result=false;this._total=0;if(f&&e&&f.exists&&e.exists){if(f.type==Phaser.SPRITE&&e.type==Phaser.SPRITE){this.collideSpriteVsSprite(f,e,d,c,b)}else{if(f.type==Phaser.SPRITE&&e.type==Phaser.GROUP){this.collideSpriteVsGroup(f,e,d,c,b)}else{if(f.type==Phaser.GROUP&&e.type==Phaser.SPRITE){this.collideSpriteVsGroup(e,f,d,c,b)}else{if(f.type==Phaser.GROUP&&e.type==Phaser.GROUP){this.collideGroupVsGroup(f,e,d,c,b)}else{if(f.type==Phaser.SPRITE&&e.type==Phaser.TILEMAP){this.collideSpriteVsTilemap(f,e,d,c,b)}else{if(f.type==Phaser.TILEMAP&&e.type==Phaser.SPRITE){this.collideSpriteVsTilemap(e,f,d,c,b)}else{if(f.type==Phaser.GROUP&&e.type==Phaser.TILEMAP){this.collideGroupVsTilemap(f,e,d,c,b)}else{if(f.type==Phaser.TILEMAP&&e.type==Phaser.GROUP){this.collideGroupVsTilemap(e,f,d,c,b)}else{if(f.type==Phaser.EMITTER&&e.type==Phaser.TILEMAP){this.collideGroupVsTilemap(f,e,d,c,b)}else{if(f.type==Phaser.TILEMAP&&e.type==Phaser.EMITTER){this.collideGroupVsTilemap(e,f,d,c,b)}}}}}}}}}}}return(this._total>0)},collideSpriteVsSprite:function(f,e,d,c,b){this.separate(f.body,e.body);if(this._result){if(c){if(c.call(b,f,e)){this._total++;if(d){d.call(b,f,e)}}}else{this._total++;if(d){d.call(b,f,e)}}}},collideGroupVsTilemap:function(g,f,e,d,b){if(g._container.first._iNext){var c=g._container.first._iNext;do{if(c.exists){this.collideSpriteVsTilemap(c,f,e,d,b)}c=c._iNext}while(c!=g._container.last._iNext)}},collideSpriteVsTilemap:function(d,g,f,e,b){this._mapData=g.collisionLayer.getTileOverlaps(d);var c=this._mapData.length;while(c--){if(e){if(e.call(b,d,this._mapData[c].tile)){this._total++;if(f){f.call(b,d,this._mapData[c].tile)}}}else{this._total++;if(f){f.call(b,d,this._mapData[c].tile)}}}},collideSpriteVsGroup:function(e,h,g,f,c){this._potentials=this.quadTree.retrieve(e);for(var d=0,b=this._potentials.length;d0)?c.deltaX():0),c.lastY,c.width+((c.deltaX()>0)?c.deltaX():-c.deltaX()),c.height);this._bounds2.setTo(b.x-((b.deltaX()>0)?b.deltaX():0),b.lastY,b.width+((b.deltaX()>0)?b.deltaX():-b.deltaX()),b.height);if((this._bounds1.right>this._bounds2.x)&&(this._bounds1.xthis._bounds2.y)&&(this._bounds1.yb.deltaX()){this._overlap=c.x+c.width-b.x;if((this._overlap>this._maxOverlap)||c.allowCollision.right==false||b.allowCollision.left==false){this._overlap=0}else{c.touching.right=true;b.touching.left=true}}else{if(c.deltaX()this._maxOverlap)||c.allowCollision.left==false||b.allowCollision.right==false){this._overlap=0}else{c.touching.left=true;b.touching.right=true}}}}}if(this._overlap!=0){c.overlapX=this._overlap;b.overlapX=this._overlap;if(c.customSeparateX||b.customSeparateX){return true}this._velocity1=c.velocity.x;this._velocity2=b.velocity.x;if(!c.immovable&&!b.immovable){this._overlap*=0.5;c.x=c.x-this._overlap;b.x+=this._overlap;this._newVelocity1=Math.sqrt((this._velocity2*this._velocity2*b.mass)/c.mass)*((this._velocity2>0)?1:-1);this._newVelocity2=Math.sqrt((this._velocity1*this._velocity1*c.mass)/b.mass)*((this._velocity1>0)?1:-1);this._average=(this._newVelocity1+this._newVelocity2)*0.5;this._newVelocity1-=this._average;this._newVelocity2-=this._average;c.velocity.x=this._average+this._newVelocity1*c.bounce.x;b.velocity.x=this._average+this._newVelocity2*b.bounce.x}else{if(!c.immovable){c.x=c.x-this._overlap;c.velocity.x=this._velocity2-this._velocity1*c.bounce.x}else{if(!b.immovable){b.x+=this._overlap;b.velocity.x=this._velocity1-this._velocity2*b.bounce.x}}}return true}else{return false}},separateY:function(c,b){if(c.immovable&&b.immovable){return false}this._overlap=0;if(c.deltaY()!=b.deltaY()){this._bounds1.setTo(c.x,c.y-((c.deltaY()>0)?c.deltaY():0),c.width,c.height+c.deltaAbsY());this._bounds2.setTo(b.x,b.y-((b.deltaY()>0)?b.deltaY():0),b.width,b.height+b.deltaAbsY());if((this._bounds1.right>this._bounds2.x)&&(this._bounds1.xthis._bounds2.y)&&(this._bounds1.yb.deltaY()){this._overlap=c.y+c.height-b.y;if((this._overlap>this._maxOverlap)||c.allowCollision.down==false||b.allowCollision.up==false){this._overlap=0}else{c.touching.down=true;b.touching.up=true}}else{if(c.deltaY()this._maxOverlap)||c.allowCollision.up==false||b.allowCollision.down==false){this._overlap=0}else{c.touching.up=true;b.touching.down=true}}}}}if(this._overlap!=0){c.overlapY=this._overlap;b.overlapY=this._overlap;if(c.customSeparateY||b.customSeparateY){return true}this._velocity1=c.velocity.y;this._velocity2=b.velocity.y;if(!c.immovable&&!b.immovable){this._overlap*=0.5;c.y=c.y-this._overlap;b.y+=this._overlap;this._newVelocity1=Math.sqrt((this._velocity2*this._velocity2*b.mass)/c.mass)*((this._velocity2>0)?1:-1);this._newVelocity2=Math.sqrt((this._velocity1*this._velocity1*c.mass)/b.mass)*((this._velocity1>0)?1:-1);this._average=(this._newVelocity1+this._newVelocity2)*0.5;this._newVelocity1-=this._average;this._newVelocity2-=this._average;c.velocity.y=this._average+this._newVelocity1*c.bounce.y;b.velocity.y=this._average+this._newVelocity2*b.bounce.y}else{if(!c.immovable){c.y=c.y-this._overlap;c.velocity.y=this._velocity2-this._velocity1*c.bounce.y;if(b.active&&b.moves&&(c.deltaY()>b.deltaY())){c.x+=b.x-b.lastX}}else{if(!b.immovable){b.y+=this._overlap;b.velocity.y=this._velocity1-this._velocity2*b.bounce.y;if(c.sprite.active&&c.moves&&(c.deltaY()h)&&(this._bounds1.xg)&&(this._bounds1.yh)&&(this._bounds1.xg)&&(this._bounds1.y0){this._overlap=d.bottom-g;if(d.allowCollision.down&&b&&this._overlap0){var h=this.distanceBetween(g,e);f=h/(c/1000)}g.body.velocity.x=Math.cos(b)*f;g.body.velocity.y=Math.sin(b)*f},accelerateTowardsObject:function(f,d,e,b,g){b=b||1000;g=g||1000;var c=this.angleBetween(f,d);f.body.velocity.x=0;f.body.velocity.y=0;f.body.acceleration.x=Math.cos(c)*e;f.body.acceleration.y=Math.sin(c)*e;f.body.maxVelocity.x=b;f.body.maxVelocity.y=g},moveTowardsMouse:function(f,e,c){e=e||60;c=c||0;var b=this.angleBetweenMouse(f);if(c>0){var g=this.distanceToMouse(f);e=g/(c/1000)}f.body.velocity.x=Math.cos(b)*e;f.body.velocity.y=Math.sin(b)*e},accelerateTowardsMouse:function(e,d,b,f){b=b||1000;f=f||1000;var c=this.angleBetweenMouse(e);e.body.velocity.x=0;e.body.velocity.y=0;e.body.acceleration.x=Math.cos(c)*d;e.body.acceleration.y=Math.sin(c)*d;e.body.maxVelocity.x=b;e.body.maxVelocity.y=f},moveTowardsPoint:function(f,g,e,c){e=e||60;c=c||0;var b=this.angleBetweenPoint(f,g);if(c>0){var h=this.distanceToPoint(f,g);e=h/(c/1000)}f.body.velocity.x=Math.cos(b)*e;f.body.velocity.y=Math.sin(b)*e},accelerateTowardsPoint:function(e,f,d,b,g){b=b||1000;g=g||1000;var c=this.angleBetweenPoint(e,f);e.body.velocity.x=0;e.body.velocity.y=0;e.body.acceleration.x=Math.cos(c)*d;e.body.acceleration.y=Math.sin(c)*d;e.body.maxVelocity.x=b;e.body.maxVelocity.y=g},distanceBetween:function(e,c){var f=e.center.x-c.center.x;var d=e.center.y-c.center.y;return Math.sqrt(f*f+d*d)},distanceToPoint:function(c,e){var d=c.center.x-e.x;var b=c.center.y-e.y;return Math.sqrt(d*d+b*b)},distanceToMouse:function(c){var d=c.center.x-this.game.input.x;var b=c.center.y-this.game.input.y;return Math.sqrt(d*d+b*b)},angleBetweenPoint:function(c,f,e){e=e||false;var d=f.x-c.center.x;var b=f.y-c.center.y;if(e){return this.game.math.radToDeg(Math.atan2(b,d))}else{return Math.atan2(b,d)}},angleBetween:function(e,c,g){g=g||false;var f=c.center.x-e.center.x;var d=c.center.y-e.center.y;if(g){return this.game.math.radToDeg(Math.atan2(d,f))}else{return Math.atan2(d,f)}},velocityFromFacing:function(b,c){},angleBetweenMouse:function(c,e){e=e||false;var d=this.game.input.x-c.bounds.x;var b=this.game.input.y-c.bounds.y;if(e){return this.game.math.radToDeg(Math.atan2(b,d))}else{return Math.atan2(b,d)}}};Phaser.Physics.Arcade.Body=function(b){this.sprite=b;this.game=b.game;this.offset=new Phaser.Point;this.x=b.x;this.y=b.y;this.sourceWidth=b.currentFrame.sourceSizeW;this.sourceHeight=b.currentFrame.sourceSizeH;this.width=b.currentFrame.sourceSizeW;this.height=b.currentFrame.sourceSizeH;this.halfWidth=Math.floor(b.currentFrame.sourceSizeW/2);this.halfHeight=Math.floor(b.currentFrame.sourceSizeH/2);this._sx=b.scale.x;this._sy=b.scale.y;this.velocity=new Phaser.Point;this.acceleration=new Phaser.Point;this.drag=new Phaser.Point;this.gravity=new Phaser.Point;this.bounce=new Phaser.Point;this.maxVelocity=new Phaser.Point(10000,10000);this.angularVelocity=0;this.angularAcceleration=0;this.angularDrag=0;this.maxAngular=1000;this.mass=1;this.quadTreeIDs=[];this.quadTreeIndex=-1;this.allowCollision={none:false,any:true,up:true,down:true,left:true,right:true};this.touching={none:true,up:false,down:false,left:false,right:false};this.wasTouching={none:true,up:false,down:false,left:false,right:false};this.immovable=false;this.moves=true;this.rotation=0;this.allowRotation=true;this.allowGravity=true;this.customSeparateX=false;this.customSeparateY=false;this.overlapX=0;this.overlapY=0;this.collideWorldBounds=false;this.lastX=b.x;this.lastY=b.y};Phaser.Physics.Arcade.Body.prototype={updateBounds:function(e,d,c,b){if(c!=this._sx||b!=this._sy){this.width=this.sourceWidth*c;this.height=this.sourceHeight*b;this.halfWidth=Math.floor(this.width/2);this.halfHeight=Math.floor(this.height/2);this._sx=c;this._sy=b}},update:function(){this.wasTouching.none=this.touching.none;this.wasTouching.up=this.touching.up;this.wasTouching.down=this.touching.down;this.wasTouching.left=this.touching.left;this.wasTouching.right=this.touching.right;this.touching.none=true;this.touching.up=false;this.touching.down=false;this.touching.left=false;this.touching.right=false;this.lastX=this.x;this.lastY=this.y;this.rotation=this.sprite.angle;this.x=(this.sprite.x-(this.sprite.anchor.x*this.width))+this.offset.x;this.y=(this.sprite.y-(this.sprite.anchor.y*this.height))+this.offset.y;if(this.moves){this.game.physics.updateMotion(this)}if(this.collideWorldBounds){this.checkWorldBounds()}if(this.allowCollision.none==false&&this.sprite.visible&&this.sprite.alive){this.quadTreeIDs=[];this.quadTreeIndex=-1;this.game.physics.quadTree.insert(this)}this.sprite.x=this.x-this.offset.x+(this.sprite.anchor.x*this.width);this.sprite.y=this.y-this.offset.y+(this.sprite.anchor.y*this.height);if(this.allowRotation){this.sprite.angle=this.rotation}},postUpdate:function(){this.sprite.x=this.x-this.offset.x+(this.sprite.anchor.x*this.width);this.sprite.y=this.y-this.offset.y+(this.sprite.anchor.y*this.height);if(this.allowRotation){this.sprite.angle=this.rotation}},checkWorldBounds:function(){if(this.xthis.game.world.bounds.right){this.x=this.game.world.bounds.right-this.width;this.velocity.x*=-this.bounce.x}}if(this.ythis.game.world.bounds.bottom){this.y=this.game.world.bounds.bottom-this.height;this.velocity.y*=-this.bounce.y}}},setSize:function(d,c,b,e){b=b||this.offset.x;e=e||this.offset.y;this.sourceWidth=d;this.sourceHeight=c;this.width=this.sourceWidth*this._sx;this.height=this.sourceHeight*this._sy;this.halfWidth=Math.floor(this.width/2);this.halfHeight=Math.floor(this.height/2);this.offset.setTo(b,e)},reset:function(){this.velocity.setTo(0,0);this.acceleration.setTo(0,0);this.angularVelocity=0;this.angularAcceleration=0;this.x=(this.sprite.x-(this.sprite.anchor.x*this.width))+this.offset.x;this.y=(this.sprite.y-(this.sprite.anchor.y*this.height))+this.offset.y;this.lastX=this.x;this.lastY=this.y},deltaAbsX:function(){return(this.deltaX()>0?this.deltaX():-this.deltaX())},deltaAbsY:function(){return(this.deltaY()>0?this.deltaY():-this.deltaY())},deltaX:function(){return this.x-this.lastX},deltaY:function(){return this.y-this.lastY}};Object.defineProperty(Phaser.Physics.Arcade.Body.prototype,"bottom",{get:function(){return this.y+this.height},set:function(b){if(b<=this.y){this.height=0}else{this.height=(this.y-b)}}});Object.defineProperty(Phaser.Physics.Arcade.Body.prototype,"right",{get:function(){return this.x+this.width},set:function(b){if(b<=this.x){this.width=0}else{this.width=this.x+b}}});Phaser.Particles=function(b){this.emitters={};this.ID=0};Phaser.Particles.prototype={emitters:null,add:function(b){this.emitters[b.name]=b;return b},remove:function(b){delete this.emitters[b.name]},update:function(){for(var b in this.emitters){if(this.emitters[b].exists){this.emitters[b].update()}}}};Phaser.Particles.Arcade={};Phaser.Particles.Arcade.Emitter=function(c,b,e,d){d=d||50;Phaser.Group.call(this,c);this.name="emitter"+this.game.particles.ID++;this.type=Phaser.EMITTER;this.x=0;this.y=0;this.width=1;this.height=1;this.minParticleSpeed=new Phaser.Point(-100,-100);this.maxParticleSpeed=new Phaser.Point(100,100);this.minParticleScale=1;this.maxParticleScale=1;this.minRotation=-360;this.maxRotation=360;this.gravity=2;this.particleClass=null;this.particleDrag=new Phaser.Point();this.frequency=100;this.maxParticles=d;this.lifespan=2000;this.bounce=0;this._quantity=0;this._timer=0;this._counter=0;this._explode=true;this.on=false;this.exists=true;this.emitX=b;this.emitY=e};Phaser.Particles.Arcade.Emitter.prototype=Object.create(Phaser.Group.prototype);Phaser.Particles.Arcade.Emitter.prototype.constructor=Phaser.Particles.Arcade.Emitter;Phaser.Particles.Arcade.Emitter.prototype.update=function(){if(this.on){if(this._explode){this._counter=0;do{this.emitParticle();this._counter++}while(this._counter=this._timer){this.emitParticle();this._counter++;if(this._quantity>0){if(this._counter>=this._quantity){this.on=false}}this._timer=this.game.time.now+this.frequency}}}};Phaser.Particles.Arcade.Emitter.prototype.makeParticles=function(d,h,f,e){if(typeof h=="undefined"){h=0}f=f||this.maxParticles;e=e||0;var j;var b=0;var c=d;var g=0;while(b0){j.body.allowCollision.any=true;j.body.allowCollision.none=false}else{j.body.allowCollision.none=true}j.exists=false;j.visible=false;j.anchor.setTo(0.5,0.5);this.add(j);b++}return this};Phaser.Particles.Arcade.Emitter.prototype.kill=function(){this.on=false;this.alive=false;this.exists=false};Phaser.Particles.Arcade.Emitter.prototype.revive=function(){this.alive=true;this.exists=true};Phaser.Particles.Arcade.Emitter.prototype.start=function(b,e,d,c){if(typeof b!=="boolean"){b=true}e=e||0;d=d||250;c=c||0;this.revive();this.visible=true;this.on=true;this._explode=b;this.lifespan=e;this.frequency=d;this._quantity+=c;this._counter=0;this._timer=this.game.time.now+d};Phaser.Particles.Arcade.Emitter.prototype.emitParticle=function(){var c=this.getFirstExists(false);if(c==null){return}if(this.width>1||this.height>1){c.reset(this.emiteX-this.game.rnd.integerInRange(this.left,this.right),this.emiteY-this.game.rnd.integerInRange(this.top,this.bottom))}else{c.reset(this.emitX,this.emitY)}c.lifespan=this.lifespan;c.body.bounce.setTo(this.bounce,this.bounce);if(this.minParticleSpeed.x!=this.maxParticleSpeed.x){c.body.velocity.x=this.game.rnd.integerInRange(this.minParticleSpeed.x,this.maxParticleSpeed.x)}else{c.body.velocity.x=this.minParticleSpeed.x}if(this.minParticleSpeed.y!=this.maxParticleSpeed.y){c.body.velocity.y=this.game.rnd.integerInRange(this.minParticleSpeed.y,this.maxParticleSpeed.y)}else{c.body.velocity.y=this.minParticleSpeed.y}c.body.gravity.y=this.gravity;if(this.minRotation!=this.maxRotation){c.body.angularVelocity=this.game.rnd.integerInRange(this.minRotation,this.maxRotation)}else{c.body.angularVelocity=this.minRotation}if(this.minParticleScale!==1||this.maxParticleScale!==1){var b=this.game.rnd.realInRange(this.minParticleScale,this.maxParticleScale);c.scale.setTo(b,b)}c.body.drag.x=this.particleDrag.x;c.body.drag.y=this.particleDrag.y};Phaser.Particles.Arcade.Emitter.prototype.setSize=function(c,b){this.width=c;this.height=b};Phaser.Particles.Arcade.Emitter.prototype.setXSpeed=function(c,b){c=c||0;b=b||0;this.minParticleSpeed.x=c;this.maxParticleSpeed.x=b};Phaser.Particles.Arcade.Emitter.prototype.setYSpeed=function(c,b){c=c||0;b=b||0;this.minParticleSpeed.y=c;this.maxParticleSpeed.y=b};Phaser.Particles.Arcade.Emitter.prototype.setRotation=function(c,b){c=c||0;b=b||0;this.minRotation=c;this.maxRotation=b};Phaser.Particles.Arcade.Emitter.prototype.at=function(b){this.emitX=b.center.x;this.emitY=b.center.y};Object.defineProperty(Phaser.Particles.Arcade.Emitter.prototype,"alpha",{get:function(){return this._container.alpha},set:function(b){this._container.alpha=b}});Object.defineProperty(Phaser.Particles.Arcade.Emitter.prototype,"visible",{get:function(){return this._container.visible},set:function(b){this._container.visible=b}});Object.defineProperty(Phaser.Particles.Arcade.Emitter.prototype,"x",{get:function(){return this.emitX},set:function(b){this.emitX=b}});Object.defineProperty(Phaser.Particles.Arcade.Emitter.prototype,"y",{get:function(){return this.emitY},set:function(b){this.emitY=b}});Object.defineProperty(Phaser.Particles.Arcade.Emitter.prototype,"left",{get:function(){return Math.floor(this.x-(this.width/2))}});Object.defineProperty(Phaser.Particles.Arcade.Emitter.prototype,"right",{get:function(){return Math.floor(this.x+(this.width/2))}});Object.defineProperty(Phaser.Particles.Arcade.Emitter.prototype,"top",{get:function(){return Math.floor(this.y-(this.height/2))}});Object.defineProperty(Phaser.Particles.Arcade.Emitter.prototype,"bottom",{get:function(){return Math.floor(this.y+(this.height/2))}});Phaser.Tilemap=function(d,e,b,i,g,h,c){if(typeof g==="undefined"){g=true}if(typeof h==="undefined"){h=0}if(typeof c==="undefined"){c=0}this.game=d;this.group=null;this.name="";this.key=e;this.renderOrderID=0;this.collisionCallback=null;this.exists=true;this.visible=true;this.tiles=[];this.layers=[];var f=this.game.cache.getTilemap(e);PIXI.DisplayObjectContainer.call(this);this.position.x=b;this.position.y=i;this.type=Phaser.TILEMAP;this.renderer=new Phaser.TilemapRenderer(this.game);this.mapFormat=f.format;switch(this.mapFormat){case Phaser.Tilemap.CSV:this.parseCSV(f.mapData,e,h,c);break;case Phaser.Tilemap.JSON:this.parseTiledJSON(f.mapData,e);break}if(this.currentLayer&&g){this.game.world.setSize(this.currentLayer.widthInPixels,this.currentLayer.heightInPixels,true)}};Phaser.Tilemap.prototype=Object.create(PIXI.DisplayObjectContainer.prototype);Phaser.Tilemap.prototype.constructor=Phaser.Tilemap;Phaser.Tilemap.CSV=0;Phaser.Tilemap.JSON=1;Phaser.Tilemap.prototype.parseCSV=function(d,j,h,g){var f=new Phaser.TilemapLayer(this,0,j,Phaser.Tilemap.CSV,"TileLayerCSV"+this.layers.length.toString(),h,g);d=d.trim();var k=d.split("\n");for(var e=0;e0){f.addColumn(c)}}f.updateBounds();f.createCanvas();var b=f.parseTileOffsets();this.currentLayer=f;this.collisionLayer=f;this.layers.push(f);this.generateTiles(b)};Phaser.Tilemap.prototype.parseTiledJSON=function(g,f){for(var e=0;e0){this.collisionCallback.call(this.collisionCallbackContext,b,this._tempCollisionData)}return true}else{return false}};Phaser.Tilemap.prototype.putTile=function(b,e,c,d){if(typeof d==="undefined"){d=this.currentLayer.ID}this.layers[d].putTile(b,e,c)};Phaser.Tilemap.prototype.update=function(){this.renderer.render(this)};Phaser.Tilemap.prototype.destroy=function(){this.tiles.length=0;this.layers.length=0};Object.defineProperty(Phaser.Tilemap.prototype,"widthInPixels",{get:function(){return this.currentLayer.widthInPixels}});Object.defineProperty(Phaser.Tilemap.prototype,"heightInPixels",{get:function(){return this.currentLayer.heightInPixels}});Phaser.TilemapLayer=function(f,i,e,d,c,h,b){this.exists=true;this.visible=true;this.widthInTiles=0;this.heightInTiles=0;this.widthInPixels=0;this.heightInPixels=0;this.tileMargin=0;this.tileSpacing=0;this.parent=f;this.game=f.game;this.ID=i;this.name=c;this.key=e;this.type=Phaser.TILEMAPLAYER;this.mapFormat=d;this.tileWidth=h;this.tileHeight=b;this.boundsInTiles=new Phaser.Rectangle();var g=this.game.cache.getTilemap(e);this.tileset=g.data;this._alpha=1;this.canvas=null;this.context=null;this.baseTexture=null;this.texture=null;this.sprite=null;this.mapData=[];this._tempTileBlock=[];this._tempBlockResults=[]};Phaser.TilemapLayer.prototype={putTileWorldXY:function(b,d,c){b=this.game.math.snapToFloor(b,this.tileWidth)/this.tileWidth;d=this.game.math.snapToFloor(d,this.tileHeight)/this.tileHeight;if(d>=0&&d=0&&b=0&&d=0&&bthis.widthInPixels||b.body.y<0||b.body.bottom>this.heightInPixels){return this._tempBlockResults}this._tempTileX=this.game.math.snapToFloor(b.body.x,this.tileWidth)/this.tileWidth;this._tempTileY=this.game.math.snapToFloor(b.body.y,this.tileHeight)/this.tileHeight;this._tempTileW=(this.game.math.snapToCeil(b.body.width,this.tileWidth)+this.tileWidth)/this.tileWidth;this._tempTileH=(this.game.math.snapToCeil(b.body.height,this.tileHeight)+this.tileHeight)/this.tileHeight;this.getTempBlock(this._tempTileX,this._tempTileY,this._tempTileW,this._tempTileH,true);for(var c=0;cthis.widthInTiles){g=this.widthInTiles}if(c>this.heightInTiles){c=this.heightInTiles}this._tempTileBlock=[];for(var b=h;b=0&&c=0&&bb.widthInTiles){this._maxX=b.widthInTiles}if(this._maxY>b.heightInTiles){this._maxY=b.heightInTiles}if(this._startX+this._maxX>b.widthInTiles){this._startX=b.widthInTiles-this._maxX}if(this._startY+this._maxY>b.heightInTiles){this._startY=b.heightInTiles-this._maxY}this._dx=-(this.game.camera.x-(this._startX*b.tileWidth));this._dy=-(this.game.camera.y-(this._startY*b.tileHeight));this._tx=this._dx;this._ty=this._dy;if(b.alpha!==1){this._ga=b.context.globalAlpha;b.context.globalAlpha=b.alpha}b.context.clearRect(0,0,b.canvas.width,b.canvas.height);for(var f=this._startY;f-1){b.context.globalAlpha=this._ga}if(this.game.renderType==Phaser.WEBGL){PIXI.texturesToUpdate.push(b.baseTexture)}}return true}};