2014-08-28 03:53:05 +00:00
/* Phaser v2.1.0 - http://phaser.io - @photonstorm - (c) 2014 Photon Storm Ltd. */
2014-02-28 09:30:53 +00:00
2014-08-29 17:13:33 +00:00
( function ( ) { var a = this , b = b || { } ; b . WEBGL _RENDERER = 0 , b . CANVAS _RENDERER = 1 , b . VERSION = "v1.6.1" , 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 , "undefined" != typeof Float32Array ? ( b . Float32Array = Float32Array , b . Uint16Array = Uint16Array ) : ( b . Float32Array = Array , b . 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 . dontSayHello = ! 1 , b . sayHello = function ( a ) { if ( ! b . dontSayHello ) { if ( navigator . userAgent . toLowerCase ( ) . indexOf ( "chrome" ) > - 1 ) { var c = [ "%c %c %c Pixi.js " + b . VERSION + " - " + a + " %c %c http://www.pixijs.com/ %c %c ♥%c♥%c♥ " , "background: #ff66a5" , "background: #ff66a5" , "color: #ff66a5; background: #030307;" , "background: #ff66a5" , "background: #ffc3dc" , "background: #ff66a5" , "color: #ff2424; background: #fff" , "color: #ff2424; background: #fff" , "color: #ff2424; background: #fff" ] ; console . log . apply ( console , c ) } else window . console && console . log ( "Pixi.js " + b . VERSION + " - http://www.pixijs.com/" ) ; b . dontSayHello = ! 0 } } , 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 . Matrix . prototype . apply = function ( a , c ) { return c = c || new b . Point , c . x = this . a * a . x + this . b * a . y + this . tx , c . y = this . c * a . x + this . d * a . y + this . ty , c } , b . Matrix . prototype . applyInverse = function ( a , c ) { c = c || new b . Point ; var d = 1 / ( this . a * this . d + this . b * - this . c ) ; return c . x = this . d * d * a . x - this . b * d * a . y + ( this . ty * this . b - this . tx * this . d ) * d , c . y = this . a * d * a . y - this . c * d * a . x + ( this . tx * this . c - this . ty * this . a ) * d , c } , 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 , this . stage = null , this . worldAlpha = 1 , this . _interactive = ! 1 , this . defaultCursor = "pointer" , this . worldTransform = new b . Matrix , this . color = [ ] , this . dynamic = ! 0 , this . _sr = 0 , this . _cr = 1 , this . filterArea = null , this . _bounds = new b . Rectangle ( 0 , 0 , 1 , 1 ) , this . _currentBounds = null , this . _mask = null , this . _cacheAsBitmap = ! 1 , this . _cacheIsDirty = ! 1 } , b . DisplayObject . prototype . constructor = b . DisplayObject , b . DisplayObject . prototype . setInteractive = function ( a ) { this . interactive = a } , Object . defineProperty ( b . DisplayObject . prototype , "interactive" , { get : function ( ) { return this . _interactive } , set : function ( a ) { this . _interactive = a , this . stage && ( this . stage . dirty = ! 0 ) } } ) , Object . defineProperty ( b . DisplayObject . prototype , "worldVisible" , { get : function ( ) { var a = this ; do { if ( ! a . visible ) return ! 1 ; a = a . parent } while ( a ) ; return ! 0 } } ) , Object . defineProperty ( b . DisplayObject . prototype , "mask" , { get : function ( ) { return this . _mask } , set : function ( a ) { this . _mask && ( this . _mask . isMask = ! 1 ) , this . _mask = a , this . _mask && ( this . _mask . isMask = ! 0 ) } } ) , Object . defineProperty ( b . DisplayObject . prototype , "filters" , { get : function ( ) { return this . _filters } , set : function ( a ) { if ( a ) { for ( var b = [ ] , c = 0 ; c < a . length ; c ++ ) for ( var d = a [ c ] . passes , e = 0 ; e < d . length ; e ++ ) b . push ( d [ e ] ) ; this . _filterBlock = { target : this , filterPasses : b } } this . _filters = a } } ) , Object . defineProperty ( b . DisplayObject . prototype , "cacheAsBitmap" , { get : function ( ) { return this . _cacheAsBitmap } , set : function ( a ) { this . _cacheAsBitmap !== a && ( a ? this . _generateCachedSprite ( ) : this . _destroyCachedSprite ( ) , this . _cacheAsBitmap = a ) } } ) , b . DisplayObject . prototype . updateTransform = function ( ) { this . rotation !== this . rotationCache && ( this . rotationCache = this . rotation , this . _sr = Math . sin ( this . rotation ) , this . _cr = Math . cos (
} , 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;" , "attribute vec2 aTextureCoord;" , "uniform mat3 translationMatrix;" , "uniform vec2 projectionVector;" , "uniform vec2 offsetVector;" , "varying vec2 vTextureCoord;" , "void main(void) {" , " vec3 v = translationMatrix * vec3(aVertexPosition , 1.0);" , " v -= offsetVector.xyx;" , " gl_Position = vec4( v.x / projectionVector.x -1.0, v.y / -projectionVector.y + 1.0 , 0.0, 1.0);" , " vTextureCoord = aTextureCoord;" , "}" ] , this . init ( ) } , b . StripShader . 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 . colorAttribute = a . getAttribLocation ( c , "aColor" ) , this . aVertexPosition = a . getAttribLocation ( c , "aVertexPosition" ) , this . aTextureCoord = a . getAttribLocation ( c , " aTextureCoord
} , b . WebGLSpriteBatch . prototype . flush = function ( ) { if ( 0 !== this . currentBatchSize ) { var a = this . gl ; if ( this . renderSession . shaderManager . setShader ( this . renderSession . shaderManager . defaultShader ) , this . dirty ) { this . dirty = ! 1 , a . activeTexture ( a . TEXTURE0 ) , a . bindBuffer ( a . ARRAY _BUFFER , this . vertexBuffer ) , a . bindBuffer ( a . ELEMENT _ARRAY _BUFFER , this . indexBuffer ) ; var b = this . renderSession . projection ; a . uniform2f ( this . shader . projectionVector , b . x , b . y ) ; var c = 4 * this . vertSize ; a . vertexAttribPointer ( this . shader . aVertexPosition , 2 , a . FLOAT , ! 1 , c , 0 ) , a . vertexAttribPointer ( this . shader . aTextureCoord , 2 , a . FLOAT , ! 1 , c , 8 ) , a . vertexAttribPointer ( this . shader . colorAttribute , 2 , a . FLOAT , ! 1 , c , 16 ) } if ( this . currentBatchSize > . 5 * this . size ) a . bufferSubData ( a . ARRAY _BUFFER , 0 , this . vertices ) ; else { var d = this . vertices . subarray ( 0 , 4 * this . currentBatchSize * this . vertSize ) ; a . bufferSubData ( a . ARRAY _BUFFER , 0 , d ) } for ( var e , f , g = 0 , h = 0 , i = null , j = this . renderSession . blendModeManager . currentBlendMode , k = 0 , l = this . currentBatchSize ; l > k ; k ++ ) e = this . textures [ k ] , f = this . blendModes [ k ] , ( i !== e || j !== f ) && ( this . renderBatch ( i , g , h ) , h = k , g = 0 , i = e , j = f , this . renderSession . blendModeManager . setBlendMode ( j ) ) , g ++ ; this . renderBatch ( i , g , h ) , this . currentBatchSize = 0 } } , b . WebGLSpriteBatch . prototype . renderBatch = function ( a , c , d ) { if ( 0 !== c ) { var e = this . gl ; e . bindTexture ( e . TEXTURE _2D , a . _glTextures [ e . id ] || b . createWebGLTexture ( a , e ) ) , a . _dirty [ e . id ] && b . updateWebGLTexture ( this . currentBaseTexture , e ) , e . drawElements ( e . TRIANGLES , 6 * c , e . UNSIGNED _SHORT , 6 * d * 2 ) , this . renderSession . drawCount ++ } } , b . WebGLSpriteBatch . prototype . stop = function ( ) { this . flush ( ) } , b . WebGLSpriteBatch . prototype . start = function ( ) { this . dirty = ! 0 } , 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 ) } , 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 . renderSession . blendModeManager . currentBlendMode && ( this . flush ( ) , this . renderSession . blendModeManager . 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 . crop . width , h = k . y - a . anchor . y * k . height , g = h + a . texture . crop . height } else e = a . texture . frame . width * ( 1 - a . anchor . x ) , f = a . texture . frame . width * - a . anchor . x , g = a . texture . frame . height * ( 1 - a . anchor . y ) , h = a . texture . frame . height * - a . anchor . y ; i = 4 * this . currentBatchSize * this . vertSize , j [ i ++ ] = f , j [ i ++ ] = h , j [ i ++ ] = a . position . x , j [ i ++ ] = a . position . y , j [ i ++ ] = a . scale . x , j [ i ++
2014-09-04 15:56:45 +00:00
} } , 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 , this . padding = 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 . blendFunc ( c . ONE , c . ONE _MINUS _SRC _ALPHA ) , c . uniformMatrix3fv ( f . translationMatrix , ! 1 , this . worldTransform . toArray ( ! 0 ) ) , c . uniform2f ( f . projectionVector , d . x , - d . y ) , c . uniform2f ( f . offsetVector , - e . x , - e . y ) , c . uniform1f ( f . alpha , 1 )
var d = a . length ; if ( 1 > d ) throw new Error ( "Phaser.Point. Parameter 'points' array must not be empty" ) ; if ( 1 === d ) return c . copyFrom ( a [ 0 ] ) , c ; for ( var e = 0 ; d > e ; e ++ ) b . Point . add ( c , a [ e ] , c ) ; return c . divide ( d , d ) , c } , PIXI . Point = b . Point , b . Rectangle = function ( a , b , c , d ) { a = a || 0 , b = b || 0 , c = c || 0 , d = d || 0 , this . x = a , this . y = b , this . width = c , this . height = d } , b . Rectangle . prototype = { offset : function ( a , b ) { return this . x += a , this . y += b , this } , offsetPoint : function ( a ) { return this . offset ( a . x , a . y ) } , setTo : function ( a , b , c , d ) { return this . x = a , this . y = b , this . width = c , this . height = d , this } , floor : function ( ) { this . x = Math . floor ( this . x ) , this . y = Math . floor ( this . y ) } , floorAll : function ( ) { this . x = Math . floor ( this . x ) , this . y = Math . floor ( this . y ) , this . width = Math . floor ( this . width ) , this . height = Math . floor ( this . height ) } , copyFrom : function ( a ) { return this . setTo ( a . x , a . y , a . width , a . height ) } , copyTo : function ( a ) { return a . x = this . x , a . y = this . y , a . width = this . width , a . height = this . height , a } , inflate : function ( a , c ) { return b . Rectangle . inflate ( this , a , c ) } , size : function ( a ) { return b . Rectangle . size ( this , a ) } , clone : function ( a ) { return b . Rectangle . clone ( this , a ) } , contains : function ( a , c ) { return b . Rectangle . contains ( this , a , c ) } , containsRect : function ( a ) { return b . Rectangle . containsRect ( a , this ) } , equals : function ( a ) { return b . Rectangle . equals ( this , a ) } , intersection : function ( a , c ) { return b . Rectangle . intersection ( this , a , c ) } , intersects : function ( a , c ) { return b . Rectangle . intersects ( this , a , c ) } , intersectsRaw : function ( a , c , d , e , f ) { return b . Rectangle . intersectsRaw ( this , a , c , d , e , f ) } , union : function ( a , c ) { return b . Rectangle . union ( this , a , c ) } , toString : function ( ) { return "[{Rectangle (x=" + this . x + " y=" + this . y + " width=" + this . width + " height=" + this . height + " empty=" + this . empty + ")}]" } } , 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 : a - this . y } } ) , 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 , "randomX" , { get : function ( ) { return this . x + Math . random ( ) * this . width } } ) , Object . defineProperty ( b . Rectangle . prototype , "randomY" , { get : function ( ) { return this . y + Math . random ( ) * this . height } } ) , 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 || null === 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 || null === c ? c = new b . Rect
2014-09-01 07:21:40 +00:00
} , b . Stage . prototype . update = function ( ) { for ( var a = this . children . length ; a -- ; ) this . children [ a ] . update ( ) } , b . Stage . prototype . postUpdate = function ( ) { if ( this . game . world . camera . target ) { this . game . world . camera . target . postUpdate ( ) , this . game . world . camera . update ( ) ; for ( var a = this . children . length ; a -- ; ) this . children [ a ] !== this . game . world . camera . target && this . children [ a ] . postUpdate ( ) } else { this . game . world . camera . update ( ) ; for ( var a = this . children . length ; a -- ; ) this . children [ a ] . postUpdate ( ) } } , b . Stage . prototype . checkVisibility = function ( ) { this . _hiddenVar = void 0 !== document . webkitHidden ? "webkitvisibilitychange" : void 0 !== document . mozHidden ? "mozvisibilitychange" : void 0 !== document . msHidden ? "msvisibilitychange" : void 0 !== document . hidden ? "visibilitychange" : null , this . _hiddenVar && document . addEventListener ( this . _hiddenVar , this . _onChange , ! 1 ) , window . onpagehide = this . _onChange , window . onpageshow = this . _onChange , window . onblur = this . _onChange , window . onfocus = this . _onChange ; var a = this ; this . game . device . cocoonJSApp && ( CocoonJS . App . onSuspended . addEventListener ( function ( ) { b . Stage . prototype . visibilityChange . call ( a , { type : "pause" } ) } ) , CocoonJS . App . onActivated . addEventListener ( function ( ) { b . Stage . prototype . visibilityChange . call ( a , { type : "resume" } ) } ) ) } , b . Stage . prototype . visibilityChange = function ( a ) { return "pagehide" === a . type || "blur" === a . type || "pageshow" === a . type || "focus" === a . type ? void ( "pagehide" === a . type || "blur" === a . type ? this . game . focusLoss ( a ) : ( "pageshow" === a . type || "focus" === a . type ) && this . game . focusGain ( a ) ) : void ( this . disableVisibilityChange || ( document . hidden || document . mozHidden || document . msHidden || document . webkitHidden || "pause" === a . type ? this . game . gamePaused ( a ) : this . game . gameResumed ( a ) ) ) } , b . Stage . prototype . setBackgroundColor = function ( a ) { if ( "string" == typeof a ) { var c = b . Color . hexToColor ( a ) ; this . _backgroundColor = b . Color . getColor ( c . r , c . g , c . b ) } else { var c = b . Color . getRGB ( a ) ; this . _backgroundColor = a } this . backgroundColorSplit = [ c . r / 255 , c . g / 255 , c . b / 255 ] , this . backgroundColorString = b . Color . RGBtoString ( c . r , c . g , c . b , 255 , "#" ) } , b . Stage . prototype . destroy = function ( ) { this . _hiddenVar && document . removeEventListener ( this . _hiddenVar , this . _onChange , ! 1 ) , window . onpagehide = null , window . onpageshow = null , window . onblur = null , window . onfocus = null } , Object . defineProperty ( b . Stage . prototype , "backgroundColor" , { get : function ( ) { return this . _backgroundColor } , set : function ( a ) { this . game . transparent || this . setBackgroundColor ( a ) } } ) , Object . defineProperty ( b . Stage . prototype , "smoothed" , { get : function ( ) { return ! PIXI . scaleModes . LINEAR } , set : function ( a ) { PIXI . scaleModes . LINEAR = a ? 0 : 1 } } ) , b . Group = function ( a , c , d , e , f , g ) { "undefined" == typeof e && ( e = ! 1 ) , "undefined" == typeof f && ( f = ! 1 ) , "undefined" == typeof g && ( g = b . Physics . ARCADE ) , this . game = a , "undefined" == typeof c && ( c = a . world ) , this . name = d || "group" , PIXI . DisplayObjectContainer . call ( this ) , e ? this . game . stage . addChild ( this ) : c && c . addChild ( this ) , this . z = 0 , this . type = b . GROUP , this . alive = ! 0 , this . exists = ! 0 , this . classType = b . Sprite , this . scale = new b . Point ( 1 , 1 ) , this . cursor = null , this . cameraOffset = new b . Point , this . enableBody = f , this . enableBodyDebug = ! 1 , this . physicsBodyType = g , this . onDestroy = new b . Signal , this . _sortProperty = "z" , this . _cache = [ 0 , 0 , 0 , 0 , 1 , 0 , 1 , 0 , 0 , 0 ] } , 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 t
2014-09-04 15:56:45 +00:00
var c = [ ( Date . now ( ) * Math . random ( ) ) . toString ( ) ] ; a . seed && ( c = a . seed ) , this . rnd = new b . RandomDataGenerator ( c ) ; var d = null ; a . state && ( d = a . state ) , this . state = new b . StateManager ( this , d ) } , boot : function ( ) { this . isBooted || ( document . body ? ( document . removeEventListener ( "DOMContentLoaded" , this . _onBoot ) , window . removeEventListener ( "load" , this . _onBoot ) , this . onPause = new b . Signal , this . onResume = new b . Signal , this . onBlur = new b . Signal , this . onFocus = new b . Signal , this . isBooted = ! 0 , this . device = new b . Device ( this ) , this . math = b . Math , this . scale = new b . ScaleManager ( this , this . _width , this . _height ) , this . stage = new b . Stage ( this ) , this . setUpRenderer ( ) , this . device . checkFullScreenSupport ( ) , this . world = new b . World ( this ) , this . add = new b . GameObjectFactory ( this ) , this . make = new b . GameObjectCreator ( this ) , this . cache = new b . Cache ( this ) , this . load = new b . Loader ( this ) , this . time = new b . Time ( this ) , this . tweens = new b . TweenManager ( this ) , this . input = new b . Input ( this ) , this . sound = new b . SoundManager ( this ) , this . physics = new b . Physics ( this , this . physicsConfig ) , this . particles = new b . Particles ( this ) , this . plugins = new b . PluginManager ( this ) , this . net = new b . Net ( this ) , this . time . boot ( ) , this . stage . boot ( ) , this . world . boot ( ) , this . scale . boot ( ) , this . input . boot ( ) , this . sound . boot ( ) , this . state . boot ( ) , this . config . enableDebug && ( this . debug = new b . Utils . Debug ( this ) , this . debug . boot ( ) ) , this . showDebugHeader ( ) , this . isRunning = ! 0 , this . raf = this . config && this . config . forceSetTimeOut ? new b . RequestAnimationFrame ( this , this . config . forceSetTimeOut ) : new b . RequestAnimationFrame ( this , ! 1 ) , this . raf . start ( ) ) : window . setTimeout ( this . _onBoot , 20 ) ) } , showDebugHeader : function ( ) { var a = b . VERSION , c = "Canvas" , d = "HTML Audio" , e = 1 ; if ( this . renderType === b . WEBGL ? ( c = "WebGL" , e ++ ) : this . renderType == b . HEADLESS && ( c = "Headless" ) , this . device . webAudio && ( d = "WebAudio" , e ++ ) , this . device . chrome ) { for ( var f = [ "%c %c %c Phaser v" + a + " | Pixi.js " + PIXI . VERSION + " | " + c + " | " + d + " %c %c http://phaser.io %c %c ♥%c♥%c♥ " , "background: #7a66a3" , "background: #625186" , "color: #ffffff; background: #43375b;" , "background: #625186" , "background: #ccb9f2" , "background: #625186" ] , g = 0 ; 3 > g ; g ++ ) f . push ( e > g ? "color: #ff2424; background: #fff" : "color: #959595; background: #fff" ) ; console . log . apply ( console , f ) } else window . console && console . log ( "Phaser v" + a + " | Pixi.js " + PIXI . VERSION + " | " + c + " | " + d + " | http://phaser.io" ) } , setUpRenderer : function ( ) { if ( this . device . trident && ( this . renderType = b . CANVAS ) , this . canvas = this . config . canvasID ? b . Canvas . create ( this . width , this . height , this . config . canvasID ) : b . Canvas . create ( this . width , this . height ) , this . config . canvasStyle ? this . canvas . style = this . config . canvasStyle : this . canvas . style [ "-webkit-full-screen" ] = "width: 100%; height: 100%" , this . device . cocoonJS && ( this . canvas . screencanvas = ! 1 ) , this . renderType === b . HEADLESS || this . renderType === b . CANVAS || this . renderType === b . AUTO && this . device . webGL === ! 1 ) { if ( ! this . device . canvas ) throw new Error ( "Phaser.Game - cannot create Canvas or WebGL context, aborting." ) ; this . renderType === b . AUTO && ( this . renderType = b . CANVAS ) , this . renderer = new PIXI . CanvasRenderer ( this . width , this . height , this . canvas , this . transparent ) , this . context = this . renderer . context } else this . renderType = b . WEBGL , this . renderer = new PIXI . WebGLRenderer ( this . width , this . height , this . canvas , this . transparent , this . antialias , this . preserveDrawingBuffer ) , this . context = null ; this . renderType !== b . HEADLESS && ( this . stage . smoothed = this . antialias , b . Canvas . addToDOM ( this . canvas , this . parent , ! 1 ) , b . Canvas . setTouchAction ( this . canvas ) ) } , update : function ( a ) { this . time . update ( a ) , this . _paused || this . pendingStep ? ( this . state . pauseUpdate ( ) , this . config . enableDebug && this . debug . preUpdate ( ) ) : ( this . stepping && ( this . pendingStep = ! 0 ) , this . scale . preUpdate ( ) , this . config . enableDebug && this . debug . preUpdate ( ) , this . physics . preUpdate ( ) , this . state . preUpdate ( ) , this . plugins . preUpdate ( ) , this . stage . preUpdate ( ) , this . state . update ( ) , this . stage . update ( ) , this . tweens . update ( ) , this . sound . update ( ) , this . input . update ( ) , this . physics . update ( ) , this . particles . update ( ) , this . plugins . update ( ) , this . stage . postUpdate ( ) , this . plugins . postUpdate ( ) ) , this . renderType != b . HEADLESS && ( this . state . preRender ( ) , this . renderer . render ( this . stage ) , this . plugins . render ( ) , this . state . render
2014-09-01 07:21:40 +00:00
} } , processInteractiveObjects : function ( a ) { this . game . input . interactiveItems . setAll ( "checked" , ! 1 ) , this . _highestRenderOrderID = Number . MAX _SAFE _INTEGER , this . _highestRenderObject = null , this . _highestInputPriorityID = - 1 ; var b = this . game . input . interactiveItems . first ; do b && b . validForInput ( this . _highestInputPriorityID , this . _highestRenderOrderID , ! 1 ) && ( b . checked = ! 0 , ( a && b . checkPointerDown ( this , ! 0 ) || ! a && b . checkPointerOver ( this , ! 0 ) ) && ( this . _highestRenderOrderID = b . sprite . _cache [ 3 ] , this . _highestInputPriorityID = b . priorityID , this . _highestRenderObject = b ) ) , b = this . game . input . interactiveItems . next ; while ( null !== b ) ; var b = this . game . input . interactiveItems . first ; do b && ! b . checked && b . validForInput ( this . _highestInputPriorityID , this . _highestRenderOrderID , ! 0 ) && ( a && b . checkPointerDown ( this , ! 1 ) || ! a && b . checkPointerOver ( this , ! 1 ) ) && ( this . _highestRenderOrderID = b . sprite . _cache [ 3 ] , this . _highestInputPriorityID = b . priorityID , this . _highestRenderObject = b ) , b = this . game . input . interactiveItems . next ; while ( null !== b ) ; return null === this . _highestRenderObject ? this . targetObject && ( this . targetObject . _pointerOutHandler ( this ) , this . targetObject = null ) : null === this . targetObject ? ( this . targetObject = this . _highestRenderObject , this . _highestRenderObject . _pointerOverHandler ( this ) ) : this . targetObject === this . _highestRenderObject ? this . _highestRenderObject . update ( this ) === ! 1 && ( this . targetObject = null ) : ( this . targetObject . _pointerOutHandler ( this ) , this . targetObject = this . _highestRenderObject , this . targetObject . _pointerOverHandler ( this ) ) , null !== this . targetObject } , leave : function ( a ) { this . withinGame = ! 1 , this . move ( a , ! 1 ) } , stop : function ( a ) { return this . _stateReset ? void a . preventDefault ( ) : ( this . timeUp = this . game . time . now , ( this . game . input . multiInputOverride === b . Input . MOUSE _OVERRIDES _TOUCH || this . game . input . multiInputOverride === b . Input . MOUSE _TOUCH _COMBINE || this . game . input . multiInputOverride === b . Input . TOUCH _OVERRIDES _MOUSE && 0 === this . game . input . currentPointers ) && ( this . game . input . onUp . dispatch ( this , a ) , this . duration >= 0 && this . duration <= this . game . input . tapRate && ( this . timeUp - this . previousTapTime < this . game . input . doubleTapRate ? this . game . input . onTap . dispatch ( this , ! 0 ) : this . game . input . onTap . dispatch ( this , ! 1 ) , this . previousTapTime = this . timeUp ) ) , this . id > 0 && ( this . active = ! 1 ) , this . withinGame = ! 1 , this . isDown = ! 1 , this . isUp = ! 0 , this . pointerId = null , this . identifier = null , this . positionUp . setTo ( this . x , this . y ) , this . isMouse === ! 1 && this . game . input . currentPointers -- , this . game . input . interactiveItems . callAll ( "_releasedHandler" , this ) , this . targetObject = null , this ) } , justPressed : function ( a ) { return a = a || this . game . input . justPressedRate , this . isDown === ! 0 && this . timeDown + a > this . game . time . now } , justReleased : function ( a ) { return a = a || this . game . input . justReleasedRate , this . isUp === ! 0 && this . timeUp + a > this . game . time . now } , reset : function ( ) { this . isMouse === ! 1 && ( this . active = ! 1 ) , this . pointerId = null , this . identifier = null , this . dirty = ! 1 , this . isDown = ! 1 , this . isUp = ! 0 , this . totalTouches = 0 , this . _holdSent = ! 1 , this . _history . length = 0 , this . _stateReset = ! 0 , this . targetObject && this . targetObject . _releasedHandler ( this ) , this . targetObject = null } , resetMovement : function ( ) { this . movementX = 0 , this . movementY = 0 } } , b . Pointer . prototype . constructor = b . Pointer , Object . defineProperty ( b . Pointer . prototype , "duration" , { get : function ( ) { return this . isUp ? - 1 : this . game . time . now - this . timeDown } } ) , Object . defineProperty ( b . Pointer . prototype , "worldX" , { get : function ( ) { return this . game . world . camera . x + this . x } } ) , Object . defineProperty ( b . Pointer . prototype , "worldY" , { get : function ( ) { return this . game . world . camera . y + this . y } } ) , b . Touch = function ( a ) { this . game = a , this . disabled = ! 1 , this . callbackContext = this . game , this . touchStartCallback = null , this . touchMoveCallback = null , this . touchEndCallback = null , this . touchEnterCallback = null , this . touchLeaveCallback = null , this . touchCancelCallback = null , this . preventDefault = ! 0 , this . event = null , this . _onTouchStart = null , this . _onTouchMove = null , this . _onTouchEnd = null , this . _onTouchEnter = null , this . _onTouchLeave = null , this . _onTouchCancel = null , this . _onTouchMove = null } , b . Touch . prototype = { start : function ( ) { if ( null === this . _onTouchStart ) { var a = this ; this . game . device . touch && ( this . _onTouchStart = function ( b ) { return a . onTouchStart ( b ) } , this . _onTouchMove = fun
2014-09-04 15:56:45 +00:00
} , checkBoundsSprite : function ( ) { this . sprite . fixedToCamera && this . boundsSprite . fixedToCamera ? ( this . sprite . cameraOffset . x < this . boundsSprite . camerOffset . x ? this . sprite . cameraOffset . x = this . boundsSprite . camerOffset . x : this . sprite . cameraOffset . x + this . sprite . width > this . boundsSprite . camerOffset . x + this . boundsSprite . width && ( this . sprite . cameraOffset . x = this . boundsSprite . camerOffset . x + this . boundsSprite . width - this . sprite . width ) , this . sprite . cameraOffset . y < this . boundsSprite . camerOffset . y ? this . sprite . cameraOffset . y = this . boundsSprite . camerOffset . y : this . sprite . cameraOffset . y + this . sprite . height > this . boundsSprite . camerOffset . y + this . boundsSprite . height && ( this . sprite . cameraOffset . y = this . boundsSprite . camerOffset . y + this . boundsSprite . height - this . sprite . height ) ) : ( this . sprite . x < this . boundsSprite . x ? this . sprite . x = this . boundsSprite . x : this . sprite . x + this . sprite . width > this . boundsSprite . x + this . boundsSprite . width && ( this . sprite . x = this . boundsSprite . x + this . boundsSprite . width - this . sprite . width ) , this . sprite . y < this . boundsSprite . y ? this . sprite . y = this . boundsSprite . y : this . sprite . y + this . sprite . height > this . boundsSprite . y + this . boundsSprite . height && ( this . sprite . y = this . boundsSprite . y + this . boundsSprite . height - this . sprite . height ) ) } } , b . InputHandler . prototype . constructor = b . InputHandler , b . Events = function ( a ) { this . parent = a , this . onAddedToGroup = new b . Signal , this . onRemovedFromGroup = new b . Signal , this . onDestroy = new b . Signal , this . onKilled = new b . Signal , this . onRevived = new b . Signal , this . onOutOfBounds = new b . Signal , this . onEnterBounds = new b . Signal , this . onInputOver = null , this . onInputOut = null , this . onInputDown = null , this . onInputUp = null , this . onDragStart = null , this . onDragStop = null , this . onAnimationStart = null , this . onAnimationComplete = null , this . onAnimationLoop = null } , b . Events . prototype = { destroy : function ( ) { this . parent = null , this . onDestroy . dispose ( ) , this . onAddedToGroup . dispose ( ) , this . onRemovedFromGroup . dispose ( ) , this . onKilled . dispose ( ) , this . onRevived . dispose ( ) , this . onOutOfBounds . dispose ( ) , this . onInputOver && ( this . onInputOver . dispose ( ) , this . onInputOut . dispose ( ) , this . onInputDown . dispose ( ) , this . onInputUp . dispose ( ) , this . onDragStart . dispose ( ) , this . onDragStop . dispose ( ) ) , this . onAnimationStart && ( this . onAnimationStart . dispose ( ) , this . onAnimationComplete . dispose ( ) , this . onAnimationLoop . dispose ( ) ) } } , b . Events . prototype . constructor = b . Events , b . GameObjectFactory = function ( a ) { this . game = a , this . world = this . game . world } , b . GameObjectFactory . prototype = { existing : function ( a ) { return this . world . add ( a ) } , image : function ( a , c , d , e , f ) { return "undefined" == typeof f && ( f = this . world ) , f . add ( new b . Image ( this . game , a , c , d , e ) ) } , sprite : function ( a , b , c , d , e ) { return "undefined" == typeof e && ( e = this . world ) , e . create ( a , b , c , d ) } , tween : function ( a ) { return this . game . tweens . create ( a ) } , group : function ( a , c , d , e , f ) { return new b . Group ( this . game , a , c , d , e , f ) } , physicsGroup : function ( a , c , d , e ) { return new b . Group ( this . game , c , d , e , ! 0 , a ) } , spriteBatch : function ( a , c , d ) { return "undefined" == typeof a && ( a = null ) , "undefined" == typeof c && ( c = "group" ) , "undefined" == typeof d && ( d = ! 1 ) , new b . SpriteBatch ( this . game , a , c , d ) } , audio : function ( a , b , c , d ) { return this . game . sound . add ( a , b , c , d ) } , sound : function ( a , b , c , d ) { return this . game . sound . add ( a , b , c , d ) } , tileSprite : function ( a , c , d , e , f , g , h ) { return "undefined" == typeof h && ( h = this . world ) , h . add ( new b . TileSprite ( this . game , a , c , d , e , f , g ) ) } , rope : function ( a , c , d , e , f , g ) { return "undefined" == typeof g && ( g = this . world ) , g . add ( new b . Rope ( this . game , a , c , d , e , f ) ) } , text : function ( a , c , d , e , f ) { return "undefined" == typeof f && ( f = this . world ) , f . add ( new b . Text ( this . game , a , c , d , e ) ) } , button : function ( a , c , d , e , f , g , h , i , j , k ) { return "undefined" == typeof k && ( k = this . world ) , k . add ( new b . Button ( this . game , a , c , d , e , f , g , h , i , j ) ) } , graphics : function ( a , c , d ) { return "undefined" == typeof d && ( d = this . world ) , d . add ( new b . Graphics ( this . game , a , c ) ) } , emitter : function ( a , c , d ) { return this . game . particles . add ( new b . Particles . Arcade . Emitter ( this . game , a , c , d ) ) } , retroFont : function ( a , c , d , e , f , g , h , i , j ) { return new b . RetroFont ( this . game , a , c , d , e , f , g , h , i , j ) } , bitmapText : function ( a , c , d , e , f , g ) { return "undefined" == typeof g && ( g = this . world ) , g . add ( new b . BitmapText ( this . game , a , c , d , e , f ) ) } , tilemap : function ( a , c , d , e , f ) { return new b . Tilemap ( this . game , a , c , d , e , f ) } , renderTexture
} , b . Image . prototype . updateCrop = function ( ) { if ( this . cropRect ) { this . _crop = b . Rectangle . clone ( this . cropRect , this . _crop ) , this . _crop . x += this . _frame . x , this . _crop . y += this . _frame . y ; var a = Math . max ( this . _frame . x , this . _crop . x ) , c = Math . max ( this . _frame . y , this . _crop . y ) , d = Math . min ( this . _frame . right , this . _crop . right ) - a , e = Math . min ( this . _frame . bottom , this . _crop . bottom ) - c ; this . texture . crop . x = a , this . texture . crop . y = c , this . texture . crop . width = d , this . texture . crop . height = e , this . texture . frame . width = Math . min ( d , this . cropRect . width ) , this . texture . frame . height = Math . min ( e , this . cropRect . height ) , this . texture . width = this . texture . frame . width , this . texture . height = this . texture . frame . height , this . game . renderType === b . WEBGL && PIXI . WebGLRenderer . updateTextureFrame ( this . texture ) } } , b . Image . prototype . revive = function ( ) { return this . alive = ! 0 , this . exists = ! 0 , this . visible = ! 0 , this . events && this . events . onRevived . dispatch ( this ) , this } , b . Image . prototype . kill = function ( ) { return this . alive = ! 1 , this . exists = ! 1 , this . visible = ! 1 , this . events && this . events . onKilled . dispatch ( this ) , this } , b . Image . prototype . destroy = function ( a ) { if ( null !== this . game && ! this . destroyPhase ) { "undefined" == typeof a && ( a = ! 0 ) , this . _cache [ 8 ] = 1 , this . events && this . events . onDestroy . dispatch ( this ) , this . parent && ( this . parent instanceof b . Group ? this . parent . remove ( this ) : this . parent . removeChild ( this ) ) , this . events && this . events . destroy ( ) , this . input && this . input . destroy ( ) , this . animations && this . animations . destroy ( ) ; var c = this . children . length ; if ( a ) for ( ; c -- ; ) this . children [ c ] . destroy ( a ) ; else for ( ; c -- ; ) this . removeChild ( this . children [ c ] ) ; this . alive = ! 1 , this . exists = ! 1 , this . visible = ! 1 , this . filters = null , this . mask = null , this . game = null , this . _cache [ 8 ] = 0 } } , b . Image . prototype . reset = function ( a , b ) { return this . world . setTo ( a , b ) , this . position . x = a , this . position . y = b , this . alive = ! 0 , this . exists = ! 0 , this . visible = ! 0 , this . renderable = ! 0 , this } , b . Image . prototype . bringToTop = function ( ) { return this . parent && this . parent . bringToTop ( this ) , this } , Object . defineProperty ( b . Image . prototype , "angle" , { get : function ( ) { return b . Math . wrapAngle ( b . Math . radToDeg ( this . rotation ) ) } , set : function ( a ) { this . rotation = b . Math . degToRad ( b . Math . wrapAngle ( a ) ) } } ) , Object . defineProperty ( b . Image . prototype , "deltaX" , { get : function ( ) { return this . world . x - this . _cache [ 0 ] } } ) , Object . defineProperty ( b . Image . prototype , "deltaY" , { get : function ( ) { return this . world . y - this . _cache [ 1 ] } } ) , Object . defineProperty ( b . Image . prototype , "deltaZ" , { get : function ( ) { return this . rotation - this . _cache [ 2 ] } } ) , Object . defineProperty ( b . Image . prototype , "inWorld" , { get : function ( ) { return this . game . world . bounds . intersects ( this . getBounds ( ) ) } } ) , Object . defineProperty ( b . Image . prototype , "inCamera" , { get : function ( ) { return this . game . world . camera . screenView . intersects ( this . getBounds ( ) ) } } ) , Object . defineProperty ( b . Image . prototype , "frame" , { get : function ( ) { return this . _frame } , set : function ( a ) { if ( a !== this . frame ) { var b = this . game . cache . getFrameData ( this . key ) ; b && a < b . total && b . getFrame ( a ) && ( this . setTexture ( PIXI . TextureCache [ b . getFrame ( a ) . uuid ] ) , this . _frame = a ) } } } ) , Object . defineProperty ( b . Image . prototype , "frameName" , { get : function ( ) { return this . _frameName } , set : function ( a ) { if ( a !== this . frameName ) { var b = this . game . cache . getFrameData ( this . key ) ; b && b . getFrameByName ( a ) && ( this . setTexture ( PIXI . TextureCache [ b . getFrameByName ( a ) . uuid ] ) , this . _frameName = a ) } } } ) , Object . defineProperty ( b . Image . prototype , "renderOrderID" , { get : function ( ) { return this . _cache [ 3 ] } } ) , Object . defineProperty ( b . Image . prototype , "inputEnabled" , { get : function ( ) { return this . input && this . input . enabled } , set : function ( a ) { a ? null === this . input ? ( this . input = new b . InputHandler ( this ) , this . input . start ( ) ) : this . input && ! this . input . enabled && this . input . start ( ) : this . input && this . input . enabled && this . input . stop ( ) } } ) , Object . defineProperty ( b . Image . prototype , "fixedToCamera" , { get : function ( ) { return ! ! this . _cache [ 7 ] } , set : function ( a ) { a ? ( this . _cache [ 7 ] = 1 , this . cameraOffset . set ( this . x , this . y ) ) : this . _cache [ 7 ] = 0 } } ) , Object . defineProperty ( b . Image . prototype , "smoothed" , { get : function ( ) { return ! this . texture . baseTexture . scaleMode } , set : function ( a ) { a ? this . texture && ( this . texture . baseTexture . scaleMode = 0 ) : this . texture && ( this . texture . baseTexture . scaleMode = 1 ) } } ) , Object . defineProperty ( b . Im
} , b . Button . prototype . setSounds = function ( a , b , c , d , e , f , g , h ) { this . setOverSound ( a , b ) , this . setOutSound ( e , f ) , this . setDownSound ( c , d ) , this . setUpSound ( g , h ) } , b . Button . prototype . setOverSound = function ( a , c ) { this . onOverSound = null , this . onOverSoundMarker = "" , a instanceof b . Sound && ( this . onOverSound = a ) , "string" == typeof c && ( this . onOverSoundMarker = c ) } , b . Button . prototype . setOutSound = function ( a , c ) { this . onOutSound = null , this . onOutSoundMarker = "" , a instanceof b . Sound && ( this . onOutSound = a ) , "string" == typeof c && ( this . onOutSoundMarker = c ) } , b . Button . prototype . setDownSound = function ( a , c ) { this . onDownSound = null , this . onDownSoundMarker = "" , a instanceof b . Sound && ( this . onDownSound = a ) , "string" == typeof c && ( this . onDownSoundMarker = c ) } , b . Button . prototype . setUpSound = function ( a , c ) { this . onUpSound = null , this . onUpSoundMarker = "" , a instanceof b . Sound && ( this . onUpSound = a ) , "string" == typeof c && ( this . onUpSoundMarker = c ) } , b . Button . prototype . onInputOverHandler = function ( a , b ) { this . freezeFrames === ! 1 && this . setState ( 1 ) , ( ! this . onOverMouseOnly || b . isMouse ) && ( this . onOverSound && this . onOverSound . play ( this . onOverSoundMarker ) , this . onInputOver && this . onInputOver . dispatch ( this , b ) ) } , b . Button . prototype . onInputOutHandler = function ( a , b ) { this . freezeFrames === ! 1 && this . setState ( 2 ) , this . onOutSound && this . onOutSound . play ( this . onOutSoundMarker ) , this . onInputOut && this . onInputOut . dispatch ( this , b ) } , b . Button . prototype . onInputDownHandler = function ( a , b ) { this . freezeFrames === ! 1 && this . setState ( 3 ) , this . onDownSound && this . onDownSound . play ( this . onDownSoundMarker ) , this . onInputDown && this . onInputDown . dispatch ( this , b ) } , b . Button . prototype . onInputUpHandler = function ( a , b , c ) { this . onUpSound && this . onUpSound . play ( this . onUpSoundMarker ) , this . onInputUp && this . onInputUp . dispatch ( this , b , c ) , this . freezeFrames || this . setState ( this . forceOut ? 2 : null !== this . _onUpFrameName || null !== this . _onUpFrameID ? 4 : c ? 1 : 2 ) } , b . Button . prototype . setState = function ( a ) { 1 === a ? null != this . _onOverFrameName ? this . frameName = this . _onOverFrameName : null != this . _onOverFrameID && ( this . frame = this . _onOverFrameID ) : 2 === a ? null != this . _onOutFrameName ? this . frameName = this . _onOutFrameName : null != this . _onOutFrameID && ( this . frame = this . _onOutFrameID ) : 3 === a ? null != this . _onDownFrameName ? this . frameName = this . _onDownFrameName : null != this . _onDownFrameID && ( this . frame = this . _onDownFrameID ) : 4 === a && ( null != this . _onUpFrameName ? this . frameName = this . _onUpFrameName : null != this . _onUpFrameID && ( this . frame = this . _onUpFrameID ) ) } , b . Graphics = function ( a , c , d ) { c = c || 0 , d = d || 0 , this . game = a , this . exists = ! 0 , this . name = "" , this . type = b . GRAPHICS , this . z = 0 , this . world = new b . Point ( c , d ) , this . cameraOffset = new b . Point , PIXI . Graphics . call ( this ) , this . position . set ( c , d ) , this . _cache = [ 0 , 0 , 0 , 0 , 1 , 0 , 1 , 0 , 0 ] } , b . Graphics . prototype = Object . create ( PIXI . Graphics . prototype ) , b . Graphics . prototype . constructor = b . Graphics , b . Graphics . prototype . preUpdate = function ( ) { return this . _cache [ 0 ] = this . world . x , this . _cache [ 1 ] = this . world . y , this . _cache [ 2 ] = this . rotation , this . exists && this . parent . exists ? ( this . autoCull && ( this . renderable = this . game . world . camera . screenView . intersects ( this . getBounds ( ) ) ) , this . world . setTo ( this . game . camera . x + this . worldTransform . tx , this . game . camera . y + this . worldTransform . ty ) , this . visible && ( this . _cache [ 3 ] = this . game . stage . currentRenderOrderID ++ ) , ! 0 ) : ( this . renderOrderID = - 1 , ! 1 ) } , b . Graphics . prototype . update = function ( ) { } , b . Graphics . prototype . postUpdate = function ( ) { 1 === this . _cache [ 7 ] && ( this . position . x = ( this . game . camera . view . x + this . cameraOffset . x ) / this . game . camera . scale . x , this . position . y = ( this . game . camera . view . y + this . cameraOffset . y ) / this . game . camera . scale . y ) } , b . Graphics . prototype . destroy = function ( a ) { if ( null !== this . game && ! this . destroyPhase ) { "undefined" == typeof a && ( a = ! 0 ) , this . _cache [ 8 ] = 1 , this . clear ( ) , this . parent && ( this . parent instanceof b . Group ? this . parent . remove ( this ) : this . parent . removeChild ( this ) ) ; var c = this . children . length ; if ( a ) for ( ; c -- ; ) this . children [ c ] . destroy ( a ) ; else for ( ; c -- ; ) this . removeChild ( this . children [ c ] ) ; this . exists = ! 1 , this . visible = ! 1 , this . game = null , this . _cache [ 8 ] = 0 } } , b . Graphics . prototype . drawPolygon = function ( a ) { this . moveTo ( a . points [ 0 ] . x , a . points [ 0 ] . y ) ; for ( var b = 1 ; b < a . points . length ; b += 1 ) this . lineTo ( a . points [ b ] . x , a . points [ b ] . y ) ; this . lineTo ( a . points [ 0 ] . x , a . points [ 0 ] . y ) }
} , pick : function ( a ) { return a [ this . integerInRange ( 0 , a . length - 1 ) ] } , weightedPick : function ( a ) { return a [ ~ ~ ( Math . pow ( this . frac ( ) , 2 ) * ( a . length - 1 ) ) ] } , timestamp : function ( a , b ) { return this . realInRange ( a || 9466848e5 , b || 1577862e6 ) } , angle : function ( ) { return this . integerInRange ( - 180 , 180 ) } } , b . RandomDataGenerator . prototype . constructor = b . RandomDataGenerator , b . QuadTree = function ( a , b , c , d , e , f , g ) { this . maxObjects = 10 , this . maxLevels = 4 , this . level = 0 , this . bounds = { } , this . objects = [ ] , this . nodes = [ ] , this . _empty = [ ] , this . reset ( a , b , c , d , e , f , g ) } , b . QuadTree . prototype = { reset : function ( a , b , c , d , e , f , g ) { this . maxObjects = e || 10 , this . maxLevels = f || 4 , this . level = g || 0 , this . bounds = { x : Math . round ( a ) , y : Math . round ( b ) , width : c , height : d , subWidth : Math . floor ( c / 2 ) , subHeight : Math . floor ( d / 2 ) , right : Math . round ( a ) + Math . floor ( c / 2 ) , bottom : Math . round ( b ) + Math . floor ( d / 2 ) } , this . objects . length = 0 , this . nodes . length = 0 } , populate : function ( a ) { a . forEach ( this . populateHandler , this , ! 0 ) } , populateHandler : function ( a ) { a . body && a . exists && this . insert ( a . body ) } , split : function ( ) { this . nodes [ 0 ] = new b . QuadTree ( this . bounds . right , this . bounds . y , this . bounds . subWidth , this . bounds . subHeight , this . maxObjects , this . maxLevels , this . level + 1 ) , this . nodes [ 1 ] = new b . QuadTree ( this . bounds . x , this . bounds . y , this . bounds . subWidth , this . bounds . subHeight , this . maxObjects , this . maxLevels , this . level + 1 ) , this . nodes [ 2 ] = new b . QuadTree ( this . bounds . x , this . bounds . bottom , this . bounds . subWidth , this . bounds . subHeight , this . maxObjects , this . maxLevels , this . level + 1 ) , this . nodes [ 3 ] = new b . QuadTree ( this . bounds . right , this . bounds . bottom , this . bounds . subWidth , this . bounds . subHeight , this . maxObjects , this . maxLevels , this . level + 1 ) } , insert : function ( a ) { var b , c = 0 ; if ( null != this . nodes [ 0 ] && ( b = this . getIndex ( a ) , - 1 !== b ) ) return void this . nodes [ b ] . insert ( a ) ; if ( this . objects . push ( a ) , this . objects . length > this . maxObjects && this . level < this . maxLevels ) for ( null == this . nodes [ 0 ] && this . split ( ) ; c < this . objects . length ; ) b = this . getIndex ( this . objects [ c ] ) , - 1 !== b ? this . nodes [ b ] . insert ( this . objects . splice ( c , 1 ) [ 0 ] ) : c ++ } , getIndex : function ( a ) { var b = - 1 ; return a . x < this . bounds . right && a . right < this . bounds . right ? a . y < this . bounds . bottom && a . bottom < this . bounds . bottom ? b = 1 : a . y > this . bounds . bottom && ( b = 2 ) : a . x > this . bounds . right && ( a . y < this . bounds . bottom && a . bottom < this . bounds . bottom ? b = 0 : a . y > this . bounds . bottom && ( b = 3 ) ) , b } , retrieve : function ( a ) { if ( a instanceof b . Rectangle ) var c = this . objects , d = this . getIndex ( a ) ; else { if ( ! a . body ) return this . _empty ; var c = this . objects , d = this . getIndex ( a . body ) } return this . nodes [ 0 ] && ( - 1 !== d ? c = c . concat ( this . nodes [ d ] . retrieve ( a ) ) : ( c = c . concat ( this . nodes [ 0 ] . retrieve ( a ) ) , c = c . concat ( this . nodes [ 1 ] . retrieve ( a ) ) , c = c . concat ( this . nodes [ 2 ] . retrieve ( a ) ) , c = c . concat ( this . nodes [ 3 ] . retrieve ( a ) ) ) ) , c } , clear : function ( ) { this . objects . length = 0 ; for ( var a = this . nodes . length ; a -- ; ) this . nodes [ a ] . clear ( ) , this . nodes . splice ( a , 1 ) ; this . nodes . length = 0 } } , b . QuadTree . prototype . constructor = b . QuadTree , b . Net = function ( a ) { this . game = a } , b . Net . prototype = { getHostName : function ( ) { return window . location && window . location . hostname ? window . location . hostname : null } , checkDomainName : function ( a ) { return - 1 !== window . location . hostname . indexOf ( a ) } , updateQueryString : function ( a , b , c , d ) { "undefined" == typeof c && ( c = ! 1 ) , ( "undefined" == typeof d || "" === d ) && ( d = window . location . href ) ; var e = "" , f = new RegExp ( "([?|&])" + a + "=.*?(&|#|$)(.*)" , "gi" ) ; if ( f . test ( d ) ) e = "undefined" != typeof b && null !== b ? d . replace ( f , "$1" + a + "=" + b + "$2$3" ) : d . replace ( f , "$1$3" ) . replace ( /(&|\?)$/ , "" ) ; else if ( "undefined" != typeof b && null !== b ) { var g = - 1 !== d . indexOf ( "?" ) ? "&" : "?" , h = d . split ( "#" ) ; d = h [ 0 ] + g + a + "=" + b , h [ 1 ] && ( d += "#" + h [ 1 ] ) , e = d } else e = d ; return c ? void ( window . location . href = e ) : e } , getQueryString : function ( a ) { "undefined" == typeof a && ( a = "" ) ; var b = { } , c = location . search . substring ( 1 ) . split ( "&" ) ; for ( var d in c ) { var e = c [ d ] . split ( "=" ) ; if ( e . length > 1 ) { if ( a && a == this . decodeURI ( e [ 0 ] ) ) return this . decodeURI ( e [ 1 ] ) ; b [ this . decodeURI ( e [ 0 ] ) ] = this . decodeURI ( e [ 1 ] ) } } return b } , decodeURI : function ( a ) { return decodeURIComponent ( a . replace ( /\+/g , " " ) ) } } , b . Net . prototype . constructor = b . Net , b . TweenManager = function ( a ) { this . game = a , this . _tweens = [ ] , this . _add = [ ] , this . game . onPause . add ( this . _pauseAll , this ) , this . game . onResume . add ( this . _resumeAll , this ) } , b . TweenManager . prototype = { getA
} , getFrameByName : function ( a ) { return "number" == typeof this . _frameNames [ a ] ? this . _frames [ this . _frameNames [ a ] ] : null } , checkFrameName : function ( a ) { return null == this . _frameNames [ a ] ? ! 1 : ! 0 } , clone : function ( ) { for ( var a = new b . FrameData , c = 0 ; c < this . _frames . length ; c ++ ) a . _frames . push ( this . _frames [ c ] . clone ( ) ) ; for ( var c = 0 ; c < this . _frameNames . length ; c ++ ) a . _frameNames . push ( this . _frameNames [ c ] ) ; return a } , getFrameRange : function ( a , b , c ) { "undefined" == typeof c && ( c = [ ] ) ; for ( var d = a ; b >= d ; d ++ ) c . push ( this . _frames [ d ] ) ; return c } , getFrames : function ( a , b , c ) { if ( "undefined" == typeof b && ( b = ! 0 ) , "undefined" == typeof c && ( c = [ ] ) , "undefined" == typeof a || 0 === a . length ) for ( var d = 0 ; d < this . _frames . length ; d ++ ) c . push ( this . _frames [ d ] ) ; else for ( var d = 0 , e = a . length ; e > d ; d ++ ) c . push ( b ? this . getFrame ( a [ d ] ) : this . getFrameByName ( a [ d ] ) ) ; return c } , getFrameIndexes : function ( a , b , c ) { if ( "undefined" == typeof b && ( b = ! 0 ) , "undefined" == typeof c && ( c = [ ] ) , "undefined" == typeof a || 0 === a . length ) for ( var d = 0 , e = this . _frames . length ; e > d ; d ++ ) c . push ( this . _frames [ d ] . index ) ; else for ( var d = 0 , e = a . length ; e > d ; d ++ ) b ? c . push ( a [ d ] ) : this . getFrameByName ( a [ d ] ) && c . push ( this . getFrameByName ( a [ d ] ) . index ) ; return c } } , b . FrameData . prototype . constructor = b . FrameData , Object . defineProperty ( b . FrameData . prototype , "total" , { get : function ( ) { return this . _frames . length } } ) , b . AnimationParser = { spriteSheet : function ( a , c , d , e , f , g , h ) { var i = a . cache . getImage ( c ) ; if ( null == i ) return null ; var j = i . width , k = i . height ; 0 >= d && ( d = Math . floor ( - j / Math . min ( - 1 , d ) ) ) , 0 >= e && ( e = Math . floor ( - k / Math . min ( - 1 , e ) ) ) ; var l = Math . floor ( ( j - g ) / ( d + h ) ) , m = Math . floor ( ( k - g ) / ( e + h ) ) , n = l * m ; if ( - 1 !== f && ( n = f ) , 0 === j || 0 === k || d > j || e > k || 0 === n ) return console . warn ( "Phaser.AnimationParser.spriteSheet: '" + c + "'s width/height zero or width/height < given frameWidth/frameHeight" ) , null ; for ( var o = new b . FrameData , p = g , q = g , r = 0 ; n > r ; r ++ ) { var s = a . rnd . uuid ( ) ; o . addFrame ( new b . Frame ( r , p , q , d , e , "" , s ) ) , PIXI . TextureCache [ s ] = new PIXI . Texture ( PIXI . BaseTextureCache [ c ] , { x : p , y : q , width : d , height : e } ) , p += d + h , p + d > j && ( p = g , q += e + h ) } return o } , JSONData : function ( a , c , d ) { if ( ! c . frames ) return console . warn ( "Phaser.AnimationParser.JSONData: Invalid Texture Atlas JSON given, missing 'frames' array" ) , void console . log ( c ) ; for ( var e , f = new b . FrameData , g = c . frames , h = 0 ; h < g . length ; h ++ ) { var i = a . rnd . uuid ( ) ; e = f . addFrame ( new b . Frame ( h , g [ h ] . frame . x , g [ h ] . frame . y , g [ h ] . frame . w , g [ h ] . frame . h , g [ h ] . filename , i ) ) , PIXI . TextureCache [ i ] = new PIXI . Texture ( PIXI . BaseTextureCache [ d ] , { x : g [ h ] . frame . x , y : g [ h ] . frame . y , width : g [ h ] . frame . w , height : g [ h ] . frame . h } ) , g [ h ] . trimmed && e . setTrim ( g [ h ] . trimmed , g [ h ] . sourceSize . w , g [ h ] . sourceSize . h , g [ h ] . spriteSourceSize . x , g [ h ] . spriteSourceSize . y , g [ h ] . spriteSourceSize . w , g [ h ] . spriteSourceSize . h ) } return f } , JSONDataHash : function ( a , c , d ) { if ( ! c . frames ) return console . warn ( "Phaser.AnimationParser.JSONDataHash: Invalid Texture Atlas JSON given, missing 'frames' object" ) , void console . log ( c ) ; var e , f = new b . FrameData , g = c . frames , h = 0 ; for ( var i in g ) { var j = a . rnd . uuid ( ) ; e = f . addFrame ( new b . Frame ( h , g [ i ] . frame . x , g [ i ] . frame . y , g [ i ] . frame . w , g [ i ] . frame . h , i , j ) ) , PIXI . TextureCache [ j ] = new PIXI . Texture ( PIXI . BaseTextureCache [ d ] , { x : g [ i ] . frame . x , y : g [ i ] . frame . y , width : g [ i ] . frame . w , height : g [ i ] . frame . h } ) , g [ i ] . trimmed && e . setTrim ( g [ i ] . trimmed , g [ i ] . sourceSize . w , g [ i ] . sourceSize . h , g [ i ] . spriteSourceSize . x , g [ i ] . spriteSourceSize . y , g [ i ] . spriteSourceSize . w , g [ i ] . spriteSourceSize . h ) , h ++ } return f } , XMLData : function ( a , c , d ) { if ( ! c . getElementsByTagName ( "TextureAtlas" ) ) return void console . warn ( "Phaser.AnimationParser.XMLData: Invalid Texture Atlas XML given, missing <TextureAtlas> tag" ) ; for ( var e , f , g , h , i , j , k , l , m , n , o , p , q = new b . FrameData , r = c . getElementsByTagName ( "SubTexture" ) , s = 0 ; s < r . length ; s ++ ) f = a . rnd . uuid ( ) , h = r [ s ] . attributes , g = h . name . nodeValue , i = parseInt ( h . x . nodeValue , 10 ) , j = parseInt ( h . y . nodeValue , 10 ) , k = parseInt ( h . width . nodeValue , 10 ) , l = parseInt ( h . height . nodeValue , 10 ) , m = null , n = null , h . frameX && ( m = Math . abs ( parseInt ( h . frameX . nodeValue , 10 ) ) , n = Math . abs ( parseInt ( h . frameY . nodeValue , 10 ) ) , o = parseInt ( h . frameWidth . nodeValue , 10 ) , p = parseInt ( h . frameHeight . nodeValue , 10 ) ) , e = q . addFrame ( new b . Frame ( s , i , j , k , l , g , f ) ) , PIXI . TextureCache [ f ] = new PIXI . Texture ( PIXI . BaseTextureCache [ d ] , { x : i , y : j , width : k , height : l } ) , ( null !== m || null !== n ) && e . set
f . chars [ k ] = { xOffset : parseInt ( i [ j ] . getAttribute ( "xoffset" ) , 10 ) , yOffset : parseInt ( i [ j ] . getAttribute ( "yoffset" ) , 10 ) , xAdvance : parseInt ( i [ j ] . getAttribute ( "xadvance" ) , 10 ) + d , kerning : { } , texture : PIXI . TextureCache [ c ] = new PIXI . Texture ( PIXI . BaseTextureCache [ c ] , l ) } } var m = b . getElementsByTagName ( "kerning" ) ; for ( j = 0 ; j < m . length ; j ++ ) { var n = parseInt ( m [ j ] . getAttribute ( "first" ) , 10 ) , o = parseInt ( m [ j ] . getAttribute ( "second" ) , 10 ) , p = parseInt ( m [ j ] . getAttribute ( "amount" ) , 10 ) ; f . chars [ o ] . kerning [ n ] = p } PIXI . BitmapText . fonts [ c ] = f } } , b . Sound = function ( a , c , d , e , f ) { "undefined" == typeof d && ( d = 1 ) , "undefined" == typeof e && ( e = ! 1 ) , "undefined" == typeof f && ( f = a . sound . connectToMaster ) , this . game = a , this . name = c , this . key = c , this . loop = e , this . volume = d , this . markers = { } , this . context = null , this . autoplay = ! 1 , this . totalDuration = 0 , this . startTime = 0 , this . currentTime = 0 , this . duration = 0 , this . durationMS = 0 , this . position = 0 , this . stopTime = 0 , this . paused = ! 1 , this . pausedPosition = 0 , this . pausedTime = 0 , this . isPlaying = ! 1 , this . currentMarker = "" , this . pendingPlayback = ! 1 , this . override = ! 1 , this . usingWebAudio = this . game . sound . usingWebAudio , this . usingAudioTag = this . game . sound . usingAudioTag , this . externalNode = null , this . masterGainNode = null , this . gainNode = null , this . usingWebAudio ? ( this . context = this . game . sound . context , this . masterGainNode = this . game . sound . masterGain , this . gainNode = "undefined" == typeof this . context . createGain ? this . context . createGainNode ( ) : this . context . createGain ( ) , this . gainNode . gain . value = d * this . game . sound . volume , f && this . gainNode . connect ( this . masterGainNode ) ) : this . game . cache . getSound ( c ) && this . game . cache . isSoundReady ( c ) ? ( this . _sound = this . game . cache . getSoundData ( c ) , this . totalDuration = 0 , this . _sound . duration && ( this . totalDuration = this . _sound . duration ) ) : this . game . cache . onSoundUnlock . add ( this . soundHasUnlocked , this ) , this . onDecoded = new b . Signal , this . onPlay = new b . Signal , this . onPause = new b . Signal , this . onResume = new b . Signal , this . onLoop = new b . Signal , this . onStop = new b . Signal , this . onMute = new b . Signal , this . onMarkerComplete = new b . Signal , this . _volume = d , this . _buffer = null , this . _muted = ! 1 , this . _tempMarker = 0 , this . _tempPosition = 0 , this . _tempVolume = 0 , this . _muteVolume = 0 , this . _tempLoop = 0 , this . _paused = ! 1 , this . _onDecodedEventDispatched = ! 1 } , b . Sound . prototype = { soundHasUnlocked : function ( a ) { a === this . key && ( this . _sound = this . game . cache . getSoundData ( this . key ) , this . totalDuration = this . _sound . duration ) } , addMarker : function ( a , b , c , d , e ) { "undefined" == typeof d && ( d = 1 ) , "undefined" == typeof e && ( e = ! 1 ) , this . markers [ a ] = { name : a , start : b , stop : b + c , volume : d , duration : c , durationMS : 1e3 * c , loop : e } } , removeMarker : function ( a ) { delete this . markers [ a ] } , update : function ( ) { this . isDecoded && ! this . _onDecodedEventDispatched && ( this . onDecoded . dispatch ( this ) , this . _onDecodedEventDispatched = ! 0 ) , this . pendingPlayback && this . game . cache . isSoundReady ( this . key ) && ( this . pendingPlayback = ! 1 , this . play ( this . _tempMarker , this . _tempPosition , this . _tempVolume , this . _tempLoop ) ) , this . isPlaying && ( this . currentTime = this . game . time . now - this . startTime , this . currentTime >= this . durationMS && ( this . usingWebAudio ? this . loop ? ( this . onLoop . dispatch ( this ) , "" === this . currentMarker ? ( this . currentTime = 0 , this . startTime = this . game . time . now ) : ( this . onMarkerComplete . dispatch ( this . currentMarker , this ) , this . play ( this . currentMarker , 0 , this . volume , ! 0 , ! 0 ) ) ) : this . stop ( ) : this . loop ? ( this . onLoop . dispatch ( this ) , this . play ( this . currentMarker , 0 , this . volume , ! 0 , ! 0 ) ) : this . stop ( ) ) ) } , play : function ( a , b , c , d , e ) { if ( "undefined" == typeof a && ( a = "" ) , "undefined" == typeof e && ( e = ! 0 ) , this . isPlaying && ! e && ! this . override ) return this ; if ( this . isPlaying && ( this . override || e ) && ( this . usingWebAudio ? "undefined" == typeof this . _sound . stop ? this . _sound . noteOff ( 0 ) : this . _sound . stop ( 0 ) : this . usingAudioTag && ( this . _sound . pause ( ) , this . _sound . currentTime = 0 ) ) , this . currentMarker = a , "" !== a ) { if ( ! this . markers [ a ] ) return console . warn ( "Phaser.Sound.play: audio marker " + a + " doesn't exist" ) , this ; this . position = this . markers [ a ] . start , this . volume = this . markers [ a ] . volume , this . loop = this . markers [ a ] . loop , this . duration = this . markers [ a ] . duration , this . durationMS = this . markers [ a ] . durationMS , "undefined" != typeof c && ( this . volume = c ) , "undefined" != typeof d && ( this . loop = d ) , this . _tempMarker = a , this . _tempPosition = this . position , this . _tempV
else if ( Array . isArray ( a ) && ! Array . isArray ( b ) ) for ( var f = 0 , g = a . length ; g > f ; f ++ ) this . collideHandler ( a [ f ] , b , c , d , e , ! 0 ) ; else if ( Array . isArray ( a ) && Array . isArray ( b ) ) for ( var f = 0 , g = a . length ; g > f ; f ++ ) for ( var h = 0 , i = b . length ; i > h ; h ++ ) this . collideHandler ( a [ f ] , b [ h ] , 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 ( a ) && Array . isArray ( b ) ) for ( var f = 0 , g = b . length ; g > f ; f ++ ) this . collideHandler ( a , b [ f ] , c , d , e , ! 1 ) ; else if ( Array . isArray ( a ) && ! Array . isArray ( b ) ) for ( var f = 0 , g = a . length ; g > f ; f ++ ) this . collideHandler ( a [ f ] , b , c , d , e , ! 1 ) ; else if ( Array . isArray ( a ) && Array . isArray ( b ) ) for ( var f = 0 , h = a . length ; h > f ; f ++ ) for ( var i = 0 , j = b . length ; j > i ; i ++ ) this . collideHandler ( a [ f ] , b [ i ] , c , d , e , ! 1 ) ; else this . collideHandler ( a , b , c , d , e , ! 1 ) ; return this . _total > 0 } , collideHandler : function ( a , c , d , e , f , g ) { return "undefined" != typeof c || a . type !== b . GROUP && a . type !== b . EMITTER ? void ( a && c && a . exists && c . exists && ( a . type == b . SPRITE || a . type == b . TILESPRITE ? c . type == b . SPRITE || c . type == b . TILESPRITE ? this . collideSpriteVsSprite ( a , c , d , e , f , g ) : c . type == b . GROUP || c . type == b . EMITTER ? this . collideSpriteVsGroup ( a , c , d , e , f , g ) : c . type == b . TILEMAPLAYER && this . collideSpriteVsTilemapLayer ( a , c , d , e , f ) : a . type == b . GROUP ? c . type == b . SPRITE || c . type == b . TILESPRITE ? this . collideSpriteVsGroup ( c , a , d , e , f , g ) : c . type == b . GROUP || c . type == b . EMITTER ? this . collideGroupVsGroup ( a , c , d , e , f , g ) : c . type == b . TILEMAPLAYER && this . collideGroupVsTilemapLayer ( a , c , d , e , f ) : a . type == b . TILEMAPLAYER ? c . type == b . SPRITE || c . type == b . TILESPRITE ? this . collideSpriteVsTilemapLayer ( c , a , d , e , f ) : ( c . type == b . GROUP || c . type == b . EMITTER ) && this . collideGroupVsTilemapLayer ( c , a , d , e , f ) : a . type == b . EMITTER && ( c . type == b . SPRITE || c . type == b . TILESPRITE ? this . collideSpriteVsGroup ( c , a , d , e , f , g ) : c . type == b . GROUP || c . type == b . EMITTER ? this . collideGroupVsGroup ( a , c , d , e , f , g ) : c . type == b . TILEMAPLAYER && this . collideGroupVsTilemapLayer ( a , c , d , e , f ) ) ) ) : void this . collideGroupVsSelf ( a , d , e , f , g ) } , collideSpriteVsSprite : function ( a , b , c , d , e , f ) { return a . body && b . body ? ( this . separate ( a . body , b . body , d , e , f ) && ( c && c . call ( e , a , b ) , this . _total ++ ) , ! 0 ) : ! 1 } , collideSpriteVsGroup : function ( a , b , c , d , e , f ) { if ( 0 !== b . length && a . body ) if ( a . body . skipQuadTree || this . skipQuadTree ) for ( var g = 0 , h = b . children . length ; h > g ; g ++ ) b . children [ g ] && b . children [ g ] . exists && this . collideSpriteVsSprite ( a , b . children [ g ] , c , d , e , f ) ; else { this . quadTree . clear ( ) , this . quadTree . reset ( this . game . world . bounds . x , this . game . world . bounds . y , this . game . world . bounds . width , this . game . world . bounds . height , this . maxObjects , this . maxLevels ) , this . quadTree . populate ( b ) , this . _potentials = this . quadTree . retrieve ( a ) ; for ( var g = 0 , h = this . _potentials . length ; h > g ; g ++ ) this . separate ( a . body , this . _potentials [ g ] , d , e , f ) && ( c && c . call ( e , a , this . _potentials [ g ] . sprite ) , this . _total ++ ) } } , collideGroupVsSelf : function ( a , b , c , d , e ) { if ( 0 !== a . length ) for ( var f = a . children . length , g = 0 ; f > g ; g ++ ) for ( var h = g + 1 ; f >= h ; h ++ ) a . children [ g ] && a . children [ h ] && a . children [ g ] . exists && a . children [ h ] . exists && this . collideSpriteVsSprite ( a . children [ g ] , a . children [ h ] , b , c , d , e ) } , collideGroupVsGroup : function ( a , c , d , e , f , g ) { if ( 0 !== a . length && 0 !== c . length ) for ( var h = 0 , i = a . children . length ; i > h ; h ++ ) a . children [ h ] . exists && ( a . children [ h ] . type === b . GROUP ? this . collideGroupVsGroup ( a . children [ h ] , c , d , e , f , g ) : this . collideSpriteVsGroup ( a . children [ h ] , c , d , e , f , g ) ) } , collideSpriteVsTilemapLayer : function ( a , b , c , d , e ) { if ( a . body && ( this . _mapData = b . getTiles ( a . body . position . x - a . body . tilePadding . x , a . body . position . y - a . body . tilePadding . y , a . body . width + a . body . tilePadding . x , a . body . height + a . body . tilePadding . y , ! 1 , ! 1 ) , 0 !== this . _mapData . length ) ) for ( var f = 0 ; f < this . _mapData . length ; f ++ ) d ? d . call ( e , a , this . _mapData [ f ] ) && this . separateTile ( f , a . body , this . _mapData [ f ] ) && ( this . _total ++ , c && c . call ( e , a , this . _mapData [ f ] ) ) : this . separateTile ( f , a . body , this . _mapData [ f ] ) && ( this . _total ++ , c && c . call ( e , a , this . _mapData [ f ] ) ) } , collideGroupVsTilemapLayer : function ( a , b , c , d , e ) { if ( 0 !== a . length ) for ( var f = 0 , g = a . children . length ; g > f ; f ++ ) a . children [ f ] . exists && this . collideSpriteVsTilemapLayer ( a . children [ f ] , b , c , d , e ) } , separate : function ( a , b , c , d , e ) { return a . enable && b . enable && this . intersects ( a , b ) ? c && c . call ( d , a . sprite , b . sprite ) === ! 1 ? ! 1 : ( this . _result = this . forceX || M
} , b . Tilemap . CSV = 0 , b . Tilemap . TILED _JSON = 1 , b . Tilemap . NORTH = 0 , b . Tilemap . EAST = 1 , b . Tilemap . SOUTH = 2 , b . Tilemap . WEST = 3 , b . Tilemap . prototype = { create : function ( a , b , c , d , e , f ) { return "undefined" == typeof f && ( f = this . game . world ) , this . width = b , this . height = c , this . setTileSize ( d , e ) , this . layers . length = 0 , this . createBlankLayer ( a , b , c , d , e , f ) } , setTileSize : function ( a , b ) { this . tileWidth = a , this . tileHeight = b , this . widthInPixels = this . width * a , this . heightInPixels = this . height * b } , addTilesetImage : function ( a , c , d , e , f , g , h ) { if ( "undefined" == typeof d && ( d = this . tileWidth ) , "undefined" == typeof e && ( e = this . tileHeight ) , "undefined" == typeof f && ( f = 0 ) , "undefined" == typeof g && ( g = 0 ) , "undefined" == typeof h && ( h = 0 ) , 0 === d && ( d = 32 ) , 0 === e && ( e = 32 ) , "undefined" == typeof c ) { if ( "string" != typeof a ) return null ; if ( c = a , ! this . game . cache . checkImageKey ( c ) ) return console . warn ( 'Phaser.Tilemap.addTilesetImage: Invalid image key given: "' + c + '"' ) , null } if ( "string" == typeof a && ( a = this . getTilesetIndex ( a ) , null === a && this . format === b . Tilemap . TILED _JSON ) ) return console . warn ( 'Phaser.Tilemap.addTilesetImage: No data found in the JSON matching the tileset name: "' + c + '"' ) , null ; if ( this . tilesets [ a ] ) return this . tilesets [ a ] . setImage ( this . game . cache . getImage ( c ) ) , this . tilesets [ a ] ; var i = new b . Tileset ( c , h , d , e , f , g , { } ) ; i . setImage ( this . game . cache . getImage ( c ) ) , this . tilesets . push ( i ) ; for ( var j = this . tilesets . length - 1 , k = f , l = f , m = 0 , n = 0 , o = 0 , p = h ; p < h + i . total && ( this . tiles [ p ] = [ k , l , j ] , k += d + g , m ++ , m !== i . total ) && ( n ++ , n !== i . columns || ( k = f , l += e + g , n = 0 , o ++ , o !== i . rows ) ) ; p ++ ) ; return i } , createFromObjects : function ( a , c , d , e , f , g , h , i , j ) { if ( "undefined" == typeof f && ( f = ! 0 ) , "undefined" == typeof g && ( g = ! 1 ) , "undefined" == typeof h && ( h = this . game . world ) , "undefined" == typeof i && ( i = b . Sprite ) , "undefined" == typeof j && ( j = ! 0 ) , ! this . objects [ a ] ) return void console . warn ( "Tilemap.createFromObjects: Invalid objectgroup name given: " + a ) ; for ( var k , l = 0 , m = this . objects [ a ] . length ; m > l ; l ++ ) if ( this . objects [ a ] [ l ] . gid === c ) { k = new i ( this . game , this . objects [ a ] [ l ] . x , this . objects [ a ] [ l ] . y , d , e ) , k . name = this . objects [ a ] [ l ] . name , k . visible = this . objects [ a ] [ l ] . visible , k . autoCull = g , k . exists = f , j && ( k . y -= k . height ) , h . add ( k ) ; for ( var n in this . objects [ a ] [ l ] . properties ) h . set ( k , n , this . objects [ a ] [ l ] . properties [ n ] , ! 1 , ! 1 , 0 , ! 0 ) } } , createLayer : function ( a , c , d , e ) { "undefined" == typeof c && ( c = this . game . width ) , "undefined" == typeof d && ( d = this . game . height ) , "undefined" == typeof e && ( e = this . game . world ) ; var f = a ; return "string" == typeof a && ( f = this . getLayerIndex ( a ) ) , null === f || f > this . layers . length ? void console . warn ( "Tilemap.createLayer: Invalid layer ID given: " + f ) : e . add ( new b . TilemapLayer ( this . game , this , f , c , d ) ) } , createBlankLayer : function ( a , c , d , e , f , g ) { if ( "undefined" == typeof g && ( g = this . game . world ) , null !== this . getLayerIndex ( a ) ) return void console . warn ( "Tilemap.createBlankLayer: Layer with matching name already exists" ) ; for ( var h , i = { name : a , x : 0 , y : 0 , width : c , height : d , widthInPixels : c * e , heightInPixels : d * f , alpha : 1 , visible : ! 0 , properties : { } , indexes : [ ] , callbacks : [ ] , bodies : [ ] , data : null } , j = [ ] , k = 0 ; d > k ; k ++ ) { h = [ ] ; for ( var l = 0 ; c > l ; l ++ ) h . push ( new b . Tile ( i , - 1 , l , k , e , f ) ) ; j . push ( h ) } i . data = j , this . layers . push ( i ) , this . currentLayer = this . layers . length - 1 ; var m = i . widthInPixels , n = i . heightInPixels ; m > this . game . width && ( m = this . game . width ) , n > this . game . height && ( n = this . game . height ) ; var j = new b . TilemapLayer ( this . game , this , this . layers . length - 1 , m , n ) ; return j . name = a , g . add ( j ) } , getIndex : function ( a , b ) { for ( var c = 0 ; c < a . length ; c ++ ) if ( a [ c ] . name === b ) return c ; return null } , getLayerIndex : function ( a ) { return this . getIndex ( this . layers , a ) } , getTilesetIndex : function ( a ) { return this . getIndex ( this . tilesets , a ) } , getImageIndex : function ( a ) { return this . getIndex ( this . images , a ) } , getObjectIndex : function ( a ) { return this . getIndex ( this . objects , a ) } , setTileIndexCallback : function ( a , b , c , d ) { if ( d = this . getLayer ( d ) , "number" == typeof a ) this . layers [ d ] . callbacks [ a ] = { callback : b , callbackContext : c } ; else for ( var e = 0 , f = a . length ; f > e ; e ++ ) this . layers [ d ] . callbacks [ a [ e ] ] = { callback : b , callbackContext : c } } , setTileLocationCallback : function ( a , b , c , d , e , f , g ) { if ( g = this . getLayer ( g ) , this . copy ( a , b , c , d , g ) , ! ( this . _results . length < 2 ) ) for ( var h = 1 ; h < this . _results . length ; h ++ ) this . _results [ h ] . setCollisionCallback ( e , f ) } , setCollision : function ( a , b , c , d ) { if ( " undef
var e = a . length ; if ( ! ( b >= e ) ) { if ( b + 1 === e ) { var f = new Ab ( new Bb ( 2 ) ) ; return f . setUint8 ( 0 , a [ e - 1 ] ) , f . getUint16 ( 0 , c ) } return a . _dataview . getUint16 ( b , c ) } } function v ( a , b ) { return u ( this , a , ! 0 , b ) } function w ( a , b ) { return u ( this , a , ! 1 , b ) } function x ( a , b , c , d ) { d || ( yb ( "boolean" == typeof c , "missing or invalid endian" ) , yb ( void 0 !== b && null !== b , "missing offset" ) , yb ( b + 3 < a . length , "Trying to read beyond buffer length" ) ) ; var e = a . length ; if ( ! ( b >= e ) ) { if ( b + 3 >= e ) { for ( var f = new Ab ( new Bb ( 4 ) ) , g = 0 ; e > g + b ; g ++ ) f . setUint8 ( g , a [ g + b ] ) ; return f . getUint32 ( 0 , c ) } return a . _dataview . getUint32 ( b , c ) } } function y ( a , b ) { return x ( this , a , ! 0 , b ) } function z ( a , b ) { return x ( this , a , ! 1 , b ) } function A ( a , b ) { var c = this ; return b || ( yb ( void 0 !== a && null !== a , "missing offset" ) , yb ( a < c . length , "Trying to read beyond buffer length" ) ) , a >= c . length ? void 0 : c . _dataview . getInt8 ( a ) } function B ( a , b , c , d ) { d || ( yb ( "boolean" == typeof c , "missing or invalid endian" ) , yb ( void 0 !== b && null !== b , "missing offset" ) , yb ( b + 1 < a . length , "Trying to read beyond buffer length" ) ) ; var e = a . length ; if ( ! ( b >= e ) ) { if ( b + 1 === e ) { var f = new Ab ( new Bb ( 2 ) ) ; return f . setUint8 ( 0 , a [ e - 1 ] ) , f . getInt16 ( 0 , c ) } return a . _dataview . getInt16 ( b , c ) } } function C ( a , b ) { return B ( this , a , ! 0 , b ) } function D ( a , b ) { return B ( this , a , ! 1 , b ) } function E ( a , b , c , d ) { d || ( yb ( "boolean" == typeof c , "missing or invalid endian" ) , yb ( void 0 !== b && null !== b , "missing offset" ) , yb ( b + 3 < a . length , "Trying to read beyond buffer length" ) ) ; var e = a . length ; if ( ! ( b >= e ) ) { if ( b + 3 >= e ) { for ( var f = new Ab ( new Bb ( 4 ) ) , g = 0 ; e > g + b ; g ++ ) f . setUint8 ( g , a [ g + b ] ) ; return f . getInt32 ( 0 , c ) } return a . _dataview . getInt32 ( b , c ) } } function F ( a , b ) { return E ( this , a , ! 0 , b ) } function G ( a , b ) { return E ( this , a , ! 1 , b ) } function H ( a , b , c , d ) { return d || ( yb ( "boolean" == typeof c , "missing or invalid endian" ) , yb ( b + 3 < a . length , "Trying to read beyond buffer length" ) ) , a . _dataview . getFloat32 ( b , c ) } function I ( a , b ) { return H ( this , a , ! 0 , b ) } function J ( a , b ) { return H ( this , a , ! 1 , b ) } function K ( a , b , c , d ) { return d || ( yb ( "boolean" == typeof c , "missing or invalid endian" ) , yb ( b + 7 < a . length , "Trying to read beyond buffer length" ) ) , a . _dataview . getFloat64 ( b , c ) } function L ( a , b ) { return K ( this , a , ! 0 , b ) } function M ( a , b ) { return K ( this , a , ! 1 , b ) } function N ( a , b , c ) { var d = this ; c || ( yb ( void 0 !== a && null !== a , "missing value" ) , yb ( void 0 !== b && null !== b , "missing offset" ) , yb ( b < d . length , "trying to write beyond buffer length" ) , vb ( a , 255 ) ) , b >= d . length || ( d [ b ] = a ) } function O ( a , b , c , d , e ) { e || ( yb ( void 0 !== b && null !== b , "missing value" ) , yb ( "boolean" == typeof d , "missing or invalid endian" ) , yb ( void 0 !== c && null !== c , "missing offset" ) , yb ( c + 1 < a . length , "trying to write beyond buffer length" ) , vb ( b , 65535 ) ) ; var f = a . length ; if ( ! ( c >= f ) ) if ( c + 1 === f ) { var g = new Ab ( new Bb ( 2 ) ) ; g . setUint16 ( 0 , b , d ) , a [ c ] = g . getUint8 ( 0 ) } else a . _dataview . setUint16 ( c , b , d ) } function P ( a , b , c ) { O ( this , a , b , ! 0 , c ) } function Q ( a , b , c ) { O ( this , a , b , ! 1 , c ) } function R ( a , b , c , d , e ) { e || ( yb ( void 0 !== b && null !== b , "missing value" ) , yb ( "boolean" == typeof d , "missing or invalid endian" ) , yb ( void 0 !== c && null !== c , "missing offset" ) , yb ( c + 3 < a . length , "trying to write beyond buffer length" ) , vb ( b , 4294967295 ) ) ; var f = a . length ; if ( ! ( c >= f ) ) if ( c + 3 >= f ) { var g = new Ab ( new Bb ( 4 ) ) ; g . setUint32 ( 0 , b , d ) ; for ( var h = 0 ; f > h + c ; h ++ ) a [ h + c ] = g . getUint8 ( h ) } else a . _dataview . setUint32 ( c , b , d ) } function S ( a , b , c ) { R ( this , a , b , ! 0 , c ) } function T ( a , b , c ) { R ( this , a , b , ! 1 , c ) } function U ( a , b , c ) { var d = this ; c || ( yb ( void 0 !== a && null !== a , "missing value" ) , yb ( void 0 !== b && null !== b , "missing offset" ) , yb ( b < d . length , "Trying to write beyond buffer length" ) , wb ( a , 127 , - 128 ) ) , b >= d . length || d . _dataview . setInt8 ( b , a ) } function V ( a , b , c , d , e ) { e || ( yb ( void 0 !== b && null !== b , "missing value" ) , yb ( "boolean" == typeof d , "missing or invalid endian" ) , yb ( void 0 !== c && null !== c , "missing offset" ) , yb ( c + 1 < a . length , "Trying to write beyond buffer length" ) , wb ( b , 32767 , - 32768 ) ) ; var f = a . length ; if ( ! ( c >= f ) ) if ( c + 1 === f ) { var g = new Ab ( new Bb ( 2 ) ) ; g . setInt16 ( 0 , b , d ) , a [ c ] = g . getUint8 ( 0 ) } else a . _dataview . setInt16 ( c , b , d ) } function W ( a , b , c ) { V ( this , a , b , ! 0 , c ) } function X ( a , b , c ) { V ( this , a , b , ! 1 , c ) } function Y ( a , b , c , d , e ) { e || ( yb ( void 0 !== b && null !== b , "missing value" ) , yb ( "boolean" == typeof d , "missing or invalid endian" ) , yb ( void 0 !== c && null !== c , "missing offset" ) , yb ( c + 3 < a . length , "Trying to write beyond buffer length" ) , wb ( b , 2147483647 , - 214748364
} var d = ( a ( "__browserify_process" ) , a ( "__browserify_Buffer" ) , a ( "../math/vec2" ) ) , e = a ( "../objects/Body" ) ; b . exports = c , c . AABB = 1 , c . BOUNDING _CIRCLE = 2 , c . prototype . setWorld = function ( a ) { this . world = a } , c . prototype . getCollisionPairs = function ( ) { throw new Error ( "getCollisionPairs must be implemented in a subclass!" ) } ; var f = d . create ( ) ; c . boundingRadiusCheck = function ( a , b ) { d . sub ( f , a . position , b . position ) ; var c = d . squaredLength ( f ) , e = a . boundingRadius + b . boundingRadius ; return e * e >= c } , c . aabbCheck = function ( a , b ) { return a . getAABB ( ) . overlaps ( b . getAABB ( ) ) } , c . prototype . boundingVolumeCheck = function ( a , b ) { var d ; switch ( this . boundingVolumeType ) { case c . BOUNDING _CIRCLE : d = c . boundingRadiusCheck ( a , b ) ; break ; case c . AABB : d = c . aabbCheck ( a , b ) ; break ; default : throw new Error ( "Bounding volume type not recognized: " + this . boundingVolumeType ) } return d } , c . canCollide = function ( a , b ) { return a . type === e . STATIC && b . type === e . STATIC ? ! 1 : a . type === e . KINEMATIC && b . type === e . STATIC || a . type === e . STATIC && b . type === e . KINEMATIC ? ! 1 : a . type === e . KINEMATIC && b . type === e . KINEMATIC ? ! 1 : a . sleepState === e . SLEEPING && b . sleepState === e . SLEEPING ? ! 1 : a . sleepState === e . SLEEPING && b . type === e . STATIC || b . sleepState === e . SLEEPING && a . type === e . STATIC ? ! 1 : ! 0 } , c . NAIVE = 1 , c . SAP = 2 } , { "../math/vec2" : 31 , "../objects/Body" : 32 , _ _browserify _Buffer : 1 , _ _browserify _process : 2 } ] , 11 : [ function ( a , b ) { function c ( a ) { d . apply ( this ) , a = e . defaults ( a , { xmin : - 100 , xmax : 100 , ymin : - 100 , ymax : 100 , nx : 10 , ny : 10 } ) , this . xmin = a . xmin , this . ymin = a . ymin , this . xmax = a . xmax , this . ymax = a . ymax , this . nx = a . nx , this . ny = a . ny , this . binsizeX = ( this . xmax - this . xmin ) / this . nx , this . binsizeY = ( this . ymax - this . ymin ) / this . ny } var d = ( a ( "__browserify_process" ) , a ( "__browserify_Buffer" ) , a ( "../shapes/Circle" ) , a ( "../shapes/Plane" ) , a ( "../shapes/Particle" ) , a ( "../collision/Broadphase" ) ) , e = ( a ( "../math/vec2" ) , a ( "../utils/Utils" ) ) ; b . exports = c , c . prototype = new d , c . prototype . getCollisionPairs = function ( a ) { for ( var b = [ ] , c = a . bodies , e = c . length , f = ( this . binsizeX , this . binsizeY , this . nx ) , g = this . ny , h = this . xmin , i = this . ymin , j = this . xmax , k = this . ymax , l = [ ] , m = f * g , n = 0 ; m > n ; n ++ ) l . push ( [ ] ) ; for ( var o = f / ( j - h ) , p = g / ( k - i ) , n = 0 ; n !== e ; n ++ ) for ( var q = c [ n ] , r = q . aabb , s = Math . max ( r . lowerBound [ 0 ] , h ) , t = Math . max ( r . lowerBound [ 1 ] , i ) , u = Math . min ( r . upperBound [ 0 ] , j ) , v = Math . min ( r . upperBound [ 1 ] , k ) , w = Math . floor ( o * ( s - h ) ) , x = Math . floor ( p * ( t - i ) ) , y = Math . floor ( o * ( u - h ) ) , z = Math . floor ( p * ( v - i ) ) , A = w ; y >= A ; A ++ ) for ( var B = x ; z >= B ; B ++ ) { var C = A , D = B , E = C * ( g - 1 ) + D ; E >= 0 && m > E && l [ E ] . push ( q ) } for ( var n = 0 ; n !== m ; n ++ ) for ( var F = l [ n ] , A = 0 , G = F . length ; A !== G ; A ++ ) for ( var q = F [ A ] , B = 0 ; B !== A ; B ++ ) { var H = F [ B ] ; d . canCollide ( q , H ) && this . boundingVolumeCheck ( q , H ) && b . push ( q , H ) } return b } } , { "../collision/Broadphase" : 10 , "../math/vec2" : 31 , "../shapes/Circle" : 38 , "../shapes/Particle" : 42 , "../shapes/Plane" : 43 , "../utils/Utils" : 50 , _ _browserify _Buffer : 1 , _ _browserify _process : 2 } ] , 12 : [ function ( a , b ) { function c ( ) { d . call ( this , d . NAIVE ) } { var d = ( a ( "__browserify_process" ) , a ( "__browserify_Buffer" ) , a ( "../shapes/Circle" ) , a ( "../shapes/Plane" ) , a ( "../shapes/Shape" ) , a ( "../shapes/Particle" ) , a ( "../collision/Broadphase" ) ) ; a ( "../math/vec2" ) } b . exports = c , c . prototype = new d , c . prototype . getCollisionPairs = function ( a ) { var b = a . bodies , c = this . result ; c . length = 0 ; for ( var e = 0 , f = b . length ; e !== f ; e ++ ) for ( var g = b [ e ] , h = 0 ; e > h ; h ++ ) { var i = b [ h ] ; d . canCollide ( g , i ) && this . boundingVolumeCheck ( g , i ) && c . push ( g , i ) } return c } } , { "../collision/Broadphase" : 10 , "../math/vec2" : 31 , "../shapes/Circle" : 38 , "../shapes/Particle" : 42 , "../shapes/Plane" : 43 , "../shapes/Shape" : 45 , _ _browserify _Buffer : 1 , _ _browserify _process : 2 } ] , 13 : [ function ( a , b ) { function c ( ) { this . contactEquations = [ ] , this . frictionEquations = [ ] , this . enableFriction = ! 0 , this . slipForce = 10 , this . frictionCoefficient = . 3 , this . surfaceVelocity = 0 , this . reuseObjects = ! 0 , this . reusableContactEquations = [ ] , this . reusableFrictionEquations = [ ] , this . restitution = 0 , this . stiffness = l . DEFAULT _STIFFNESS , this . relaxation = l . DEFAULT _RELAXATION , this . frictionStiffness = l . DEFAULT _STIFFNESS , this . frictionRelaxation = l . DEFAULT _RELAXATION , this . enableFrictionReduction = ! 0 , this . collidingBodiesLastStep = new k , this . contactSkinSize = . 01 } function d ( a , b ) { f . set ( a . vertices [ 0 ] , . 5 * - b . length , - b . radius ) , f . set ( a . vertices [ 1 ] , . 5 * b . length , - b . radius ) , f . set ( a . vertices [ 2 ] , . 5 * b . length , b . radius ) , f . set ( a . ve
e . rotate ( g , this . localOffsetB , d . angle ) , e . rotate ( h , this . localOffsetB , f . angle - this . localAngleB ) , e . scale ( h , h , - 1 ) , e . rotate ( i , h , Math . PI / 2 ) , e . normalize ( i , i ) , a . G [ 0 ] = - 1 , a . G [ 1 ] = 0 , a . G [ 2 ] = - e . crossLength ( g , j ) , a . G [ 3 ] = 1 , b . G [ 0 ] = 0 , b . G [ 1 ] = - 1 , b . G [ 2 ] = - e . crossLength ( g , k ) , b . G [ 4 ] = 1 , c . G [ 0 ] = - i [ 0 ] , c . G [ 1 ] = - i [ 1 ] , c . G [ 3 ] = i [ 0 ] , c . G [ 4 ] = i [ 1 ] , c . G [ 5 ] = e . crossLength ( h , i ) } } , { "../equations/Equation" : 23 , "../math/vec2" : 31 , "./Constraint" : 15 , _ _browserify _Buffer : 1 , _ _browserify _process : 2 } ] , 19 : [ function ( a , b ) { function c ( a , b , c ) { c = c || { } , d . call ( this , a , b , d . PRISMATIC , c ) ; var i = g . fromValues ( 0 , 0 ) , j = g . fromValues ( 1 , 0 ) , k = g . fromValues ( 0 , 0 ) ; c . localAnchorA && g . copy ( i , c . localAnchorA ) , c . localAxisA && g . copy ( j , c . localAxisA ) , c . localAnchorB && g . copy ( k , c . localAnchorB ) , this . localAnchorA = i , this . localAnchorB = k , this . localAxisA = j ; var l = this . maxForce = "undefined" != typeof c . maxForce ? c . maxForce : Number . MAX _VALUE , m = new f ( a , b , - l , l ) , n = new g . create , o = new g . create , p = new g . create , q = new g . create ; if ( m . computeGq = function ( ) { return g . dot ( p , q ) } , m . updateJacobian = function ( ) { var c = this . G , d = a . position , e = b . position ; g . rotate ( n , i , a . angle ) , g . rotate ( o , k , b . angle ) , g . add ( p , e , o ) , g . sub ( p , p , d ) , g . sub ( p , p , n ) , g . rotate ( q , j , a . angle + Math . PI / 2 ) , c [ 0 ] = - q [ 0 ] , c [ 1 ] = - q [ 1 ] , c [ 2 ] = - g . crossLength ( n , q ) + g . crossLength ( q , p ) , c [ 3 ] = q [ 0 ] , c [ 4 ] = q [ 1 ] , c [ 5 ] = g . crossLength ( o , q ) } , this . equations . push ( m ) , ! c . disableRotationalLock ) { var r = new h ( a , b , - l , l ) ; this . equations . push ( r ) } this . position = 0 , this . velocity = 0 , this . lowerLimitEnabled = "undefined" != typeof c . lowerLimit ? ! 0 : ! 1 , this . upperLimitEnabled = "undefined" != typeof c . upperLimit ? ! 0 : ! 1 , this . lowerLimit = "undefined" != typeof c . lowerLimit ? c . lowerLimit : 0 , this . upperLimit = "undefined" != typeof c . upperLimit ? c . upperLimit : 1 , this . upperLimitEquation = new e ( a , b ) , this . lowerLimitEquation = new e ( a , b ) , this . upperLimitEquation . minForce = this . lowerLimitEquation . minForce = 0 , this . upperLimitEquation . maxForce = this . lowerLimitEquation . maxForce = l , this . motorEquation = new f ( a , b ) , this . motorEnabled = ! 1 , this . motorSpeed = 0 ; { var s = this , t = this . motorEquation ; t . computeGW } t . computeGq = function ( ) { return 0 } , t . computeGW = function ( ) { var a = this . G , b = this . bodyA , c = this . bodyB , d = b . velocity , e = c . velocity , f = b . angularVelocity , g = c . angularVelocity ; return this . gmult ( a , d , f , e , g ) + s . motorSpeed } } var d = ( a ( "__browserify_process" ) , a ( "__browserify_Buffer" ) , a ( "./Constraint" ) ) , e = a ( "../equations/ContactEquation" ) , f = a ( "../equations/Equation" ) , g = a ( "../math/vec2" ) , h = a ( "../equations/RotationalLockEquation" ) ; b . exports = c , c . prototype = new d ; var i = g . create ( ) , j = g . create ( ) , k = g . create ( ) , l = g . create ( ) , m = g . create ( ) , n = g . create ( ) ; c . prototype . update = function ( ) { var a = this . equations , b = a [ 0 ] , c = this . upperLimit , d = this . lowerLimit , e = this . upperLimitEquation , f = this . lowerLimitEquation , h = this . bodyA , o = this . bodyB , p = this . localAxisA , q = this . localAnchorA , r = this . localAnchorB ; b . updateJacobian ( ) , g . rotate ( i , p , h . angle ) , g . rotate ( l , q , h . angle ) , g . add ( j , l , h . position ) , g . rotate ( m , r , o . angle ) , g . add ( k , m , o . position ) ; var s = this . position = g . dot ( k , i ) - g . dot ( j , i ) ; if ( this . motorEnabled ) { var t = this . motorEquation . G ; t [ 0 ] = i [ 0 ] , t [ 1 ] = i [ 1 ] , t [ 2 ] = g . crossLength ( i , m ) , t [ 3 ] = - i [ 0 ] , t [ 4 ] = - i [ 1 ] , t [ 5 ] = - g . crossLength ( i , l ) } if ( this . upperLimitEnabled && s > c ) g . scale ( e . normalA , i , - 1 ) , g . sub ( e . contactPointA , j , h . position ) , g . sub ( e . contactPointB , k , o . position ) , g . scale ( n , i , c ) , g . add ( e . contactPointA , e . contactPointA , n ) , - 1 === a . indexOf ( e ) && a . push ( e ) ; else { var u = a . indexOf ( e ) ; - 1 !== u && a . splice ( u , 1 ) } if ( this . lowerLimitEnabled && d > s ) g . scale ( f . normalA , i , 1 ) , g . sub ( f . contactPointA , j , h . position ) , g . sub ( f . contactPointB , k , o . position ) , g . scale ( n , i , d ) , g . sub ( f . contactPointB , f . contactPointB , n ) , - 1 === a . indexOf ( f ) && a . push ( f ) ; else { var u = a . indexOf ( f ) ; - 1 !== u && a . splice ( u , 1 ) } } , c . prototype . enableMotor = function ( ) { this . motorEnabled || ( this . equations . push ( this . motorEquation ) , this . motorEnabled = ! 0 ) } , c . prototype . disableMotor = function ( ) { if ( this . motorEnabled ) { var a = this . equations . indexOf ( this . motorEquation ) ; this . equations . splice ( a , 1 ) , this . motorEnabled = ! 1 } } , c . prototype . setLimits = function ( a , b ) { "number" == typeof a ? ( this . lowerLimit = a , this . lowerLimitEnabled = ! 0 ) : ( this . lowerLimit = a , this . lowerLimitEnabled = ! 1 ) , "number" == typeof b ? ( this . upperLimit = b , this . upperLimitEnabled = ! 0 ) : ( this . upperLimit = b , this . upperLimitEnabled = ! 1 ) } } , { " . . / equations / ContactE
return a * ( d * d + c * c ) / 12 } , c . prototype . updateBoundingRadius = function ( ) { this . boundingRadius = this . radius + this . length / 2 } , c . prototype . updateArea = function ( ) { this . area = Math . PI * this . radius * this . radius + 2 * this . radius * this . length } ; var f = e . create ( ) ; c . prototype . computeAABB = function ( a , b , c ) { var d = this . radius ; e . set ( f , this . length / 2 , 0 ) , 0 !== c && e . rotate ( f , f , c ) , e . set ( a . upperBound , Math . max ( f [ 0 ] + d , - f [ 0 ] + d ) , Math . max ( f [ 1 ] + d , - f [ 1 ] + d ) ) , e . set ( a . lowerBound , Math . min ( f [ 0 ] - d , - f [ 0 ] - d ) , Math . min ( f [ 1 ] - d , - f [ 1 ] - d ) ) , e . add ( a . lowerBound , a . lowerBound , b ) , e . add ( a . upperBound , a . upperBound , b ) } } , { "../math/vec2" : 31 , "./Shape" : 45 , _ _browserify _Buffer : 1 , _ _browserify _process : 2 } ] , 38 : [ function ( a , b ) { function c ( a ) { this . radius = a || 1 , d . call ( this , d . CIRCLE ) } var d = ( a ( "__browserify_process" ) , a ( "__browserify_Buffer" ) , a ( "./Shape" ) ) , e = a ( "../math/vec2" ) ; b . exports = c , c . prototype = new d , c . prototype . computeMomentOfInertia = function ( a ) { var b = this . radius ; return a * b * b / 2 } , c . prototype . updateBoundingRadius = function ( ) { this . boundingRadius = this . radius } , c . prototype . updateArea = function ( ) { this . area = Math . PI * this . radius * this . radius } , c . prototype . computeAABB = function ( a , b ) { var c = this . radius ; e . set ( a . upperBound , c , c ) , e . set ( a . lowerBound , - c , - c ) , b && ( e . add ( a . lowerBound , a . lowerBound , b ) , e . add ( a . upperBound , a . upperBound , b ) ) } } , { "../math/vec2" : 31 , "./Shape" : 45 , _ _browserify _Buffer : 1 , _ _browserify _process : 2 } ] , 39 : [ function ( a , b ) { function c ( a , b ) { this . vertices = [ ] , this . axes = [ ] ; for ( var c = 0 ; c < a . length ; c ++ ) { var f = e . create ( ) ; e . copy ( f , a [ c ] ) , this . vertices . push ( f ) } if ( b ) for ( var c = 0 ; c < b . length ; c ++ ) { var g = e . create ( ) ; e . copy ( g , b [ c ] ) , this . axes . push ( g ) } else for ( var c = 0 ; c < a . length ; c ++ ) { var h = a [ c ] , i = a [ ( c + 1 ) % a . length ] , j = e . create ( ) ; e . sub ( j , i , h ) , e . rotate90cw ( j , j ) , e . normalize ( j , j ) , this . axes . push ( j ) } if ( this . centerOfMass = e . fromValues ( 0 , 0 ) , this . triangles = [ ] , this . vertices . length && ( this . updateTriangles ( ) , this . updateCenterOfMass ( ) ) , this . boundingRadius = 0 , d . call ( this , d . CONVEX ) , this . updateBoundingRadius ( ) , this . updateArea ( ) , this . area < 0 ) throw new Error ( "Convex vertices must be given in conter-clockwise winding." ) } { var d = ( a ( "__browserify_process" ) , a ( "__browserify_Buffer" ) , a ( "./Shape" ) ) , e = a ( "../math/vec2" ) , f = a ( "../math/polyk" ) ; a ( "poly-decomp" ) } b . exports = c , c . prototype = new d ; var g = e . create ( ) , h = e . create ( ) ; c . prototype . projectOntoLocalAxis = function ( a , b ) { for ( var c , d , f = null , h = null , a = g , i = 0 ; i < this . vertices . length ; i ++ ) c = this . vertices [ i ] , d = e . dot ( c , a ) , ( null === f || d > f ) && ( f = d ) , ( null === h || h > d ) && ( h = d ) ; if ( h > f ) { var j = h ; h = f , f = j } e . set ( b , h , f ) } , c . prototype . projectOntoWorldAxis = function ( a , b , c , d ) { var f = h ; this . projectOntoLocalAxis ( a , d ) , 0 !== c ? e . rotate ( f , a , c ) : f = a ; var g = e . dot ( b , f ) ; e . set ( d , d [ 0 ] + g , d [ 1 ] + g ) } , c . prototype . updateTriangles = function ( ) { this . triangles . length = 0 ; for ( var a = [ ] , b = 0 ; b < this . vertices . length ; b ++ ) { var c = this . vertices [ b ] ; a . push ( c [ 0 ] , c [ 1 ] ) } for ( var d = f . Triangulate ( a ) , b = 0 ; b < d . length ; b += 3 ) { var e = d [ b ] , g = d [ b + 1 ] , h = d [ b + 2 ] ; this . triangles . push ( [ e , g , h ] ) } } ; { var i = e . create ( ) , j = e . create ( ) , k = e . create ( ) , l = e . create ( ) , m = e . create ( ) ; e . create ( ) , e . create ( ) , e . create ( ) , e . create ( ) } c . prototype . updateCenterOfMass = function ( ) { var a = this . triangles , b = this . vertices , d = this . centerOfMass , f = i , g = k , h = l , n = m , o = j ; e . set ( d , 0 , 0 ) ; for ( var p = 0 , q = 0 ; q !== a . length ; q ++ ) { var r = a [ q ] , g = b [ r [ 0 ] ] , h = b [ r [ 1 ] ] , n = b [ r [ 2 ] ] ; e . centroid ( f , g , h , n ) ; var s = c . triangleArea ( g , h , n ) ; p += s , e . scale ( o , f , s ) , e . add ( d , d , o ) } e . scale ( d , d , 1 / p ) } , c . prototype . computeMomentOfInertia = function ( a ) { for ( var b = 0 , c = 0 , d = this . vertices . length , f = d - 1 , g = 0 ; d > g ; f = g , g ++ ) { var h = this . vertices [ f ] , i = this . vertices [ g ] , j = Math . abs ( e . crossLength ( h , i ) ) , k = e . dot ( i , i ) + e . dot ( i , h ) + e . dot ( h , h ) ; b += j * k , c += j } return a / 6 * ( b / c ) } , c . prototype . updateBoundingRadius = function ( ) { for ( var a = this . vertices , b = 0 , c = 0 ; c !== a . length ; c ++ ) { var d = e . squaredLength ( a [ c ] ) ; d > b && ( b = d ) } this . boundingRadius = Math . sqrt ( b ) } , c . triangleArea = function ( a , b , c ) { return . 5 * ( ( b [ 0 ] - a [ 0 ] ) * ( c [ 1 ] - a [ 1 ] ) - ( c [ 0 ] - a [ 0 ] ) * ( b [ 1 ] - a [ 1 ] ) ) } , c . prototype . updateArea = function ( ) { this . updateTriangles ( ) , this . area = 0 ; for ( var a = this . triangles , b = this . vertices , d = 0 ; d !== a . length ; d ++ ) { var e = a [ d ] , f = b [ e [ 0 ] ] , g = b [ e [ 1 ] ] , h = b [ e [ 2 ] ] , i = c . triangleArea ( f , g , h ) ; this . area += i } } , c . prototype . computeAABB = function ( a , b , c ) { a . setFromPoints ( this . vertices , b , c , 0 ) } } , { "../math/polyk" : 30 , "../math/vec2" : 31 , "./Shape"
"undefined" != typeof a . stiffness && ( e . stiffness = a . stiffness ) , "undefined" != typeof a . relaxation && ( e . relaxation = a . relaxation ) , e . needsUpdate = ! 0 } for ( var b = 0 ; b !== this . contactMaterials . length ; b ++ ) { var c = this . contactMaterials [ b ] ; "undefined" != typeof a . stiffness && ( c . stiffness = a . stiffness , c . frictionStiffness = a . stiffness ) , "undefined" != typeof a . relaxation && ( c . relaxation = a . relaxation , c . frictionRelaxation = a . relaxation ) } var c = this . defaultContactMaterial ; "undefined" != typeof a . stiffness && ( c . stiffness = a . stiffness , c . frictionStiffness = a . stiffness ) , "undefined" != typeof a . relaxation && ( c . relaxation = a . relaxation , c . frictionRelaxation = a . relaxation ) } , c . prototype . setGlobalStiffness = function ( a ) { this . setGlobalEquationParameters ( { stiffness : a } ) } , c . prototype . setGlobalRelaxation = function ( a ) { this . setGlobalEquationParameters ( { relaxation : a } ) } } , { "../../package.json" : 8 , "../collision/Broadphase" : 10 , "../collision/NaiveBroadphase" : 12 , "../collision/Narrowphase" : 13 , "../collision/SAPBroadphase" : 14 , "../constraints/Constraint" : 15 , "../constraints/DistanceConstraint" : 16 , "../constraints/GearConstraint" : 17 , "../constraints/LockConstraint" : 18 , "../constraints/PrismaticConstraint" : 19 , "../constraints/RevoluteConstraint" : 20 , "../events/EventEmitter" : 27 , "../material/ContactMaterial" : 28 , "../material/Material" : 29 , "../math/vec2" : 31 , "../objects/Body" : 32 , "../objects/LinearSpring" : 33 , "../objects/RotationalSpring" : 34 , "../shapes/Capsule" : 37 , "../shapes/Circle" : 38 , "../shapes/Convex" : 39 , "../shapes/Line" : 41 , "../shapes/Particle" : 42 , "../shapes/Plane" : 43 , "../shapes/Rectangle" : 44 , "../shapes/Shape" : 45 , "../solver/GSSolver" : 46 , "../solver/Solver" : 47 , "../utils/OverlapKeeper" : 48 , "../utils/Utils" : 50 , "./IslandManager" : 52 , _ _browserify _Buffer : 1 , _ _browserify _process : 2 } ] } , { } , [ 36 ] ) ( 36 ) } ) , p2 . Body . prototype . parent = null , p2 . Spring . prototype . parent = null , Phaser . Physics . P2 = function ( a , b ) { this . game = a , "undefined" != typeof b && b . hasOwnProperty ( "gravity" ) && b . hasOwnProperty ( "broadphase" ) || ( b = { gravity : [ 0 , 0 ] , broadphase : new p2 . SAPBroadphase } ) , this . world = new p2 . World ( b ) , this . frameRate = 1 / 60 , this . useElapsedTime = ! 1 , this . paused = ! 1 , this . materials = [ ] , this . gravity = new Phaser . Physics . P2 . InversePointProxy ( this , this . world . gravity ) , this . walls = { left : null , right : null , top : null , bottom : null } , this . onBodyAdded = new Phaser . Signal , this . onBodyRemoved = new Phaser . Signal , this . onSpringAdded = new Phaser . Signal , this . onSpringRemoved = new Phaser . Signal , this . onConstraintAdded = new Phaser . Signal , this . onConstraintRemoved = new Phaser . Signal , this . onContactMaterialAdded = new Phaser . Signal , this . onContactMaterialRemoved = new Phaser . Signal , this . postBroadphaseCallback = null , this . callbackContext = null , this . onBeginContact = new Phaser . Signal , this . onEndContact = new Phaser . Signal , b . hasOwnProperty ( "mpx" ) && b . hasOwnProperty ( "pxm" ) && b . hasOwnProperty ( "mpxi" ) && b . hasOwnProperty ( "pxmi" ) && ( this . mpx = b . mpx , this . mpxi = b . mpxi , this . pxm = b . pxm , this . pxmi = b . pxmi ) , this . world . on ( "beginContact" , this . beginContactHandler , this ) , this . world . on ( "endContact" , this . endContactHandler , this ) , this . collisionGroups = [ ] , this . nothingCollisionGroup = new Phaser . Physics . P2 . CollisionGroup ( 1 ) , this . boundsCollisionGroup = new Phaser . Physics . P2 . CollisionGroup ( 2 ) , this . everythingCollisionGroup = new Phaser . Physics . P2 . CollisionGroup ( 2147483648 ) , this . boundsCollidesWith = [ ] , this . _toRemove = [ ] , this . _collisionGroupID = 2 , this . setBoundsToWorld ( ! 0 , ! 0 , ! 0 , ! 0 , ! 1 ) } , Phaser . Physics . P2 . prototype = { removeBodyNextStep : function ( a ) { this . _toRemove . push ( a ) } , preUpdate : function ( ) { for ( var a = this . _toRemove . length ; a -- ; ) this . removeBody ( this . _toRemove [ a ] ) ; this . _toRemove . length = 0 } , enable : function ( a , b , c ) { "undefined" == typeof b && ( b = ! 1 ) , "undefined" == typeof c && ( c = ! 0 ) ; var d = 1 ; if ( Array . isArray ( a ) ) for ( d = a . length ; d -- ; ) a [ d ] instanceof Phaser . Group ? this . enable ( a [ d ] . children , b , c ) : ( this . enableBody ( a [ d ] , b ) , c && a [ d ] . hasOwnProperty ( "children" ) && a [ d ] . children . length > 0 && this . enable ( a [ d ] , b , ! 0 ) ) ; else a instanceof Phaser . Group ? this . enable ( a . children , b , c ) : ( this . enableBody ( a , b ) , c && a . hasOwnProperty ( "children" ) && a . children . length > 0 && this . enable ( a . children , b , ! 0 ) ) } , enableBody : function ( a , b ) { a . hasOwnProperty ( "body" ) && null === a . body && ( a . body = new Phaser . Physics . P2 . Body ( this . game , a , a . x , a . y , 1 ) , a . body . debu
} , set : function ( a ) { this . data . angularForce = a } } ) , Object . defineProperty ( Phaser . Physics . P2 . Body . prototype , "angularVelocity" , { get : function ( ) { return this . data . angularVelocity } , set : function ( a ) { this . data . angularVelocity = a } } ) , Object . defineProperty ( Phaser . Physics . P2 . Body . prototype , "damping" , { get : function ( ) { return this . data . damping } , set : function ( a ) { this . data . damping = a } } ) , Object . defineProperty ( Phaser . Physics . P2 . Body . prototype , "fixedRotation" , { get : function ( ) { return this . data . fixedRotation } , set : function ( a ) { a !== this . data . fixedRotation && ( this . data . fixedRotation = a ) } } ) , Object . defineProperty ( Phaser . Physics . P2 . Body . prototype , "inertia" , { get : function ( ) { return this . data . inertia } , set : function ( a ) { this . data . inertia = a } } ) , Object . defineProperty ( Phaser . Physics . P2 . Body . prototype , "mass" , { get : function ( ) { return this . data . mass } , set : function ( a ) { a !== this . data . mass && ( this . data . mass = a , this . data . updateMassProperties ( ) ) } } ) , Object . defineProperty ( Phaser . Physics . P2 . Body . prototype , "motionState" , { get : function ( ) { return this . data . type } , set : function ( a ) { a !== this . data . type && ( this . data . type = a ) } } ) , Object . defineProperty ( Phaser . Physics . P2 . Body . prototype , "rotation" , { get : function ( ) { return this . data . angle } , set : function ( a ) { this . data . angle = a } } ) , Object . defineProperty ( Phaser . Physics . P2 . Body . prototype , "sleepSpeedLimit" , { get : function ( ) { return this . data . sleepSpeedLimit } , set : function ( a ) { this . data . sleepSpeedLimit = a } } ) , Object . defineProperty ( Phaser . Physics . P2 . Body . prototype , "x" , { get : function ( ) { return this . world . mpxi ( this . data . position [ 0 ] ) } , set : function ( a ) { this . data . position [ 0 ] = this . world . pxmi ( a ) } } ) , Object . defineProperty ( Phaser . Physics . P2 . Body . prototype , "y" , { get : function ( ) { return this . world . mpxi ( this . data . position [ 1 ] ) } , set : function ( a ) { this . data . position [ 1 ] = this . world . pxmi ( a ) } } ) , Object . defineProperty ( Phaser . Physics . P2 . Body . prototype , "id" , { get : function ( ) { return this . data . id } } ) , Object . defineProperty ( Phaser . Physics . P2 . Body . prototype , "debug" , { get : function ( ) { return null !== this . debugBody } , set : function ( a ) { a && ! this . debugBody ? this . debugBody = new Phaser . Physics . P2 . BodyDebug ( this . game , this . data ) : ! a && this . debugBody && ( this . debugBody . destroy ( ) , this . debugBody = null ) } } ) , Object . defineProperty ( Phaser . Physics . P2 . Body . prototype , "collideWorldBounds" , { get : function ( ) { return this . _collideWorldBounds } , set : function ( a ) { a && ! this . _collideWorldBounds ? ( this . _collideWorldBounds = ! 0 , this . updateCollisionMask ( ) ) : ! a && this . _collideWorldBounds && ( this . _collideWorldBounds = ! 1 , this . updateCollisionMask ( ) ) } } ) , Phaser . Physics . P2 . BodyDebug = function ( a , b , c ) { Phaser . Group . call ( this , a ) ; var d = { pixelsPerLengthUnit : 20 , debugPolygons : ! 1 , lineWidth : 1 , alpha : . 5 } ; this . settings = Phaser . Utils . extend ( d , c ) , this . ppu = this . settings . pixelsPerLengthUnit , this . ppu = - 1 * this . ppu , this . body = b , this . canvas = new Phaser . Graphics ( a ) , this . canvas . alpha = this . settings . alpha , this . add ( this . canvas ) , this . draw ( ) } , Phaser . Physics . P2 . BodyDebug . prototype = Object . create ( Phaser . Group . prototype ) , Phaser . Physics . P2 . BodyDebug . prototype . constructor = Phaser . Physics . P2 . BodyDebug , Phaser . Utils . extend ( Phaser . Physics . P2 . BodyDebug . prototype , { update : function ( ) { this . updateSpriteTransform ( ) } , updateSpriteTransform : function ( ) { return this . position . x = this . body . position [ 0 ] * this . ppu , this . position . y = this . body . position [ 1 ] * this . ppu , this . rotation = this . body . angle } , draw : function ( ) { var a , b , c , d , e , f , g , h , i , j , k , l , m , n , o ; if ( h = this . body , j = this . canvas , j . clear ( ) , c = parseInt ( this . randomPastelHex ( ) , 16 ) , f = 16711680 , g = this . lineWidth , h instanceof p2 . Body && h . shapes . length ) { var p = h . shapes . length ; for ( d = 0 ; d !== p ; ) { if ( b = h . shapes [ d ] , i = h . shapeOffsets [ d ] , a = h . shapeAngles [ d ] , i = i || 0 , a = a || 0 , b instanceof p2 . Circle ) this . drawCircle ( j , i [ 0 ] * this . ppu , i [ 1 ] * this . ppu , a , b . radius * this . ppu , c , g ) ; else if ( b instanceof p2 . Convex ) { for ( l = [ ] , m = p2 . vec2 . create ( ) , e = n = 0 , o = b . vertices . length ; o >= 0 ? o > n : n > o ; e = o >= 0 ? ++ n : -- n ) k = b . vertices [ e ] , p2 . vec2 . rotate ( m , k , a ) , l . push ( [ ( m [ 0 ] + i [ 0 ] ) * this . ppu , - ( m [ 1 ] + i [ 1 ] ) * this . ppu ] ) ; this . drawConvex ( j , l , b . triangles , f , c , g , this . settings . debugPolygons , [ i [ 0 ] * this . ppu , - i [ 1 ] * this . ppu ] ) } else b instanceof p2 . Plane ? this . drawPlane ( j , i [ 0 ] * this . ppu , - i [ 1 ] * this . ppu , c , f , 5 * g , 10 * g , 10 * g , 100 * this . ppu , a ) : b instanceof p2 . Line ? this . drawLine ( j , b . length * this . ppu , f , g ) : b ins
2014-02-28 09:30:53 +00:00
//# sourceMappingURL=phaser.map