2014-05-29 16:37:28 +00:00
/* Phaser v2.0.6 - http://phaser.io - @photonstorm - (c) 2014 Photon Storm Ltd. */
2014-02-28 09:30:53 +00:00
2014-07-01 14:04:03 +00:00
( function ( ) { var a = this , b = b || { } ; b . WEBGL _RENDERER = 0 , b . CANVAS _RENDERER = 1 , b . VERSION = "v1.5.4" , 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 . _UID = 0 , b . Float32Array = Float32Array || Array , b . Uint16Array = Uint16Array || Array , b . INTERACTION _FREQUENCY = 30 , b . AUTO _PREVENT _DEFAULT = ! 0 , b . RAD _TO _DEG = 180 / Math . PI , b . DEG _TO _RAD = Math . PI / 180 , b . sayHello = function ( ) { if ( navigator . userAgent . toLowerCase ( ) . indexOf ( "chrome" ) > - 1 ) { var a = [ "%c %c %c Pixi.js " + b . VERSION + " %c %c http://pixjs.com %c %c ♥%c♥%c♥ " , "background: #ed2577" , "background: #ed2577" , "color: #ed2577; background: #0a0c1a;" , "background: #ed2577" , "background: #0a0c1a" , "background: #ed2577" , "color: #ff2424; background: #fff" , "color: #ff2424; background: #fff" , "color: #ff2424; background: #fff" ] ; console . log . apply ( console , a ) } else window . console && console . log ( "Pixi.js " + b . VERSION + " - http://pixjs.com" ) } , b . sayHello ( ) , 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 . set = function ( a , b ) { this . x = a || 0 , this . y = b || ( 0 !== b ? this . x : 0 ) } , b . Point . prototype . constructor = b . Point , 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 . 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 ? ( b [ 0 ] = this . a , b [ 1 ] = this . c , b [ 2 ] = 0 , b [ 3 ] = this . b , b [ 4 ] = this . d , b [ 5 ] = 0 , b [ 6 ] = this . tx , b [ 7 ] = this . ty , b [ 8 ] = 1 ) : ( b [ 0 ] = this . a , b [ 1 ] = this . b , b [ 2 ] = this . tx , b [ 3 ] = this . c , b [ 4 ] = this . d , b [ 5 ] = this . ty , b [ 6 ] = 0 , b [ 7 ] = 0 , b [ 8 ] = 1 ) , b } , b . identityMatrix = new b . Matrix , b . determineMatrixArrayType = function ( ) { return "undefined" != typeof Float32Array ? Float32Array : Array } , b . Matrix2 = b . determineMatrixArrayType ( ) , 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 , t
} b . uniform1i ( a . uniformLocation , this . textureCount ) , a . _init = ! 0 , this . textureCount ++ } } , b . PixiShader . prototype . syncUniforms = function ( ) { this . textureCount = 1 ; var a , c = this . gl ; for ( var d in this . uniforms ) a = this . uniforms [ d ] , 1 === a . glValueLength ? a . glMatrix === ! 0 ? a . glFunc . call ( c , a . uniformLocation , a . transpose , a . value ) : a . glFunc . call ( c , a . uniformLocation , a . value ) : 2 === a . glValueLength ? a . glFunc . call ( c , a . uniformLocation , a . value . x , a . value . y ) : 3 === a . glValueLength ? a . glFunc . call ( c , a . uniformLocation , a . value . x , a . value . y , a . value . z ) : 4 === a . glValueLength ? a . glFunc . call ( c , a . uniformLocation , a . value . x , a . value . y , a . value . z , a . value . w ) : "sampler2D" === a . type && ( a . _init ? ( c . activeTexture ( c [ "TEXTURE" + this . textureCount ] ) , c . bindTexture ( c . TEXTURE _2D , a . value . baseTexture . _glTextures [ c . id ] || b . createWebGLTexture ( a . value . baseTexture , c ) ) , c . uniform1i ( a . uniformLocation , this . textureCount ) , this . textureCount ++ ) : this . initSampler2D ( a ) ) } , b . PixiShader . prototype . destroy = function ( ) { this . gl . deleteProgram ( this . program ) , this . uniforms = null , this . gl = null , this . attributes = null } , b . PixiShader . defaultVertexSrc = [ "attribute vec2 aVertexPosition;" , "attribute vec2 aTextureCoord;" , "attribute vec2 aColor;" , "uniform vec2 projectionVector;" , "uniform vec2 offsetVector;" , "varying vec2 vTextureCoord;" , "varying vec4 vColor;" , "const vec2 center = vec2(-1.0, 1.0);" , "void main(void) {" , " gl_Position = vec4( ((aVertexPosition + offsetVector) / projectionVector) + center , 0.0, 1.0);" , " vTextureCoord = aTextureCoord;" , " vec3 color = mod(vec3(aColor.y/65536.0, aColor.y/256.0, aColor.y), 256.0) / 256.0;" , " vColor = vec4(color * aColor.x, aColor.x);" , "}" ] , b . PixiFastShader = function ( a ) { this . _UID = b . _UID ++ , this . gl = a , this . program = null , this . fragmentSrc = [ "precision lowp float;" , "varying vec2 vTextureCoord;" , "varying float vColor;" , "uniform sampler2D uSampler;" , "void main(void) {" , " gl_FragColor = texture2D(uSampler, vTextureCoord) * vColor ;" , "}" ] , this . vertexSrc = [ "attribute vec2 aVertexPosition;" , "attribute vec2 aPositionCoord;" , "attribute vec2 aScale;" , "attribute float aRotation;" , "attribute vec2 aTextureCoord;" , "attribute float aColor;" , "uniform vec2 projectionVector;" , "uniform vec2 offsetVector;" , "uniform mat3 uMatrix;" , "varying vec2 vTextureCoord;" , "varying float vColor;" , "const vec2 center = vec2(-1.0, 1.0);" , "void main(void) {" , " vec2 v;" , " vec2 sv = aVertexPosition * aScale;" , " v.x = (sv.x) * cos(aRotation) - (sv.y) * sin(aRotation);" , " v.y = (sv.x) * sin(aRotation) + (sv.y) * cos(aRotation);" , " v = ( uMatrix * vec3(v + aPositionCoord , 1.0) ).xy ;" , " gl_Position = vec4( ( v / projectionVector) + center , 0.0, 1.0);" , " vTextureCoord = aTextureCoord;" , " vColor = aColor;" , "}" ] , this . textureCount = 0 , this . init ( ) } , 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 ( a ) { this . _UID = b . _UID ++ , this . gl = a , this . program = null , this . fragmentSrc = [ "precision mediump float;" , "varying vec2 vTextureCoord;" , "uniform float alpha;" , "uniform sampler2D uSampler;" , "void main(void) {" , " gl_FragColor = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y));" , "}" ] , this . vertexSrc = [ "attribute vec2 aVertexPosition;" , " att
k [ t ++ ] = v * q + x * s + z , k [ t ++ ] = y * s + w * q + A , k [ t ++ ] = d . x0 , k [ t ++ ] = d . y0 , k [ t ++ ] = i , k [ t ++ ] = j , k [ t ++ ] = v * p + x * s + z , k [ t ++ ] = y * s + w * p + A , k [ t ++ ] = d . x1 , k [ t ++ ] = d . y1 , k [ t ++ ] = i , k [ t ++ ] = j , k [ t ++ ] = v * p + x * r + z , k [ t ++ ] = y * r + w * p + A , k [ t ++ ] = d . x2 , k [ t ++ ] = d . y2 , k [ t ++ ] = i , k [ t ++ ] = j , k [ t ++ ] = v * q + x * r + z , k [ t ++ ] = y * r + w * q + A , k [ t ++ ] = d . x3 , k [ t ++ ] = d . y3 , k [ t ++ ] = i , k [ t ++ ] = j , this . currentBatchSize ++ } , b . WebGLSpriteBatch . prototype . flush = function ( ) { if ( 0 !== this . currentBatchSize ) { var a = this . gl ; if ( this . renderSession . shaderManager . setShader ( this . renderSession . shaderManager . defaultShader ) , a . bindTexture ( a . TEXTURE _2D , this . currentBaseTexture . _glTextures [ a . id ] || b . createWebGLTexture ( this . currentBaseTexture , a ) ) , this . currentBaseTexture . _dirty [ a . id ] && b . updateWebGLTexture ( this . currentBaseTexture , a ) , this . currentBatchSize > . 5 * this . size ) a . bufferSubData ( a . ARRAY _BUFFER , 0 , this . vertices ) ; else { var c = this . vertices . subarray ( 0 , 4 * this . currentBatchSize * this . vertSize ) ; a . bufferSubData ( a . ARRAY _BUFFER , 0 , c ) } a . drawElements ( a . TRIANGLES , 6 * this . currentBatchSize , a . UNSIGNED _SHORT , 0 ) , this . currentBatchSize = 0 , this . renderSession . drawCount ++ } } , b . WebGLSpriteBatch . prototype . stop = function ( ) { this . flush ( ) } , b . WebGLSpriteBatch . prototype . start = function ( ) { var a = this . gl ; this . renderSession . shaderManager . setShader ( this . renderSession . shaderManager . defaultShader ) , a . activeTexture ( a . TEXTURE0 ) , a . bindBuffer ( a . ARRAY _BUFFER , this . vertexBuffer ) , a . bindBuffer ( a . ELEMENT _ARRAY _BUFFER , this . indexBuffer ) ; var c = this . renderSession . projection ; a . uniform2f ( this . shader . projectionVector , c . x , c . y ) ; var d = 4 * this . vertSize ; a . vertexAttribPointer ( this . shader . aVertexPosition , 2 , a . FLOAT , ! 1 , d , 0 ) , a . vertexAttribPointer ( this . shader . aTextureCoord , 2 , a . FLOAT , ! 1 , d , 8 ) , a . vertexAttribPointer ( this . shader . colorAttribute , 2 , a . FLOAT , ! 1 , d , 16 ) , this . currentBlendMode !== b . blendModes . NORMAL && this . setBlendMode ( b . blendModes . NORMAL ) } , b . WebGLSpriteBatch . prototype . setBlendMode = function ( a ) { this . flush ( ) , this . currentBlendMode = a ; var c = b . blendModesWebGL [ this . currentBlendMode ] ; this . gl . blendFunc ( c [ 0 ] , c [ 1 ] ) } , b . WebGLSpriteBatch . prototype . destroy = function ( ) { this . vertices = null , this . indices = null , this . gl . deleteBuffer ( this . vertexBuffer ) , this . gl . deleteBuffer ( this . indexBuffer ) , this . currentBaseTexture = null , this . gl = null } , b . WebGLFastSpriteBatch = function ( a ) { this . vertSize = 10 , this . maxSize = 6e3 , this . size = this . maxSize ; var b = 4 * this . size * this . vertSize , c = 6 * this . maxSize ; this . vertices = new Float32Array ( b ) , this . indices = new Uint16Array ( c ) , this . vertexBuffer = null , this . indexBuffer = null , this . lastIndexCount = 0 ; for ( var d = 0 , e = 0 ; c > d ; d += 6 , e += 4 ) this . indices [ d + 0 ] = e + 0 , this . indices [ d + 1 ] = e + 1 , this . indices [ d + 2 ] = e + 2 , this . indices [ d + 3 ] = e + 0 , this . indices [ d + 4 ] = e + 2 , this . indices [ d + 5 ] = e + 3 ; this . drawing = ! 1 , this . currentBatchSize = 0 , this . currentBaseTexture = null , this . currentBlendMode = 0 , this . renderSession = null , this . shader = null , this . matrix = null , this . setContext ( a ) } , b . WebGLFastSpriteBatch . prototype . setContext = function ( a ) { this . gl = a , this . vertexBuffer = a . createBuffer ( ) , this . indexBuffer = a . createBuffer ( ) , a . bindBuffer ( a . ELEMENT _ARRAY _BUFFER , this . indexBuffer ) , a . bufferData ( a . ELEMENT _ARRAY _BUFFER , this . indices , a . STATIC _DRAW ) , a . bindBuffer ( a . ARRAY _BUFFER , this . vertexBuffer ) , a . bufferData ( a . ARRAY _BUFFER , this . vertices , a . DYNAMIC _DRAW ) , this . currentBlendMode = 99999 } , b . WebGLFastSpriteBatch . prototype . begin = function ( a , b ) { this . renderSession = b , this . shader = this . renderSession . shaderManager . fastShader , this . matrix = a . worldTransform . toArray ( ! 0 ) , this . start ( ) } , b . WebGLFastSpriteBatch . prototype . end = function ( ) { this . flush ( ) } , b . WebGLFastSpriteBatch . prototype . render = function ( a ) { var b = a . children , c = b [ 0 ] ; if ( c . texture . _uvs ) { this . currentBaseTexture = c . texture . baseTexture , c . blendMode !== this . currentBlendMode && this . setBlendMode ( c . blendMode ) ; for ( var d = 0 , e = b . length ; e > d ; d ++ ) this . renderSprite ( b [ d ] ) ; this . flush ( ) } } , b . WebGLFastSpriteBatch . prototype . renderSprite = function ( a ) { if ( a . visible && ( a . texture . baseTexture === this . currentBaseTexture || ( this . flush ( ) , this . currentBaseTexture = a . texture . baseTexture , a . texture . _uvs ) ) ) { var b , c , d , e , f , g , h , i , j = this . vertices ; if ( b = a . texture . _uvs , c = a . texture . frame . width , d = a . texture . frame . height , a . texture . trim ) { var k = a . texture . trim ; f = k . x - a . anchor . x * k . width , e = f + a . texture . frame . width , h = k . y - a . anchor . y * k . height , g = h + a . t
for ( var d = 0 , e = this . children . length ; e > d ; d ++ ) this . children [ d ] . _renderWebGL ( a ) ; a . spriteBatch . stop ( ) } this . _filters && a . filterManager . popFilter ( ) , this . _mask && a . maskManager . popMask ( this . mask , a ) , a . drawCount ++ , a . spriteBatch . start ( ) } } , b . Graphics . prototype . _renderCanvas = function ( a ) { if ( this . visible !== ! 1 && 0 !== this . alpha && this . isMask !== ! 0 ) { var c = a . context , d = this . worldTransform ; this . blendMode !== a . currentBlendMode && ( a . currentBlendMode = this . blendMode , c . globalCompositeOperation = b . blendModesCanvas [ a . currentBlendMode ] ) , this . _mask && a . maskManager . pushMask ( this . _mask , a . context ) , c . setTransform ( d . a , d . c , d . b , d . d , d . tx , d . ty ) , b . CanvasGraphics . renderGraphics ( this , c ) ; for ( var e = 0 , f = this . children . length ; f > e ; e ++ ) this . children [ e ] . _renderCanvas ( a ) ; this . _mask && a . maskManager . popMask ( a . context ) } } , b . Graphics . prototype . getBounds = function ( a ) { this . bounds || this . updateBounds ( ) ; var b = this . bounds . x , c = this . bounds . width + this . bounds . x , d = this . bounds . y , e = this . bounds . height + this . bounds . y , f = a || this . worldTransform , g = f . a , h = f . c , i = f . b , j = f . d , k = f . tx , l = f . ty , m = g * c + i * e + k , n = j * e + h * c + l , o = g * b + i * e + k , p = j * e + h * b + l , q = g * b + i * d + k , r = j * d + h * b + l , s = g * c + i * d + k , t = j * d + h * c + l , u = m , v = n , w = m , x = n ; w = w > o ? o : w , w = w > q ? q : w , w = w > s ? s : w , x = x > p ? p : x , x = x > r ? r : x , x = x > t ? t : x , u = o > u ? o : u , u = q > u ? q : u , u = s > u ? s : u , v = p > v ? p : v , v = r > v ? r : v , v = t > v ? t : v ; var y = this . _bounds ; return y . x = w , y . width = u - w , y . y = x , y . height = v - x , y } , b . Graphics . prototype . updateBounds = function ( ) { for ( var a , c , d , e , f , g = 1 / 0 , h = - 1 / 0 , i = 1 / 0 , j = - 1 / 0 , k = 0 ; k < this . graphicsData . length ; k ++ ) { var l = this . graphicsData [ k ] , m = l . type , n = l . lineWidth ; if ( a = l . points , m === b . Graphics . RECT ) c = a [ 0 ] - n / 2 , d = a [ 1 ] - n / 2 , e = a [ 2 ] + n , f = a [ 3 ] + n , g = g > c ? c : g , h = c + e > h ? c + e : h , i = i > d ? c : i , j = d + f > j ? d + f : j ; else if ( m === b . Graphics . CIRC || m === b . Graphics . ELIP ) c = a [ 0 ] , d = a [ 1 ] , e = a [ 2 ] + n / 2 , f = a [ 3 ] + n / 2 , g = g > c - e ? c - e : g , h = c + e > h ? c + e : h , i = i > d - f ? d - f : i , j = d + f > j ? d + f : j ; else for ( var o = 0 ; o < a . length ; o += 2 ) c = a [ o ] , d = a [ o + 1 ] , g = g > c - n ? c - n : g , h = c + n > h ? c + n : h , i = i > d - n ? d - n : i , j = d + n > j ? d + n : j } var p = this . boundsPadding ; this . bounds = new b . Rectangle ( g - p , i - p , h - g + 2 * p , j - i + 2 * p ) } , b . Graphics . prototype . _generateCachedSprite = function ( ) { var a = this . getLocalBounds ( ) ; if ( this . _cachedSprite ) this . _cachedSprite . buffer . resize ( a . width , a . height ) ; else { var c = new b . CanvasBuffer ( a . width , a . height ) , d = b . Texture . fromCanvas ( c . canvas ) ; this . _cachedSprite = new b . Sprite ( d ) , this . _cachedSprite . buffer = c , this . _cachedSprite . worldTransform = this . worldTransform } this . _cachedSprite . anchor . x = - ( a . x / a . width ) , this . _cachedSprite . anchor . y = - ( a . y / a . height ) , this . _cachedSprite . buffer . context . translate ( - a . x , - a . y ) , b . CanvasGraphics . renderGraphics ( this , this . _cachedSprite . buffer . context ) , this . _cachedSprite . alpha = this . alpha } , b . Graphics . prototype . destroyCachedSprite = function ( ) { this . _cachedSprite . texture . destroy ( ! 0 ) , this . _cachedSprite = null } , b . Graphics . POLY = 0 , b . Graphics . RECT = 1 , b . Graphics . CIRC = 2 , b . Graphics . ELIP = 3 , b . Graphics . RREC = 4 , b . Strip = function ( a ) { b . DisplayObjectContainer . call ( this ) , this . texture = a , this . uvs = new b . Float32Array ( [ 0 , 1 , 1 , 1 , 1 , 0 , 0 , 1 ] ) , this . verticies = new b . Float32Array ( [ 0 , 0 , 100 , 0 , 100 , 100 , 0 , 100 ] ) , this . colors = new b . Float32Array ( [ 1 , 1 , 1 , 1 ] ) , this . indices = new b . Uint16Array ( [ 0 , 1 , 2 , 3 ] ) , this . dirty = ! 0 } , b . Strip . prototype = Object . create ( b . DisplayObjectContainer . prototype ) , b . Strip . prototype . constructor = b . Strip , b . Strip . prototype . _renderWebGL = function ( a ) { ! this . visible || this . alpha <= 0 || ( a . spriteBatch . stop ( ) , this . _vertexBuffer || this . _initWebGL ( a ) , a . shaderManager . setShader ( a . shaderManager . stripShader ) , this . _renderStrip ( a ) , a . spriteBatch . start ( ) ) } , b . Strip . prototype . _initWebGL = function ( a ) { var b = a . gl ; this . _vertexBuffer = b . createBuffer ( ) , this . _indexBuffer = b . createBuffer ( ) , this . _uvBuffer = b . createBuffer ( ) , this . _colorBuffer = b . createBuffer ( ) , b . bindBuffer ( b . ARRAY _BUFFER , this . _vertexBuffer ) , b . bufferData ( b . ARRAY _BUFFER , this . verticies , b . DYNAMIC _DRAW ) , b . bindBuffer ( b . ARRAY _BUFFER , this . _uvBuffer ) , b . bufferData ( b . ARRAY _BUFFER , this . uvs , b . STATIC _DRAW ) , b . bindBuffer ( b . ARRAY _BUFFER , this . _colorBuffer ) , b . bufferData ( b . ARRAY _BUFFER , this . colors , b . STATIC _DRAW ) , b . bindBuffer ( b . ELEMENT _ARRAY _BUFFER , this . _indexBuffer ) , b . bufferData ( b . ELEMENT _ARRAY _BUFFER , this . indices , b . STATIC _DRAW ) } , b . Strip . prototype . _renderStrip = function ( a ) { var c = a . gl , d = a . projection , e = a . offset , f = a . shaderManager . stripShader ; c . blendFun
2014-07-02 22:23:26 +00:00
} } , Object . defineProperty ( b . Rectangle . prototype , "halfWidth" , { get : function ( ) { return Math . round ( this . width / 2 ) } } ) , Object . defineProperty ( b . Rectangle . prototype , "halfHeight" , { get : function ( ) { return Math . round ( this . height / 2 ) } } ) , Object . defineProperty ( b . Rectangle . prototype , "bottom" , { get : function ( ) { return this . y + this . height } , set : function ( a ) { this . height = a <= this . y ? 0 : this . y - a } } ) , Object . defineProperty ( b . Rectangle . prototype , "bottomRight" , { get : function ( ) { return new b . Point ( this . right , this . bottom ) } , set : function ( a ) { this . right = a . x , this . bottom = a . y } } ) , Object . defineProperty ( b . Rectangle . prototype , "left" , { get : function ( ) { return this . x } , set : function ( a ) { this . width = a >= this . right ? 0 : this . right - a , this . x = a } } ) , Object . defineProperty ( b . Rectangle . prototype , "right" , { get : function ( ) { return this . x + this . width } , set : function ( a ) { this . width = a <= this . x ? 0 : a - this . x } } ) , Object . defineProperty ( b . Rectangle . prototype , "volume" , { get : function ( ) { return this . width * this . height } } ) , Object . defineProperty ( b . Rectangle . prototype , "perimeter" , { get : function ( ) { return 2 * this . width + 2 * this . height } } ) , Object . defineProperty ( b . Rectangle . prototype , "centerX" , { get : function ( ) { return this . x + this . halfWidth } , set : function ( a ) { this . x = a - this . halfWidth } } ) , Object . defineProperty ( b . Rectangle . prototype , "centerY" , { get : function ( ) { return this . y + this . halfHeight } , set : function ( a ) { this . y = a - this . halfHeight } } ) , Object . defineProperty ( b . Rectangle . prototype , "top" , { get : function ( ) { return this . y } , set : function ( a ) { a >= this . bottom ? ( this . height = 0 , this . y = a ) : this . height = this . bottom - a } } ) , Object . defineProperty ( b . Rectangle . prototype , "topLeft" , { get : function ( ) { return new b . Point ( this . x , this . y ) } , set : function ( a ) { this . x = a . x , this . y = a . y } } ) , Object . defineProperty ( b . Rectangle . prototype , "empty" , { get : function ( ) { return ! this . width || ! this . height } , set : function ( a ) { a === ! 0 && this . setTo ( 0 , 0 , 0 , 0 ) } } ) , b . Rectangle . prototype . constructor = b . Rectangle , b . Rectangle . inflate = function ( a , b , c ) { return a . x -= b , a . width += 2 * b , a . y -= c , a . height += 2 * c , a } , b . Rectangle . inflatePoint = function ( a , c ) { return b . Rectangle . inflate ( a , c . x , c . y ) } , b . Rectangle . size = function ( a , c ) { return "undefined" == typeof c ? c = new b . Point ( a . width , a . height ) : c . setTo ( a . width , a . height ) , c } , b . Rectangle . clone = function ( a , c ) { return "undefined" == typeof c ? c = new b . Rectangle ( a . x , a . y , a . width , a . height ) : c . setTo ( a . x , a . y , a . width , a . height ) , c } , b . Rectangle . contains = function ( a , b , c ) { return a . width <= 0 || a . height <= 0 ? ! 1 : b >= a . x && b <= a . right && c >= a . y && c <= a . bottom } , b . Rectangle . containsRaw = function ( a , b , c , d , e , f ) { return e >= a && a + c >= e && f >= b && b + d >= f } , b . Rectangle . containsPoint = function ( a , c ) { return b . Rectangle . contains ( a , c . x , c . y ) } , b . Rectangle . containsRect = function ( a , b ) { return a . volume > b . volume ? ! 1 : a . x >= b . x && a . y >= b . y && a . right <= b . right && a . bottom <= b . bottom } , b . Rectangle . equals = function ( a , b ) { return a . x == b . x && a . y == b . y && a . width == b . width && a . height == b . height } , b . Rectangle . intersection = function ( a , c , d ) { return "undefined" == typeof d && ( d = new b . Rectangle ) , b . Rectangle . intersects ( a , c ) && ( d . x = Math . max ( a . x , c . x ) , d . y = Math . max ( a . y , c . y ) , d . width = Math . min ( a . right , c . right ) - d . x , d . height = Math . min ( a . bottom , c . bottom ) - d . y ) , d } , b . Rectangle . intersects = function ( a , b ) { return a . width <= 0 || a . height <= 0 || b . width <= 0 || b . height <= 0 ? ! 1 : ! ( a . right < b . x || a . bottom < b . y || a . x > b . right || a . y > b . bottom ) } , b . Rectangle . intersectsRaw = function ( a , b , c , d , e , f ) { return "undefined" == typeof f && ( f = 0 ) , ! ( b > a . right + f || c < a . left - f || d > a . bottom + f || e < a . top - f ) } , b . Rectangle . union = function ( a , c , d ) { return "undefined" == typeof d && ( d = new b . Rectangle ) , d . setTo ( Math . min ( a . x , c . x ) , Math . min ( a . y , c . y ) , Math . max ( a . right , c . right ) - Math . min ( a . left , c . left ) , Math . max ( a . bottom , c . bottom ) - Math . min ( a . top , c . top ) ) } , PIXI . Rectangle = b . Rectangle , PIXI . EmptyRectangle = new b . Rectangle ( 0 , 0 , 0 , 0 ) , b . Line = function ( a , c , d , e ) { a = a || 0 , c = c || 0 , d = d || 0 , e = e || 0 , this . start = new b . Point ( a , c ) , this . end = new b . Point ( d , e ) } , b . Line . prototype = { setTo : function ( a , b , c , d ) { return this . start . setTo ( a , b ) , this . end . setTo ( c , d ) , this } , fromSprite : function ( a , b , c ) { return "undefined" == typeof c && ( c = ! 1 ) , c ? this . setTo ( a . center . x , a . center . y , b . center . x , b . center . y ) : this . setTo ( a . x , a . y , b . x , b . y ) } , intersects : function ( a , c , d ) { return b . Line . intersectsPoints ( this . start , this . end , a . start , a . end , c , d ) } , pointOnLine : function ( a , b ) { return ( a - this . start . x )
} , b . Group . prototype = Object . create ( PIXI . DisplayObjectContainer . prototype ) , b . Group . prototype . constructor = b . Group , b . Group . RETURN _NONE = 0 , b . Group . RETURN _TOTAL = 1 , b . Group . RETURN _CHILD = 2 , b . Group . SORT _ASCENDING = - 1 , b . Group . SORT _DESCENDING = 1 , b . Group . prototype . add = function ( a , b ) { return "undefined" == typeof b && ( b = ! 1 ) , a . parent !== this && ( this . enableBody && this . game . physics . enable ( a , this . physicsBodyType ) , this . addChild ( a ) , a . z = this . children . length , ! b && a . events && a . events . onAddedToGroup . dispatch ( a , this ) , null === this . cursor && ( this . cursor = a ) ) , a } , b . Group . prototype . addAt = function ( a , b , c ) { return "undefined" == typeof c && ( c = ! 1 ) , a . parent !== this && ( this . enableBody && this . game . physics . enable ( a , this . physicsBodyType ) , this . addChildAt ( a , b ) , this . updateZ ( ) , ! c && a . events && a . events . onAddedToGroup . dispatch ( a , this ) , null === this . cursor && ( this . cursor = a ) ) , a } , b . Group . prototype . getAt = function ( a ) { return 0 > a || a >= this . children . length ? - 1 : this . getChildAt ( a ) } , b . Group . prototype . create = function ( a , b , c , d , e ) { "undefined" == typeof e && ( e = ! 0 ) ; var f = new this . classType ( this . game , a , b , c , d ) ; return this . enableBody && this . game . physics . enable ( f , this . physicsBodyType ) , f . exists = e , f . visible = e , f . alive = e , this . addChild ( f ) , f . z = this . children . length , f . events && f . events . onAddedToGroup . dispatch ( f , this ) , null === this . cursor && ( this . cursor = f ) , f } , b . Group . prototype . createMultiple = function ( a , b , c , d ) { "undefined" == typeof d && ( d = ! 1 ) ; for ( var e = 0 ; a > e ; e ++ ) this . create ( 0 , 0 , b , c , d ) } , b . Group . prototype . updateZ = function ( ) { for ( var a = this . children . length ; a -- ; ) this . children [ a ] . z = a } , b . Group . prototype . resetCursor = function ( a ) { return "undefined" == typeof a && ( a = 0 ) , a > this . children . length - 1 && ( a = 0 ) , this . cursor ? ( this . _cache [ 8 ] = a , this . cursor = this . children [ this . _cache [ 8 ] ] , this . cursor ) : void 0 } , b . Group . prototype . next = function ( ) { return this . cursor ? ( this . _cache [ 8 ] >= this . children . length - 1 ? this . _cache [ 8 ] = 0 : this . _cache [ 8 ] ++ , this . cursor = this . children [ this . _cache [ 8 ] ] , this . cursor ) : void 0 } , b . Group . prototype . previous = function ( ) { return this . cursor ? ( 0 === this . _cache [ 8 ] ? this . _cache [ 8 ] = this . children . length - 1 : this . _cache [ 8 ] -- , this . cursor = this . children [ this . _cache [ 8 ] ] , this . cursor ) : void 0 } , b . Group . prototype . swap = function ( a , b ) { var c = this . swapChildren ( a , b ) ; return c && this . updateZ ( ) , c } , b . Group . prototype . bringToTop = function ( a ) { return a . parent === this && this . getIndex ( a ) < this . children . length && ( this . remove ( a , ! 1 , ! 0 ) , this . add ( a , ! 0 ) ) , a } , b . Group . prototype . sendToBack = function ( a ) { return a . parent === this && this . getIndex ( a ) > 0 && ( this . remove ( a , ! 1 , ! 0 ) , this . addAt ( a , 0 , ! 0 ) ) , a } , b . Group . prototype . moveUp = function ( a ) { if ( a . parent === this && this . getIndex ( a ) < this . children . length - 1 ) { var b = this . getIndex ( a ) , c = this . getAt ( b + 1 ) ; c && this . swap ( a , c ) } return a } , b . Group . prototype . moveDown = function ( a ) { if ( a . parent === this && this . getIndex ( a ) > 0 ) { var b = this . getIndex ( a ) , c = this . getAt ( b - 1 ) ; c && this . swap ( a , c ) } return a } , b . Group . prototype . xy = function ( a , b , c ) { return 0 > a || a > this . children . length ? - 1 : ( this . getChildAt ( a ) . x = b , void ( this . getChildAt ( a ) . y = c ) ) } , b . Group . prototype . reverse = function ( ) { this . children . reverse ( ) , this . updateZ ( ) } , b . Group . prototype . getIndex = function ( a ) { return this . children . indexOf ( a ) } , b . Group . prototype . replace = function ( a , c ) { var d = this . getIndex ( a ) ; if ( - 1 !== d ) { void 0 !== c . parent && ( c . events . onRemovedFromGroup . dispatch ( c , this ) , c . parent . removeChild ( c ) , c . parent instanceof b . Group && c . parent . updateZ ( ) ) ; var e = a ; return this . remove ( e ) , this . addAt ( c , d ) , e } } , b . Group . prototype . hasProperty = function ( a , b ) { var c = b . length ; return 1 === c && b [ 0 ] in a ? ! 0 : 2 === c && b [ 0 ] in a && b [ 1 ] in a [ b [ 0 ] ] ? ! 0 : 3 === c && b [ 0 ] in a && b [ 1 ] in a [ b [ 0 ] ] && b [ 2 ] in a [ b [ 0 ] ] [ b [ 1 ] ] ? ! 0 : 4 === c && b [ 0 ] in a && b [ 1 ] in a [ b [ 0 ] ] && b [ 2 ] in a [ b [ 0 ] ] [ b [ 1 ] ] && b [ 3 ] in a [ b [ 0 ] ] [ b [ 1 ] ] [ b [ 2 ] ] ? ! 0 : ! 1 } , b . Group . prototype . setProperty = function ( a , b , c , d , e ) { if ( "undefined" == typeof e && ( e = ! 1 ) , d = d || 0 , ! this . hasProperty ( a , b ) && ( ! e || d > 0 ) ) return ! 1 ; var f = b . length ; return 1 === f ? 0 === d ? a [ b [ 0 ] ] = c : 1 == d ? a [ b [ 0 ] ] += c : 2 == d ? a [ b [ 0 ] ] -= c : 3 == d ? a [ b [ 0 ] ] *= c : 4 == d && ( a [ b [ 0 ] ] /= c ) : 2 === f ? 0 === d ? a [ b [ 0 ] ] [ b [ 1 ] ] = c : 1 == d ? a [ b [ 0 ] ] [ b [ 1 ] ] += c : 2 == d ? a [ b [ 0 ] ] [ b [ 1 ] ] -= c : 3 == d ? a [ b [ 0 ] ] [ b [ 1 ] ] *= c : 4 == d && ( a [ b [ 0 ] ] [ b [ 1 ] ] /= c ) : 3 === f ? 0 === d ? a [ b [ 0 ] ] [ b [ 1 ] ] [ b [ 2 ] ] = c : 1 == d ? a [ b [ 0 ] ] [ b [ 1 ] ] [ b [ 2 ] ] += c : 2 == d ? a [ b [ 0 ] ] [ b [ 1 ] ] [ b [ 2 ] ] -= c : 3 == d ? a [ b [ 0 ] ] [ b [ 1 ] ] [ b [ 2 ] ] *= c : 4 == d && ( a [ b [ 0 ] ] [ b [ 1 ] ] [ b [ 2 ] ] /= c ) : 4 === f && ( 0 === d ? a [ b [
} , destroy : function ( ) { this . mouse . stop ( ) , this . keyboard . stop ( ) , this . touch . stop ( ) , this . mspointer . stop ( ) , this . gamepad . stop ( ) , this . moveCallbacks = [ ] , this . moveCallback = null } , setMoveCallback : function ( a , b ) { this . moveCallback = a , this . moveCallbackContext = b } , addMoveCallback : function ( a , b ) { return this . moveCallbacks . push ( { callback : a , context : b } ) - 1 } , deleteMoveCallback : function ( a ) { this . moveCallbacks [ a ] && this . moveCallbacks . splice ( a , 1 ) } , addPointer : function ( ) { for ( var a = 0 , c = 10 ; c > 0 ; c -- ) null === this [ "pointer" + c ] && ( a = c ) ; return 0 === a ? ( console . warn ( "You can only have 10 Pointer objects" ) , null ) : ( this [ "pointer" + a ] = new b . Pointer ( this . game , a ) , this [ "pointer" + a ] ) } , update : function ( ) { return this . keyboard . update ( ) , this . pollRate > 0 && this . _pollCounter < this . pollRate ? void this . _pollCounter ++ : ( this . speed . x = this . position . x - this . _oldPosition . x , this . speed . y = this . position . y - this . _oldPosition . y , this . _oldPosition . copyFrom ( this . position ) , this . mousePointer . update ( ) , this . gamepad . active && this . gamepad . update ( ) , this . pointer1 . update ( ) , this . pointer2 . update ( ) , this . pointer3 && this . pointer3 . update ( ) , this . pointer4 && this . pointer4 . update ( ) , this . pointer5 && this . pointer5 . update ( ) , this . pointer6 && this . pointer6 . update ( ) , this . pointer7 && this . pointer7 . update ( ) , this . pointer8 && this . pointer8 . update ( ) , this . pointer9 && this . pointer9 . update ( ) , this . pointer10 && this . pointer10 . update ( ) , void ( this . _pollCounter = 0 ) ) } , reset : function ( a ) { if ( this . game . isBooted && ! this . resetLocked ) { "undefined" == typeof a && ( a = ! 1 ) , this . keyboard . reset ( a ) , this . mousePointer . reset ( ) , this . gamepad . reset ( ) ; for ( var c = 1 ; 10 >= c ; c ++ ) this [ "pointer" + c ] && this [ "pointer" + c ] . reset ( ) ; this . currentPointers = 0 , "none" !== this . game . canvas . style . cursor && ( this . game . canvas . style . cursor = "inherit" ) , a && ( this . onDown . dispose ( ) , this . onUp . dispose ( ) , this . onTap . dispose ( ) , this . onHold . dispose ( ) , this . onDown = new b . Signal , this . onUp = new b . Signal , this . onTap = new b . Signal , this . onHold = new b . Signal , this . moveCallbacks = [ ] ) , this . _pollCounter = 0 } } , resetSpeed : function ( a , b ) { this . _oldPosition . setTo ( a , b ) , this . speed . setTo ( 0 , 0 ) } , startPointer : function ( a ) { if ( this . maxPointers < 10 && this . totalActivePointers == this . maxPointers ) return null ; if ( this . pointer1 . active === ! 1 ) return this . pointer1 . start ( a ) ; if ( this . pointer2 . active === ! 1 ) return this . pointer2 . start ( a ) ; for ( var b = 3 ; 10 >= b ; b ++ ) if ( this [ "pointer" + b ] && this [ "pointer" + b ] . active === ! 1 ) return this [ "pointer" + b ] . start ( a ) ; return null } , updatePointer : function ( a ) { if ( this . pointer1 . active && this . pointer1 . identifier == a . identifier ) return this . pointer1 . move ( a ) ; if ( this . pointer2 . active && this . pointer2 . identifier == a . identifier ) return this . pointer2 . move ( a ) ; for ( var b = 3 ; 10 >= b ; b ++ ) if ( this [ "pointer" + b ] && this [ "pointer" + b ] . active && this [ "pointer" + b ] . identifier == a . identifier ) return this [ "pointer" + b ] . move ( a ) ; return null } , stopPointer : function ( a ) { if ( this . pointer1 . active && this . pointer1 . identifier == a . identifier ) return this . pointer1 . stop ( a ) ; if ( this . pointer2 . active && this . pointer2 . identifier == a . identifier ) return this . pointer2 . stop ( a ) ; for ( var b = 3 ; 10 >= b ; b ++ ) if ( this [ "pointer" + b ] && this [ "pointer" + b ] . active && this [ "pointer" + b ] . identifier == a . identifier ) return this [ "pointer" + b ] . stop ( a ) ; return null } , getPointer : function ( a ) { if ( a = a || ! 1 , this . pointer1 . active == a ) return this . pointer1 ; if ( this . pointer2 . active == a ) return this . pointer2 ; for ( var b = 3 ; 10 >= b ; b ++ ) if ( this [ "pointer" + b ] && this [ "pointer" + b ] . active == a ) return this [ "pointer" + b ] ; return null } , getPointerFromIdentifier : function ( a ) { if ( this . pointer1 . identifier === a ) return this . pointer1 ; if ( this . pointer2 . identifier === a ) return this . pointer2 ; for ( var b = 3 ; 10 >= b ; b ++ ) if ( this [ "pointer" + b ] && this [ "pointer" + b ] . identifier === a ) return this [ "pointer" + b ] ; return null } , getPointerFromId : function ( a ) { if ( this . pointer1 . pointerId === a ) return this . pointer1 ; if ( this . pointer2 . pointerId === a ) return this . pointer2 ; for ( var b = 3 ; 10 >= b ; b ++ ) if ( this [ "pointer" + b ] && this [ "pointer" + b ] . pointerId === a ) return this [ "pointer" + b ] ; return null } , getLocalPosition : function ( a , c , d ) { "undefined" == typeof d && ( d = new b . Point ) ; var e = a . worldTransform , f = 1 / ( e . a * e . d + e . b * - e . c ) ; return d . setTo ( e . d * f * c . x + - e . b * f * c . y + ( e . ty * e . b - e . tx * e . d ) * f , e . a * f * c . y + - e . c * f * c . x + ( - e . ty * e . a + e . tx * e . c ) * f ) } , hitTest : function ( a , c , d ) { if ( ! a . worldVisible ) return ! 1 ; if ( this
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 ( ) , this . pad1 . pollStatus ( ) , this . pad2 . pollStatus ( ) , this . pad3 . pollStatus ( ) , this . pad4 . pollStatus ( ) } , _pollGamepads : function ( ) { if ( navigator . getGamepads ) var a = navigator . getGamepads ( ) ; else if ( navigator . webkitGetGamepads ) var a = navigator . webkitGetGamepads ( ) ; else if ( navigator . webkitGamepads ) var a = 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 _STICK _RIGHT _X = 2 , b . Gamepad . XBOX360 _STICK _RIGHT _Y =
l && ( this . context . putImageData ( this . imageData , 0 , 0 ) , this . dirty = ! 0 ) } , processPixel : function ( a , b , c , d , e , f ) { "undefined" == typeof c && ( c = 0 ) , "undefined" == typeof d && ( d = 0 ) , "undefined" == typeof e && ( e = this . width ) , "undefined" == typeof f && ( f = this . height ) ; for ( var g = c + e , h = d + f , i = 0 , j = 0 , k = ! 1 , l = d ; h > l ; l ++ ) for ( var m = c ; g > m ; m ++ ) i = this . getPixel32 ( m , l ) , j = a . call ( b , i , m , l ) , j !== i && ( this . pixels [ l * this . width + m ] = j , k = ! 0 ) ; k && ( this . context . putImageData ( this . imageData , 0 , 0 ) , this . dirty = ! 0 ) } , replaceRGB : function ( a , c , d , e , f , g , h , i , j ) { var k = 0 , l = 0 , m = this . width , n = this . height , o = b . Color . packPixel ( a , c , d , e ) ; void 0 !== j && j instanceof b . Rectangle && ( k = j . x , l = j . y , m = j . width , n = j . height ) ; for ( var p = 0 ; n > p ; p ++ ) for ( var q = 0 ; m > q ; q ++ ) this . getPixel32 ( k + q , l + p ) === o && this . setPixel32 ( k + q , l + p , f , g , h , i , ! 1 ) ; this . context . putImageData ( this . imageData , 0 , 0 ) , this . dirty = ! 0 } , setHSL : function ( a , c , d , e ) { if ( ( "undefined" == typeof a || null === a ) && ( a = ! 1 ) , ( "undefined" == typeof c || null === c ) && ( c = ! 1 ) , ( "undefined" == typeof d || null === d ) && ( d = ! 1 ) , a || c || d ) { "undefined" == typeof e && ( e = new b . Rectangle ( 0 , 0 , this . width , this . height ) ) ; for ( var f = b . Color . createColor ( ) , g = e . y ; g < e . bottom ; g ++ ) for ( var h = e . x ; h < e . right ; h ++ ) b . Color . unpackPixel ( this . getPixel32 ( h , g ) , f , ! 0 ) , a && ( f . h = a ) , c && ( f . s = c ) , d && ( f . l = d ) , b . Color . HSLtoRGB ( f . h , f . s , f . l , f ) , this . setPixel32 ( h , g , f . r , f . g , f . b , f . a , ! 1 ) ; this . context . putImageData ( this . imageData , 0 , 0 ) , this . dirty = ! 0 } } , shiftHSL : function ( a , c , d , e ) { if ( ( "undefined" == typeof a || null === a ) && ( a = ! 1 ) , ( "undefined" == typeof c || null === c ) && ( c = ! 1 ) , ( "undefined" == typeof d || null === d ) && ( d = ! 1 ) , a || c || d ) { "undefined" == typeof e && ( e = new b . Rectangle ( 0 , 0 , this . width , this . height ) ) ; for ( var f = b . Color . createColor ( ) , g = e . y ; g < e . bottom ; g ++ ) for ( var h = e . x ; h < e . right ; h ++ ) b . Color . unpackPixel ( this . getPixel32 ( h , g ) , f , ! 0 ) , a && ( f . h = this . game . math . wrap ( f . h + a , 0 , 1 ) ) , c && ( f . s = this . game . math . limitValue ( f . s + c , 0 , 1 ) ) , d && ( f . l = this . game . math . limitValue ( f . l + d , 0 , 1 ) ) , b . Color . HSLtoRGB ( f . h , f . s , f . l , f ) , this . setPixel32 ( h , g , f . r , f . g , f . b , f . a , ! 1 ) ; this . context . putImageData ( this . imageData , 0 , 0 ) , this . dirty = ! 0 } } , setPixel32 : function ( a , c , d , e , f , g , h ) { "undefined" == typeof h && ( h = ! 0 ) , a >= 0 && a <= this . width && c >= 0 && c <= this . height && ( this . pixels [ c * this . width + a ] = b . Device . LITTLE _ENDIAN ? g << 24 | f << 16 | e << 8 | d : d << 24 | e << 16 | f << 8 | g , h && ( this . context . putImageData ( this . imageData , 0 , 0 ) , this . dirty = ! 0 ) ) } , setPixel : function ( a , b , c , d , e , f ) { this . setPixel32 ( a , b , c , d , e , 255 , f ) } , getPixel : function ( a , c , d ) { d || ( d = b . Color . createColor ( ) ) ; var e = ~ ~ ( a + c * this . width ) ; return e *= 4 , d . r = this . data [ e ] , d . g = this . data [ ++ e ] , d . b = this . data [ ++ e ] , d . a = this . data [ ++ e ] , d } , getPixel32 : function ( a , b ) { return a >= 0 && a <= this . width && b >= 0 && b <= this . height ? this . pixels [ b * this . width + a ] : void 0 } , getPixelRGB : function ( a , c , d , e , f ) { return b . Color . unpackPixel ( this . getPixel32 ( a , c ) , d , e , f ) } , getPixels : function ( a ) { return this . context . getImageData ( a . x , a . y , a . width , a . height ) } , addToWorld : function ( a , b ) { return this . game . add . image ( a , b , this ) } , copyPixels : function ( a , c , d , e ) { "string" == typeof a && ( a = this . game . cache . getImage ( a ) ) ; var f = a , g = 0 , h = 0 ; if ( a instanceof b . Image || a instanceof b . Sprite ) { f = a . texture . baseTexture . source ; var i = a . texture . frame ; g = i . x , h = i . y } else a instanceof b . BitmapData && ( f = a . canvas ) ; this . context . drawImage ( f , g + c . x , h + c . y , c . width , c . height , d , e , c . width , c . height ) , this . dirty = ! 0 } , draw : function ( a , c , d , e , f ) { "undefined" == typeof c && ( c = 0 ) , "undefined" == typeof d && ( d = 0 ) , "string" == typeof a && ( a = this . game . cache . getImage ( a ) ) ; var g = a , h = 0 , i = 0 , j = 0 , k = 0 ; if ( a instanceof b . Image || a instanceof b . Sprite ) { g = a . texture . baseTexture . source ; var l = a . texture . frame ; h = l . x , i = l . y , j = l . width , k = l . height } else a instanceof b . BitmapData && ( g = a . canvas ) , j = a . width , k = a . height ; "undefined" == typeof e && ( e = j ) , "undefined" == typeof f && ( f = k ) , this . context . drawImage ( g , h , i , j , k , c , d , e , f ) , this . dirty = ! 0 } , drawSprite : function ( a , b , c ) { "undefined" == typeof b && ( b = 0 ) , "undefined" == typeof c && ( c = 0 ) , this . draw ( a , b , c ) } , alphaMask : function ( a , b , c , d ) { ( "undefined" == typeof b || null === b ) && ( b = this ) ; var e = this . context . globalCompositeOperation ; "undefined" == typeof d || null === d ? this . draw ( b ) : this . draw ( b , d . x , d . y , d . width , d . height ) , this . context . globalCompositeOperation = "source-atop" , "undefined" == typeof c || null === c ? this . draw ( a ) : this . draw ( a , c . x , c . y , c . width , c . height ) , this . context . globalCompositeOperation = e
} , b . Text . prototype . updateText = function ( ) { this . context . font = this . style . font ; var a = this . text ; this . style . wordWrap && ( a = this . runWordWrap ( this . text ) ) ; for ( var b = a . split ( /(?:\r\n|\r|\n)/ ) , c = [ ] , d = 0 , e = 0 ; e < b . length ; e ++ ) { var f = this . context . measureText ( b [ e ] ) . width ; c [ e ] = f , d = Math . max ( d , f ) } this . canvas . width = d + this . style . strokeThickness ; var g = this . determineFontHeight ( "font: " + this . style . font + ";" ) + this . style . strokeThickness + this . _lineSpacing + this . style . shadowOffsetY ; for ( this . canvas . height = g * b . length , navigator . isCocoonJS && this . context . clearRect ( 0 , 0 , this . canvas . width , this . canvas . height ) , this . context . fillStyle = this . style . fill , this . context . font = this . style . font , this . context . strokeStyle = this . style . stroke , this . context . lineWidth = this . style . strokeThickness , this . context . shadowOffsetX = this . style . shadowOffsetX , this . context . shadowOffsetY = this . style . shadowOffsetY , this . context . shadowColor = this . style . shadowColor , this . context . shadowBlur = this . style . shadowBlur , this . context . textBaseline = "top" , this . context . lineCap = "round" , this . context . lineJoin = "round" , e = 0 ; e < b . length ; e ++ ) { var h = new PIXI . Point ( this . style . strokeThickness / 2 , this . style . strokeThickness / 2 + e * g ) ; "right" === this . style . align ? h . x += d - c [ e ] : "center" === this . style . align && ( h . x += ( d - c [ e ] ) / 2 ) , h . y += this . _lineSpacing , this . style . stroke && this . style . strokeThickness && this . context . strokeText ( b [ e ] , h . x , h . y ) , this . style . fill && this . context . fillText ( b [ e ] , h . x , h . y ) } this . updateTexture ( ) } , b . Text . prototype . runWordWrap = function ( a ) { for ( var b = "" , c = a . split ( "\n" ) , d = 0 ; d < c . length ; d ++ ) { for ( var e = this . style . wordWrapWidth , f = c [ d ] . split ( " " ) , g = 0 ; g < f . length ; g ++ ) { var h = this . context . measureText ( f [ g ] ) . width , i = h + this . context . measureText ( " " ) . width ; i > e ? ( g > 0 && ( b += "\n" ) , b += f [ g ] + " " , e = this . style . wordWrapWidth - h ) : ( e -= i , b += f [ g ] + " " ) } d < c . length - 1 && ( b += "\n" ) } return b } , Object . defineProperty ( b . Text . prototype , "angle" , { get : function ( ) { return b . Math . radToDeg ( this . rotation ) } , set : function ( a ) { this . rotation = b . Math . degToRad ( a ) } } ) , Object . defineProperty ( b . Text . prototype , "text" , { get : function ( ) { return this . _text } , set : function ( a ) { a !== this . _text && ( this . _text = a . toString ( ) || " " , this . dirty = ! 0 , this . updateTransform ( ) ) } } ) , Object . defineProperty ( b . Text . prototype , "font" , { get : function ( ) { return this . _font } , set : function ( a ) { a !== this . _font && ( this . _font = a . trim ( ) , this . style . font = this . _fontWeight + " " + this . _fontSize + "px '" + this . _font + "'" , this . dirty = ! 0 , this . updateTransform ( ) ) } } ) , Object . defineProperty ( b . Text . prototype , "fontSize" , { get : function ( ) { return this . _fontSize } , set : function ( a ) { a = parseInt ( a , 10 ) , a !== this . _fontSize && ( this . _fontSize = a , this . style . font = this . _fontWeight + " " + this . _fontSize + "px '" + this . _font + "'" , this . dirty = ! 0 , this . updateTransform ( ) ) } } ) , Object . defineProperty ( b . Text . prototype , "fontWeight" , { get : function ( ) { return this . _fontWeight } , set : function ( a ) { a !== this . _fontWeight && ( this . _fontWeight = a , this . style . font = this . _fontWeight + " " + this . _fontSize + "px '" + this . _font + "'" , this . dirty = ! 0 , this . updateTransform ( ) ) } } ) , Object . defineProperty ( b . Text . prototype , "fill" , { get : function ( ) { return this . style . fill } , set : function ( a ) { a !== this . style . fill && ( this . style . fill = a , this . dirty = ! 0 ) } } ) , Object . defineProperty ( b . Text . prototype , "align" , { get : function ( ) { return this . style . align } , set : function ( a ) { a !== this . style . align && ( this . style . align = a , this . dirty = ! 0 ) } } ) , Object . defineProperty ( b . Text . prototype , "stroke" , { get : function ( ) { return this . style . stroke } , set : function ( a ) { a !== this . style . stroke && ( this . style . stroke = a , this . dirty = ! 0 ) } } ) , Object . defineProperty ( b . Text . prototype , "strokeThickness" , { get : function ( ) { return this . style . strokeThickness } , set : function ( a ) { a !== this . style . strokeThickness && ( this . style . strokeThickness = a , this . dirty = ! 0 ) } } ) , Object . defineProperty ( b . Text . prototype , "wordWrap" , { get : function ( ) { return this . style . wordWrap } , set : function ( a ) { a !== this . style . wordWrap && ( this . style . wordWrap = a , this . dirty = ! 0 ) } } ) , Object . defineProperty ( b . Text . prototype , "wordWrapWidth" , { get : function ( ) { return this . style . wordWrapWidth } , set : function ( a ) { a !== this . style . wordWrapWidth && ( this . style . wordWrapWidth = a , this . dirty = ! 0 ) } } ) , Object . defineProperty ( b . Text . prototype , "lineSpacing" , { get : function ( ) { return this . _lineSpacing } , set : function ( a ) { a !== this . _lineSpacing && ( t
} , _checkIsUint8ClampedImageData : function ( ) { if ( "undefined" == typeof Uint8ClampedArray ) return ! 1 ; var a = document . createElement ( "canvas" ) , b = a . getContext ( "2d" ) ; if ( ! b ) return ! 1 ; var c = b . createImageData ( 1 , 1 ) ; return c . data instanceof Uint8ClampedArray } , _checkCSS3D : function ( ) { var a , b = document . createElement ( "p" ) , c = { webkitTransform : "-webkit-transform" , OTransform : "-o-transform" , msTransform : "-ms-transform" , MozTransform : "-moz-transform" , transform : "transform" } ; document . body . insertBefore ( b , null ) ; for ( var d in c ) void 0 !== b . style [ d ] && ( b . style [ d ] = "translate3d(1px,1px,1px)" , a = window . getComputedStyle ( b ) . getPropertyValue ( c [ d ] ) ) ; document . body . removeChild ( b ) , this . css3D = void 0 !== a && a . length > 0 && "none" !== a } , canPlayAudio : function ( a ) { return "mp3" == a && this . mp3 ? ! 0 : "ogg" == a && ( this . ogg || this . opus ) ? ! 0 : "m4a" == a && this . m4a ? ! 0 : "wav" == a && this . wav ? ! 0 : "webm" == a && this . webm ? ! 0 : ! 1 } , isConsoleOpen : function ( ) { return window . console && window . console . firebug ? ! 0 : window . console && ( console . profile ( ) , console . profileEnd ( ) , console . clear && console . clear ( ) , console . profiles ) ? console . profiles . length > 0 : ! 1 } } , b . Device . prototype . constructor = b . Device , b . RequestAnimationFrame = function ( a , b ) { "undefined" == typeof b && ( b = ! 1 ) , this . game = a , this . isRunning = ! 1 , this . forceSetTimeOut = b ; for ( var c = [ "ms" , "moz" , "webkit" , "o" ] , d = 0 ; d < c . length && ! window . requestAnimationFrame ; d ++ ) window . requestAnimationFrame = window [ c [ d ] + "RequestAnimationFrame" ] , window . cancelAnimationFrame = window [ c [ d ] + "CancelAnimationFrame" ] ; this . _isSetTimeOut = ! 1 , this . _onLoop = null , this . _timeOutID = null } , b . RequestAnimationFrame . prototype = { start : function ( ) { this . isRunning = ! 0 ; var a = this ; ! window . requestAnimationFrame || this . forceSetTimeOut ? ( this . _isSetTimeOut = ! 0 , this . _onLoop = function ( ) { return a . updateSetTimeout ( ) } , this . _timeOutID = window . setTimeout ( this . _onLoop , 0 ) ) : ( this . _isSetTimeOut = ! 1 , this . _onLoop = function ( b ) { return a . updateRAF ( b ) } , this . _timeOutID = window . requestAnimationFrame ( this . _onLoop ) ) } , updateRAF : function ( ) { this . game . update ( Date . now ( ) ) , this . _timeOutID = window . requestAnimationFrame ( this . _onLoop ) } , updateSetTimeout : function ( ) { this . game . update ( Date . now ( ) ) , this . _timeOutID = window . setTimeout ( this . _onLoop , this . game . time . timeToCall ) } , stop : function ( ) { this . _isSetTimeOut ? clearTimeout ( this . _timeOutID ) : window . cancelAnimationFrame ( this . _timeOutID ) , this . isRunning = ! 1 } , isSetTimeOut : function ( ) { return this . _isSetTimeOut } , isRAF : function ( ) { return this . _isSetTimeOut === ! 1 } } , b . RequestAnimationFrame . prototype . constructor = b . RequestAnimationFrame , b . Math = { PI2 : 2 * Math . PI , fuzzyEqual : function ( a , b , c ) { return "undefined" == typeof c && ( c = 1e-4 ) , Math . abs ( a - b ) < c } , fuzzyLessThan : function ( a , b , c ) { return "undefined" == typeof c && ( c = 1e-4 ) , b + c > a } , fuzzyGreaterThan : function ( a , b , c ) { return "undefined" == typeof c && ( c = 1e-4 ) , a > b - c } , fuzzyCeil : function ( a , b ) { return "undefined" == typeof b && ( b = 1e-4 ) , Math . ceil ( a - b ) } , fuzzyFloor : function ( a , b ) { return "undefined" == typeof b && ( b = 1e-4 ) , Math . floor ( a + b ) } , average : function ( ) { for ( var a = [ ] , b = 0 ; b < arguments . length - 0 ; b ++ ) a [ b ] = arguments [ b + 0 ] ; for ( var c = 0 , d = 0 ; d < a . length ; d ++ ) c += a [ d ] ; return c / a . length } , truncate : function ( a ) { return a > 0 ? Math . floor ( a ) : Math . ceil ( a ) } , shear : function ( a ) { return a % 1 } , snapTo : function ( a , b , c ) { return "undefined" == typeof c && ( c = 0 ) , 0 === b ? a : ( a -= c , a = b * Math . round ( a / b ) , c + a ) } , snapToFloor : function ( a , b , c ) { return "undefined" == typeof c && ( c = 0 ) , 0 === b ? a : ( a -= c , a = b * Math . floor ( a / b ) , c + a ) } , snapToCeil : function ( a , b , c ) { return "undefined" == typeof c && ( c = 0 ) , 0 === b ? a : ( a -= c , a = b * Math . ceil ( a / b ) , c + a ) } , snapToInArray : function ( a , b , c ) { if ( "undefined" == typeof c && ( c = ! 0 ) , c && b . sort ( ) , a < b [ 0 ] ) return b [ 0 ] ; for ( var d = 1 ; b [ d ] < a ; ) d ++ ; var e = b [ d - 1 ] , f = d < b . length ? b [ d ] : Number . POSITIVE _INFINITY ; return a - e >= f - a ? f : e } , roundTo : function ( a , b , c ) { "undefined" == typeof b && ( b = 0 ) , "undefined" == typeof c && ( c = 10 ) ; var d = Math . pow ( c , - b ) ; return Math . round ( a * d ) / d } , floorTo : function ( a , b , c ) { "undefined" == typeof b && ( b = 0 ) , "undefined" == typeof c && ( c = 10 ) ; var d = Math . pow ( c , - b ) ; return Math . floor ( a * d ) / d } , ceilTo : function ( a , b , c ) { "undefined" == typeof b && ( b = 0 ) , "undefined" == typeof c && ( c = 10 ) ; var d = Math . pow ( c , - b ) ; return Math . ceil ( a * d ) / d } , interpolateFloat : function ( a , b , c ) { return ( b - a ) * c + a } , angleBetween : function ( a , b , c , d ) { return Math . atan2 ( d - b , c - a ) } , angleBetweenPoints : function ( a
} , destroy : function ( ) { var a = null ; for ( var a in this . _anims ) this . _anims . hasOwnProperty ( a ) && this . _anims [ a ] . destroy ( ) ; this . _anims = { } , this . _frameData = null , this . _frameIndex = 0 , this . currentAnim = null , this . currentFrame = null } } , b . AnimationManager . prototype . constructor = b . AnimationManager , Object . defineProperty ( b . AnimationManager . prototype , "frameData" , { get : function ( ) { return this . _frameData } } ) , Object . defineProperty ( b . AnimationManager . prototype , "frameTotal" , { get : function ( ) { return this . _frameData ? this . _frameData . total : - 1 } } ) , Object . defineProperty ( b . AnimationManager . prototype , "paused" , { get : function ( ) { return this . currentAnim . isPaused } , set : function ( a ) { this . currentAnim . paused = a } } ) , Object . defineProperty ( b . AnimationManager . prototype , "frame" , { get : function ( ) { return this . currentFrame ? this . _frameIndex : void 0 } , set : function ( a ) { "number" == typeof a && this . _frameData && null !== this . _frameData . getFrame ( a ) && ( this . currentFrame = this . _frameData . getFrame ( a ) , this . currentFrame && ( this . _frameIndex = a , this . sprite . setFrame ( this . currentFrame ) , this . sprite . _ _tilePattern && ( this . _ _tilePattern = ! 1 , this . tilingTexture = ! 1 ) ) ) } } ) , Object . defineProperty ( b . AnimationManager . prototype , "frameName" , { get : function ( ) { return this . currentFrame ? this . currentFrame . name : void 0 } , set : function ( a ) { "string" == typeof a && this . _frameData && null !== this . _frameData . getFrameByName ( a ) ? ( this . currentFrame = this . _frameData . getFrameByName ( a ) , this . currentFrame && ( this . _frameIndex = this . currentFrame . index , this . sprite . setFrame ( this . currentFrame ) , this . sprite . _ _tilePattern && ( this . _ _tilePattern = ! 1 , this . tilingTexture = ! 1 ) ) ) : console . warn ( "Cannot set frameName: " + a ) } } ) , b . Animation = function ( a , c , d , e , f , g , h ) { this . game = a , this . _parent = c , this . _frameData = e , this . name = d , this . _frames = [ ] , this . _frames = this . _frames . concat ( f ) , this . delay = 1e3 / g , this . loop = h , this . loopCount = 0 , this . killOnComplete = ! 1 , this . isFinished = ! 1 , this . isPlaying = ! 1 , this . isPaused = ! 1 , this . _pauseStartTime = 0 , this . _frameIndex = 0 , this . _frameDiff = 0 , this . _frameSkip = 1 , this . currentFrame = this . _frameData . getFrame ( this . _frames [ this . _frameIndex ] ) , this . onStart = new b . Signal , this . onComplete = new b . Signal , this . onLoop = new b . Signal , this . game . onPause . add ( this . onPause , this ) , this . game . onResume . add ( this . onResume , this ) } , b . Animation . prototype = { play : function ( a , b , c ) { return "number" == typeof a && ( this . delay = 1e3 / a ) , "boolean" == typeof b && ( this . loop = b ) , "undefined" != typeof c && ( this . killOnComplete = c ) , this . isPlaying = ! 0 , this . isFinished = ! 1 , this . paused = ! 1 , this . loopCount = 0 , this . _timeLastFrame = this . game . time . now , this . _timeNextFrame = this . game . time . now + this . delay , this . _frameIndex = 0 , this . currentFrame = this . _frameData . getFrame ( this . _frames [ this . _frameIndex ] ) , this . _parent . setFrame ( this . currentFrame ) , this . _parent . _ _tilePattern && ( this . _parent . _ _tilePattern = ! 1 , this . _parent . tilingTexture = ! 1 ) , this . _parent . events . onAnimationStart . dispatch ( this . _parent , this ) , this . onStart . dispatch ( this . _parent , this ) , this } , restart : function ( ) { this . isPlaying = ! 0 , this . isFinished = ! 1 , this . paused = ! 1 , this . loopCount = 0 , this . _timeLastFrame = this . game . time . now , this . _timeNextFrame = this . game . time . now + this . delay , this . _frameIndex = 0 , this . currentFrame = this . _frameData . getFrame ( this . _frames [ this . _frameIndex ] ) , this . _parent . setFrame ( this . currentFrame ) , this . onStart . dispatch ( this . _parent , this ) } , setFrame : function ( a , b ) { var c ; if ( "undefined" == typeof b && ( b = ! 1 ) , "string" == typeof a ) for ( var d = 0 ; d < this . _frames . length ; d ++ ) this . _frameData . getFrame ( this . _frames [ d ] ) . name === a && ( c = d ) ; else if ( "number" == typeof a ) if ( b ) c = a ; else for ( var d = 0 ; d < this . _frames . length ; d ++ ) this . frames [ d ] === c && ( c = d ) ; c && ( this . _frameIndex = c - 1 , this . _timeNextFrame = this . game . time . now , this . update ( ) ) } , stop : function ( a , b ) { "undefined" == typeof a && ( a = ! 1 ) , "undefined" == typeof b && ( b = ! 1 ) , this . isPlaying = ! 1 , this . isFinished = ! 0 , this . paused = ! 1 , a && ( this . currentFrame = this . _frameData . getFrame ( this . _frames [ 0 ] ) , this . _parent . setFrame ( this . currentFrame ) ) , b && ( this . _parent . events . onAnimationComplete . dispatch ( this . _parent , this ) , this . onComplete . dispatch ( this . _parent , this ) ) } , onPause : function ( ) { this . isPlaying && ( this . _frameDiff = this . _timeNextFrame - this . game . time . now ) } , onResume : function ( ) { this . isPlaying && ( this . _timeNextFrame = this . game . time . now + this . _frameDiff ) }
else { if ( a . format !== b . Tilemap . CSV ) throw new Error ( "Phaser.Loader. Invalid Tilemap format: " + a . format ) ; this . xhrLoad ( this . _fileIndex , this . baseURL + a . url , "text" , "csvLoadComplete" , "dataLoadError" ) } break ; case "text" : case "script" : case "physics" : this . xhrLoad ( this . _fileIndex , this . baseURL + a . url , "text" , "fileComplete" , "fileError" ) ; break ; case "binary" : this . xhrLoad ( this . _fileIndex , this . baseURL + a . url , "arraybuffer" , "fileComplete" , "fileError" ) } } , xhrLoad : function ( a , b , c , d , e ) { this . _xhr . open ( "GET" , b , ! 0 ) , this . _xhr . responseType = c ; var f = this ; this . _xhr . onload = function ( ) { return f [ d ] ( a ) } , this . _xhr . onerror = function ( ) { return f [ e ] ( a ) } , this . _xhr . send ( ) } , getAudioURL : function ( a ) { var b ; "string" == typeof a && ( a = [ a ] ) ; for ( var c = 0 ; c < a . length ; c ++ ) if ( b = a [ c ] . toLowerCase ( ) , b = b . substr ( ( Math . max ( 0 , b . lastIndexOf ( "." ) ) || 1 / 0 ) + 1 ) , this . game . device . canPlayAudio ( b ) ) return a [ c ] ; return null } , fileError : function ( a ) { this . _fileList [ a ] . loaded = ! 0 , this . _fileList [ a ] . error = ! 0 , this . onFileError . dispatch ( this . _fileList [ a ] . key , this . _fileList [ a ] ) , console . warn ( "Phaser.Loader error loading file: " + this . _fileList [ a ] . key + " from URL " + this . _fileList [ a ] . url ) , this . nextFile ( a , ! 1 ) } , fileComplete : function ( a ) { if ( ! this . _fileList [ a ] ) return void console . warn ( "Phaser.Loader fileComplete invalid index " + a ) ; var c = this . _fileList [ a ] ; c . loaded = ! 0 ; var d = ! 0 ; switch ( c . type ) { case "image" : this . game . cache . addImage ( c . key , c . url , c . data ) ; break ; case "spritesheet" : this . game . cache . addSpriteSheet ( c . key , c . url , c . data , c . frameWidth , c . frameHeight , c . frameMax , c . margin , c . spacing ) ; break ; case "textureatlas" : if ( null == c . atlasURL ) this . game . cache . addTextureAtlas ( c . key , c . url , c . data , c . atlasData , c . format ) ; else if ( d = ! 1 , c . format == b . Loader . TEXTURE _ATLAS _JSON _ARRAY || c . format == b . Loader . TEXTURE _ATLAS _JSON _HASH ) this . xhrLoad ( this . _fileIndex , this . baseURL + c . atlasURL , "text" , "jsonLoadComplete" , "dataLoadError" ) ; else { if ( c . format != b . Loader . TEXTURE _ATLAS _XML _STARLING ) throw new Error ( "Phaser.Loader. Invalid Texture Atlas format: " + c . format ) ; this . xhrLoad ( this . _fileIndex , this . baseURL + c . atlasURL , "text" , "xmlLoadComplete" , "dataLoadError" ) } break ; case "bitmapfont" : null == c . xmlURL ? this . game . cache . addBitmapFont ( c . key , c . url , c . data , c . xmlData , c . xSpacing , c . ySpacing ) : ( d = ! 1 , this . xhrLoad ( this . _fileIndex , this . baseURL + c . xmlURL , "text" , "xmlLoadComplete" , "dataLoadError" ) ) ; break ; case "audio" : if ( this . game . sound . usingWebAudio ) { if ( c . data = this . _xhr . response , this . game . cache . addSound ( c . key , c . url , c . data , ! 0 , ! 1 ) , c . autoDecode ) { var e = this , f = c . key ; this . game . cache . updateSound ( f , "isDecoding" , ! 0 ) , this . game . sound . context . decodeAudioData ( c . data , function ( a ) { a && ( e . game . cache . decodedSound ( f , a ) , e . game . sound . onSoundDecode . dispatch ( f , e . game . cache . getSound ( f ) ) ) } ) } } else c . data . removeEventListener ( "canplaythrough" , b . GAMES [ this . game . id ] . load . fileComplete ) , this . game . cache . addSound ( c . key , c . url , c . data , ! 1 , ! 0 ) ; break ; case "text" : c . data = this . _xhr . responseText , this . game . cache . addText ( c . key , c . url , c . data ) ; break ; case "physics" : var g = JSON . parse ( this . _xhr . responseText ) ; this . game . cache . addPhysicsData ( c . key , c . url , g , c . format ) ; break ; case "script" : c . data = document . createElement ( "script" ) , c . data . language = "javascript" , c . data . type = "text/javascript" , c . data . defer = ! 1 , c . data . text = this . _xhr . responseText , document . head . appendChild ( c . data ) , c . callback && ( c . data = c . callback . call ( c . callbackContext , c . key , this . _xhr . responseText ) ) ; break ; case "binary" : c . data = c . callback ? c . callback . call ( c . callbackContext , c . key , this . _xhr . response ) : this . _xhr . response , this . game . cache . addBinary ( c . key , c . data ) } d && this . nextFile ( a , ! 0 ) } , jsonLoadComplete : function ( a ) { if ( ! this . _fileList [ a ] ) return void console . warn ( "Phaser.Loader jsonLoadComplete invalid index " + a ) ; var b = this . _fileList [ a ] , c = JSON . parse ( this . _xhr . responseText ) ; b . loaded = ! 0 , "tilemap" === b . type ? this . game . cache . addTilemap ( b . key , b . url , c , b . format ) : "json" === b . type ? this . game . cache . addJSON ( b . key , b . url , c ) : this . game . cache . addTextureAtlas ( b . key , b . url , b . data , c , b . format ) , this . nextFile ( a , ! 0 ) } , csvLoadComplete : function ( a ) { if ( ! this . _fileList [ a ] ) return void console . warn ( "Phaser.Loader csvLoadComplete invalid index " + a ) ; var b = this . _fileList [ a ] , c = this . _xhr . responseText ; b . loaded = ! 0 , this . game . cache . addTilemap ( b . key , b . url , c , b . format ) , this . nextFile (
} , componentToHex : function ( a ) { var b = a . toString ( 16 ) ; return 1 == b . length ? "0" + b : b } , HSVColorWheel : function ( a , c ) { "undefined" == typeof a && ( a = 1 ) , "undefined" == typeof c && ( c = 1 ) ; for ( var d = [ ] , e = 0 ; 359 >= e ; e ++ ) d . push ( b . Color . HSVtoRGB ( e / 359 , a , c ) ) ; return d } , HSLColorWheel : function ( a , c ) { "undefined" == typeof a && ( a = . 5 ) , "undefined" == typeof c && ( c = . 5 ) ; for ( var d = [ ] , e = 0 ; 359 >= e ; e ++ ) d . push ( b . Color . HSLtoRGB ( e / 359 , a , c ) ) ; return d } , interpolateColor : function ( a , c , d , e , f ) { "undefined" == typeof f && ( f = 255 ) ; var g = b . Color . getRGB ( a ) , h = b . Color . getRGB ( c ) , i = ( h . red - g . red ) * e / d + g . red , j = ( h . green - g . green ) * e / d + g . green , k = ( h . blue - g . blue ) * e / d + g . blue ; return b . Color . getColor32 ( f , i , j , k ) } , interpolateColorWithRGB : function ( a , c , d , e , f , g ) { var h = b . Color . getRGB ( a ) , i = ( c - h . red ) * g / f + h . red , j = ( d - h . green ) * g / f + h . green , k = ( e - h . blue ) * g / f + h . blue ; return b . Color . getColor ( i , j , k ) } , interpolateRGB : function ( a , c , d , e , f , g , h , i ) { var j = ( e - a ) * i / h + a , k = ( f - c ) * i / h + c , l = ( g - d ) * i / h + d ; return b . Color . getColor ( j , k , l ) } , getRandomColor : function ( a , c , d ) { if ( "undefined" == typeof a && ( a = 0 ) , "undefined" == typeof c && ( c = 255 ) , "undefined" == typeof d && ( d = 255 ) , c > 255 || a > c ) return b . Color . getColor ( 255 , 255 , 255 ) ; var e = a + Math . round ( Math . random ( ) * ( c - a ) ) , f = a + Math . round ( Math . random ( ) * ( c - a ) ) , g = a + Math . round ( Math . random ( ) * ( c - a ) ) ; return b . Color . getColor32 ( d , e , f , g ) } , getRGB : function ( a ) { return a > 16777215 ? { alpha : a >>> 24 , red : a >> 16 & 255 , green : a >> 8 & 255 , blue : 255 & a , a : a >>> 24 , r : a >> 16 & 255 , g : a >> 8 & 255 , b : 255 & a } : { alpha : 255 , red : a >> 16 & 255 , green : a >> 8 & 255 , blue : 255 & a , a : 255 , r : a >> 16 & 255 , g : a >> 8 & 255 , b : 255 & a } } , getWebRGB : function ( a ) { var c = b . Color . getRGB ( a ) ; return "rgba(" + c . r . toString ( ) + "," + c . g . toString ( ) + "," + c . b . toString ( ) + "," + c . a . toString ( ) + ")" } , getAlpha : function ( a ) { return a >>> 24 } , getAlphaFloat : function ( a ) { return ( a >>> 24 ) / 255 } , getRed : function ( a ) { return a >> 16 & 255 } , getGreen : function ( a ) { return a >> 8 & 255 } , getBlue : function ( a ) { return 255 & a } , getColorInfo : function ( a ) { var c = b . Color . getRGB ( a ) , d = b . Color . RGBtoHexstring ( a ) + "\n" ; return d = d . concat ( "Alpha: " + c . alpha + " Red: " + c . red + " Green: " + c . green + " Blue: " + c . blue ) + "\n" } , RGBtoHexstring : function ( a ) { var c = b . Color . getRGB ( a ) ; return "0x" + b . Color . colorToHexstring ( c . alpha ) + b . Color . colorToHexstring ( c . red ) + b . Color . colorToHexstring ( c . green ) + b . Color . colorToHexstring ( c . blue ) } , RGBtoWebstring : function ( a ) { var c = b . Color . getRGB ( a ) ; return "#" + b . Color . colorToHexstring ( c . red ) + b . Color . colorToHexstring ( c . green ) + b . Color . colorToHexstring ( c . blue ) } , colorToHexstring : function ( a ) { var b = "0123456789ABCDEF" , c = a % 16 , d = ( a - c ) / 16 , e = b . charAt ( d ) + b . charAt ( c ) ; return e } } , b . Physics = function ( a , b ) { b = b || { } , this . game = a , this . config = b , this . arcade = null , this . p2 = null , this . ninja = null , this . box2d = null , this . chipmunk = null , this . parseConfig ( ) } , b . Physics . ARCADE = 0 , b . Physics . P2JS = 1 , b . Physics . NINJA = 2 , b . Physics . BOX2D = 3 , b . Physics . CHIPMUNK = 5 , b . Physics . prototype = { parseConfig : function ( ) { this . config . hasOwnProperty ( "arcade" ) && this . config . arcade !== ! 0 || ! b . Physics . hasOwnProperty ( "Arcade" ) || ( this . arcade = new b . Physics . Arcade ( this . game ) , this . game . time . deltaCap = . 2 ) , this . config . hasOwnProperty ( "ninja" ) && this . config . ninja === ! 0 && b . Physics . hasOwnProperty ( "Ninja" ) && ( this . ninja = new b . Physics . Ninja ( this . game ) ) , this . config . hasOwnProperty ( "p2" ) && this . config . p2 === ! 0 && b . Physics . hasOwnProperty ( "P2" ) && ( this . p2 = new b . Physics . P2 ( this . game , this . config ) ) } , startSystem : function ( a ) { if ( a === b . Physics . ARCADE ? this . arcade = new b . Physics . Arcade ( this . game ) : a === b . Physics . P2JS && ( this . p2 = new b . Physics . P2 ( this . game , this . config ) ) , a === b . Physics . NINJA ) this . ninja = new b . Physics . Ninja ( this . game ) ; else { if ( a === b . Physics . BOX2D && null === this . box2d ) throw new Error ( "The Box2D physics system has not been implemented yet." ) ; if ( a === b . Physics . CHIPMUNK && null === this . chipmunk ) throw new Error ( "The Chipmunk physics system has not been implemented yet." ) } } , enable : function ( a , c , d ) { "undefined" == typeof c && ( c = b . Physics . ARCADE ) , "undefined" == typeof d && ( d = ! 1 ) , c === b . Physics . ARCADE ? this . arcade . enable ( a ) : c === b . Physics . P2JS && this . p2 ? this . p2 . enable ( a , d ) : c === b . Physics . NINJA && this . ninja && this . ninja . enableAABB ( a ) } , preUpdate : function ( ) { this . p2 && this . p2 . preUpdate ( ) } , update : function ( ) { this . p2 && this . p2 . update ( ) } , setBoundsToWorld : function ( ) { this . arcade && this . arcade . setBoundsToWorld ( ) , this . ninja && this . nin
} , b . Particles . Arcade . Emitter . prototype . setSize = function ( a , b ) { this . width = a , this . height = b } , b . Particles . Arcade . Emitter . prototype . setXSpeed = function ( a , b ) { a = a || 0 , b = b || 0 , this . minParticleSpeed . x = a , this . maxParticleSpeed . x = b } , b . Particles . Arcade . Emitter . prototype . setYSpeed = function ( a , b ) { a = a || 0 , b = b || 0 , this . minParticleSpeed . y = a , this . maxParticleSpeed . y = b } , b . Particles . Arcade . Emitter . prototype . setRotation = function ( a , b ) { a = a || 0 , b = b || 0 , this . minRotation = a , this . maxRotation = b } , b . Particles . Arcade . Emitter . prototype . setAlpha = function ( a , c , d , e , f ) { if ( "undefined" == typeof a && ( a = 1 ) , "undefined" == typeof c && ( c = 1 ) , "undefined" == typeof d && ( d = 0 ) , "undefined" == typeof e && ( e = b . Easing . Linear . None ) , "undefined" == typeof f && ( f = ! 1 ) , this . minParticleAlpha = a , this . maxParticleAlpha = c , this . autoAlpha = ! 1 , d > 0 && a !== c ) { var g = { v : a } , h = this . game . make . tween ( g ) . to ( { v : c } , d , e ) ; h . yoyo ( f ) , this . alphaData = h . generateData ( 60 ) , this . alphaData . reverse ( ) , this . autoAlpha = ! 0 } } , b . Particles . Arcade . Emitter . prototype . setScale = function ( a , c , d , e , f , g , h ) { if ( "undefined" == typeof a && ( a = 1 ) , "undefined" == typeof c && ( c = 1 ) , "undefined" == typeof d && ( d = 1 ) , "undefined" == typeof e && ( e = 1 ) , "undefined" == typeof f && ( f = 0 ) , "undefined" == typeof g && ( g = b . Easing . Linear . None ) , "undefined" == typeof h && ( h = ! 1 ) , this . minParticleScale = 1 , this . maxParticleScale = 1 , this . _minParticleScale . set ( a , d ) , this . _maxParticleScale . set ( c , e ) , this . autoScale = ! 1 , f > 0 && a !== c || d !== e ) { var i = { x : a , y : d } , j = this . game . make . tween ( i ) . to ( { x : c , y : e } , f , g ) ; j . yoyo ( h ) , this . scaleData = j . generateData ( 60 ) , this . scaleData . reverse ( ) , this . autoScale = ! 0 } } , b . Particles . Arcade . Emitter . prototype . at = function ( a ) { a . center ? ( this . emitX = a . center . x , this . emitY = a . center . y ) : ( this . emitX = a . world . x + a . anchor . x * a . width , this . emitY = a . world . y + a . anchor . y * a . height ) } , Object . defineProperty ( b . Particles . Arcade . Emitter . prototype , "x" , { get : function ( ) { return this . emitX } , set : function ( a ) { this . emitX = a } } ) , Object . defineProperty ( b . Particles . Arcade . Emitter . prototype , "y" , { get : function ( ) { return this . emitY } , set : function ( a ) { this . emitY = a } } ) , Object . defineProperty ( b . Particles . Arcade . Emitter . prototype , "left" , { get : function ( ) { return Math . floor ( this . x - this . width / 2 ) } } ) , Object . defineProperty ( b . Particles . Arcade . Emitter . prototype , "right" , { get : function ( ) { return Math . floor ( this . x + this . width / 2 ) } } ) , Object . defineProperty ( b . Particles . Arcade . Emitter . prototype , "top" , { get : function ( ) { return Math . floor ( this . y - this . height / 2 ) } } ) , Object . defineProperty ( b . Particles . Arcade . Emitter . prototype , "bottom" , { get : function ( ) { return Math . floor ( this . y + this . height / 2 ) } } ) , b . Tile = function ( a , b , c , d , e , f ) { this . layer = a , this . index = b , this . x = c , this . y = d , this . worldX = c * e , this . worldY = d * f , this . width = e , this . height = f , this . centerX = Math . abs ( e / 2 ) , this . centerY = Math . abs ( f / 2 ) , this . alpha = 1 , this . properties = { } , this . scanned = ! 1 , this . faceTop = ! 1 , this . faceBottom = ! 1 , this . faceLeft = ! 1 , this . faceRight = ! 1 , this . collideLeft = ! 1 , this . collideRight = ! 1 , this . collideUp = ! 1 , this . collideDown = ! 1 , this . collisionCallback = null , this . collisionCallbackContext = this } , b . Tile . prototype = { containsPoint : function ( a , b ) { return ! ( a < this . worldX || b < this . worldY || a > this . right || b > this . bottom ) } , intersects : function ( a , b , c , d ) { return c <= this . worldX ? ! 1 : d <= this . worldY ? ! 1 : a >= this . worldX + this . width ? ! 1 : b >= this . worldY + this . height ? ! 1 : ! 0 } , setCollisionCallback : function ( a , b ) { this . collisionCallback = a , this . collisionCallbackContext = b } , destroy : function ( ) { this . collisionCallback = null , this . collisionCallbackContext = null , this . properties = null } , setCollision : function ( a , b , c , d ) { this . collideLeft = a , this . collideRight = b , this . collideUp = c , this . collideDown = d } , resetCollision : function ( ) { this . collideLeft = ! 1 , this . collideRight = ! 1 , this . collideUp = ! 1 , this . collideDown = ! 1 , this . faceTop = ! 1 , this . faceBottom = ! 1 , this . faceLeft = ! 1 , this . faceRight = ! 1 } , isInteresting : function ( a , b ) { return a && b ? this . collideLeft || this . collideRight || this . collideUp || this . collideDown || this . faceTop || this . faceBottom || this . faceLeft || this . faceRight || this . collisionCallback : a ? this . collideLeft || this . collideRight || this . collideUp || this . collideDown : b ? this . faceTop || this . faceBottom || this . faceLeft || this . faceRight : ! 1 } , copy : function ( a ) { this . index = a . index , this . alpha = a . alpha , this . properties = a . properties , this . collideUp = a . collideUp , this . collideDo
} , 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 . world . bounds . y , this . game . world . bounds . width , this . game . world . bounds . height , this . maxObjects , this . maxLevels ) } , Phaser . Physics . Ninja . prototype . constructor = Phaser . Physics . Ninja , Phaser . Physics . Ninja . prototype = { enableAABB : function ( a , b ) { this . enable ( a , 1 , 0 , 0 , b ) } , enableCircle : function ( a , b , c ) { this . enable ( a , 2 , 0 , b , c ) } , enableTile : function ( a , b , c ) { this . enable ( a , 3 , b , 0 , c ) } , enable : function ( a , b , c , d , e ) { if ( "undefined" == typeof b && ( b = 1 ) , "undefined" == typeof c && ( c = 1 ) , "undefined" == typeof d && ( d = 0 ) , "undefined" == typeof e && ( e = ! 0 ) , Array . isArray ( a ) ) for ( var f = a . length ; f -- ; ) a [ f ] instanceof Phaser . Group ? this . enable ( a [ f ] . children , b , c , d , e ) : ( this . enableBody ( a [ f ] , b , c , d ) , e && a [ f ] . hasOwnProperty ( "children" ) && a [ f ] . children . length > 0 && this . enable ( a [ f ] , b , c , d , ! 0 ) ) ; else a instanceof Phaser . Group ? this . enable ( a . children , b , c , d , e ) : ( this . enableBody ( a , b , c , d ) , e && a . hasOwnProperty ( "children" ) && a . children . length > 0 && this . enable ( a . children , b , c , d , ! 0 ) ) } , enableBody : function ( a , b , c , d ) { a . hasOwnProperty ( "body" ) && null === a . body && ( a . body = new Phaser . Physics . Ninja . Body ( this , a , b , c , d ) , a . anchor . set ( . 5 ) ) } , setBounds : function ( a , b , c , d ) { this . bounds . setTo ( a , b , c , d ) } , setBoundsToWorld : function ( ) { this . bounds . setTo ( this . game . world . bounds . x , this . game . world . bounds . y , this . game . world . bounds . width , this . game . world . bounds . height ) } , clearTilemapLayerBodies : function ( a , b ) { b = a . getLayer ( b ) ; for ( var c = a . layers [ b ] . bodies . length ; c -- ; ) a . layers [ b ] . bodies [ c ] . destroy ( ) ; a . layers [ b ] . bodies . length = [ ] } , convertTilemap : function ( a , b , c ) { b = a . getLayer ( b ) , this . clearTilemapLayerBodies ( a , b ) ; for ( var d = 0 , e = a . layers [ b ] . height ; e > d ; d ++ ) for ( var f = 0 , g = a . layers [ b ] . width ; g > f ; f ++ ) { var h = a . layers [ b ] . data [ d ] [ f ] ; if ( h && c . hasOwnProperty ( h . index ) ) { var i = new Phaser . Physics . Ninja . Body ( this , null , 3 , c [ h . index ] , 0 , h . worldX + h . centerX , h . worldY + h . centerY , h . width , h . height ) ; a . layers [ b ] . bodies . push ( i ) } } return a . layers [ b ] . bodies } , overlap : function ( a , b , c , d , e ) { if ( c = c || null , d = d || null , e = e || c , this . _result = ! 1 , this . _total = 0 , Array . isArray ( b ) ) for ( var f = 0 , g = b . length ; g > f ; f ++ ) this . collideHandler ( a , b [ f ] , c , d , e , ! 0 ) ; else this . collideHandler ( a , b , c , d , e , ! 0 ) ; return this . _total > 0 } , collide : function ( a , b , c , d , e ) { if ( c = c || null , d = d || null , e = e || c , this . _result = ! 1 , this . _total = 0 , Array . isArray ( b ) ) for ( var f = 0 , g = b . length ; g > f ; f ++ ) this . collideHandler ( a , b [ f ] , c , d , e , ! 1 ) ; else this . collideHandler ( a , b , c , d , e , ! 1 ) ; return this . _total > 0 } , collideHandler : function ( a , b , c , d , e , f ) { return "undefined" != typeof b || a . type !== Phaser . GROUP && a . type !== Phaser . EMITTER ? void ( a && b && a . exists && b . exists && ( a . type == Phaser . SPRITE || a . type == Phaser . TILESPRITE ? b . type == Phaser . SPRITE || b . type == Phaser . TILESPRITE ? this . collideSpriteVsSprite ( a , b , c , d , e , f ) : b . type == Phaser . GROUP || b . type == Phaser . EMITTER ? this . collideSpriteVsGroup ( a , b , c , d , e , f ) : b . type == Phaser . TILEMAPLAYER && this . collideSpriteVsTilemapLayer ( a , b , c , d , e ) : a . type == Phaser . GROUP ? b . type == Phaser . SPRITE || b . type == Phaser . TILESPRITE ? this . collideSpriteVsGroup ( b , a , c , d , e , f ) : b . type == Phaser . GROUP || b . type == Phaser . EMITTER ? this . collideGroupVsGroup ( a , b , c , d , e , f ) : b . type == Phaser . TILEMAPLAYER && this . collideGroupVsTilemapLayer ( a , b , c , d , e
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 * d > 0 ) return Phaser . Physics . Ninja . Circle . COL _NONE ; var s = f . pos . x + c * f . xw , t = f . pos . y + d * f . yw , u = e . pos . x - s , v = e . pos . y - t , q = Math . sqrt ( u * u + v * v ) , r = e . radius - q ; if ( r > 0 ) return 0 === q ? ( u = c / Math . SQRT2 , v = d / Math . SQRT2 ) : ( u /= q , v /= q ) , e . reportCollisionVsWorld ( u * r , v * r , u , v , f ) , Phaser . Physics . Ninja . Circle . COL _OTHER } return Phaser . Physics . Ninja . Circle . COL _NONE } , projCircle _Concave : function ( a , b , c , d , e , f ) { var g , h = f . signx , i = f . signy ; if ( 0 === c ) { if ( 0 === d ) { var j = f . pos . x + h * f . xw - e . pos . x , k = f . pos . y + i * f . yw - e . pos . y , l = 2 * f . xw , m = Math . sqrt ( l * l + 0 ) , n = Math . sqrt ( j * j + k * k ) , o = n + e . radius - m ; return o > 0 ? ( 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 ) ) , o > g ? ( e . reportCollisionVsWorld ( a , b , a / g , b / g , f ) , Phaser . Physics . Ninja . Circle . COL _AXIS ) : ( j /= n , k /= n , e . reportCollisionVsWorld ( j * o , k * o , j , k , f ) , Phaser . Physics . Ninja . Circle . COL _OTHER ) ) : Phaser . Physics . Ninja . Circle . COL _NONE } if ( 0 > i * d ) return e . reportCollisionVsWorld ( 0 , b * d , 0 , d , f ) , Phaser . Physics . Ninja . Circle . COL _AXIS ; var p = f . pos . x - h * f . xw , q = f . pos . y + d * f . yw , r = e . pos . x - p , s = e . pos . y - q , n = Math . sqrt ( r * r + s * s ) , o = e . radius - n ; if ( o > 0 ) return 0 === n ? ( r = 0 , s = d ) : ( r /= n , s /= n ) , e . reportCollisionVsWorld ( r * o , s * o , r , s , 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 p = f . pos . x + c * f . xw , q = f . pos . y - i * f . yw , r = e . pos . x - p , s = e . pos . y - q , n = Math . sqrt ( r * r + s * s ) , o = e . radius - n ; if ( o > 0 ) return 0 === n ? ( r = c , s = 0 ) : ( r /= n , s /= n ) , e . reportCollisionVsWorld ( r * o , s * o , r , s , f ) , Phaser . Physics . Ninja . Circle . COL _OTHER } else { if ( h * c + i * d > 0 ) return Phaser . Physics . Ninja . Circle . COL _NONE ; var p = f . pos . x + c * f . xw , q = f . pos . y + d * f . yw , r = e . pos . x - p , s = e . pos . y - q , n = Math . sqrt ( r * r + s * s ) , o = e . radius - n ; if ( o > 0 ) return 0 === n ? ( r = c / Math . SQRT2 , s = d / Math . SQRT2 ) : ( r /= n , s /= n ) , e . reportCollisionVsWorld ( r * o , s * o , r , s , f ) , Phaser . Physics . Ninja . Circle . COL _OTHER } return Phaser . Physics . Ninja . Circle . COL _NONE } , projCircle _Convex : function ( a , b , c , d , e , f ) { var g , h = f . signx , i = f . signy ; if ( 0 === c ) if ( 0 === d ) { var j = e . pos . x - ( f . pos . x - h * f . xw ) , k = e . pos . y - ( f . pos . y - i * f . yw ) , l = 2 * f . xw , m = Math . sqrt ( l * l + 0 ) , n = Math . sqrt ( j * j + k * k ) , o = m + e . radius - n ; if ( o > 0 ) return 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 ) ) , o > g ? ( e . reportCollisionVsWorld ( a , b , a / g , b / g , f ) , Phaser . Physics . Ninja . Circle . COL _AXIS ) : ( j /= n , k /= n , e . reportCollisionVsWorld ( j * o , k * o , j , k , 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 = e . pos . x - ( f . pos . x - h * f . xw ) , k = e . pos . y - ( f . pos . y - i * f . yw ) , l = 2 * f . xw , m = Math . sqrt ( l * l + 0 ) , n = Math . sqrt ( j * j + k * k ) , o = m + e . radius - n ; if ( o > 0 ) return j /= n , k /= n , e . reportCollisionVsWorld ( j * o , k * o , 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 = e . pos . x - ( f . pos . x - h * f . xw ) , k = e . pos . y - ( f . pos . y - i * f . yw ) , l = 2 * f . xw , m = Math . sqrt ( l * l + 0 ) , n = Math . sqrt ( j * j + k * k ) , o = m + e . radius - n ; if ( o > 0 ) return j /= n , k /= n , e . reportCollisionVsWorld ( j * o , k * o , j , k , f ) , Phaser . Physics . Ninja . Circle . COL _OTHER } else if (
} , c . prototype . createFrictionFromContact = function ( a ) { var b = this . createFrictionEquation ( a . bodyA , a . bodyB , a . shapeA , a . shapeB ) ; return f . copy ( b . contactPointA , a . contactPointA ) , f . copy ( b . contactPointB , a . contactPointB ) , f . rotate90cw ( b . t , a . normalA ) , b . contactEquation = a , b } , c . prototype [ q . LINE | q . CONVEX ] = c . prototype . convexLine = function ( a , b , c , d , e , f , g , h , i ) { return i ? ! 1 : 0 } , c . prototype [ q . LINE | q . RECTANGLE ] = c . prototype . lineRectangle = function ( a , b , c , d , e , f , g , h , i ) { return i ? ! 1 : 0 } ; var M = new r ( 1 , 1 ) , N = f . create ( ) ; c . prototype [ q . CAPSULE | q . CONVEX ] = c . prototype [ q . CAPSULE | q . RECTANGLE ] = c . prototype . convexCapsule = function ( a , b , c , e , g , h , i , j , k ) { var l = N ; f . set ( l , h . length / 2 , 0 ) , f . rotate ( l , l , j ) , f . add ( l , l , i ) ; var m = this . circleConvex ( g , h , l , j , a , b , c , e , k , h . radius ) ; f . set ( l , - h . length / 2 , 0 ) , f . rotate ( l , l , j ) , f . add ( l , l , i ) ; var n = this . circleConvex ( g , h , l , j , a , b , c , e , k , h . radius ) ; if ( k && ( m || n ) ) return ! 0 ; var o = M ; d ( o , h ) ; var p = this . convexConvex ( a , b , c , e , g , o , i , j , k ) ; return p + m + n } , c . prototype [ q . CAPSULE | q . LINE ] = c . prototype . lineCapsule = function ( a , b , c , d , e , f , g , h , i ) { return i ? ! 1 : 0 } ; var O = f . create ( ) , P = f . create ( ) , Q = new r ( 1 , 1 ) ; c . prototype [ q . CAPSULE | q . CAPSULE ] = c . prototype . capsuleCapsule = function ( a , b , c , e , g , h , i , j , k ) { for ( var l = O , m = P , n = 0 , o = 0 ; 2 > o ; o ++ ) { f . set ( l , ( 0 == o ? - 1 : 1 ) * b . length / 2 , 0 ) , f . rotate ( l , l , e ) , f . add ( l , l , c ) ; for ( var p = 0 ; 2 > p ; p ++ ) { f . set ( m , ( 0 == p ? - 1 : 1 ) * h . length / 2 , 0 ) , f . rotate ( m , m , j ) , f . add ( m , m , i ) ; var q = this . circleCircle ( a , b , l , e , g , h , m , j , k , b . radius , h . radius ) ; if ( k && q ) return ! 0 ; n += q } } var r = Q ; d ( r , b ) ; var s = this . convexCapsule ( a , r , c , e , g , h , i , j , k ) ; if ( k && s ) return ! 0 ; n += s , d ( r , h ) ; var t = this . convexCapsule ( g , r , i , j , a , b , c , e , k ) ; return k && t ? ! 0 : n += t } , c . prototype [ q . LINE | q . LINE ] = c . prototype . lineLine = function ( a , b , c , d , e , f , g , h , i ) { return i ? ! 1 : 0 } , c . prototype [ q . PLANE | q . LINE ] = c . prototype . planeLine = function ( a , b , c , d , e , j , k , l , m ) { var n = t , o = u , p = v , q = w , r = x , C = y , D = z , E = A , F = B , G = L ; numContacts = 0 , f . set ( n , - j . length / 2 , 0 ) , f . set ( o , j . length / 2 , 0 ) , f . rotate ( p , n , l ) , f . rotate ( q , o , l ) , h ( p , p , k ) , h ( q , q , k ) , f . copy ( n , p ) , f . copy ( o , q ) , g ( r , o , n ) , f . normalize ( C , r ) , f . rotate90cw ( F , C ) , f . rotate ( E , s , d ) , G [ 0 ] = n , G [ 1 ] = o ; for ( var H = 0 ; H < G . length ; H ++ ) { var I = G [ H ] ; g ( D , I , c ) ; var J = i ( D , E ) ; if ( 0 > J ) { if ( m ) return ! 0 ; var K = this . createContactEquation ( a , e , b , j ) ; numContacts ++ , f . copy ( K . normalA , E ) , f . normalize ( K . normalA , K . normalA ) , f . scale ( D , E , J ) , g ( K . contactPointA , I , D ) , g ( K . contactPointA , K . contactPointA , a . position ) , g ( K . contactPointB , I , k ) , h ( K . contactPointB , K . contactPointB , k ) , g ( K . contactPointB , K . contactPointB , e . position ) , this . contactEquations . push ( K ) , this . enableFriction && this . frictionEquations . push ( this . createFrictionFromContact ( K ) ) } } return numContacts } , c . prototype [ q . PARTICLE | q . CAPSULE ] = c . prototype . particleCapsule = function ( a , b , c , d , e , f , g , h , i ) { return this . circleLine ( a , b , c , d , e , f , g , h , i , f . radius , 0 ) } , c . prototype [ q . CIRCLE | q . LINE ] = c . prototype . circleLine = function ( a , b , c , d , e , j , k , l , m , n , o ) { var p = j , q = l , r = e , s = k , H = c , I = a , J = b , n = n || 0 , o = "undefined" != typeof o ? o : J . radius , K = t , M = u , N = v , O = w , P = x , Q = y , R = z , S = A , T = B , U = C , V = D , W = E , X = F , Y = G , Z = L ; f . set ( S , - p . length / 2 , 0 ) , f . set ( T , p . length / 2 , 0 ) , f . rotate ( U , S , q ) , f . rotate ( V , T , q ) , h ( U , U , s ) , h ( V , V , s ) , f . copy ( S , U ) , f . copy ( T , V ) , g ( Q , T , S ) , f . normalize ( R , Q ) , f . rotate90cw ( P , R ) , g ( W , H , S ) ; var $ = i ( W , P ) ; if ( g ( O , S , s ) , g ( X , H , s ) , Math . abs ( $ ) < o + n ) { f . scale ( K , P , $ ) , g ( N , H , K ) , f . scale ( M , P , i ( P , X ) ) , f . normalize ( M , M ) , f . scale ( M , M , n ) , h ( N , N , M ) ; var _ = i ( R , N ) , ab = i ( R , S ) , bb = i ( R , T ) ; if ( _ > ab && bb > _ ) { if ( m ) return ! 0 ; var cb = this . createContactEquation ( I , r , b , j ) ; return f . scale ( cb . normalA , K , - 1 ) , f . normalize ( cb . normalA , cb . normalA ) , f . scale ( cb . contactPointA , cb . normalA , o ) , h ( cb . contactPointA , cb . contactPointA , H ) , g ( cb . contactPointA , cb . contactPointA , I . position ) , g ( cb . contactPointB , N , s ) , h ( cb . contactPointB , cb . contactPointB , s ) , g ( cb . contactPointB , cb . contactPointB , r . position ) , this . contactEquations . push ( cb ) , this . enableFriction && this . frictionEquations . push ( this . createFrictionFromContact ( cb ) ) , 1 } } Z [ 0 ] = S , Z [ 1 ] = T ; for ( var db = 0 ; db < Z . length ; db ++ ) { var eb = Z [ db ] ; if ( g ( W , eb , H ) , f . squaredLength ( W ) < ( o + n ) * ( o + n ) ) { if ( m ) return ! 0 ; var cb = this . createContactEquation ( I , r , b , j ) ; return f . copy ( cb . normalA , W ) , f . normalize ( cb . normalA , cb . normalA ) , f . scale ( cb . contactPointA , cb . normalA , o ) , h ( cb . contactPointA , cb . contactPointA , H ) , g ( cb . contactPointA , cb . contactPointA , I . position ) , g ( cb . contactPointB , eb , s ) , f . scale ( Y , cb . normalA , - n ) , h
return i [ 0 ] * i [ 0 ] * c + i [ 1 ] * i [ 1 ] * c + i [ 2 ] * i [ 2 ] * g + i [ 3 ] * i [ 3 ] * d + i [ 4 ] * i [ 4 ] * d + i [ 5 ] * i [ 5 ] * h } ; { var n = g . create ( ) , o = g . create ( ) , p = g . create ( ) ; g . create ( ) , g . create ( ) , g . create ( ) } c . prototype . addToWlambda = function ( a ) { var b = this . bodyA , c = this . bodyB , d = n , h = o , i = p , j = e ( b ) , k = e ( c ) , l = f ( b ) , m = f ( c ) , q = this . G ; h [ 0 ] = q [ 0 ] , h [ 1 ] = q [ 1 ] , i [ 0 ] = q [ 3 ] , i [ 1 ] = q [ 4 ] , g . scale ( d , h , j * a ) , g . add ( b . vlambda , b . vlambda , d ) , b . wlambda += l * q [ 2 ] * a , g . scale ( d , i , k * a ) , g . add ( c . vlambda , c . vlambda , d ) , c . wlambda += m * q [ 5 ] * a } , c . prototype . computeInvC = function ( a ) { return 1 / ( this . computeGiMGt ( ) + a ) } } , { "../math/vec2" : 30 , "../objects/Body" : 31 , "../utils/Utils" : 47 } ] , 23 : [ function ( a , b ) { function c ( a , b , c ) { e . call ( this , a , b , - c , c ) , this . contactPointA = d . create ( ) , this . contactPointB = d . create ( ) , this . t = d . create ( ) , this . contactEquation = null , this . shapeA = null , this . shapeB = null , this . frictionCoefficient = . 3 } { var d = a ( "../math/vec2" ) , e = a ( "./Equation" ) ; a ( "../utils/Utils" ) } b . exports = c , c . prototype = new e , c . prototype . constructor = c , c . prototype . setSlipForce = function ( a ) { this . maxForce = a , this . minForce = - a } , c . prototype . getSlipForce = function ( ) { return this . maxForce } , c . prototype . computeB = function ( a , b , c ) { var e = ( this . bodyA , this . bodyB , this . contactPointA ) , f = this . contactPointB , g = this . t , h = this . G ; h [ 0 ] = - g [ 0 ] , h [ 1 ] = - g [ 1 ] , h [ 2 ] = - d . crossLength ( e , g ) , h [ 3 ] = g [ 0 ] , h [ 4 ] = g [ 1 ] , h [ 5 ] = d . crossLength ( f , g ) ; var i = this . computeGW ( ) , j = this . computeGiMf ( ) , k = - i * b - c * j ; return k } } , { "../math/vec2" : 30 , "../utils/Utils" : 47 , "./Equation" : 22 } ] , 24 : [ 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 ; var e = this . G ; e [ 2 ] = 1 , e [ 5 ] = - 1 } var d = a ( "./Equation" ) , e = a ( "../math/vec2" ) ; b . exports = c , c . prototype = new d , c . prototype . constructor = c ; var f = e . create ( ) , g = e . create ( ) , h = e . fromValues ( 1 , 0 ) , i = e . fromValues ( 0 , 1 ) ; c . prototype . computeGq = function ( ) { return e . rotate ( f , h , this . bodyA . angle + this . angle ) , e . rotate ( g , i , this . bodyB . angle ) , e . dot ( f , g ) } } , { "../math/vec2" : 30 , "./Equation" : 22 } ] , 25 : [ function ( a , b ) { function c ( a , b ) { d . call ( this , a , b , - Number . MAX _VALUE , Number . MAX _VALUE ) , this . relativeVelocity = 1 , this . ratio = 1 } { var d = a ( "./Equation" ) ; a ( "../math/vec2" ) } b . exports = c , c . prototype = new d , c . prototype . constructor = c , c . prototype . computeB = function ( a , b , c ) { var d = this . G ; d [ 2 ] = - 1 , d [ 5 ] = this . ratio ; var e = this . computeGiMf ( ) , f = this . computeGW ( ) , g = - f * b - c * e ; return g } } , { "../math/vec2" : 30 , "./Equation" : 22 } ] , 26 : [ function ( a , b ) { var c = function ( ) { } ; b . exports = c , c . prototype = { constructor : c , on : function ( a , b , c ) { b . context = c || this , void 0 === this . _listeners && ( this . _listeners = { } ) ; var d = this . _listeners ; return void 0 === d [ a ] && ( d [ a ] = [ ] ) , - 1 === d [ a ] . indexOf ( b ) && d [ a ] . push ( b ) , this } , has : function ( a , b ) { if ( void 0 === this . _listeners ) return ! 1 ; var c = this . _listeners ; if ( b ) { if ( void 0 !== c [ a ] && - 1 !== c [ a ] . indexOf ( b ) ) return ! 0 } else if ( void 0 !== c [ a ] ) return ! 0 ; return ! 1 } , off : function ( a , b ) { if ( void 0 === this . _listeners ) return this ; var c = this . _listeners , d = c [ a ] . indexOf ( b ) ; return - 1 !== d && c [ a ] . splice ( d , 1 ) , this } , emit : function ( a ) { if ( void 0 === this . _listeners ) return this ; var b = this . _listeners , c = b [ a . type ] ; if ( void 0 !== c ) { a . target = this ; for ( var d = 0 , e = c . length ; e > d ; d ++ ) { var f = c [ d ] ; f . call ( f . context , a ) } } return this } } } , { } ] , 27 : [ function ( a , b ) { function c ( a , b , f ) { if ( f = f || { } , ! ( a instanceof d && b instanceof d ) ) throw new Error ( "First two arguments must be Material instances." ) ; this . id = c . idCounter ++ , this . materialA = a , this . materialB = b , this . friction = "undefined" != typeof f . friction ? Number ( f . friction ) : . 3 , this . restitution = "undefined" != typeof f . restitution ? Number ( f . restitution ) : 0 , this . stiffness = "undefined" != typeof f . stiffness ? Number ( f . stiffness ) : e . DEFAULT _STIFFNESS , this . relaxation = "undefined" != typeof f . relaxation ? Number ( f . relaxation ) : e . DEFAULT _RELAXATION , this . frictionStiffness = "undefined" != typeof f . frictionStiffness ? Number ( f . frictionStiffness ) : e . DEFAULT _STIFFNESS , this . frictionRelaxation = "undefined" != typeof f . frictionRelaxation ? Number ( f . frictionRelaxation ) : e . DEFAULT _RELAXATION , this . surfaceVelocity = "undefined" != typeof f . surfaceVelocity ? Number ( f . surfaceVelocity ) : 0 } var d = a ( "./Material" ) , e = a ( "../equations/Equation" ) ; b . exports = c , c . idCounter = 0 } , { "../equations/Equation" : 22 , "./Material" : 28 } ] , 28 : [ function ( a , b ) { function c ( ) { this . id = c . idCounter ++ } b . exports = c , c . idCounter = 0 } , { } ] , 29 : [ function ( a , b ) { var
- 1 === c . indexOf ( f ) && c . push ( f ) } } , c . prototype . bfs = function ( a , b , d ) { var e = this . queue ; for ( e . length = 0 , e . push ( a ) , a . visited = ! 0 , this . visit ( a , b , d ) ; e . length ; ) for ( var g , h = e . pop ( ) ; g = c . getUnvisitedNode ( h . neighbors ) ; ) g . visited = ! 0 , this . visit ( g , b , d ) , g . body . motionState === f . DYNAMIC && e . push ( g ) } , c . prototype . split = function ( a ) { for ( var b = a . bodies , f = this . nodes , g = this . equations ; f . length ; ) this . _nodePool . push ( f . pop ( ) ) ; for ( var h = 0 ; h !== b . length ; h ++ ) if ( this . _nodePool . length ) { var i = this . _nodePool . pop ( ) ; i . reset ( ) , i . body = b [ h ] , f . push ( i ) } else f . push ( new e ( b [ h ] ) ) ; for ( var j = 0 ; j !== g . length ; j ++ ) { var k = g [ j ] , h = b . indexOf ( k . bodyA ) , l = b . indexOf ( k . bodyB ) , m = f [ h ] , n = f [ l ] ; m . neighbors . push ( n ) , n . neighbors . push ( m ) , m . equations . push ( k ) , n . equations . push ( k ) } for ( var o = this . islands ; o . length ; ) { var p = o . pop ( ) ; p . reset ( ) , this . _islandPool . push ( p ) } for ( var q ; q = c . getUnvisitedNode ( f ) ; ) { var p = this . _islandPool . length ? this . _islandPool . pop ( ) : new d ; this . bfs ( q , p . bodies , p . equations ) , o . push ( p ) } return o } } , { "../math/vec2" : 30 , "../objects/Body" : 31 , "./Island" : 48 , "./IslandNode" : 50 } ] , 50 : [ function ( a , b ) { function c ( a ) { this . body = a , this . neighbors = [ ] , this . equations = [ ] , this . visited = ! 1 } b . exports = c , c . prototype . reset = function ( ) { this . equations . length = 0 , this . neighbors . length = 0 , this . visited = ! 1 , this . body = null } } , { } ] , 51 : [ function ( a , b ) { function c ( a ) { r . apply ( this ) , a = a || { } , this . springs = [ ] , this . bodies = [ ] , this . disabledBodyCollisionPairs = [ ] , this . solver = a . solver || new g , this . narrowphase = new G ( this ) , this . islandManager = new J , this . gravity = j . fromValues ( 0 , - 9.78 ) , a . gravity && j . copy ( this . gravity , a . gravity ) , this . frictionGravity = j . length ( this . gravity ) || 10 , this . useWorldGravityAsFrictionGravity = ! 0 , this . useFrictionGravityOnZeroGravity = ! 0 , this . doProfiling = a . doProfiling || ! 1 , this . lastStepTime = 0 , this . broadphase = a . broadphase || new i , this . broadphase . setWorld ( this ) , this . constraints = [ ] , this . defaultMaterial = new v , this . defaultContactMaterial = new w ( 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 . stepping = ! 1 , this . bodiesToBeRemoved = [ ] , this . fixedStepTime = 0 , this . islandSplit = "undefined" != typeof a . islandSplit ? ! ! a . islandSplit : ! 1 , 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 . enableIslandSleeping = ! 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 . overlapKeeper = new I } function d ( a ) { return a ? [ a [ 0 ] , a [ 1 ] ] : a } function e ( a , b ) { for ( var c in b ) a [ c ] = b [ c ] } function f ( a ) { return { id : a . id , materialA : a . materialA . id , materialB : a . materialB . id , friction : a . friction , restitution : a . restitution , stiffness : a . stiffness , relaxation : a . relaxation , frictionStiffness : a . frictionStiffness , frictionRelaxation : a . frictionRelaxation } } var g = a ( "../solver/GSSolver" ) , h = a ( "../solver/Solver" ) , i = a ( "../collision/NaiveBroadphase" ) , j = a ( "../math/vec2" ) , k = a ( "../shapes/Circle" ) , l = a ( "../shapes/Rectangle" ) , m = a ( "../shapes/Convex" ) , n = a ( "../shapes/Line" ) , o = a ( "../shapes/Plane" ) , p = a ( "../shapes/Capsule" ) , q = a ( "../shapes/Particle" ) , r = a ( "../events/EventEmitter" ) , s = a ( "../objects/Body" ) , t = a ( "../shapes/Shape" ) , u = a ( "../objects/Spring" ) , v = a ( "../material/Material" ) , w = a ( "../material/ContactMaterial" ) , x = a ( "../constraints/DistanceConstraint" ) , y = a ( "../constraints/Constraint" ) , z = a ( "../constraints/LockConstraint" ) , A = a ( "../constraints/RevoluteConstraint" ) , B = a ( "../constraints/PrismaticConstraint" ) , C = a ( "../constraints/GearConstraint" ) , D = a ( "../../package.json" ) , E = a ( " . . / collision / Bro
} , createRevoluteConstraint : function ( a , b , c , d , e ) { return a = this . getBody ( a ) , c = this . getBody ( c ) , a && c ? this . addConstraint ( new Phaser . Physics . P2 . RevoluteConstraint ( this , a , b , c , d , e ) ) : void console . warn ( "Cannot create Constraint, invalid body objects given" ) } , createLockConstraint : function ( a , b , c , d , e ) { return a = this . getBody ( a ) , b = this . getBody ( b ) , a && b ? this . addConstraint ( new Phaser . Physics . P2 . LockConstraint ( this , a , b , c , d , e ) ) : void console . warn ( "Cannot create Constraint, invalid body objects given" ) } , createPrismaticConstraint : function ( a , b , c , d , e , f , g ) { return a = this . getBody ( a ) , b = this . getBody ( b ) , a && b ? this . addConstraint ( new Phaser . Physics . P2 . PrismaticConstraint ( this , a , b , c , d , e , f , g ) ) : void console . warn ( "Cannot create Constraint, invalid body objects given" ) } , addConstraint : function ( a ) { return this . world . addConstraint ( a ) , this . onConstraintAdded . dispatch ( a ) , a } , removeConstraint : function ( a ) { return this . world . removeConstraint ( a ) , this . onConstraintRemoved . dispatch ( a ) , a } , addContactMaterial : function ( a ) { return this . world . addContactMaterial ( a ) , this . onContactMaterialAdded . dispatch ( a ) , a } , removeContactMaterial : function ( a ) { return this . world . removeContactMaterial ( a ) , this . onContactMaterialRemoved . dispatch ( a ) , a } , getContactMaterial : function ( a , b ) { return this . world . getContactMaterial ( a , b ) } , setMaterial : function ( a , b ) { for ( var c = b . length ; c -- ; ) b [ c ] . setMaterial ( a ) } , createMaterial : function ( a , b ) { a = a || "" ; var c = new Phaser . Physics . P2 . Material ( a ) ; return this . materials . push ( c ) , "undefined" != typeof b && b . setMaterial ( c ) , c } , createContactMaterial : function ( a , b , c ) { "undefined" == typeof a && ( a = this . createMaterial ( ) ) , "undefined" == typeof b && ( b = this . createMaterial ( ) ) ; var d = new Phaser . Physics . P2 . ContactMaterial ( a , b , c ) ; return this . addContactMaterial ( d ) } , getBodies : function ( ) { for ( var a = [ ] , b = this . world . bodies . length ; b -- ; ) a . push ( this . world . bodies [ b ] . parent ) ; return a } , getBody : function ( a ) { return a instanceof p2 . Body ? a : a instanceof Phaser . Physics . P2 . Body ? a . data : a . body && a . body . type === Phaser . Physics . P2JS ? a . body . data : null } , getSprings : function ( ) { for ( var a = [ ] , b = this . world . springs . length ; b -- ; ) a . push ( this . world . springs [ b ] . parent ) ; return a } , getConstraints : function ( ) { for ( var a = [ ] , b = this . world . constraints . length ; b -- ; ) a . push ( this . world . constraints [ b ] . parent ) ; return a } , hitTest : function ( a , b , c , d ) { "undefined" == typeof b && ( b = this . world . bodies ) , "undefined" == typeof c && ( c = 5 ) , "undefined" == typeof d && ( d = ! 1 ) ; for ( var e = [ this . pxmi ( a . x ) , this . pxmi ( a . y ) ] , f = [ ] , g = b . length ; g -- ; ) b [ g ] instanceof Phaser . Physics . P2 . Body && ( ! d || b [ g ] . data . motionState !== p2 . Body . STATIC ) ? f . push ( b [ g ] . data ) : b [ g ] instanceof p2 . Body && b [ g ] . parent && ( ! d || b [ g ] . motionState !== p2 . Body . STATIC ) ? f . push ( b [ g ] ) : b [ g ] instanceof Phaser . Sprite && b [ g ] . hasOwnProperty ( "body" ) && ( ! d || b [ g ] . body . data . motionState !== p2 . Body . STATIC ) && f . push ( b [ g ] . body . data ) ; return this . world . hitTest ( e , f , c ) } , toJSON : function ( ) { return this . world . toJSON ( ) } , createCollisionGroup : function ( a ) { var b = Math . pow ( 2 , this . _collisionGroupID ) ; this . walls . left && ( this . walls . left . shapes [ 0 ] . collisionMask = this . walls . left . shapes [ 0 ] . collisionMask | b ) , this . walls . right && ( this . walls . right . shapes [ 0 ] . collisionMask = this . walls . right . shapes [ 0 ] . collisionMask | b ) , this . walls . top && ( this . walls . top . shapes [ 0 ] . collisionMask = this . walls . top . shapes [ 0 ] . collisionMask | b ) , this . walls . bottom && ( this . walls . bottom . shapes [ 0 ] . collisionMask = this . walls . bottom . shapes [ 0 ] . collisionMask | b ) , this . _collisionGroupID ++ ; var c = new Phaser . Physics . P2 . CollisionGroup ( b ) ; return this . collisionGroups . push ( c ) , a && this . setCollisionGroup ( a , c ) , c } , setCollisionGroup : function ( a , b ) { if ( a instanceof Phaser . Group ) for ( var c = 0 ; c < a . total ; c ++ ) a . children [ c ] . body && a . children [ c ] . body . type === Phaser . Physics . P2JS && a . children [ c ] . body . setCollisionGroup ( b ) ; else a . body . setCollisionGroup ( b ) } , createSpring : function ( a , b , c , d , e , f , g , h , i ) { return a = this . getBody ( a ) , b = this . getBody ( b ) , a && b ? this . addSpring ( new Phaser . Physics . P2 . Spring ( this , a , b , c , d , e , f , g , h , i ) ) : void console . warn ( "Cannot create Spring, invalid body objects given" ) } , createBody : function ( a , b , c , d , e , f ) { "undefined" == typeof d && ( d = ! 1 ) ; var g = new Phaser . Physics . P2 . Body ( this . game , null , a , b , c ) ; if ( f ) { var h = g . addPolygon ( e , f ) ; if ( ! h ) return ! 1 } return d && this . world . addBody ( g . data ) , g } , creat
2014-02-28 09:30:53 +00:00
//# sourceMappingURL=phaser.map