2014-03-30 19:52:00 +00:00
/* Phaser v2.0.2 - http://phaser.io - @photonstorm - (c) 2014 Photon Storm Ltd. */
2014-03-24 23:38:52 +00:00
( function ( ) { var a = this , b = b || { } ; b . WEBGL _RENDERER = 0 , b . CANVAS _RENDERER = 1 , b . VERSION = "v1.5.0" , b . blendModes = { NORMAL : 0 , ADD : 1 , MULTIPLY : 2 , SCREEN : 3 , OVERLAY : 4 , DARKEN : 5 , LIGHTEN : 6 , COLOR _DODGE : 7 , COLOR _BURN : 8 , HARD _LIGHT : 9 , SOFT _LIGHT : 10 , DIFFERENCE : 11 , EXCLUSION : 12 , HUE : 13 , SATURATION : 14 , COLOR : 15 , LUMINOSITY : 16 } , b . scaleModes = { DEFAULT : 0 , LINEAR : 0 , NEAREST : 1 } , b . INTERACTION _FREQUENCY = 30 , b . AUTO _PREVENT _DEFAULT = ! 0 , b . RAD _TO _DEG = 180 / Math . PI , b . DEG _TO _RAD = Math . PI / 180 , b . Point = function ( a , b ) { this . x = a || 0 , this . y = b || 0 } , b . Point . prototype . clone = function ( ) { return new b . Point ( this . x , this . y ) } , b . Point . prototype . constructor = b . Point , b . Point . prototype . set = function ( a , b ) { this . x = a || 0 , this . y = b || ( 0 !== b ? this . x : 0 ) } , b . Rectangle = function ( a , b , c , d ) { this . x = a || 0 , this . y = b || 0 , this . width = c || 0 , this . height = d || 0 } , b . Rectangle . prototype . clone = function ( ) { return new b . Rectangle ( this . x , this . y , this . width , this . height ) } , b . Rectangle . prototype . contains = function ( a , b ) { if ( this . width <= 0 || this . height <= 0 ) return ! 1 ; var c = this . x ; if ( a >= c && a <= c + this . width ) { var d = this . y ; if ( b >= d && b <= d + this . height ) return ! 0 } return ! 1 } , b . Rectangle . prototype . constructor = b . Rectangle , b . EmptyRectangle = new b . Rectangle ( 0 , 0 , 0 , 0 ) , b . Polygon = function ( a ) { if ( a instanceof Array || ( a = Array . prototype . slice . call ( arguments ) ) , "number" == typeof a [ 0 ] ) { for ( var c = [ ] , d = 0 , e = a . length ; e > d ; d += 2 ) c . push ( new b . Point ( a [ d ] , a [ d + 1 ] ) ) ; a = c } this . points = a } , b . Polygon . prototype . clone = function ( ) { for ( var a = [ ] , c = 0 ; c < this . points . length ; c ++ ) a . push ( this . points [ c ] . clone ( ) ) ; return new b . Polygon ( a ) } , b . Polygon . prototype . contains = function ( a , b ) { for ( var c = ! 1 , d = 0 , e = this . points . length - 1 ; d < this . points . length ; e = d ++ ) { var f = this . points [ d ] . x , g = this . points [ d ] . y , h = this . points [ e ] . x , i = this . points [ e ] . y , j = g > b != i > b && ( h - f ) * ( b - g ) / ( i - g ) + f > a ; j && ( c = ! c ) } return c } , b . Polygon . prototype . constructor = b . Polygon , b . Circle = function ( a , b , c ) { this . x = a || 0 , this . y = b || 0 , this . radius = c || 0 } , b . Circle . prototype . clone = function ( ) { return new b . Circle ( this . x , this . y , this . radius ) } , b . Circle . prototype . contains = function ( a , b ) { if ( this . radius <= 0 ) return ! 1 ; var c = this . x - a , d = this . y - b , e = this . radius * this . radius ; return c *= c , d *= d , e >= c + d } , b . Circle . prototype . constructor = b . Circle , b . Ellipse = function ( a , b , c , d ) { this . x = a || 0 , this . y = b || 0 , this . width = c || 0 , this . height = d || 0 } , b . Ellipse . prototype . clone = function ( ) { return new b . Ellipse ( this . x , this . y , this . width , this . height ) } , b . Ellipse . prototype . contains = function ( a , b ) { if ( this . width <= 0 || this . height <= 0 ) return ! 1 ; var c = ( a - this . x ) / this . width , d = ( b - this . y ) / this . height ; return c *= c , d *= d , 1 >= c + d } , b . Ellipse . prototype . getBounds = function ( ) { return new b . Rectangle ( this . x , this . y , this . width , this . height ) } , b . Ellipse . prototype . constructor = b . Ellipse , b . determineMatrixArrayType = function ( ) { return "undefined" != typeof Float32Array ? Float32Array : Array } , b . Matrix2 = b . determineMatrixArrayType ( ) , b . Matrix = function ( ) { this . a = 1 , this . b = 0 , this . c = 0 , this . d = 1 , this . tx = 0 , this . ty = 0 } , b . Matrix . prototype . fromArray = function ( a ) { this . a = a [ 0 ] , this . b = a [ 1 ] , this . c = a [ 3 ] , this . d = a [ 4 ] , this . tx = a [ 2 ] , this . ty = a [ 5 ] } , b . Matrix . prototype . toArray = function ( a ) { this . array || ( this . array = new Float32Array ( 9 ) ) ; var b = this . array ; return a ? ( this . array [ 0 ] = this . a , this . array [ 1 ] = this . c , this . array [ 2 ] = 0 , this . array [ 3 ] = this . b , this . array [ 4 ] = this . d , this . array [ 5 ] = 0 , this . array [ 6 ] = this . tx , this . array [ 7 ] = this . ty , this . array [ 8 ] = 1 ) : ( this . array [ 0 ] = this . a , this . array [ 1 ] = this . b , this . array [ 2 ] = this . tx , this . array [ 3 ] = this . c , this . array [ 4 ] = this . d , this . array [ 5 ] = this . ty , this . array [ 6 ] = 0 , this . array [ 7 ] = 0 , this . array [ 8 ] = 1 ) , b } , b . identityMatrix = new b . Matrix , b . DisplayObject = function ( ) { this . position = new b . Point , this . scale = new b . Point ( 1 , 1 ) , this . pivot = new b . Point ( 0 , 0 ) , this . rotation = 0 , this . alpha = 1 , this . visible = ! 0 , this . hitArea = null , this . buttonMode = ! 1 , this . renderable = ! 1 , this . parent = null , this . stage = null , this . worldAlpha = 1 , this . _interactive = ! 1 , this . defaultCursor = "pointer" , this . worldTransform = new b . Matrix , this . color = [ ] , this . dynamic = ! 0 , this . _sr = 0 , this . _cr = 1 , this . filterArea = new b . Rectangle ( 0 , 0 , 1 , 1 ) , this . _bounds = new b . Rectangle ( 0 , 0 , 1 , 1 ) , this . _currentBounds = null , this . _mask = null , this . _cacheAsBitmap = ! 1 , this . _cacheIsDirty = ! 1 } , b . DisplayObject . prototype . constructor = b . DisplayObject , b . DisplayObject . prototype . setInteractive = function ( a ) { this . interactive =
} , b . PixiFastShader . prototype . init = function ( ) { var a = this . gl , c = b . compileProgram ( a , this . vertexSrc , this . fragmentSrc ) ; a . useProgram ( c ) , this . uSampler = a . getUniformLocation ( c , "uSampler" ) , this . projectionVector = a . getUniformLocation ( c , "projectionVector" ) , this . offsetVector = a . getUniformLocation ( c , "offsetVector" ) , this . dimensions = a . getUniformLocation ( c , "dimensions" ) , this . uMatrix = a . getUniformLocation ( c , "uMatrix" ) , this . aVertexPosition = a . getAttribLocation ( c , "aVertexPosition" ) , this . aPositionCoord = a . getAttribLocation ( c , "aPositionCoord" ) , this . aScale = a . getAttribLocation ( c , "aScale" ) , this . aRotation = a . getAttribLocation ( c , "aRotation" ) , this . aTextureCoord = a . getAttribLocation ( c , "aTextureCoord" ) , this . colorAttribute = a . getAttribLocation ( c , "aColor" ) , - 1 === this . colorAttribute && ( this . colorAttribute = 2 ) , this . attributes = [ this . aVertexPosition , this . aPositionCoord , this . aScale , this . aRotation , this . aTextureCoord , this . colorAttribute ] , this . program = c } , b . PixiFastShader . prototype . destroy = function ( ) { this . gl . deleteProgram ( this . program ) , this . uniforms = null , this . gl = null , this . attributes = null } , b . StripShader = function ( ) { this . program = null , this . fragmentSrc = [ "precision mediump float;" , "varying vec2 vTextureCoord;" , "varying float vColor;" , "uniform float alpha;" , "uniform sampler2D uSampler;" , "void main(void) {" , " gl_FragColor = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y));" , " gl_FragColor = gl_FragColor * alpha;" , "}" ] , this . vertexSrc = [ "attribute vec2 aVertexPosition;" , "attribute vec2 aTextureCoord;" , "attribute float aColor;" , "uniform mat3 translationMatrix;" , "uniform vec2 projectionVector;" , "varying vec2 vTextureCoord;" , "uniform vec2 offsetVector;" , "varying float vColor;" , "void main(void) {" , " vec3 v = translationMatrix * vec3(aVertexPosition, 1.0);" , " v -= offsetVector.xyx;" , " gl_Position = vec4( v.x / projectionVector.x -1.0, v.y / projectionVector.y + 1.0 , 0.0, 1.0);" , " vTextureCoord = aTextureCoord;" , " vColor = aColor;" , "}" ] } , b . StripShader . prototype . init = function ( ) { var a = b . gl , c = b . compileProgram ( a , this . vertexSrc , this . fragmentSrc ) ; a . useProgram ( c ) , this . uSampler = a . getUniformLocation ( c , "uSampler" ) , this . projectionVector = a . getUniformLocation ( c , "projectionVector" ) , this . offsetVector = a . getUniformLocation ( c , "offsetVector" ) , this . colorAttribute = a . getAttribLocation ( c , "aColor" ) , this . aVertexPosition = a . getAttribLocation ( c , "aVertexPosition" ) , this . aTextureCoord = a . getAttribLocation ( c , "aTextureCoord" ) , this . translationMatrix = a . getUniformLocation ( c , "translationMatrix" ) , this . alpha = a . getUniformLocation ( c , "alpha" ) , this . program = c } , b . PrimitiveShader = function ( a ) { this . gl = a , this . program = null , this . fragmentSrc = [ "precision mediump float;" , "varying vec4 vColor;" , "void main(void) {" , " gl_FragColor = vColor;" , "}" ] , this . vertexSrc = [ "attribute vec2 aVertexPosition;" , "attribute vec4 aColor;" , "uniform mat3 translationMatrix;" , "uniform vec2 projectionVector;" , "uniform vec2 offsetVector;" , "uniform float alpha;" , "uniform vec3 tint;" , "varying vec4 vColor;" , "void main(void) {" , " vec3 v = translationMatrix * vec3(aVertexPosition , 1.0);" , " v -= offsetVector.xyx;" , " gl_Position = vec4( v.x / projectionVector.x -1.0, v.y / -projectionVector.y + 1.0 , 0.0, 1.0);" , " vColor = aColor * vec4(tint * alpha, alpha);" , "}" ] , this . init ( ) } , b . PrimitiveShader . prototype . init = function ( ) { var a = this . gl , c = b . compileProgram ( a , this . vertexSrc , this . fragmentSrc ) ; a . useProgram ( c ) , this . projectionVector = a . getUniformLocation ( c , "projectionVector" ) , this . offsetVector = a . getUniformLocation ( c , "offsetVector" ) , this . tintColor = a . getUniformLocation ( c , "tint" ) , this . aVertexPosition = a . getAttribLocation ( c , "aVertexPosition" ) , this . colorAttribute = a . getAttribLocation ( c , "aColor" ) , this . attributes = [ this . aVertexPosition , this . colorAttribute ] , this . translationMatrix = a . getUniformLocation ( c , "translationMatrix" ) , this . alpha = a . getUniformLocation ( c , "alpha" ) , this . program = c } , b . PrimitiveShader . prototype . destroy = function ( ) { this . gl . deleteProgram ( this . program ) , this . uniforms = null , this . gl = null , this . attribute = null } , b . WebGLGraphics = function ( ) { } , b . WebGLGraphics . renderGraphics = function ( a , c ) { var d = c . gl , e = c . projection , f = c . offset , g = c . shaderManager . primitiveShader ; a . _w
2014-03-30 19:52:00 +00:00
} , b . WebGLFilterManager . prototype . applyFilterPass = function ( a , c , d , e ) { var f = this . gl , g = a . shaders [ f . id ] ; g || ( g = new b . PixiShader ( f ) , g . fragmentSrc = a . fragmentSrc , g . uniforms = a . uniforms , g . init ( ) , a . shaders [ f . id ] = g ) , f . useProgram ( g . program ) , f . uniform2f ( g . projectionVector , d / 2 , - e / 2 ) , f . uniform2f ( g . offsetVector , 0 , 0 ) , a . uniforms . dimensions && ( a . uniforms . dimensions . value [ 0 ] = this . width , a . uniforms . dimensions . value [ 1 ] = this . height , a . uniforms . dimensions . value [ 2 ] = this . vertexArray [ 0 ] , a . uniforms . dimensions . value [ 3 ] = this . vertexArray [ 5 ] ) , g . syncUniforms ( ) , f . bindBuffer ( f . ARRAY _BUFFER , this . vertexBuffer ) , f . vertexAttribPointer ( g . aVertexPosition , 2 , f . FLOAT , ! 1 , 0 , 0 ) , f . bindBuffer ( f . ARRAY _BUFFER , this . uvBuffer ) , f . vertexAttribPointer ( g . aTextureCoord , 2 , f . FLOAT , ! 1 , 0 , 0 ) , f . bindBuffer ( f . ARRAY _BUFFER , this . colorBuffer ) , f . vertexAttribPointer ( g . colorAttribute , 2 , f . FLOAT , ! 1 , 0 , 0 ) , f . bindBuffer ( f . ELEMENT _ARRAY _BUFFER , this . indexBuffer ) , f . drawElements ( f . TRIANGLES , 6 , f . UNSIGNED _SHORT , 0 ) , this . renderSession . drawCount ++ } , b . WebGLFilterManager . prototype . initShaderBuffers = function ( ) { var a = this . gl ; this . vertexBuffer = a . createBuffer ( ) , this . uvBuffer = a . createBuffer ( ) , this . colorBuffer = a . createBuffer ( ) , this . indexBuffer = a . createBuffer ( ) , this . vertexArray = new Float32Array ( [ 0 , 0 , 1 , 0 , 0 , 1 , 1 , 1 ] ) , a . bindBuffer ( a . ARRAY _BUFFER , this . vertexBuffer ) , a . bufferData ( a . ARRAY _BUFFER , this . vertexArray , a . STATIC _DRAW ) , this . uvArray = new Float32Array ( [ 0 , 0 , 1 , 0 , 0 , 1 , 1 , 1 ] ) , a . bindBuffer ( a . ARRAY _BUFFER , this . uvBuffer ) , a . bufferData ( a . ARRAY _BUFFER , this . uvArray , a . STATIC _DRAW ) , this . colorArray = new Float32Array ( [ 1 , 16777215 , 1 , 16777215 , 1 , 16777215 , 1 , 16777215 ] ) , a . bindBuffer ( a . ARRAY _BUFFER , this . colorBuffer ) , a . bufferData ( a . ARRAY _BUFFER , this . colorArray , a . STATIC _DRAW ) , a . bindBuffer ( a . ELEMENT _ARRAY _BUFFER , this . indexBuffer ) , a . bufferData ( a . ELEMENT _ARRAY _BUFFER , new Uint16Array ( [ 0 , 1 , 2 , 1 , 3 , 2 ] ) , a . STATIC _DRAW ) } , b . WebGLFilterManager . prototype . destroy = function ( ) { var a = this . gl ; this . filterStack = null , this . offsetX = 0 , this . offsetY = 0 ; for ( var b = 0 ; b < this . texturePool . length ; b ++ ) this . texturePool . destroy ( ) ; this . texturePool = null , a . deleteBuffer ( this . vertexBuffer ) , a . deleteBuffer ( this . uvBuffer ) , a . deleteBuffer ( this . colorBuffer ) , a . deleteBuffer ( this . indexBuffer ) } , b . FilterTexture = function ( a , b , c ) { this . gl = a , this . frameBuffer = a . createFramebuffer ( ) , this . texture = a . createTexture ( ) , a . bindTexture ( a . TEXTURE _2D , this . texture ) , a . texParameteri ( a . TEXTURE _2D , a . TEXTURE _MAG _FILTER , a . LINEAR ) , a . texParameteri ( a . TEXTURE _2D , a . TEXTURE _MIN _FILTER , a . LINEAR ) , a . texParameteri ( a . TEXTURE _2D , a . TEXTURE _WRAP _S , a . CLAMP _TO _EDGE ) , a . texParameteri ( a . TEXTURE _2D , a . TEXTURE _WRAP _T , a . CLAMP _TO _EDGE ) , a . bindFramebuffer ( a . FRAMEBUFFER , this . framebuffer ) , a . bindFramebuffer ( a . FRAMEBUFFER , this . frameBuffer ) , a . framebufferTexture2D ( a . FRAMEBUFFER , a . COLOR _ATTACHMENT0 , a . TEXTURE _2D , this . texture , 0 ) , this . resize ( b , c ) } , b . FilterTexture . prototype . clear = function ( ) { var a = this . gl ; a . clearColor ( 0 , 0 , 0 , 0 ) , a . clear ( a . COLOR _BUFFER _BIT ) } , b . FilterTexture . prototype . resize = function ( a , b ) { if ( this . width !== a || this . height !== b ) { this . width = a , this . height = b ; var c = this . gl ; c . bindTexture ( c . TEXTURE _2D , this . texture ) , c . texImage2D ( c . TEXTURE _2D , 0 , c . RGBA , a , b , 0 , c . RGBA , c . UNSIGNED _BYTE , null ) } } , b . FilterTexture . prototype . destroy = function ( ) { var a = this . gl ; a . deleteFramebuffer ( this . frameBuffer ) , a . deleteTexture ( this . texture ) , this . frameBuffer = null , this . texture = null } , b . CanvasMaskManager = function ( ) { } , b . CanvasMaskManager . prototype . pushMask = function ( a , c ) { c . save ( ) ; var d = a . alpha , e = a . worldTransform ; c . setTransform ( e . a , e . c , e . b , e . d , e . tx , e . ty ) , b . CanvasGraphics . renderGraphicsMask ( a , c ) , c . clip ( ) , a . worldAlpha = d } , b . CanvasMaskManager . prototype . popMask = function ( a ) { a . restore ( ) } , b . CanvasTinter = function ( ) { } , b . CanvasTinter . getTintedTexture = function ( a , c ) { var d = a . texture ; c = b . CanvasTinter . roundColor ( c ) ; var e = "#" + ( "00000" + ( 0 | c ) . toString ( 16 ) ) . substr ( - 6 ) ; if ( d . tintCache = d . tintCache || { } , d . tintCache [ e ] ) return d . tintCache [ e ] ; var f = b . CanvasTinter . canvas || document . createElement ( "canvas" ) ; if ( b . CanvasTinter . tintMethod ( d , c , f ) , b . CanvasTinter . convertTintToImage ) { var g = new Image ; g . src = f . toDataURL ( ) , d . tintCache [ e ] = g } else d . tintCache [ e ] = f , b . CanvasTinter . canvas = null ; return f } , b . CanvasTinter . tintWithMultiply = function ( a , b , c ) { v
a = new Array ( g + 1 ) . join ( c ) + a + new Array ( f + 1 ) . join ( c ) ; break ; default : a += new Array ( b + 1 - a . length ) . join ( c ) } return a } , isPlainObject : function ( a ) { if ( "object" != typeof a || a . nodeType || a === a . window ) return ! 1 ; try { if ( a . constructor && ! { } . hasOwnProperty . call ( a . constructor . prototype , "isPrototypeOf" ) ) return ! 1 } catch ( b ) { return ! 1 } return ! 0 } , extend : function ( ) { var a , c , d , e , f , g , h = arguments [ 0 ] || { } , i = 1 , j = arguments . length , k = ! 1 ; for ( "boolean" == typeof h && ( k = h , h = arguments [ 1 ] || { } , i = 2 ) , j === i && ( h = this , -- i ) ; j > i ; i ++ ) if ( null != ( a = arguments [ i ] ) ) for ( c in a ) d = h [ c ] , e = a [ c ] , h !== e && ( k && e && ( b . Utils . isPlainObject ( e ) || ( f = Array . isArray ( e ) ) ) ? ( f ? ( f = ! 1 , g = d && Array . isArray ( d ) ? d : [ ] ) : g = d && b . Utils . isPlainObject ( d ) ? d : { } , h [ c ] = b . Utils . extend ( k , g , e ) ) : void 0 !== e && ( h [ c ] = e ) ) ; return h } } , "function" != typeof Function . prototype . bind && ( Function . prototype . bind = function ( ) { var a = Array . prototype . slice ; return function ( b ) { function c ( ) { var f = e . concat ( a . call ( arguments ) ) ; d . apply ( this instanceof c ? this : b , f ) } var d = this , e = a . call ( arguments , 1 ) ; if ( "function" != typeof d ) throw new TypeError ; return c . prototype = function f ( a ) { return a && ( f . prototype = a ) , this instanceof f ? void 0 : new f } ( d . prototype ) , c } } ( ) ) , Array . isArray || ( Array . isArray = function ( a ) { return "[object Array]" == Object . prototype . toString . call ( a ) } ) , b . Circle = function ( a , b , c ) { a = a || 0 , b = b || 0 , c = c || 0 , this . x = a , this . y = b , this . _diameter = c , this . _radius = c > 0 ? . 5 * c : 0 } , b . Circle . prototype = { circumference : function ( ) { return 2 * Math . PI * this . _radius } , setTo : function ( a , b , c ) { return this . x = a , this . y = b , this . _diameter = c , this . _radius = . 5 * c , this } , copyFrom : function ( a ) { return this . setTo ( a . x , a . y , a . diameter ) } , copyTo : function ( a ) { return a . x = this . x , a . y = this . y , a . diameter = this . _diameter , a } , distance : function ( a , c ) { return "undefined" == typeof c && ( c = ! 1 ) , c ? b . Math . distanceRound ( this . x , this . y , a . x , a . y ) : b . Math . distance ( this . x , this . y , a . x , a . y ) } , clone : function ( a ) { return "undefined" == typeof a ? a = new b . Circle ( this . x , this . y , this . diameter ) : a . setTo ( this . x , this . y , this . diameter ) , a } , contains : function ( a , c ) { return b . Circle . contains ( this , a , c ) } , circumferencePoint : function ( a , c , d ) { return b . Circle . circumferencePoint ( this , a , c , d ) } , offset : function ( a , b ) { return this . x += a , this . y += b , this } , offsetPoint : function ( a ) { return this . offset ( a . x , a . y ) } , toString : function ( ) { return "[{Phaser.Circle (x=" + this . x + " y=" + this . y + " diameter=" + this . diameter + " radius=" + this . radius + ")}]" } } , b . Circle . prototype . constructor = b . Circle , Object . defineProperty ( b . Circle . prototype , "diameter" , { get : function ( ) { return this . _diameter } , set : function ( a ) { a > 0 && ( this . _diameter = a , this . _radius = . 5 * a ) } } ) , Object . defineProperty ( b . Circle . prototype , "radius" , { get : function ( ) { return this . _radius } , set : function ( a ) { a > 0 && ( this . _radius = a , this . _diameter = 2 * a ) } } ) , Object . defineProperty ( b . Circle . prototype , "left" , { get : function ( ) { return this . x - this . _radius } , set : function ( a ) { a > this . x ? ( this . _radius = 0 , this . _diameter = 0 ) : this . radius = this . x - a } } ) , Object . defineProperty ( b . Circle . prototype , "right" , { get : function ( ) { return this . x + this . _radius } , set : function ( a ) { a < this . x ? ( this . _radius = 0 , this . _diameter = 0 ) : this . radius = a - this . x } } ) , Object . defineProperty ( b . Circle . prototype , "top" , { get : function ( ) { return this . y - this . _radius } , set : function ( a ) { a > this . y ? ( this . _radius = 0 , this . _diameter = 0 ) : this . radius = this . y - a } } ) , Object . defineProperty ( b . Circle . prototype , "bottom" , { get : function ( ) { return this . y + this . _radius } , set : function ( a ) { a < this . y ? ( this . _radius = 0 , this . _diameter = 0 ) : this . radius = a - this . y } } ) , Object . defineProperty ( b . Circle . prototype , "area" , { get : function ( ) { return this . _radius > 0 ? Math . PI * this . _radius * this . _radius : 0 } } ) , Object . defineProperty ( b . Circle . prototype , "empty" , { get : function ( ) { return 0 === this . _diameter } , set : function ( a ) { a === ! 0 && this . setTo ( 0 , 0 , 0 ) } } ) , b . Circle . contains = function ( a , b , c ) { if ( a . radius > 0 && b >= a . left && b <= a . right && c >= a . top && c <= a . bottom ) { var d = ( a . x - b ) * ( a . x - b ) , e = ( a . y - c ) * ( a . y - c ) ; return d + e <= a . radius * a . radius } return ! 1 } , b . Circle . equals = function ( a , b ) { return a . x == b . x && a . y == b . y && a . diameter == b . diameter } , b . Circle . intersects = function ( a , c ) { return b . Math . distance ( a . x , a . y , c . x , c . y ) <= a . radius + c . radius } , b . Circle . circumferencePoint = function ( a , c , d , e ) { return "undefined" == typeof d && ( d = ! 1 ) , "undefined" == typeof e && ( e = new b . Point ) , d === ! 0 && ( c = b . Math . degToRad ( c ) ) , e . x = a . x
2014-03-24 23:38:52 +00:00
} } ) , b . Plugin = function ( a , b ) { "undefined" == typeof b && ( b = null ) , this . game = a , this . parent = b , this . active = ! 1 , this . visible = ! 1 , this . hasPreUpdate = ! 1 , this . hasUpdate = ! 1 , this . hasPostUpdate = ! 1 , this . hasRender = ! 1 , this . hasPostRender = ! 1 } , b . Plugin . prototype = { preUpdate : function ( ) { } , update : function ( ) { } , render : function ( ) { } , postRender : function ( ) { } , destroy : function ( ) { this . game = null , this . parent = null , this . active = ! 1 , this . visible = ! 1 } } , b . Plugin . prototype . constructor = b . Plugin , b . PluginManager = function ( a , b ) { this . game = a , this . _parent = b , this . plugins = [ ] , this . _pluginsLength = 0 } , b . PluginManager . prototype = { add : function ( a ) { var b = ! 1 ; return "function" == typeof a ? a = new a ( this . game , this . _parent ) : ( a . game = this . game , a . parent = this . _parent ) , "function" == typeof a . preUpdate && ( a . hasPreUpdate = ! 0 , b = ! 0 ) , "function" == typeof a . update && ( a . hasUpdate = ! 0 , b = ! 0 ) , "function" == typeof a . postUpdate && ( a . hasPostUpdate = ! 0 , b = ! 0 ) , "function" == typeof a . render && ( a . hasRender = ! 0 , b = ! 0 ) , "function" == typeof a . postRender && ( a . hasPostRender = ! 0 , b = ! 0 ) , b ? ( ( a . hasPreUpdate || a . hasUpdate || a . hasPostUpdate ) && ( a . active = ! 0 ) , ( a . hasRender || a . hasPostRender ) && ( a . visible = ! 0 ) , this . _pluginsLength = this . plugins . push ( a ) , "function" == typeof a . init && a . init ( ) , a ) : null } , remove : function ( a ) { if ( 0 !== this . _pluginsLength ) for ( this . _p = 0 ; this . _p < this . _pluginsLength ; this . _p ++ ) if ( this . plugins [ this . _p ] === a ) return a . destroy ( ) , this . plugins . splice ( this . _p , 1 ) , void this . _pluginsLength -- } , removeAll : function ( ) { for ( this . _p = 0 ; this . _p < this . _pluginsLength ; this . _p ++ ) this . plugins [ this . _p ] . destroy ( ) ; this . plugins . length = 0 , this . _pluginsLength = 0 } , preUpdate : function ( ) { if ( 0 !== this . _pluginsLength ) for ( this . _p = 0 ; this . _p < this . _pluginsLength ; this . _p ++ ) this . plugins [ this . _p ] . active && this . plugins [ this . _p ] . hasPreUpdate && this . plugins [ this . _p ] . preUpdate ( ) } , update : function ( ) { if ( 0 !== this . _pluginsLength ) for ( this . _p = 0 ; this . _p < this . _pluginsLength ; this . _p ++ ) this . plugins [ this . _p ] . active && this . plugins [ this . _p ] . hasUpdate && this . plugins [ this . _p ] . update ( ) } , postUpdate : function ( ) { if ( 0 !== this . _pluginsLength ) for ( this . _p = 0 ; this . _p < this . _pluginsLength ; this . _p ++ ) this . plugins [ this . _p ] . active && this . plugins [ this . _p ] . hasPostUpdate && this . plugins [ this . _p ] . postUpdate ( ) } , render : function ( ) { if ( 0 !== this . _pluginsLength ) for ( this . _p = 0 ; this . _p < this . _pluginsLength ; this . _p ++ ) this . plugins [ this . _p ] . visible && this . plugins [ this . _p ] . hasRender && this . plugins [ this . _p ] . render ( ) } , postRender : function ( ) { if ( 0 !== this . _pluginsLength ) for ( this . _p = 0 ; this . _p < this . _pluginsLength ; this . _p ++ ) this . plugins [ this . _p ] . visible && this . plugins [ this . _p ] . hasPostRender && this . plugins [ this . _p ] . postRender ( ) } , destroy : function ( ) { this . plugins . length = 0 , this . _pluginsLength = 0 , this . game = null , this . _parent = null } } , b . PluginManager . prototype . constructor = b . PluginManager , b . Stage = function ( a , c , d ) { this . game = a , this . offset = new b . Point , PIXI . Stage . call ( this , 0 , ! 1 ) , this . name = "_stage_root" , this . interactive = ! 1 , this . disableVisibilityChange = ! 1 , this . checkOffsetInterval = 2500 , this . exists = ! 0 , this . currentRenderOrderID = 0 , this . _hiddenVar = "hidden" , this . _nextOffsetCheck = 0 , this . _backgroundColor = 0 , a . config ? this . parseConfig ( a . config ) : ( this . game . canvas = b . Canvas . create ( c , d ) , this . game . canvas . style [ "-webkit-full-screen" ] = "width: 100%; height: 100%" ) } , b . Stage . prototype = Object . create ( PIXI . Stage . prototype ) , b . Stage . prototype . constructor = b . Stage , b . Stage . prototype . preUpdate = function ( ) { this . currentRenderOrderID = 0 ; for ( var a = this . children . length , b = 0 ; a > b ; b ++ ) this . children [ b ] . preUpdate ( ) } , b . Stage . prototype . update = function ( ) { for ( var a = this . children . length ; a -- ; ) this . children [ a ] . update ( ) } , b . Stage . prototype . postUpdate = function ( ) { if ( this . game . world . camera . target ) { this . game . world . camera . target . postUpdate ( ) , this . game . world . camera . update ( ) ; for ( var a = this . children . length ; a -- ; ) this . children [ a ] !== this . game . world . camera . target && this . children [ a ] . postUpdate ( ) } else { this . game . world . camera . update ( ) ; for ( var a = this . children . length ; a -- ; ) this . children [ a ] . postUpdate ( ) } this . checkOffsetInterval !== ! 1 && this . game . time . now > this . _nextOffsetCheck && ( b . Canvas . getOffset ( this . game . canvas , this . offset ) , this . _nextOffsetCheck = this . game . time . now + this . checkOffsetInterval ) } , b . Stage . prototype . parseConfig = function ( a ) { this . game . canvas = a . canvasID ? b
2014-03-30 19:52:00 +00:00
} , setUpRenderer : function ( ) { if ( this . device . trident && ( this . renderType = b . CANVAS ) , this . renderType === b . HEADLESS || this . renderType === b . CANVAS || this . renderType === b . AUTO && this . device . webGL === ! 1 ) { if ( ! this . device . canvas ) throw new Error ( "Phaser.Game - cannot create Canvas or WebGL context, aborting." ) ; this . renderType === b . AUTO && ( this . renderType = b . CANVAS ) , this . renderer = new PIXI . CanvasRenderer ( this . width , this . height , this . canvas , this . transparent ) , this . context = this . renderer . context } else this . renderType = b . WEBGL , this . renderer = new PIXI . WebGLRenderer ( this . width , this . height , this . canvas , this . transparent , this . antialias ) , this . context = null ; this . renderType !== b . HEADLESS && ( this . stage . smoothed = this . antialias , b . Canvas . addToDOM ( this . canvas , this . parent , ! 0 ) , b . Canvas . setTouchAction ( this . canvas ) ) } , update : function ( a ) { this . time . update ( a ) , this . _paused || this . pendingStep ? this . debug . preUpdate ( ) : ( this . stepping && ( this . pendingStep = ! 0 ) , this . debug . preUpdate ( ) , this . physics . preUpdate ( ) , this . state . preUpdate ( ) , this . plugins . preUpdate ( ) , this . stage . preUpdate ( ) , this . stage . update ( ) , this . tweens . update ( ) , this . sound . update ( ) , this . input . update ( ) , this . state . update ( ) , this . physics . update ( ) , this . particles . update ( ) , this . plugins . update ( ) , this . stage . postUpdate ( ) , this . plugins . postUpdate ( ) ) , this . renderType != b . HEADLESS && ( this . renderer . render ( this . stage ) , this . plugins . render ( ) , this . state . render ( ) , this . plugins . postRender ( ) ) } , enableStep : function ( ) { this . stepping = ! 0 , this . pendingStep = ! 1 , this . stepCount = 0 } , disableStep : function ( ) { this . stepping = ! 1 , this . pendingStep = ! 1 } , step : function ( ) { this . pendingStep = ! 1 , this . stepCount ++ } , destroy : function ( ) { this . raf . stop ( ) , this . input . destroy ( ) , this . state . destroy ( ) , this . physics . 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 = ! 1 } , gamePaused : function ( a ) { this . _paused || ( this . _paused = ! 0 , this . time . gamePaused ( ) , this . sound . setMute ( ) , this . onPause . dispatch ( a ) ) } , gameResumed : function ( a ) { this . _paused && ! this . _codePaused && ( this . _paused = ! 1 , this . time . gameResumed ( ) , this . input . reset ( ) , this . sound . unsetMute ( ) , this . onResume . dispatch ( a ) ) } , focusLoss : function ( a ) { this . onBlur . dispatch ( a ) , this . gamePaused ( a ) } , focusGain : function ( a ) { this . onFocus . dispatch ( a ) , this . gameResumed ( a ) } } , b . Game . prototype . constructor = b . Game , Object . defineProperty ( b . Game . prototype , "paused" , { get : function ( ) { return this . _paused } , set : function ( a ) { a === ! 0 ? this . _paused === ! 1 && ( this . _paused = ! 0 , this . _codePaused = ! 0 , this . sound . mute = ! 0 , this . time . gamePaused ( ) , this . onPause . dispatch ( this ) ) : this . _paused && ( this . _paused = ! 1 , this . _codePaused = ! 1 , this . input . reset ( ) , this . sound . mute = ! 1 , this . time . gameResumed ( ) , this . onResume . dispatch ( this ) ) } } ) , b . Input = function ( a ) { this . game = a , this . hitCanvas = null , this . hitContext = null , this . moveCallback = null , this . moveCallbackContext = this , this . pollRate = 0 , this . disabled = ! 1 , this . multiInputOverride = b . Input . MOUSE _TOUCH _COMBINE , this . position = null , this . speed = null , this . circle = null , this . scale = null , this . maxPointers = 10 , this . currentPointers = 0 , this . tapRate = 200 , this . doubleTapRate = 300 , this . holdRate = 2e3 , this . justPressedRate = 200 , this . justReleasedRate = 200 , this . recordPointerHistory = ! 1 , this . recordRate = 100 , this . recordLimit = 100 , this . pointer1 = null , this . pointer2 = null , this . pointer3 = null , this . pointer4 = null , this . pointer5 = null , this . pointer6 = null , this . pointer7 = null , this . pointer8 = null , this . pointer9 = null , this . pointer10 = null , this . activePointer = null , this . mousePointer = null , this . mouse = null , this . keyboard = null , this . touch = null , this . mspointer = null , this . gamepad = null , this . onDown = null , this . onUp = null , this . onTap = null , this . onHold = null , this . interactiveItems = new b . LinkedList , this . _localPoint = new b . Point , this . _pollCounter = 0 , this . _oldPosition = null , this . _x = 0 , this . _y = 0 } , b . Input . MOUSE _OVERRIDES _TOUCH = 0 , b . Input . TOUCH _OVERRIDES _MOUSE = 1 , b . Input . MOUSE _TOUCH _COMBINE = 2 , b . Input . prototype = { boot : function ( ) { this . mousePointer = new b . Pointer ( this . game , 0 ) , this . pointer1 = new b . Pointer ( this . game , 1 ) , this . pointer2 = new b . Pointer ( this . game , 2 ) , this . mouse = new b . Mouse ( this . game ) , this . keyboard = new b . Keyboard ( this . game ) , this . touch = new b . Touch ( this . game ) , this . mspointer = new b . MSPointer ( this . game ) , this . ga
2014-03-24 23:38:52 +00:00
} , start : function ( ) { if ( ! this . _active ) { this . _active = ! 0 ; var a = this ; this . _ongamepadconnected = function ( b ) { var c = b . gamepad ; a . _rawPads . push ( c ) , a . _gamepads [ c . index ] . connect ( c ) } , window . addEventListener ( "gamepadconnected" , this . _ongamepadconnected , ! 1 ) , this . _ongamepaddisconnected = function ( b ) { var c = b . gamepad ; for ( var d in a . _rawPads ) a . _rawPads [ d ] . index === c . index && a . _rawPads . splice ( d , 1 ) ; a . _gamepads [ c . index ] . disconnect ( ) } , window . addEventListener ( "gamepaddisconnected" , this . _ongamepaddisconnected , ! 1 ) } } , update : function ( ) { this . _pollGamepads ( ) ; for ( var a = 0 ; a < this . _gamepads . length ; a ++ ) this . _gamepads [ a ] . _connected && this . _gamepads [ a ] . pollStatus ( ) } , _pollGamepads : function ( ) { var a = navigator . getGamepads || navigator . webkitGetGamepads && navigator . webkitGetGamepads ( ) || navigator . webkitGamepads ; if ( a ) { this . _rawPads = [ ] ; for ( var b = ! 1 , c = 0 ; c < a . length && ( typeof a [ c ] !== this . _prevRawGamepadTypes [ c ] && ( b = ! 0 , this . _prevRawGamepadTypes [ c ] = typeof a [ c ] ) , a [ c ] && this . _rawPads . push ( a [ c ] ) , 3 !== c ) ; c ++ ) ; if ( b ) { for ( var d , e = { rawIndices : { } , padIndices : { } } , f = 0 ; f < this . _gamepads . length ; f ++ ) if ( d = this . _gamepads [ f ] , d . connected ) for ( var g = 0 ; g < this . _rawPads . length ; g ++ ) this . _rawPads [ g ] . index === d . index && ( e . rawIndices [ d . index ] = ! 0 , e . padIndices [ f ] = ! 0 ) ; for ( var h = 0 ; h < this . _gamepads . length ; h ++ ) if ( d = this . _gamepads [ h ] , ! e . padIndices [ h ] ) { this . _rawPads . length < 1 && d . disconnect ( ) ; for ( var i = 0 ; i < this . _rawPads . length && ! e . padIndices [ h ] ; i ++ ) { var j = this . _rawPads [ i ] ; if ( j ) { if ( e . rawIndices [ j . index ] ) { d . disconnect ( ) ; continue } d . connect ( j ) , e . rawIndices [ j . index ] = ! 0 , e . padIndices [ h ] = ! 0 } else d . disconnect ( ) } } } } } , setDeadZones : function ( a ) { for ( var b = 0 ; b < this . _gamepads . length ; b ++ ) this . _gamepads [ b ] . deadZone = a } , stop : function ( ) { this . _active = ! 1 , window . removeEventListener ( "gamepadconnected" , this . _ongamepadconnected ) , window . removeEventListener ( "gamepaddisconnected" , this . _ongamepaddisconnected ) } , reset : function ( ) { this . update ( ) ; for ( var a = 0 ; a < this . _gamepads . length ; a ++ ) this . _gamepads [ a ] . reset ( ) } , justPressed : function ( a , b ) { for ( var c = 0 ; c < this . _gamepads . length ; c ++ ) if ( this . _gamepads [ c ] . justPressed ( a , b ) === ! 0 ) return ! 0 ; return ! 1 } , justReleased : function ( a , b ) { for ( var c = 0 ; c < this . _gamepads . length ; c ++ ) if ( this . _gamepads [ c ] . justReleased ( a , b ) === ! 0 ) return ! 0 ; return ! 1 } , isDown : function ( a ) { for ( var b = 0 ; b < this . _gamepads . length ; b ++ ) if ( this . _gamepads [ b ] . isDown ( a ) === ! 0 ) return ! 0 ; return ! 1 } } , b . Gamepad . prototype . constructor = b . Gamepad , Object . defineProperty ( b . Gamepad . prototype , "active" , { get : function ( ) { return this . _active } } ) , Object . defineProperty ( b . Gamepad . prototype , "supported" , { get : function ( ) { return this . _gamepadSupportAvailable } } ) , Object . defineProperty ( b . Gamepad . prototype , "padsConnected" , { get : function ( ) { return this . _rawPads . length } } ) , Object . defineProperty ( b . Gamepad . prototype , "pad1" , { get : function ( ) { return this . _gamepads [ 0 ] } } ) , Object . defineProperty ( b . Gamepad . prototype , "pad2" , { get : function ( ) { return this . _gamepads [ 1 ] } } ) , Object . defineProperty ( b . Gamepad . prototype , "pad3" , { get : function ( ) { return this . _gamepads [ 2 ] } } ) , Object . defineProperty ( b . Gamepad . prototype , "pad4" , { get : function ( ) { return this . _gamepads [ 3 ] } } ) , b . Gamepad . BUTTON _0 = 0 , b . Gamepad . BUTTON _1 = 1 , b . Gamepad . BUTTON _2 = 2 , b . Gamepad . BUTTON _3 = 3 , b . Gamepad . BUTTON _4 = 4 , b . Gamepad . BUTTON _5 = 5 , b . Gamepad . BUTTON _6 = 6 , b . Gamepad . BUTTON _7 = 7 , b . Gamepad . BUTTON _8 = 8 , b . Gamepad . BUTTON _9 = 9 , b . Gamepad . BUTTON _10 = 10 , b . Gamepad . BUTTON _11 = 11 , b . Gamepad . BUTTON _12 = 12 , b . Gamepad . BUTTON _13 = 13 , b . Gamepad . BUTTON _14 = 14 , b . Gamepad . BUTTON _15 = 15 , b . Gamepad . AXIS _0 = 0 , b . Gamepad . AXIS _1 = 1 , b . Gamepad . AXIS _2 = 2 , b . Gamepad . AXIS _3 = 3 , b . Gamepad . AXIS _4 = 4 , b . Gamepad . AXIS _5 = 5 , b . Gamepad . AXIS _6 = 6 , b . Gamepad . AXIS _7 = 7 , b . Gamepad . AXIS _8 = 8 , b . Gamepad . AXIS _9 = 9 , b . Gamepad . XBOX360 _A = 0 , b . Gamepad . XBOX360 _B = 1 , b . Gamepad . XBOX360 _X = 2 , b . Gamepad . XBOX360 _Y = 3 , b . Gamepad . XBOX360 _LEFT _BUMPER = 4 , b . Gamepad . XBOX360 _RIGHT _BUMPER = 5 , b . Gamepad . XBOX360 _LEFT _TRIGGER = 6 , b . Gamepad . XBOX360 _RIGHT _TRIGGER = 7 , b . Gamepad . XBOX360 _BACK = 8 , b . Gamepad . XBOX360 _START = 9 , b . Gamepad . XBOX360 _STICK _LEFT _BUTTON = 10 , b . Gamepad . XBOX360 _STICK _RIGHT _BUTTON = 11 , b . Gamepad . XBOX360 _DPAD _LEFT = 14 , b . Gamepad . XBOX360 _DPAD _RIGHT = 15 , b . Gamepad . XBOX360 _DPAD _UP = 12 , b . Gamepad . XBOX360 _DPAD _DOWN = 13 , b . Gamepad . XBOX360 _STICK _LEFT _X = 0 , b . Gamepad . XBOX360 _STICK _LEFT _Y = 1 , b . Gamepad . XBOX360 _S
2014-03-30 19:52:00 +00:00
if ( this . _cache [ 0 ] = this . world . x , this . _cache [ 1 ] = this . world . y , this . _cache [ 2 ] = this . rotation , ! this . exists || ! this . parent . exists ) return this . _cache [ 3 ] = - 1 , ! 1 ; if ( this . lifespan > 0 && ( this . lifespan -= this . game . time . elapsed , this . lifespan <= 0 ) ) return this . kill ( ) , ! 1 ; if ( ( this . autoCull || this . checkWorldBounds ) && this . _bounds . copyFrom ( this . getBounds ( ) ) , this . autoCull && ( this . renderable = this . game . world . camera . screenView . intersects ( this . _bounds ) ) , this . checkWorldBounds ) if ( 1 === this . _cache [ 5 ] && this . game . world . bounds . intersects ( this . _bounds ) ) this . _cache [ 5 ] = 0 , this . events . onEnterBounds . dispatch ( this ) ; else if ( 0 === this . _cache [ 5 ] && ! this . game . world . bounds . intersects ( this . _bounds ) && ( this . _cache [ 5 ] = 1 , this . events . onOutOfBounds . dispatch ( this ) , this . outOfBoundsKill ) ) return this . kill ( ) , ! 1 ; this . world . setTo ( this . game . camera . x + this . worldTransform . tx , this . game . camera . y + this . worldTransform . ty ) , this . visible && ( this . _cache [ 3 ] = this . game . stage . currentRenderOrderID ++ ) , this . animations . update ( ) , this . body && this . body . preUpdate ( ) ; for ( var a = 0 , b = this . children . length ; b > a ; a ++ ) this . children [ a ] . preUpdate ( ) ; return ! 0 } , b . Sprite . prototype . update = function ( ) { } , b . Sprite . prototype . postUpdate = function ( ) { this . key instanceof b . BitmapData && this . key . render ( ) , this . exists && this . body && this . body . postUpdate ( ) , 1 === this . _cache [ 7 ] && ( this . position . x = ( this . game . camera . view . x + this . cameraOffset . x ) / this . game . camera . scale . x , this . position . y = ( this . game . camera . view . y + this . cameraOffset . y ) / this . game . camera . scale . y ) ; for ( var a = 0 , c = this . children . length ; c > a ; a ++ ) this . children [ a ] . postUpdate ( ) } , b . Sprite . prototype . loadTexture = function ( a , c ) { return c = c || 0 , a instanceof b . RenderTexture ? ( this . key = a . key , void this . setTexture ( a ) ) : a instanceof b . BitmapData ? ( this . key = a , void this . setTexture ( a . texture ) ) : a instanceof PIXI . Texture ? ( this . key = a , void this . setTexture ( a ) ) : null === a || "undefined" == typeof a ? ( this . key = "__default" , void this . setTexture ( PIXI . TextureCache [ this . key ] ) ) : "string" != typeof a || this . game . cache . checkImageKey ( a ) ? this . game . cache . isSpriteSheet ( a ) ? ( this . key = a , this . animations . loadFrameData ( this . game . cache . getFrameData ( a ) ) , "string" == typeof c ? this . frameName = c : this . frame = c , void 0 ) : ( this . key = a , void this . setTexture ( PIXI . TextureCache [ a ] ) ) : ( this . key = "__missing" , void this . setTexture ( PIXI . TextureCache [ this . key ] ) ) } , b . Sprite . prototype . crop = function ( a ) { if ( "undefined" == typeof a || null === a ) this . texture . hasOwnProperty ( "sourceWidth" ) && this . texture . setFrame ( new b . Rectangle ( 0 , 0 , this . texture . sourceWidth , this . texture . sourceHeight ) ) ; else if ( this . texture instanceof PIXI . Texture ) { var c = { } ; b . Utils . extend ( ! 0 , c , this . texture ) , c . sourceWidth = c . width , c . sourceHeight = c . height , c . frame = a , c . width = a . width , c . height = a . height , this . texture = c , this . texture . updateFrame = ! 0 , PIXI . Texture . frameUpdates . push ( this . texture ) } else this . texture . setFrame ( a ) } , b . Sprite . prototype . revive = function ( a ) { return "undefined" == typeof a && ( a = 1 ) , this . alive = ! 0 , this . exists = ! 0 , this . visible = ! 0 , this . health = a , this . events && this . events . onRevived . dispatch ( this ) , this } , b . Sprite . prototype . kill = function ( ) { return this . alive = ! 1 , this . exists = ! 1 , this . visible = ! 1 , this . events && this . events . onKilled . dispatch ( this ) , this } , b . Sprite . prototype . destroy = function ( a ) { if ( null !== this . game ) { "undefined" == typeof a && ( a = ! 0 ) , this . parent && ( this . parent instanceof b . Group ? this . parent . remove ( this ) : this . parent . removeChild ( this ) ) , this . input && this . input . destroy ( ) , this . animations && this . animations . destroy ( ) , this . body && this . body . destroy ( ) , this . events && this . events . destroy ( ) ; var c = this . children . length ; if ( a ) for ( ; c -- ; ) this . children [ c ] . destroy ( a ) ; else for ( ; c -- ; ) this . removeChild ( this . children [ c ] ) ; this . alive = ! 1 , this . exists = ! 1 , this . visible = ! 1 , this . filters = null , this . mask = null , this . game = null } } , b . Sprite . prototype . damage = function ( a ) { return this . alive && ( this . health -= a , this . health <= 0 && this . kill ( ) ) , this } , b . Sprite . prototype . reset = function ( a , b , c ) { return "undefined" == typeof c && ( c = 1 ) , this . world . setTo ( a , b ) , this . position . x = a , this . position . y = b , this . alive = ! 0 , this . exists = ! 0 , this . visible = ! 0 , this . renderable = ! 0 , this . _outOfBoundsFired = ! 1 , this . health = c , this . body && this . body . reset ( a , b , ! 1 , ! 1 ) , this . _cache [ 4 ] = 1 , this } , b . Sprite . prototype . bringToTop = function ( ) { return this . parent && this . par
} , b . Button . prototype . setSounds = function ( a , b , c , d , e , f , g , h ) { this . setOverSound ( a , b ) , this . setOutSound ( e , f ) , this . setDownSound ( c , d ) , this . setUpSound ( g , h ) } , b . Button . prototype . setOverSound = function ( a , c ) { this . onOverSound = null , this . onOverSoundMarker = "" , a instanceof b . Sound && ( this . onOverSound = a ) , "string" == typeof c && ( this . onOverSoundMarker = c ) } , b . Button . prototype . setOutSound = function ( a , c ) { this . onOutSound = null , this . onOutSoundMarker = "" , a instanceof b . Sound && ( this . onOutSound = a ) , "string" == typeof c && ( this . onOutSoundMarker = c ) } , b . Button . prototype . setDownSound = function ( a , c ) { this . onDownSound = null , this . onDownSoundMarker = "" , a instanceof b . Sound && ( this . onDownSound = a ) , "string" == typeof c && ( this . onDownSoundMarker = c ) } , b . Button . prototype . setUpSound = function ( a , c ) { this . onUpSound = null , this . onUpSoundMarker = "" , a instanceof b . Sound && ( this . onUpSound = a ) , "string" == typeof c && ( this . onUpSoundMarker = c ) } , b . Button . prototype . onInputOverHandler = function ( a , b ) { this . freezeFrames === ! 1 && this . setState ( 1 ) , this . onOverSound && this . onOverSound . play ( this . onOverSoundMarker ) , this . onInputOver && this . onInputOver . dispatch ( this , b ) } , b . Button . prototype . onInputOutHandler = function ( a , b ) { this . freezeFrames === ! 1 && this . setState ( 2 ) , this . onOutSound && this . onOutSound . play ( this . onOutSoundMarker ) , this . onInputOut && this . onInputOut . dispatch ( this , b ) } , b . Button . prototype . onInputDownHandler = function ( a , b ) { this . freezeFrames === ! 1 && this . setState ( 3 ) , this . onDownSound && this . onDownSound . play ( this . onDownSoundMarker ) , this . onInputDown && this . onInputDown . dispatch ( this , b ) } , b . Button . prototype . onInputUpHandler = function ( a , b , c ) { this . onUpSound && this . onUpSound . play ( this . onUpSoundMarker ) , this . onInputUp && this . onInputUp . dispatch ( this , b , c ) , this . freezeFrames || this . setState ( this . forceOut ? 2 : null !== this . _onUpFrameName || null !== this . _onUpFrameID ? 4 : c ? 1 : 2 ) } , b . Button . prototype . setState = function ( a ) { 1 === a ? null != this . _onOverFrameName ? this . frameName = this . _onOverFrameName : null != this . _onOverFrameID && ( this . frame = this . _onOverFrameID ) : 2 === a ? null != this . _onOutFrameName ? this . frameName = this . _onOutFrameName : null != this . _onOutFrameID && ( this . frame = this . _onOutFrameID ) : 3 === a ? null != this . _onDownFrameName ? this . frameName = this . _onDownFrameName : null != this . _onDownFrameID && ( this . frame = this . _onDownFrameID ) : 4 === a && ( null != this . _onUpFrameName ? this . frameName = this . _onUpFrameName : null != this . _onUpFrameID && ( this . frame = this . _onUpFrameID ) ) } , b . Graphics = function ( a , c , d ) { c = c || 0 , d = d || 0 , this . game = a , this . exists = ! 0 , this . name = "" , this . type = b . GRAPHICS , this . z = 0 , this . world = new b . Point ( c , d ) , this . cameraOffset = new b . Point , PIXI . Graphics . call ( this ) , this . position . set ( c , d ) , this . _cache = [ 0 , 0 , 0 , 0 , 1 , 0 , 1 , 0 ] } , b . Graphics . prototype = Object . create ( PIXI . Graphics . prototype ) , b . Graphics . prototype . constructor = b . Graphics , b . Graphics . prototype . preUpdate = function ( ) { return this . _cache [ 0 ] = this . world . x , this . _cache [ 1 ] = this . world . y , this . _cache [ 2 ] = this . rotation , this . exists && this . parent . exists ? ( this . autoCull && ( this . renderable = this . game . world . camera . screenView . intersects ( this . getBounds ( ) ) ) , this . world . setTo ( this . game . camera . x + this . worldTransform [ 2 ] , this . game . camera . y + this . worldTransform [ 5 ] ) , this . visible && ( this . _cache [ 3 ] = this . game . stage . currentRenderOrderID ++ ) , ! 0 ) : ( this . renderOrderID = - 1 , ! 1 ) } , b . Graphics . prototype . update = function ( ) { } , b . Graphics . prototype . postUpdate = function ( ) { 1 === this . _cache [ 7 ] && ( this . position . x = ( this . game . camera . view . x + this . cameraOffset . x ) / this . game . camera . scale . x , this . position . y = ( this . game . camera . view . y + this . cameraOffset . y ) / this . game . camera . scale . y ) } , b . Graphics . prototype . destroy = function ( a ) { "undefined" == typeof a && ( a = ! 0 ) , this . clear ( ) , this . parent && ( this . parent instanceof b . Group ? this . parent . remove ( this ) : this . parent . removeChild ( this ) ) ; var c = this . children . length ; if ( a ) for ( ; c -- ; ) this . children [ c ] . destroy ( a ) ; else for ( ; c -- ; ) this . removeChild ( this . children [ c ] ) ; this . exists = ! 1 , this . visible = ! 1 , this . game = null } , b . Graphics . prototype . drawPolygon = function ( a ) { this . moveTo ( a . points [ 0 ] . x , a . points [ 0 ] . y ) ; for ( var b = 1 ; b < a . points . length ; b += 1 ) this . lineTo ( a . points [ b ] . x , a . points [ b ] . y ) ; this . lineTo ( a . points [ 0 ] . x , a . points [ 0 ] . y ) } , Object . defineProperty ( b . Graphics . prototype , "angle" , { get : function ( ) { return b . Math . radToDeg ( this . rotation ) } , set : funct
} , create : function ( a ) { return new b . Tween ( a , this . game , this ) } , remove : function ( a ) { var b = this . _tweens . indexOf ( a ) ; - 1 !== b && ( this . _tweens [ b ] . pendingDelete = ! 0 ) } , update : function ( ) { if ( 0 === this . _tweens . length && 0 === this . _add . length ) return ! 1 ; for ( var a = 0 , b = this . _tweens . length ; b > a ; ) this . _tweens [ a ] . update ( this . game . time . now ) ? a ++ : ( this . _tweens . splice ( a , 1 ) , b -- ) ; return this . _add . length > 0 && ( this . _tweens = this . _tweens . concat ( this . _add ) , this . _add . length = 0 ) , ! 0 } , isTweening : function ( a ) { return this . _tweens . some ( function ( b ) { return b . _object === a } ) } , _pauseAll : function ( ) { for ( var a = this . _tweens . length - 1 ; a >= 0 ; a -- ) this . _tweens [ a ] . _pause ( ) } , _resumeAll : function ( ) { for ( var a = this . _tweens . length - 1 ; a >= 0 ; a -- ) this . _tweens [ a ] . _resume ( ) } , pauseAll : function ( ) { for ( var a = this . _tweens . length - 1 ; a >= 0 ; a -- ) this . _tweens [ a ] . pause ( ) } , resumeAll : function ( ) { for ( var a = this . _tweens . length - 1 ; a >= 0 ; a -- ) this . _tweens [ a ] . resume ( ! 0 ) } } , b . TweenManager . prototype . constructor = b . TweenManager , b . Tween = function ( a , c , d ) { this . _object = a , this . game = c , this . _manager = d , this . _valuesStart = { } , this . _valuesEnd = { } , this . _valuesStartRepeat = { } , this . _duration = 1e3 , this . _repeat = 0 , this . _yoyo = ! 1 , this . _reversed = ! 1 , this . _delayTime = 0 , this . _startTime = null , this . _easingFunction = b . Easing . Linear . None , this . _interpolationFunction = b . Math . linearInterpolation , this . _chainedTweens = [ ] , this . _onStartCallbackFired = ! 1 , this . _onUpdateCallback = null , this . _onUpdateCallbackContext = null , this . _paused = ! 1 , this . _pausedTime = 0 , this . _codePaused = ! 1 , this . pendingDelete = ! 1 , this . onStart = new b . Signal , this . onLoop = new b . Signal , this . onComplete = new b . Signal , this . isRunning = ! 1 } , b . Tween . prototype = { to : function ( a , b , c , d , e , f , g ) { b = b || 1e3 , c = c || null , d = d || ! 1 , e = e || 0 , f = f || 0 , g = g || ! 1 ; var h ; return this . _parent ? ( h = this . _manager . create ( this . _object ) , this . _lastChild . chain ( h ) , this . _lastChild = h ) : ( h = this , this . _parent = this , this . _lastChild = this ) , h . _repeat = f , h . _duration = b , h . _valuesEnd = a , null !== c && ( h . _easingFunction = c ) , e > 0 && ( h . _delayTime = e ) , h . _yoyo = g , d ? this . start ( ) : this } , start : function ( ) { if ( null !== this . game && null !== this . _object ) { this . _manager . add ( this ) , this . isRunning = ! 0 , this . _onStartCallbackFired = ! 1 , this . _startTime = this . game . time . now + this . _delayTime ; for ( var a in this . _valuesEnd ) { if ( Array . isArray ( this . _valuesEnd [ a ] ) ) { if ( 0 === this . _valuesEnd [ a ] . length ) continue ; this . _valuesEnd [ a ] = [ this . _object [ a ] ] . concat ( this . _valuesEnd [ a ] ) } this . _valuesStart [ a ] = this . _object [ a ] , Array . isArray ( this . _valuesStart [ a ] ) || ( this . _valuesStart [ a ] *= 1 ) , this . _valuesStartRepeat [ a ] = this . _valuesStart [ a ] || 0 } return this } } , generateData : function ( a , b ) { if ( null === this . game || null === this . _object ) return null ; this . _startTime = 0 ; for ( var c in this . _valuesEnd ) { if ( Array . isArray ( this . _valuesEnd [ c ] ) ) { if ( 0 === this . _valuesEnd [ c ] . length ) continue ; this . _valuesEnd [ c ] = [ this . _object [ c ] ] . concat ( this . _valuesEnd [ c ] ) } this . _valuesStart [ c ] = this . _object [ c ] , Array . isArray ( this . _valuesStart [ c ] ) || ( this . _valuesStart [ c ] *= 1 ) , this . _valuesStartRepeat [ c ] = this . _valuesStart [ c ] || 0 } for ( var d = 0 , e = Math . floor ( a * ( this . _duration / 1e3 ) ) , f = this . _duration / e , g = [ ] ; e -- ; ) { var c , h = ( d - this . _startTime ) / this . _duration ; h = h > 1 ? 1 : h ; var i = this . _easingFunction ( h ) , j = { } ; for ( c in this . _valuesEnd ) { var k = this . _valuesStart [ c ] || 0 , l = this . _valuesEnd [ c ] ; l instanceof Array ? j [ c ] = this . _interpolationFunction ( l , i ) : ( "string" == typeof l && ( l = k + parseFloat ( l , 10 ) ) , "number" == typeof l && ( j [ c ] = k + ( l - k ) * i ) ) } g . push ( j ) , d += f } if ( this . _yoyo ) { var m = g . slice ( ) ; m . reverse ( ) , g = g . concat ( m ) } return "undefined" != typeof b ? b = b . concat ( g ) : g } , stop : function ( ) { return this . isRunning = ! 1 , this . _onUpdateCallback = null , this . _manager . remove ( this ) , this } , delay : function ( a ) { return this . _delayTime = a , this } , repeat : function ( a ) { return this . _repeat = a , this } , yoyo : function ( a ) { return this . _yoyo = a , this } , easing : function ( a ) { return this . _easingFunction = a , this } , interpolation : function ( a ) { return this . _interpolationFunction = a , this } , chain : function ( ) { return this . _chainedTweens = arguments , this } , loop : function ( ) { return this . _lastChild . chain ( this ) , this } , onUpdateCallback : function ( a , b ) { return this . _onUpdateCallback = a , this . _onUpdateCallbackContext = b , this } , pause : function ( ) { this . _codePaused = ! 0 , this . _paused = ! 0 , this . _pausedTime = this . game . time . now } , _pause : function ( ) { this . _codePaused || ( this
} , addSound : function ( a , b , c , d , e ) { d = d || ! 0 , e = e || ! 1 ; var f = ! 1 ; e && ( f = ! 0 ) , this . _sounds [ a ] = { url : b , data : c , isDecoding : ! 1 , decoded : f , webAudio : d , audioTag : e , locked : this . game . sound . touchLocked } } , reloadSound : function ( a ) { var b = this ; this . _sounds [ a ] && ( this . _sounds [ a ] . data . src = this . _sounds [ a ] . url , this . _sounds [ a ] . data . addEventListener ( "canplaythrough" , function ( ) { return b . reloadSoundComplete ( a ) } , ! 1 ) , this . _sounds [ a ] . data . load ( ) ) } , reloadSoundComplete : function ( a ) { this . _sounds [ a ] && ( this . _sounds [ a ] . locked = ! 1 , this . onSoundUnlock . dispatch ( a ) ) } , updateSound : function ( a , b , c ) { this . _sounds [ a ] && ( this . _sounds [ a ] [ b ] = c ) } , decodedSound : function ( a , b ) { this . _sounds [ a ] . data = b , this . _sounds [ a ] . decoded = ! 0 , this . _sounds [ a ] . isDecoding = ! 1 } , getCanvas : function ( a ) { return this . _canvases [ a ] ? this . _canvases [ a ] . canvas : void console . warn ( 'Phaser.Cache.getCanvas: Invalid key: "' + a + '"' ) } , getBitmapData : function ( a ) { return this . _bitmapDatas [ a ] ? this . _bitmapDatas [ a ] : void console . warn ( 'Phaser.Cache.getBitmapData: Invalid key: "' + a + '"' ) } , getBitmapFont : function ( a ) { return this . _bitmapFont [ a ] ? this . _bitmapFont [ a ] : void console . warn ( 'Phaser.Cache.getBitmapFont: Invalid key: "' + a + '"' ) } , getPhysicsData : function ( a , b ) { if ( "undefined" == typeof b || null === b ) { if ( this . _physics [ a ] ) return this . _physics [ a ] . data ; console . warn ( 'Phaser.Cache.getPhysicsData: Invalid key: "' + a + '"' ) } else { if ( this . _physics [ a ] && this . _physics [ a ] . data [ b ] ) return this . _physics [ a ] . data [ b ] ; console . warn ( 'Phaser.Cache.getPhysicsData: Invalid key/object: "' + a + " / " + b + '"' ) } return null } , checkImageKey : function ( a ) { return this . _images [ a ] ? ! 0 : ! 1 } , getImage : function ( a ) { return this . _images [ a ] ? this . _images [ a ] . data : void console . warn ( 'Phaser.Cache.getImage: Invalid key: "' + a + '"' ) } , getTilemapData : function ( a ) { return this . _tilemaps [ a ] ? this . _tilemaps [ a ] : void console . warn ( 'Phaser.Cache.getTilemapData: Invalid key: "' + a + '"' ) } , getFrameData : function ( a ) { return this . _images [ a ] && this . _images [ a ] . frameData ? this . _images [ a ] . frameData : null } , updateFrameData : function ( a , b ) { this . _images [ a ] && ( this . _images [ a ] . spriteSheet = ! 0 , this . _images [ a ] . frameData = b ) } , getFrameByIndex : function ( a , b ) { return this . _images [ a ] && this . _images [ a ] . frameData ? this . _images [ a ] . frameData . getFrame ( b ) : null } , getFrameByName : function ( a , b ) { return this . _images [ a ] && this . _images [ a ] . frameData ? this . _images [ a ] . frameData . getFrameByName ( b ) : null } , getFrame : function ( a ) { return this . _images [ a ] && this . _images [ a ] . spriteSheet === ! 1 ? this . _images [ a ] . frame : null } , getTextureFrame : function ( a ) { return this . _textures [ a ] ? this . _textures [ a ] . frame : null } , getTexture : function ( a ) { return this . _textures [ a ] ? this . _textures [ a ] : void console . warn ( 'Phaser.Cache.getTexture: Invalid key: "' + a + '"' ) } , getSound : function ( a ) { return this . _sounds [ a ] ? this . _sounds [ a ] : void console . warn ( 'Phaser.Cache.getSound: Invalid key: "' + a + '"' ) } , getSoundData : function ( a ) { return this . _sounds [ a ] ? this . _sounds [ a ] . data : void console . warn ( 'Phaser.Cache.getSoundData: Invalid key: "' + a + '"' ) } , isSoundDecoded : function ( a ) { return this . _sounds [ a ] ? this . _sounds [ a ] . decoded : void 0 } , isSoundReady : function ( a ) { return this . _sounds [ a ] && this . _sounds [ a ] . decoded && this . game . sound . touchLocked === ! 1 } , isSpriteSheet : function ( a ) { return this . _images [ a ] ? this . _images [ a ] . spriteSheet : ! 1 } , getText : function ( a ) { return this . _text [ a ] ? this . _text [ a ] . data : void console . warn ( 'Phaser.Cache.getText: Invalid key: "' + a + '"' ) } , getJSON : function ( a ) { return this . _json [ a ] ? this . _json [ a ] . data : void console . warn ( 'Phaser.Cache.getJSON: Invalid key: "' + a + '"' ) } , getBinary : function ( a ) { return this . _binary [ a ] ? this . _binary [ a ] : void console . warn ( 'Phaser.Cache.getBinary: Invalid key: "' + a + '"' ) } , getKeys : function ( a ) { var c = null ; switch ( a ) { case b . Cache . CANVAS : c = this . _canvases ; break ; case b . Cache . IMAGE : c = this . _images ; break ; case b . Cache . TEXTURE : c = this . _textures ; break ; case b . Cache . SOUND : c = this . _sounds ; break ; case b . Cache . TEXT : c = this . _text ; break ; case b . Cache . PHYSICS : c = this . _physics ; break ; case b . Cache . TILEMAP : c = this . _tilemaps ; break ; case b . Cache . BINARY : c = this . _binary ; break ; case b . Cache . BITMAPDATA : c = this . _bitmapDatas ; break ; case b . Cache . BITMAPFONT : c = this . _bitmapFont ; break ; case b . Cache . JSON : c = this . _json } if ( c ) { var d = [ ] ; for ( var e in c ) "__default" !== e && "__missing" !== e && d . push ( e ) ; r
} , set : function ( a ) { if ( this . _volume = a , this . usingWebAudio ) this . masterGain . gain . value = a ; else for ( var b = 0 ; b < this . _sounds . length ; b ++ ) this . _sounds [ b ] . usingAudioTag && ( this . _sounds [ b ] . volume = this . _sounds [ b ] . volume * a ) } } ) , b . Utils . Debug = function ( a ) { this . game = a , this . sprite = null , this . canvas = null , this . baseTexture = null , this . texture = null , this . textureFrame = null , this . context = null , this . font = "14px Courier" , this . columnWidth = 100 , this . lineHeight = 16 , this . renderShadow = ! 0 , this . currentX = 0 , this . currentY = 0 , this . currentAlpha = 1 , this . dirty = ! 1 } , b . Utils . Debug . prototype = { boot : function ( ) { this . game . renderType === b . CANVAS ? this . context = this . game . context : ( this . canvas = b . Canvas . create ( this . game . width , this . game . height , "" , ! 0 ) , this . context = this . canvas . getContext ( "2d" ) , this . baseTexture = new PIXI . BaseTexture ( this . canvas ) , this . texture = new PIXI . Texture ( this . baseTexture ) , this . textureFrame = new b . Frame ( 0 , 0 , 0 , this . game . width , this . game . height , "debug" , this . game . rnd . uuid ( ) ) , this . sprite = this . game . make . image ( 0 , 0 , this . texture , this . textureFrame ) , this . game . stage . addChild ( this . sprite ) ) } , preUpdate : function ( ) { this . dirty && this . sprite && ( this . context . clearRect ( 0 , 0 , this . game . width , this . game . height ) , this . dirty = ! 1 ) } , start : function ( a , b , c , d ) { "number" != typeof a && ( a = 0 ) , "number" != typeof b && ( b = 0 ) , c = c || "rgb(255,255,255)" , "undefined" == typeof d && ( d = 0 ) , this . currentX = a , this . currentY = b , this . currentColor = c , this . currentAlpha = this . context . globalAlpha , this . columnWidth = d , this . sprite && ( this . dirty = ! 0 ) , this . context . save ( ) , this . context . setTransform ( 1 , 0 , 0 , 1 , 0 , 0 ) , this . context . strokeStyle = c , this . context . fillStyle = c , this . context . font = this . font , this . context . globalAlpha = 1 } , stop : function ( ) { this . context . restore ( ) , this . context . globalAlpha = this . currentAlpha , this . sprite && PIXI . updateWebGLTexture ( this . baseTexture , this . game . renderer . gl ) } , line : function ( ) { for ( var a = this . currentX , b = 0 ; b < arguments . length ; b ++ ) this . renderShadow && ( this . context . fillStyle = "rgb(0,0,0)" , this . context . fillText ( arguments [ b ] , a + 1 , this . currentY + 1 ) , this . context . fillStyle = this . currentColor ) , this . context . fillText ( arguments [ b ] , a , this . currentY ) , a += this . columnWidth ; this . currentY += this . lineHeight } , soundInfo : function ( a , b , c , d ) { this . start ( b , c , d ) , this . line ( "Sound: " + a . key + " Locked: " + a . game . sound . touchLocked ) , this . line ( "Is Ready?: " + this . game . cache . isSoundReady ( a . key ) + " Pending Playback: " + a . pendingPlayback ) , this . line ( "Decoded: " + a . isDecoded + " Decoding: " + a . isDecoding ) , this . line ( "Total Duration: " + a . totalDuration + " Playing: " + a . isPlaying ) , this . line ( "Time: " + a . currentTime ) , this . line ( "Volume: " + a . volume + " Muted: " + a . mute ) , this . line ( "WebAudio: " + a . usingWebAudio + " Audio: " + a . usingAudioTag ) , "" !== a . currentMarker && ( this . line ( "Marker: " + a . currentMarker + " Duration: " + a . duration ) , this . line ( "Start: " + a . markers [ a . currentMarker ] . start + " Stop: " + a . markers [ a . currentMarker ] . stop ) , this . line ( "Position: " + a . position ) ) , this . stop ( ) } , cameraInfo : function ( a , b , c , d ) { this . start ( b , c , d ) , this . line ( "Camera (" + a . width + " x " + a . height + ")" ) , this . line ( "X: " + a . x + " Y: " + a . y ) , this . line ( "Bounds x: " + a . bounds . x + " Y: " + a . bounds . y + " w: " + a . bounds . width + " h: " + a . bounds . height ) , this . line ( "View x: " + a . view . x + " Y: " + a . view . y + " w: " + a . view . width + " h: " + a . view . height ) , this . stop ( ) } , pointer : function ( a , b , c , d , e ) { null != a && ( "undefined" == typeof b && ( b = ! 1 ) , c = c || "rgba(0,255,0,0.5)" , d = d || "rgba(255,0,0,0.5)" , ( b !== ! 0 || a . isUp !== ! 0 ) && ( this . start ( a . x , a . y - 100 , e ) , this . context . beginPath ( ) , this . context . arc ( a . x , a . y , a . circle . radius , 0 , 2 * Math . PI ) , this . context . fillStyle = a . active ? c : d , this . context . fill ( ) , this . context . closePath ( ) , this . context . beginPath ( ) , this . context . moveTo ( a . positionDown . x , a . positionDown . y ) , this . context . lineTo ( a . position . x , a . position . y ) , this . context . lineWidth = 2 , this . context . stroke ( ) , this . context . closePath ( ) , this . line ( "ID: " + a . id + " Active: " + a . active ) , this . line ( "World X: " + a . worldX + " World Y: " + a . worldY ) , this . line ( "Screen X: " + a . x + " Screen Y: " + a . y ) , this . line ( "Duration: " + a . duration + " ms" ) , this . line ( "is Down: " + a . isDown + " is Up: " + a . isUp ) , this . stop ( ) ) ) } , spriteInputInfo : function ( a , b , c , d ) { this . start ( b , c , d ) , this . line ( "Sprite Input: (" + a . width + " x " + a . height + ")" ) , this . line ( "x: " + a . input . pointerX ( ) . toFixed ( 1 ) + " y: " + a . input . pointerY ( )
} , setSize : function ( a , b , c , d ) { c = c || this . offset . x , d = d || this . offset . y , this . sourceWidth = a , this . sourceHeight = b , 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 ( c , d ) , this . center . setTo ( this . position . x + this . halfWidth , this . position . y + this . halfHeight ) } , reset : function ( a , b ) { this . velocity . set ( 0 ) , this . acceleration . set ( 0 ) , this . angularVelocity = 0 , this . angularAcceleration = 0 , this . position . x = a - this . sprite . anchor . x * this . width + this . offset . x , this . position . y = b - this . sprite . anchor . y * this . height + this . offset . y , this . prev . x = this . position . x , this . prev . y = this . position . y , this . rotation = this . sprite . angle , this . preRotation = this . rotation , this . _sx = this . sprite . scale . x , this . _sy = this . sprite . scale . y , this . center . setTo ( this . position . x + this . halfWidth , this . position . y + this . halfHeight ) } , onFloor : function ( ) { return this . blocked . down } , onWall : function ( ) { return this . blocked . left || this . blocked . right } , deltaAbsX : function ( ) { return this . deltaX ( ) > 0 ? this . deltaX ( ) : - this . deltaX ( ) } , deltaAbsY : function ( ) { return this . deltaY ( ) > 0 ? this . deltaY ( ) : - this . deltaY ( ) } , deltaX : function ( ) { return this . position . x - this . prev . x } , deltaY : function ( ) { return this . position . y - this . prev . y } , deltaZ : function ( ) { return this . rotation - this . preRotation } } , Object . defineProperty ( b . Physics . Arcade . Body . prototype , "bottom" , { get : function ( ) { return this . position . y + this . height } } ) , Object . defineProperty ( b . Physics . Arcade . Body . prototype , "right" , { get : function ( ) { return this . position . x + this . width } } ) , Object . defineProperty ( b . Physics . Arcade . Body . prototype , "x" , { get : function ( ) { return this . position . x } , set : function ( a ) { this . position . x = a } } ) , Object . defineProperty ( b . Physics . Arcade . Body . prototype , "y" , { get : function ( ) { return this . position . y } , set : function ( a ) { this . position . y = a } } ) , b . Physics . Arcade . Body . render = function ( a , b , c , d ) { "undefined" == typeof c && ( c = ! 0 ) , d = d || "rgba(0,255,0,0.4)" , c ? ( a . fillStyle = d , a . fillRect ( b . position . x - b . game . camera . x , b . position . y - b . game . camera . y , b . width , b . height ) ) : ( a . strokeStyle = d , a . strokeRect ( b . position . x - b . game . camera . x , b . position . y - b . game . camera . y , b . width , b . height ) ) } , b . Physics . Arcade . Body . renderBodyInfo = function ( a , b ) { a . line ( "x: " + b . x . toFixed ( 2 ) , "y: " + b . y . toFixed ( 2 ) , "width: " + b . width , "height: " + b . height ) , a . line ( "velocity x: " + b . velocity . x . toFixed ( 2 ) , "y: " + b . velocity . y . toFixed ( 2 ) , "deltaX: " + b . _dx . toFixed ( 2 ) , "deltaY: " + b . _dy . toFixed ( 2 ) ) , a . line ( "acceleration x: " + b . acceleration . x . toFixed ( 2 ) , "y: " + b . acceleration . y . toFixed ( 2 ) , "speed: " + b . speed . toFixed ( 2 ) , "angle: " + b . angle . toFixed ( 2 ) ) , a . line ( "gravity x: " + b . gravity . x , "y: " + b . gravity . y , "bounce x: " + b . bounce . x . toFixed ( 2 ) , "y: " + b . bounce . y . toFixed ( 2 ) ) , a . line ( "touching left: " + b . touching . left , "right: " + b . touching . right , "up: " + b . touching . up , "down: " + b . touching . down ) , a . line ( "blocked left: " + b . blocked . left , "right: " + b . blocked . right , "up: " + b . blocked . up , "down: " + b . blocked . down ) } , b . Physics . Arcade . Body . prototype . constructor = b . Physics . Arcade . Body , b . Particles = function ( a ) { this . game = a , this . emitters = { } , this . ID = 0 } , b . Particles . prototype = { add : function ( a ) { return this . emitters [ a . name ] = a , a } , remove : function ( a ) { delete this . emitters [ a . name ] } , update : function ( ) { for ( var a in this . emitters ) this . emitters [ a ] . exists && this . emitters [ a ] . update ( ) } } , b . Particles . prototype . constructor = b . Particles , b . Particles . Arcade = { } , b . Particles . Arcade . Emitter = function ( a , c , d , e ) { this . maxParticles = e || 50 , b . Group . call ( this , a ) , this . name = "emitter" + this . game . particles . ID ++ , this . type = b . EMITTER , this . x = 0 , this . y = 0 , this . width = 1 , this . height = 1 , this . minParticleSpeed = new b . Point ( - 100 , - 100 ) , this . maxParticleSpeed = new b . Point ( 100 , 100 ) , this . minParticleScale = 1 , this . maxParticleScale = 1 , this . minRotation = - 360 , this . maxRotation = 360 , this . gravity = 100 , this . particleClass = b . Sprite , this . particleDrag = new b . Point , this . angularDrag = 0 , this . frequency = 100 , this . lifespan = 2e3 , this . bounce = new b . Point , this . _quantity = 0 , this . _timer = 0 , this . _counter = 0 , this . _explode = ! 0 , this . _frames = null , this . on = ! 1 , this . exists = ! 0 , this . emitX = c , this . emitY = d } , b . Particles . Arcade . Emitter . prototype = Object . create ( b . Group . prototype ) , b . Particles . Arcade . Emitter . prototype . constructor = b . Particles . Arc
for ( var g = 0 , h = [ ] , i = [ ] , j = 0 , k = a . layers [ e ] . data . length ; k > j ; j ++ ) h . push ( a . layers [ e ] . data [ j ] > 0 ? new b . Tile ( f , a . layers [ e ] . data [ j ] , g , i . length , a . tilewidth , a . tileheight ) : null ) , g ++ , g === a . layers [ e ] . width && ( i . push ( h ) , g = 0 , h = [ ] ) ; f . data = i , d . push ( f ) } c . layers = d ; for ( var l = [ ] , e = 0 ; e < a . layers . length ; e ++ ) if ( "imagelayer" === a . layers [ e ] . type ) { var m = { name : a . layers [ e ] . name , image : a . layers [ e ] . image , x : a . layers [ e ] . x , y : a . layers [ e ] . y , alpha : a . layers [ e ] . opacity , visible : a . layers [ e ] . visible , properties : { } } ; a . layers [ e ] . properties && ( m . properties = a . layers [ e ] . properties ) , l . push ( m ) } c . images = l ; for ( var n = [ ] , e = 0 ; e < a . tilesets . length ; e ++ ) { var o = a . tilesets [ e ] , p = new b . Tileset ( o . name , o . firstgid , o . tilewidth , o . tileheight , o . margin , o . spacing , o . properties ) ; o . tileproperties && ( p . tileProperties = o . tileproperties ) , p . rows = Math . round ( ( o . imageheight - o . margin ) / ( o . tileheight + o . spacing ) ) , p . columns = Math . round ( ( o . imagewidth - o . margin ) / ( o . tilewidth + o . spacing ) ) , p . total = p . rows * p . columns , p . rows % 1 !== 0 || p . columns % 1 !== 0 ? console . warn ( "TileSet image dimensions do not match expected dimensions. Tileset width/height must be evenly divisible by Tilemap tile width/height." ) : n . push ( p ) } c . tilesets = n ; for ( var q = { } , r = { } , e = 0 ; e < a . layers . length ; e ++ ) if ( "objectgroup" === a . layers [ e ] . type ) { q [ a . layers [ e ] . name ] = [ ] , r [ a . layers [ e ] . name ] = [ ] ; for ( var s = 0 , k = a . layers [ e ] . objects . length ; k > s ; s ++ ) if ( a . layers [ e ] . objects [ s ] . gid ) { var t = { gid : a . layers [ e ] . objects [ s ] . gid , name : a . layers [ e ] . objects [ s ] . name , x : a . layers [ e ] . objects [ s ] . x , y : a . layers [ e ] . objects [ s ] . y , visible : a . layers [ e ] . objects [ s ] . visible , properties : a . layers [ e ] . objects [ s ] . properties } ; q [ a . layers [ e ] . name ] . push ( t ) } else if ( a . layers [ e ] . objects [ s ] . polyline ) { var t = { name : a . layers [ e ] . objects [ s ] . name , x : a . layers [ e ] . objects [ s ] . x , y : a . layers [ e ] . objects [ s ] . y , width : a . layers [ e ] . objects [ s ] . width , height : a . layers [ e ] . objects [ s ] . height , visible : a . layers [ e ] . objects [ s ] . visible , properties : a . layers [ e ] . objects [ s ] . properties } ; t . polyline = [ ] ; for ( var u = 0 ; u < a . layers [ e ] . objects [ s ] . polyline . length ; u ++ ) t . polyline . push ( [ a . layers [ e ] . objects [ s ] . polyline [ u ] . x , a . layers [ e ] . objects [ s ] . polyline [ u ] . y ] ) ; r [ a . layers [ e ] . name ] . push ( t ) } } c . objects = q , c . collision = r , c . tiles = [ ] ; for ( var e = 0 ; e < c . tilesets . length ; e ++ ) for ( var o = c . tilesets [ e ] , g = o . tileMargin , v = o . tileMargin , w = 0 , x = 0 , y = 0 , j = o . firstgid ; j < o . firstgid + o . total && ( c . tiles [ j ] = [ g , v , e ] , g += o . tileWidth + o . tileSpacing , w ++ , w !== o . total ) && ( x ++ , x !== o . columns || ( g = o . tileMargin , v += o . tileHeight + o . tileSpacing , x = 0 , y ++ , y !== o . rows ) ) ; j ++ ) ; return c } } , b . Tileset = function ( a , b , c , d , e , f , g ) { ( "undefined" == typeof c || 0 >= c ) && ( c = 32 ) , ( "undefined" == typeof d || 0 >= d ) && ( d = 32 ) , "undefined" == typeof e && ( e = 0 ) , "undefined" == typeof f && ( f = 0 ) , this . name = a , this . firstgid = b , this . tileWidth = c , this . tileHeight = d , this . tileMargin = e , this . tileSpacing = f , this . properties = g , this . image = null , this . rows = 0 , this . columns = 0 , this . total = 0 , this . drawCoords = [ ] } , b . Tileset . prototype = { draw : function ( a , b , c , d ) { this . image && this . drawCoords [ d ] && a . drawImage ( this . image , this . drawCoords [ d ] [ 0 ] , this . drawCoords [ d ] [ 1 ] , this . tileWidth , this . tileHeight , b , c , this . tileWidth , this . tileHeight ) } , setImage : function ( a ) { this . image = a , this . rows = Math . round ( ( a . height - this . tileMargin ) / ( this . tileHeight + this . tileSpacing ) ) , this . columns = Math . round ( ( a . width - this . tileMargin ) / ( this . tileWidth + this . tileSpacing ) ) , this . total = this . rows * this . columns , this . drawCoords . length = 0 ; for ( var b = this . tileMargin , c = this . tileMargin , d = this . firstgid , e = 0 ; e < this . rows ; e ++ ) { for ( var f = 0 ; f < this . columns ; f ++ ) this . drawCoords [ d ] = [ b , c ] , b += this . tileWidth + this . tileSpacing , d ++ ; b = this . tileMargin , c += this . tileHeight + this . tileSpacing } } , setSpacing : function ( a , b ) { this . tileMargin = a , this . tileSpacing = b , this . setImage ( this . image ) } } , b . Tileset . prototype . constructor = b . Tileset , "undefined" != typeof exports ? ( "undefined" != typeof module && module . exports && ( exports = module . exports = b ) , exports . Phaser = b ) : "undefined" != typeof define && define . amd ? define ( "Phaser" , function ( ) { return a . Phaser = b } ( ) ) : a . Phaser = b } . call ( this ) , Phaser . Physics . Ninja = function ( a ) { this . game = a , this . time = this . game . time , this . gravity = . 2 , this . bounds = new Phaser . Rectangle ( 0 , 0 , a . world . width , a . world . height ) , this . maxObjects = 10 , this . maxLevels = 4 , this . quadTree = new Phaser . QuadTree ( this . game . world . bounds . x , this . game . worl
} , Phaser . Physics . Ninja . Circle . prototype . constructor = Phaser . Physics . Ninja . Circle , Phaser . Physics . Ninja . Circle . COL _NONE = 0 , Phaser . Physics . Ninja . Circle . COL _AXIS = 1 , Phaser . Physics . Ninja . Circle . COL _OTHER = 2 , Phaser . Physics . Ninja . Circle . prototype = { integrate : function ( ) { var a = this . pos . x , b = this . pos . y ; this . pos . x += this . body . drag * this . pos . x - this . body . drag * this . oldpos . x , this . pos . y += this . body . drag * this . pos . y - this . body . drag * this . oldpos . y + this . system . gravity * this . body . gravityScale , this . velocity . set ( this . pos . x - a , this . pos . y - b ) , this . oldpos . set ( a , b ) } , reportCollisionVsWorld : function ( a , b , c , d ) { var e , f , g , h , i , j = this . pos , k = this . oldpos , l = j . x - k . x , m = j . y - k . y , n = l * c + m * d , o = n * c , p = n * d , q = l - o , r = m - p ; 0 > n ? ( h = q * this . body . friction , i = r * this . body . friction , e = 1 + this . body . bounce , f = o * e , g = p * e , 1 === c ? this . body . touching . left = ! 0 : - 1 === c && ( this . body . touching . right = ! 0 ) , 1 === d ? this . body . touching . up = ! 0 : - 1 === d && ( this . body . touching . down = ! 0 ) ) : f = g = h = i = 0 , j . x += a , j . y += b , k . x += a + f + h , k . y += b + g + i } , collideWorldBounds : function ( ) { var a = this . system . bounds . x - ( this . pos . x - this . radius ) ; a > 0 ? this . reportCollisionVsWorld ( a , 0 , 1 , 0 , null ) : ( a = this . pos . x + this . radius - this . system . bounds . right , a > 0 && this . reportCollisionVsWorld ( - a , 0 , - 1 , 0 , null ) ) ; var b = this . system . bounds . y - ( this . pos . y - this . radius ) ; b > 0 ? this . reportCollisionVsWorld ( 0 , b , 0 , 1 , null ) : ( b = this . pos . y + this . radius - this . system . bounds . bottom , b > 0 && this . reportCollisionVsWorld ( 0 , - b , 0 , - 1 , null ) ) } , collideCircleVsTile : function ( a ) { var b = this . pos , c = this . radius , d = a , e = d . pos . x , f = d . pos . y , g = d . xw , h = d . yw , i = b . x - e , j = g + c - Math . abs ( i ) ; if ( j > 0 ) { var k = b . y - f , l = h + c - Math . abs ( k ) ; if ( l > 0 ) return this . oH = 0 , this . oV = 0 , - g > i ? this . oH = - 1 : i > g && ( this . oH = 1 ) , - h > k ? this . oV = - 1 : k > h && ( this . oV = 1 ) , this . resolveCircleTile ( j , l , this . oH , this . oV , this , d ) } } , resolveCircleTile : function ( a , b , c , d , e , f ) { return 0 < f . id ? this . circleTileProjections [ f . type ] ( a , b , c , d , e , f ) : ! 1 } , projCircle _Full : function ( a , b , c , d , e , f ) { if ( 0 === c ) { if ( 0 === d ) { if ( b > a ) { var g = e . pos . x - f . pos . x ; return 0 > g ? ( e . reportCollisionVsWorld ( - a , 0 , - 1 , 0 , f ) , Phaser . Physics . Ninja . Circle . COL _AXIS ) : ( e . reportCollisionVsWorld ( a , 0 , 1 , 0 , f ) , Phaser . Physics . Ninja . Circle . COL _AXIS ) } var h = e . pos . y - f . pos . y ; return 0 > h ? ( e . reportCollisionVsWorld ( 0 , - b , 0 , - 1 , f ) , Phaser . Physics . Ninja . Circle . COL _AXIS ) : ( e . reportCollisionVsWorld ( 0 , b , 0 , 1 , f ) , Phaser . Physics . Ninja . Circle . COL _AXIS ) } return e . reportCollisionVsWorld ( 0 , b * d , 0 , d , f ) , Phaser . Physics . Ninja . Circle . COL _AXIS } if ( 0 === d ) return e . reportCollisionVsWorld ( a * c , 0 , c , 0 , f ) , Phaser . Physics . Ninja . Circle . COL _AXIS ; var i = f . pos . x + c * f . xw , j = f . pos . y + d * f . yw , g = e . pos . x - i , h = e . pos . y - j , k = Math . sqrt ( g * g + h * h ) , l = e . radius - k ; return l > 0 ? ( 0 === k ? ( g = c / Math . SQRT2 , h = d / Math . SQRT2 ) : ( g /= k , h /= k ) , e . reportCollisionVsWorld ( g * l , h * l , g , h , f ) , Phaser . Physics . Ninja . Circle . COL _OTHER ) : Phaser . Physics . Ninja . Circle . COL _NONE } , projCircle _45Deg : function ( a , b , c , d , e , f ) { var g , h = f . signx , i = f . signy ; if ( 0 === c ) if ( 0 === d ) { var j = f . sx , k = f . sy , l = e . pos . x - j * e . radius - f . pos . x , m = e . pos . y - k * e . radius - f . pos . y , n = l * j + m * k ; if ( 0 > n ) { j *= - n , k *= - n , b > a ? ( g = a , b = 0 , e . pos . x - f . pos . x < 0 && ( a *= - 1 ) ) : ( g = b , a = 0 , e . pos . y - f . pos . y < 0 && ( b *= - 1 ) ) ; var o = Math . sqrt ( j * j + k * k ) ; return o > g ? ( e . reportCollisionVsWorld ( a , b , a / g , b / g , f ) , Phaser . Physics . Ninja . Circle . COL _AXIS ) : ( e . reportCollisionVsWorld ( j , k , f . sx , f . sy , f ) , Phaser . Physics . Ninja . Circle . COL _OTHER ) } } else { if ( 0 > i * d ) return e . reportCollisionVsWorld ( 0 , b * d , 0 , d , f ) , Phaser . Physics . Ninja . Circle . COL _AXIS ; var j = f . sx , k = f . sy , l = e . pos . x - ( f . pos . x - h * f . xw ) , m = e . pos . y - ( f . pos . y + d * f . yw ) , p = l * - k + m * j ; if ( p * h * i > 0 ) { var q = Math . sqrt ( l * l + m * m ) , r = e . radius - q ; if ( r > 0 ) return l /= q , m /= q , e . reportCollisionVsWorld ( l * r , m * r , l , m , f ) , Phaser . Physics . Ninja . Circle . COL _OTHER } else { var n = l * j + m * k , r = e . radius - Math . abs ( n ) ; if ( r > 0 ) return e . reportCollisionVsWorld ( j * r , k * r , j , k , f ) , Phaser . Physics . Ninja . Circle . COL _OTHER } } else if ( 0 === d ) { if ( 0 > h * c ) return e . reportCollisionVsWorld ( a * c , 0 , c , 0 , f ) , Phaser . Physics . Ninja . Circle . COL _AXIS ; var j = f . sx , k = f . sy , l = e . pos . x - ( f . pos . x + c * f . xw ) , m = e . pos . y - ( f . pos . y - i * f . yw ) , p = l * - k + m * j ; if ( 0 > p * h * i ) { var q = Math . sqrt ( l * l + m * m ) , r = e . radius - q ; if ( r > 0 ) return l /= q , m /= q , e . reportCollisionVsWorld ( l * r , m * r , l , m , f ) , Phaser . Physics . Ninja . Circle . COL _OTHER } else { var n = l * j + m * k , r = e . radius - Math . abs ( n ) ; if ( r > 0 ) return e . reportCollisionVsWorld ( j * r , k * r , j , k , f ) , Phaser . Physics . Ninja . Circle . COL _OTHER } } else { if ( h * c + i *
r instanceof e ? G instanceof e ? c = h . circleCircle ( q , F ) : G instanceof g ? c = h . circleParticle ( q , F ) : G instanceof f && ( c = h . circlePlane ( q , F ) ) : r instanceof g ? G instanceof e && ( c = h . circleParticle ( F , q ) ) : r instanceof f && G instanceof e && ( c = h . circlePlane ( F , q ) ) } return b } } , { "../collision/Broadphase" : 10 , "../math/vec2" : 33 , "../shapes/Circle" : 38 , "../shapes/Particle" : 42 , "../shapes/Plane" : 43 } ] , 12 : [ function ( a , b ) { function c ( ) { d . call ( this , d . NAIVE ) , this . useBoundingBoxes = ! 1 } { var d = ( a ( "../shapes/Circle" ) , a ( "../shapes/Plane" ) , a ( "../shapes/Shape" ) , a ( "../shapes/Particle" ) , a ( "../collision/Broadphase" ) ) ; a ( "../math/vec2" ) } b . exports = c , c . prototype = new d , c . prototype . getCollisionPairs = function ( a ) { var b , c , e , f , g = a . bodies , h = this . result , i = this . useBoundingBoxes ? d . aabbCheck : d . boundingRadiusCheck ; for ( h . length = 0 , b = 0 , Ncolliding = g . length ; b !== Ncolliding ; b ++ ) for ( e = g [ b ] , c = 0 ; b > c ; c ++ ) f = g [ c ] , d . canCollide ( e , f ) && i ( e , f ) && h . push ( e , f ) ; return h } } , { "../collision/Broadphase" : 10 , "../math/vec2" : 33 , "../shapes/Circle" : 38 , "../shapes/Particle" : 42 , "../shapes/Plane" : 43 , "../shapes/Shape" : 45 } ] , 13 : [ function ( a , b ) { function c ( ) { this . contactEquations = [ ] , this . frictionEquations = [ ] , this . enableFriction = ! 0 , this . slipForce = 10 , this . frictionCoefficient = . 3 , this . surfaceVelocity = 0 , this . reuseObjects = ! 0 , this . reusableContactEquations = [ ] , this . reusableFrictionEquations = [ ] , this . restitution = 0 , this . stiffness = 1e7 , this . relaxation = 3 , this . frictionStiffness = 1e7 , this . frictionRelaxation = 3 , this . collidingBodiesLastStep = { keys : [ ] } } function d ( a ) { for ( var b = 0 , c = a . keys . length ; c > b ; b ++ ) delete a [ a . keys [ b ] ] ; a . keys . length = 0 } function e ( a , b ) { g . set ( a . vertices [ 0 ] , . 5 * - b . length , - b . radius ) , g . set ( a . vertices [ 1 ] , . 5 * b . length , - b . radius ) , g . set ( a . vertices [ 2 ] , . 5 * b . length , b . radius ) , g . set ( a . vertices [ 3 ] , . 5 * - b . length , b . radius ) } function f ( a , b , c , d ) { for ( var e = Q , f = R , j = S , k = T , l = a , m = b . vertices , n = null , o = 0 ; o !== m . length + 1 ; o ++ ) { var p = m [ o % m . length ] , q = m [ ( o + 1 ) % m . length ] ; g . rotate ( e , p , d ) , g . rotate ( f , q , d ) , i ( e , e , c ) , i ( f , f , c ) , h ( j , e , l ) , h ( k , f , l ) ; var r = g . crossLength ( j , k ) ; if ( null === n && ( n = r ) , 0 >= r * n ) return ! 1 ; n = r } return ! 0 } var g = a ( "../math/vec2" ) , h = g . sub , i = g . add , j = g . dot , k = a ( "../utils/Utils" ) , l = a ( "../equations/ContactEquation" ) , m = a ( "../equations/FrictionEquation" ) , n = a ( "../shapes/Circle" ) , o = a ( "../shapes/Shape" ) , p = a ( "../objects/Body" ) , q = a ( "../shapes/Rectangle" ) ; b . exports = c ; var r = g . fromValues ( 0 , 1 ) , s = g . fromValues ( 0 , 0 ) , t = g . fromValues ( 0 , 0 ) , u = g . fromValues ( 0 , 0 ) , v = g . fromValues ( 0 , 0 ) , w = g . fromValues ( 0 , 0 ) , x = g . fromValues ( 0 , 0 ) , y = g . fromValues ( 0 , 0 ) , z = g . fromValues ( 0 , 0 ) , A = g . fromValues ( 0 , 0 ) , B = g . fromValues ( 0 , 0 ) , C = g . fromValues ( 0 , 0 ) , D = g . fromValues ( 0 , 0 ) , E = g . fromValues ( 0 , 0 ) , F = g . fromValues ( 0 , 0 ) , G = g . fromValues ( 0 , 0 ) , H = g . fromValues ( 0 , 0 ) , I = g . fromValues ( 0 , 0 ) , J = g . fromValues ( 0 , 0 ) , K = [ ] ; c . prototype . collidedLastStep = function ( a , b ) { var c = a . id , d = b . id ; if ( c > d ) { var e = c ; c = d , d = e } return ! ! this . collidingBodiesLastStep [ c + " " + d ] } , c . prototype . reset = function ( ) { d ( this . collidingBodiesLastStep ) ; for ( var a = 0 ; a !== this . contactEquations . length ; a ++ ) { var b = this . contactEquations [ a ] , c = b . bi . id , e = b . bj . id ; if ( c > e ) { var f = c ; c = e , e = f } var g = c + " " + e ; this . collidingBodiesLastStep [ g ] || ( this . collidingBodiesLastStep [ g ] = ! 0 , this . collidingBodiesLastStep . keys . push ( g ) ) } if ( this . reuseObjects ) { var h = this . contactEquations , i = this . frictionEquations , j = this . reusableFrictionEquations , l = this . reusableContactEquations ; k . appendArray ( l , h ) , k . appendArray ( j , i ) } this . contactEquations . length = this . frictionEquations . length = 0 } , c . prototype . createContactEquation = function ( a , b , c , d ) { var e = this . reusableContactEquations . length ? this . reusableContactEquations . pop ( ) : new l ( a , b ) ; return e . bi = a , e . bj = b , e . shapeA = c , e . shapeB = d , e . restitution = this . restitution , e . firstImpact = ! this . collidedLastStep ( a , b ) , e . stiffness = this . stiffness , e . relaxation = this . relaxation , e . enabled = ! 0 , a . allowSleep && a . motionState == p . DYNAMIC && b . motionState != p . STATIC && b . sleepState !== p . SLEEPY && a . wakeUp ( ) , b . allowSleep && b . motionState == p . DYNAMIC && a . motionState != p . STATIC && a . sleepState !== p . SLEEPY && b . wakeUp ( ) , e } , c . prototype . createFrictionEquation = function ( a , b , c , d ) { var e = this . reusableFrictionEquations . length ? this . reusableFrictionEquations . pop ( ) : new m ( a , b ) ; return e . bi = a , e . bj = b , e . shapeA = c , e . shapeB = d , e . setSlipForce ( this . slipForce ) , e . frictionCoefficient = this . f
else { var r = e . indexOf ( o ) ; - 1 != r && e . splice ( r , 1 ) } if ( this . lowerLimitEnabled && n > q ) p . angle = n , - 1 == e . indexOf ( p ) && e . push ( p ) ; else { var r = e . indexOf ( p ) ; - 1 != r && e . splice ( r , 1 ) } h . rotate ( i , c , a . angle ) , h . rotate ( j , d , b . angle ) , f . G [ 0 ] = - 1 , f . G [ 1 ] = 0 , f . G [ 2 ] = - h . crossLength ( i , k ) , f . G [ 3 ] = 1 , f . G [ 4 ] = 0 , f . G [ 5 ] = h . crossLength ( j , k ) , g . G [ 0 ] = 0 , g . G [ 1 ] = - 1 , g . G [ 2 ] = - h . crossLength ( i , l ) , g . G [ 3 ] = 0 , g . G [ 4 ] = 1 , g . G [ 5 ] = h . crossLength ( j , l ) } , c . prototype . enableMotor = function ( ) { this . motorEnabled || ( this . equations . push ( this . motorEquation ) , this . motorEnabled = ! 0 ) } , c . prototype . disableMotor = function ( ) { if ( this . motorEnabled ) { var a = this . equations . indexOf ( this . motorEquation ) ; this . equations . splice ( a , 1 ) , this . motorEnabled = ! 1 } } , c . prototype . motorIsEnabled = function ( ) { return ! ! this . motorEnabled } , c . prototype . setMotorSpeed = function ( a ) { if ( this . motorEnabled ) { var b = this . equations . indexOf ( this . motorEquation ) ; this . equations [ b ] . relativeVelocity = a } } , c . prototype . getMotorSpeed = function ( ) { return this . motorEnabled ? this . motorEquation . relativeVelocity : ! 1 } } , { "../equations/Equation" : 24 , "../equations/RotationalLockEquation" : 26 , "../equations/RotationalVelocityEquation" : 27 , "../math/vec2" : 33 , "./Constraint" : 16 } ] , 22 : [ function ( a , b ) { function c ( a , b , c ) { c = c || { } , d . call ( this , a , b , - Number . MAX _VALUE , Number . MAX _VALUE ) , this . angle = c . angle || 0 , this . ratio = "number" == typeof c . ratio ? c . ratio : 1 , this . setRatio ( this . ratio ) } { var d = a ( "./Equation" ) ; a ( "../math/vec2" ) } b . exports = c , c . prototype = new d , c . prototype . constructor = c , c . prototype . computeGq = function ( ) { return this . ratio * this . bi . angle - this . bj . angle + this . angle } , c . prototype . setRatio = function ( a ) { var b = this . G ; b [ 2 ] = a , b [ 5 ] = - 1 , this . ratio = a } } , { "../math/vec2" : 33 , "./Equation" : 24 } ] , 23 : [ function ( a , b ) { function c ( a , b ) { d . call ( this , a , b , 0 , Number . MAX _VALUE ) , this . ri = e . create ( ) , this . penetrationVec = e . create ( ) , this . rj = e . create ( ) , this . ni = e . create ( ) , this . restitution = 0 , this . firstImpact = ! 1 , this . shapeA = null , this . shapeB = null } { var d = a ( "./Equation" ) , e = a ( "../math/vec2" ) ; a ( "../math/mat2" ) } b . exports = c , c . prototype = new d , c . prototype . constructor = c , c . prototype . computeB = function ( a , b , c ) { var d = this . bi , f = this . bj , g = this . ri , h = this . rj , i = d . position , j = f . position , k = this . penetrationVec , l = this . ni , m = this . G , n = e . crossLength ( g , l ) , o = e . crossLength ( h , l ) ; m [ 0 ] = - l [ 0 ] , m [ 1 ] = - l [ 1 ] , m [ 2 ] = - n , m [ 3 ] = l [ 0 ] , m [ 4 ] = l [ 1 ] , m [ 5 ] = o , e . add ( k , j , h ) , e . sub ( k , k , i ) , e . sub ( k , k , g ) ; var p , q ; this . firstImpact && 0 !== this . restitution ? ( q = 0 , p = 1 / b * ( 1 + this . restitution ) * this . computeGW ( ) ) : ( q = e . dot ( l , k ) , p = this . computeGW ( ) ) ; var r = this . computeGiMf ( ) , s = - q * a - p * b - c * r ; return s } } , { "../math/mat2" : 31 , "../math/vec2" : 33 , "./Equation" : 24 } ] , 24 : [ function ( a , b ) { function c ( a , b , c , d ) { this . minForce = "undefined" == typeof c ? - 1e6 : c , this . maxForce = "undefined" == typeof d ? 1e6 : d , this . bi = a , this . bj = b , this . stiffness = 1e6 , this . relaxation = 4 , this . G = new g . ARRAY _TYPE ( 6 ) ; for ( var e = 0 ; 6 > e ; e ++ ) this . G [ e ] = 0 ; this . offset = 0 , this . a = 0 , this . b = 0 , this . eps = 0 , this . h = 0 , this . updateSpookParams ( 1 / 60 ) , this . multiplier = 0 , this . relativeVelocity = 0 , this . enabled = ! 0 } function d ( a , b , c , d , e ) { return a [ 0 ] * b [ 0 ] + a [ 1 ] * b [ 1 ] + a [ 2 ] * c + a [ 3 ] * d [ 0 ] + a [ 4 ] * d [ 1 ] + a [ 5 ] * e } b . exports = c ; var e = a ( "../math/vec2" ) , f = a ( "../math/mat2" ) , g = a ( "../utils/Utils" ) ; c . prototype . constructor = c , c . prototype . updateSpookParams = function ( a ) { var b = this . stiffness , c = this . relaxation , d = a ; this . a = 4 / ( d * ( 1 + 4 * c ) ) , this . b = 4 * c / ( 1 + 4 * c ) , this . eps = 4 / ( d * d * b * ( 1 + 4 * c ) ) , this . h = a } , c . prototype . computeB = function ( a , b , c ) { var d = this . computeGW ( ) , e = this . computeGq ( ) , f = this . computeGiMf ( ) ; return - e * a - d * b - f * c } ; var h = e . create ( ) , i = e . create ( ) ; c . prototype . computeGq = function ( ) { var a = this . G , b = this . bi , c = this . bj , e = ( b . position , c . position , b . angle ) , f = c . angle ; return d ( a , h , e , i , f ) + this . offset } ; e . create ( ) , e . create ( ) ; c . prototype . transformedGmult = function ( a , b , c , e , f ) { return d ( a , b , c , e , f ) } , c . prototype . computeGW = function ( ) { var a = this . G , b = this . bi , c = this . bj , d = b . velocity , e = c . velocity , f = b . angularVelocity , g = c . angularVelocity ; return this . transformedGmult ( a , d , f , e , g ) + this . relativeVelocity } , c . prototype . computeGWlambda = function ( ) { var a = this . G , b = this . bi , c = this . bj , e = b . vlambda , f = c . vlambda , g = b . wlambda , h = c . wlambda ; return d ( a , e , g , f , h ) } ; var j = e . create ( ) , k = e . create ( ) ; c . prototype . computeGiMf = function ( ) { var a = this . bi , b = this . bj , c = a . force , d = a . angularForce , f = b . force , g = b . angularForce , h = a . invMass , i = b
v . children . push ( w ) , v . eqs . push ( t ) , w . children . push ( v ) , w . eqs . push ( t ) } var x , y = 0 , z = m , A = n ; z . length = 0 , A . length = 0 ; var B = o ; for ( B . length = 0 ; x = d ( c ) ; ) { var C = p . length ? p . pop ( ) : new h ; z . length = 0 , A . length = 0 , f ( x , e , A , z ) ; for ( var D = z . length , q = 0 ; q !== D ; q ++ ) { var t = z [ q ] ; C . equations . push ( t ) } y ++ , B . push ( C ) } this . numIslands = y ; for ( var E = this . beforeSolveIslandEvent , q = 0 ; q < B . length ; q ++ ) { var C = B [ q ] ; E . island = C , this . emit ( E ) , C . solve ( a , this . subsolver ) , C . reset ( ) , p . push ( C ) } } } , { "../math/vec2" : 33 , "../objects/Body" : 34 , "../solver/Island" : 47 , "./Solver" : 49 } ] , 49 : [ function ( a , b ) { function c ( a , b ) { a = a || { } , d . call ( this ) , this . type = b , this . equations = [ ] , this . equationSortFunction = a . equationSortFunction || ! 1 } var d = ( a ( "../utils/Utils" ) , a ( "../events/EventEmitter" ) ) ; b . exports = c , c . prototype = new d , c . prototype . solve = function ( ) { throw new Error ( "Solver.solve should be implemented by subclasses!" ) } , c . prototype . sortEquations = function ( ) { this . equationSortFunction && this . equations . sort ( this . equationSortFunction ) } , c . prototype . addEquation = function ( a ) { a . enabled && this . equations . push ( a ) } , c . prototype . addEquations = function ( a ) { for ( var b = 0 , c = a . length ; b !== c ; b ++ ) { var d = a [ b ] ; d . enabled && this . equations . push ( d ) } } , c . prototype . removeEquation = function ( a ) { var b = this . equations . indexOf ( a ) ; - 1 != b && this . equations . splice ( b , 1 ) } , c . prototype . removeAllEquations = function ( ) { this . equations . length = 0 } , c . GS = 1 , c . ISLAND = 2 } , { "../events/EventEmitter" : 28 , "../utils/Utils" : 50 } ] , 50 : [ function ( a , b ) { function c ( ) { } b . exports = c , c . appendArray = function ( a , b ) { if ( b . length < 15e4 ) a . push . apply ( a , b ) ; else for ( var c = 0 , d = b . length ; c !== d ; ++ c ) a . push ( b [ c ] ) } , c . splice = function ( a , b , c ) { c = c || 1 ; for ( var d = b , e = a . length - c ; e > d ; d ++ ) a [ d ] = a [ d + c ] ; a . length = e } , c . ARRAY _TYPE = Float32Array || Array } , { } ] , 51 : [ function ( a , b ) { function c ( a ) { n . apply ( this ) , a = a || { } , this . springs = [ ] , this . bodies = [ ] , this . solver = a . solver || new d , this . narrowphase = new x ( this ) , this . gravity = a . gravity || f . fromValues ( 0 , - 9.78 ) , this . doProfiling = a . doProfiling || ! 1 , this . lastStepTime = 0 , this . broadphase = a . broadphase || new e , this . broadphase . setWorld ( this ) , this . constraints = [ ] , this . defaultFriction = . 3 , this . defaultRestitution = 0 , this . defaultMaterial = new q , this . defaultContactMaterial = new r ( this . defaultMaterial , this . defaultMaterial ) , this . lastTimeStep = 1 / 60 , this . applySpringForces = ! 0 , this . applyDamping = ! 0 , this . applyGravity = ! 0 , this . solveConstraints = ! 0 , this . contactMaterials = [ ] , this . time = 0 , this . fixedStepTime = 0 , this . emitImpactEvent = ! 0 , this . _constraintIdCounter = 0 , this . _bodyIdCounter = 0 , this . postStepEvent = { type : "postStep" } , this . addBodyEvent = { type : "addBody" , body : null } , this . removeBodyEvent = { type : "removeBody" , body : null } , this . addSpringEvent = { type : "addSpring" , spring : null } , this . impactEvent = { type : "impact" , bodyA : null , bodyB : null , shapeA : null , shapeB : null , contactEquation : null } , this . postBroadphaseEvent = { type : "postBroadphase" , pairs : null } , this . enableBodySleeping = ! 1 , this . beginContactEvent = { type : "beginContact" , shapeA : null , shapeB : null , bodyA : null , bodyB : null , contactEquations : [ ] } , this . endContactEvent = { type : "endContact" , shapeA : null , shapeB : null , bodyA : null , bodyB : null } , this . preSolveEvent = { type : "preSolve" , contactEquations : null , frictionEquations : null } , this . overlappingShapesLastState = { keys : [ ] } , this . overlappingShapesCurrentState = { keys : [ ] } , this . overlappingShapeLookup = { keys : [ ] } } var d = a ( "../solver/GSSolver" ) , e = a ( "../collision/NaiveBroadphase" ) , f = a ( "../math/vec2" ) , g = a ( "../shapes/Circle" ) , h = a ( "../shapes/Rectangle" ) , i = a ( "../shapes/Convex" ) , j = a ( "../shapes/Line" ) , k = a ( "../shapes/Plane" ) , l = a ( "../shapes/Capsule" ) , m = a ( "../shapes/Particle" ) , n = a ( "../events/EventEmitter" ) , o = a ( "../objects/Body" ) , p = a ( "../objects/Spring" ) , q = a ( "../material/Material" ) , r = a ( "../material/ContactMaterial" ) , s = a ( "../constraints/DistanceConstraint" ) , t = a ( "../constraints/LockConstraint" ) , u = a ( "../constraints/RevoluteConstraint" ) , v = a ( "../constraints/PrismaticConstraint" ) , w = a ( "../../package.json" ) , x = ( a ( "../collision/Broadphase" ) , a ( "../collision/Narrowphase" ) ) , y = a ( "../utils/Utils" ) ; b . exports = c ; var z = w . version . split ( "." ) . slice ( 0 , 2 ) . join ( "." ) ; if ( "undefined" == typeof performance && ( performance = { } ) , ! performance . now ) { var A = Date . now ( ) ; performance . timing && performance . timing . navigationStart && ( A = performance . timing . navigationStart ) , perf
} } ) , Object . defineProperty ( Phaser . Physics . P2 . prototype , "emitImpactEvent" , { get : function ( ) { return this . world . emitImpactEvent } , set : function ( a ) { this . world . emitImpactEvent = a } } ) , Object . defineProperty ( Phaser . Physics . P2 . prototype , "enableBodySleeping" , { get : function ( ) { return this . world . enableBodySleeping } , set : function ( a ) { this . world . enableBodySleeping = a } } ) , Object . defineProperty ( Phaser . Physics . P2 . prototype , "total" , { get : function ( ) { return this . world . bodies . length } } ) , Phaser . Physics . P2 . PointProxy = function ( a , b ) { this . world = a , this . destination = b } , Phaser . Physics . P2 . PointProxy . prototype . constructor = Phaser . Physics . P2 . PointProxy , Object . defineProperty ( Phaser . Physics . P2 . PointProxy . prototype , "x" , { get : function ( ) { return this . destination [ 0 ] } , set : function ( a ) { this . destination [ 0 ] = this . world . pxm ( a ) } } ) , Object . defineProperty ( Phaser . Physics . P2 . PointProxy . prototype , "y" , { get : function ( ) { return this . destination [ 1 ] } , set : function ( a ) { this . destination [ 1 ] = this . world . pxm ( a ) } } ) , Phaser . Physics . P2 . InversePointProxy = function ( a , b ) { this . world = a , this . destination = b } , Phaser . Physics . P2 . InversePointProxy . prototype . constructor = Phaser . Physics . P2 . InversePointProxy , Object . defineProperty ( Phaser . Physics . P2 . InversePointProxy . prototype , "x" , { get : function ( ) { return this . destination [ 0 ] } , set : function ( a ) { this . destination [ 0 ] = this . world . pxm ( - a ) } } ) , Object . defineProperty ( Phaser . Physics . P2 . InversePointProxy . prototype , "y" , { get : function ( ) { return this . destination [ 1 ] } , set : function ( a ) { this . destination [ 1 ] = this . world . pxm ( - a ) } } ) , Phaser . Physics . P2 . Body = function ( a , b , c , d , e ) { b = b || null , c = c || 0 , d = d || 0 , "undefined" == typeof e && ( e = 1 ) , this . game = a , this . world = a . physics . p2 , this . sprite = b , this . type = Phaser . Physics . P2JS , this . offset = new Phaser . Point , this . data = new p2 . Body ( { position : [ this . world . pxmi ( c ) , this . world . pxmi ( d ) ] , mass : e } ) , this . data . parent = this , this . velocity = new Phaser . Physics . P2 . InversePointProxy ( this . world , this . data . velocity ) , this . force = new Phaser . Physics . P2 . InversePointProxy ( this . world , this . data . force ) , this . gravity = new Phaser . Point , this . onImpact = new Phaser . Signal , this . onBeginContact = new Phaser . Signal , this . onEndContact = new Phaser . Signal , this . collidesWith = [ ] , this . removeNextStep = ! 1 , this . _collideWorldBounds = ! 0 , this . _bodyCallbacks = { } , this . _bodyCallbackContext = { } , this . _groupCallbacks = { } , this . _groupCallbackContext = { } , this . debugBody = null , b && ( this . setRectangleFromSprite ( b ) , b . exists && this . game . physics . p2 . addBody ( this ) ) } , Phaser . Physics . P2 . Body . prototype = { createBodyCallback : function ( a , b , c ) { var d = - 1 ; a . id ? d = a . id : a . body && ( d = a . body . id ) , d > - 1 && ( null === b ? ( delete this . _bodyCallbacks [ d ] , delete this . _bodyCallbackContext [ d ] ) : ( this . _bodyCallbacks [ d ] = b , this . _bodyCallbackContext [ d ] = c ) ) } , createGroupCallback : function ( a , b , c ) { null === b ? ( delete this . _groupCallbacks [ a . mask ] , delete this . _groupCallbacksContext [ a . mask ] ) : ( this . _groupCallbacks [ a . mask ] = b , this . _groupCallbackContext [ a . mask ] = c ) } , getCollisionMask : function ( ) { var a = 0 ; this . _collideWorldBounds && ( a = this . game . physics . p2 . boundsCollisionGroup . mask ) ; for ( var b = 0 ; b < this . collidesWith . length ; b ++ ) a |= this . collidesWith [ b ] . mask ; return a } , updateCollisionMask : function ( a ) { var b = this . getCollisionMask ( ) ; if ( "undefined" == typeof a ) for ( var c = this . data . shapes . length - 1 ; c >= 0 ; c -- ) this . data . shapes [ c ] . collisionMask = b ; else a . collisionMask = b } , setCollisionGroup : function ( a , b ) { var c = this . getCollisionMask ( ) ; if ( "undefined" == typeof b ) for ( var d = this . data . shapes . length - 1 ; d >= 0 ; d -- ) this . data . shapes [ d ] . collisionGroup = a . mask , this . data . shapes [ d ] . collisionMask = c ; else b . collisionGroup = a . mask , b . collisionMask = c } , clearCollision : function ( a , b , c ) { if ( "undefined" == typeof c ) for ( var d = this . data . shapes . length - 1 ; d >= 0 ; d -- ) a && ( this . data . shapes [ d ] . collisionGroup = null ) , b && ( this . data . shapes [ d ] . collisionMask = null ) ; else a && ( c . collisionGroup = null ) , b && ( c . collisionMask = null ) ; a && ( this . collidesWith . length = 0 ) } , collides : function ( a , b , c , d ) { if ( Array . isArray ( a ) ) for ( var e = 0 ; e < a . length ; e ++ ) - 1 === this . collidesWith . indexOf ( a [ e ] ) && ( this . collidesWith . push ( a [ e ] ) , b && this . createGroupCallback ( a [ e ] , b , c ) ) ; else - 1 === this . collidesWith . indexOf ( a ) && ( this . collidesWith . push ( a ) , b && this . createGroupCallback ( a , b , c ) ) ; var f = this . getCollisionMask ( ) ; if ( "undefined" == typeof d ) for ( var e = this . data . s
2014-03-24 23:38:52 +00:00
//# sourceMappingURL=phaser.map