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 ++
} } , 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 : this . y - a } } ) , Object . defineProperty ( b . Rectangle . prototype , "bottomRight" , { get : function ( ) { return new b . Point ( this . right , this . bottom ) } , set : function ( a ) { this . right = a . x , this . bottom = a . y } } ) , Object . defineProperty ( b . Rectangle . prototype , "left" , { get : function ( ) { return this . x } , set : function ( a ) { this . width = a >= this . right ? 0 : this . right - a , this . x = a } } ) , Object . defineProperty ( b . Rectangle . prototype , "right" , { get : function ( ) { return this . x + this . width } , set : function ( a ) { this . width = a <= this . x ? 0 : a - this . x } } ) , Object . defineProperty ( b . Rectangle . prototype , "volume" , { get : function ( ) { return this . width * this . height } } ) , Object . defineProperty ( b . Rectangle . prototype , "perimeter" , { get : function ( ) { return 2 * this . width + 2 * this . height } } ) , Object . defineProperty ( b . Rectangle . prototype , "centerX" , { get : function ( ) { return this . x + this . halfWidth } , set : function ( a ) { this . x = a - this . halfWidth } } ) , Object . defineProperty ( b . Rectangle . prototype , "centerY" , { get : function ( ) { return this . y + this . halfHeight } , set : function ( a ) { this . y = a - this . halfHeight } } ) , Object . defineProperty ( b . Rectangle . prototype , "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
for ( var a = this . children . length ; a -- ; ) this . children [ a ] !== this . game . world . camera . target && this . children [ a ] . postUpdate ( ) } else { this . game . world . camera . update ( ) ; for ( var a = this . children . length ; a -- ; ) this . children [ a ] . postUpdate ( ) } this . checkOffsetInterval !== ! 1 && this . game . time . now > this . _nextOffsetCheck && ( b . Canvas . getOffset ( this . game . canvas , this . offset ) , this . bounds . x = this . offset . x , this . bounds . y = this . offset . y , this . _nextOffsetCheck = this . game . time . now + this . checkOffsetInterval ) } , b . Stage . prototype . parseConfig = function ( a ) { a . checkOffsetInterval && ( this . checkOffsetInterval = a . checkOffsetInterval ) , a . disableVisibilityChange && ( this . disableVisibilityChange = a . disableVisibilityChange ) , a . fullScreenScaleMode && ( this . fullScreenScaleMode = a . fullScreenScaleMode ) , a . scaleMode && ( this . scaleMode = a . scaleMode ) , a . backgroundColor && ( this . backgroundColor = a . backgroundColor ) } , b . Stage . prototype . boot = function ( ) { b . Canvas . getOffset ( this . game . canvas , this . offset ) , this . bounds . setTo ( this . offset . x , this . offset . y , this . game . width , this . game . height ) ; var a = this ; this . _onChange = function ( b ) { return a . visibilityChange ( b ) } , b . Canvas . setUserSelect ( this . game . canvas , "none" ) , b . Canvas . setTouchAction ( this . game . canvas , "none" ) , this . checkVisibility ( ) } , 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 } , 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 ? 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 , "#" ) } , 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 . 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 . 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 ( ) , this . plugins . postRender ( ) , this . device . cocoonJS && this . renderType === b . CANVAS && 1 === this . stage . currentRenderOrderID && this . context . fillRect ( 0 , 0 , 0 , 0 ) ) } , enableStep : function ( ) { this . stepping = ! 0 , this . pendingStep = ! 1 , this . stepCount = 0 } , disableStep : function ( ) { this . stepping = ! 1 , this . pendingStep = ! 1 } , step : function ( ) { this . pendingStep = ! 1 , this . stepCount ++ } , destroy : function ( ) { this . raf . stop ( ) , this . state . destroy ( ) , this . sound . destroy ( ) , this . scale . destroy ( ) , this . stage . destroy ( ) , this . input . destroy ( ) , this . physics . destroy ( ) , this . state = null , this . cache = null , this . input = null , this . load = null , this . sound = null , this . stage = null , this . time = null , this . world = null , this . isBooted = ! 1 } , gamePaused : function ( a ) { this . _paused || ( this . _paused = ! 0 , this . time . gamePaused ( ) , this . sound . setMute ( ) , this . onPause . dispatch ( a ) ) } , gameResumed : function ( a ) { this . _paused && ! this . _codePaused && ( this . _paused = ! 1 , this . time . gameResumed ( ) , this . input . reset ( ) , this . sound . unsetMute ( ) , this . onResume . dispatch ( a ) ) } , focusLoss : function ( a ) { this . onBlur . dispatch ( a ) , this . stage . disableVisibilityChange || this . gamePaused ( a ) } , focusGain : function ( a ) { this . onFocus . dispatch ( a ) , this . stage . disableVisibilityChange || this . gameResumed ( a ) } } , b . Game . prototype . constructor = b . Game , Object . defineProperty ( b . Game . prototype , "paused" , { get : function ( ) { return this . _paused } , set : function ( a ) { a === ! 0 ? ( this . _paused === ! 1 && ( this . _paused = ! 0 , this . sound . setMute ( ) , this . time . gamePaused ( ) , this . onPause . dispatch ( this ) ) , this . _codePaused = ! 0 ) : ( this . _paused && ( this . _paused = ! 1 , this . input . reset ( ) , this . sound . unsetMute ( ) , this . time . gameResumed ( ) , this . onResume . dispatch ( this ) ) , this . _codePaused = ! 1 ) } } ) , b . Input = function ( a ) { this . game = a , this . hitCanvas = null , this . hitContext = null , this . moveCallbacks = [ ] , this . moveCallback = null , this . moveCallbackContext = this , this . pollRate = 0 , this . disabled = ! 1 , this . multiInputOverride = b . Input . MOUSE _TOUCH _COMBINE , this . position = null , this . speed = null , this . circle = null , this . scale = null , this . maxPointers = 10 , this . currentPointers = 0 , this . tapRate = 200 , this . doubleTapRate = 300 , this . holdRate = 2e3 , this . justPressedRate = 200 , this . justReleasedRate = 200 , this . recordPointerHistory = ! 1 , this . recordRate = 100 , this . recordLimit = 100 , this . pointer1 = null , this . pointer2 = null , this . pointer3 = null , this . pointer4 = null , this . pointer5 = null , this . pointer6 = null , this . pointer7 = null , this . pointer8 = null , this . pointer9 = null , this . pointer10 = null , this . activePointer = null , this . mousePointer = null , this . mouse = null , this . keyboard = null , this . touch = null , this . mspointer = null , this . gamepad = null , this . resetLocked = ! 1 , this . onDown = null , this . onUp = null , this . onTap = null , this . onHold = null , this . minPriorityID = 0 , this . interactiveItems = new b . ArrayList , this . _localPoint = new b . Point , this . _pollCounter = 0 , this . _oldPosition = null , this . _x = 0 , this . _y = 0 } , b . Input . MOUSE _OVERRIDES _TOUCH = 0 , b . Input . TOUCH _OVERRIDES _MOUSE = 1 , b . Input . MOUSE _TOUCH _COMBINE = 2 , b . Input . prototype = { boot : function ( ) { this . mousePointer = new b . Pointer ( this . game , 0 ) , this . pointer1 = new b . Pointer ( this . game , 1 ) , this . pointer2 = new b . Pointer ( this . game
} , 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 = function ( b ) { return a . onTouchMove ( b ) } , this . _onTouchEnd = function ( b ) { return a . onTouchEnd ( b ) } , this . _onTouchEnter = function ( b ) { return a . onTouchEnter ( b ) } , this . _onTouchLeave = function ( b ) { return a . onTouchLeave ( b ) } , this . _onTouchCancel = function ( b ) { return a . onTouchCancel ( b ) } , this . game . canvas . addEventListener ( "touchstart" , this . _onTouchStart , ! 1 ) , this . game . canvas . addEventListener ( "touchmove" , this . _onTouchMove , ! 1 ) , this . game . canvas . addEventListener ( "touchend" , this . _onTouchEnd , ! 1 ) , this . game . canvas . addEventListener ( "touchcancel" , this . _onTouchCancel , ! 1 ) , this . game . device . cocoonJS || ( this . game . canvas . addEventListener ( "touchenter" , this . _onTouchEnter , ! 1 ) , this . game . canvas . addEventListener ( "touchleave" , this . _onTouchLeave , ! 1 ) ) ) } } , consumeDocumentTouches : function ( ) { this . _documentTouchMove = function ( a ) { a . preventDefault ( ) } , document . addEventListener ( "touchmove" , this . _documentTouchMove , ! 1 ) } , onTouchStart : function ( a ) { if ( this . event = a , this . touchStartCallback && this . touchStartCallback . call ( this . callbackContext , a ) , ! this . game . input . disabled && ! this . disabled ) { this . preventDefault && a . preventDefault ( ) ; for ( var b = 0 ; b < a . changedTouches . length ; b ++ ) this . game . input . startPointer ( a . changedTouches [ b ] ) } } , onTouchCancel : function ( a ) { if ( this . event = a , this . touchCancelCallback && this . touchCancelCallback . call ( this . callbackContext , a ) , ! this . game . input . disabled && ! this . disabled ) { this . preventDefault && a . preventDefault ( ) ; for ( var b = 0 ; b < a . changedTouches . length ; b ++ ) this . game . input . stopPointer ( a . changedTouches [ b ] ) } } , onTouchEnter : function ( a ) { this . event = a , this . touchEnterCallback && this . touchEnterCallback . call ( this . callbackContext , a ) , this . game . input . disabled || this . disabled || this . preventDefault && a . preventDefault ( ) } , onTouchLeave : function ( a ) { this . event = a , this . touchLeaveCallback && this . touchLeaveCallback . call ( this . callbackContext , a ) , this . preventDefault && a . preventDefault ( ) } , onTouchMove : function ( a ) { this . event = a , this . touchMoveCallback && this . touchMoveCallback . call ( this . callbackContext , a ) , this . preventDefault && a . preventDefault ( ) ; for ( var b = 0 ; b < a . changedTouches . length ; b ++ ) this . game . input . updatePointer ( a . changedTouches [ b ] ) } , onTouchEnd : function ( a ) { this . event = a , this . touchEndCallback && this . touchEndCallback . call ( this . callbackContext , a ) , this . preventDefault && a . preventDefault ( ) ; for ( var b = 0 ; b < a . changedTouches . length ; b ++ ) this . game . input . stopPointer ( a . changedTouches [ b ] ) } , stop : function ( ) { this . game . device . touch && ( this . game . canvas . removeEventListener ( "touchstart" , this . _onTouchStart ) , this . game . canvas . removeEventListener ( "touchmove" , this . _onTouchMove ) , this . game . canvas . removeEventListener ( "touchend" , this . _onTouchEnd ) , this . game . canvas . removeEventListener ( "touchenter" , this . _onTouchEnter ) , this . game . canvas . removeEventListener ( "touchleave" , this . _onTouchLeave ) , this . game . canvas . removeEventListener ( "touchcancel" , this . _onTouchCancel ) ) } } , b . Touch . prototype . constructor = b . Touch , b . Gamepad = function ( a ) { this . game = a , this . _gamepadIndexMap = { } , this . _rawPads = [ ] , this . _active = ! 1 , this . disabled = ! 1 , this . _gamepadSupportAvailable = ! ! navigator . webkitGetGamepads || ! ! navigator . webkitGamepads || - 1 != navigat
} , 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 : function ( a , c , d , e ) { ( "undefined" == typeof d || "" === d ) && ( d = this . game . rnd . uuid ( ) ) , "undefined" == typeof e && ( e = ! 1 ) ; var f = new b . RenderTexture ( this . game , a , c , d ) ; return e && this . game . cache . addRenderTexture ( d , f ) , f } , bitmapData : function ( a , c , d , e ) { "undefined" == typeof e && ( e = ! 1 ) , ( "undefined" == typeof d || "" === d ) && ( d = this . game . rnd . uuid ( ) ) ; var f = new b . BitmapData ( this . game , d , a , c ) ; return e && this . game . cache . addBitmapData ( d , f ) , f } , filter : function ( a ) { var c = Array . prototype . splice . call ( arguments , 1 ) , a = new b . Filter [ a ] ( this . game ) ; return a . init . apply ( a , c ) , a } , plugin : function ( a ) { return this . game . plugins . add ( a ) } } , b . GameObjectFactory . prototype . constructor = b . GameObjectFactory , b . GameObjectCreator = function ( a ) { this . game = a , this . world = this . game . world } , b . GameObjectCreator . prototype = { image : function ( a , c , d , e ) { return new b . Image ( this . game , a , c , d , e ) } , sprite : function ( a , c , d , e ) { return new b . Sprite ( this . game , a , c , d , e ) } , tween : function ( a ) { return new b . Tween ( a , this . game ) } , group : function ( a , c , d , e , f ) { return new b . Group ( this . game , null , c , d , e , f ) } , spriteBatch : function ( a , c , d ) { return "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 ) { return new b . TileSprite ( this . game , a , c , d , e , f , g ) } , rope : function ( a , c , d , e , f ) { return new b . Rope ( this . game , a , c , d , e , f ) } , text : function ( a , c , d , e ) { return new b . Text ( this . game , a , c , d , e ) } , button : function ( a , c , d , e , f , g , h , i , j ) { return new b . Button ( this . game , a , c , d , e , f , g , h , i , j ) } , graphics : function ( a , c ) { return new b . Graphics ( this . game , a , c ) } , emitter : function ( a , c , d ) { return 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 ) { return 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 : function ( a , c , d , e ) { ( "undefined" == typeof d || "" === d ) && ( d = this . game . rnd . uuid ( ) ) , "undefined" == typeof e && ( e = ! 1 ) ; var f = new b . RenderTexture ( this . game , a , c , d ) ; return e && this . game . cache . addRenderTexture ( d , f ) , f } , bitmapData : function ( a , c , d , e ) { "undefined" == typeof e && ( e = ! 1 ) , ( "undefined" == typeof d || "" === d ) && ( d = this . game . rnd . uuid ( ) ) ; var f = new b . BitmapData ( this . game , d , a , c ) ; return e && this . game . cache . addBitmapData ( d , f ) , f } , filter : function ( a ) { var c = Array . prototype . splice . call ( arguments , 1 ) , a = new b . Filter [ a ] ( this . game ) ; return a . init . apply ( a , c ) , a } } , b . GameObjectCreator . prototype . constructor = b . GameObjectCreator , b . BitmapData = function ( a , c , d , e ) { "undefined" == typeof d && ( d = 100 ) , "undefined" == typeof e && ( e = 100 ) , this . game = a , this . key = c , this . width = d , this . height = e , this . canvas = b . Canvas . create ( d , e , "" , ! 0 ) , this . context = this . canvas . getContext ( "2d" ) , this . ctx = this . context , this . imageData = this . context . getImageData ( 0
} , b . TileSprite . prototype . setFrame = function ( a ) { this . texture . frame . x = a . x , this . texture . frame . y = a . y , this . texture . frame . width = a . width , this . texture . frame . height = a . height , this . texture . crop . x = a . x , this . texture . crop . y = a . y , this . texture . crop . width = a . width , this . texture . crop . height = a . height , a . trimmed && ( this . texture . trim ? ( this . texture . trim . x = a . spriteSourceSizeX , this . texture . trim . y = a . spriteSourceSizeY , this . texture . trim . width = a . sourceSizeW , this . texture . trim . height = a . sourceSizeH ) : this . texture . trim = { x : a . spriteSourceSizeX , y : a . spriteSourceSizeY , width : a . sourceSizeW , height : a . sourceSizeH } , this . texture . width = a . sourceSizeW , this . texture . height = a . sourceSizeH , this . texture . frame . width = a . sourceSizeW , this . texture . frame . height = a . sourceSizeH ) , this . game . renderType === b . WEBGL && PIXI . WebGLRenderer . updateTextureFrame ( this . texture ) } , b . TileSprite . 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 . filters && ( this . filters = null ) , this . parent && ( this . parent instanceof b . Group ? this . parent . remove ( this ) : this . parent . removeChild ( this ) ) , this . animations . destroy ( ) , this . events . destroy ( ) ; var c = this . children . length ; if ( a ) for ( ; c -- ; ) this . children [ c ] . destroy ( a ) ; else for ( ; c -- ; ) this . removeChild ( this . children [ c ] ) ; this . exists = ! 1 , this . visible = ! 1 , this . alive = ! 1 , this . filters = null , this . mask = null , this . game = null , this . _cache [ 8 ] = 0 } } , b . TileSprite . prototype . play = function ( a , b , c , d ) { return this . animations . play ( a , b , c , d ) } , b . TileSprite . 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 . _outOfBoundsFired = ! 1 , this . tilePosition . x = 0 , this . tilePosition . y = 0 , this . body && this . body . reset ( a , b , ! 1 , ! 1 ) , this . _cache [ 4 ] = 1 , this } , Object . defineProperty ( b . TileSprite . 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 . TileSprite . prototype , "frame" , { get : function ( ) { return this . animations . frame } , set : function ( a ) { a !== this . animations . frame && ( this . animations . frame = a ) } } ) , Object . defineProperty ( b . TileSprite . prototype , "frameName" , { get : function ( ) { return this . animations . frameName } , set : function ( a ) { a !== this . animations . frameName && ( this . animations . frameName = a ) } } ) , Object . defineProperty ( b . TileSprite . 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 . TileSprite . prototype , "exists" , { get : function ( ) { return ! ! this . _cache [ 6 ] } , set : function ( a ) { a ? ( this . _cache [ 6 ] = 1 , this . body && this . body . type === b . Physics . P2JS && this . body . addToWorld ( ) , this . visible = ! 0 ) : ( this . _cache [ 6 ] = 0 , this . body && this . body . type === b . Physics . P2JS && ( this . body . safeRemove = ! 0 ) , this . visible = ! 1 ) } } ) , Object . defineProperty ( b . TileSprite . 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 . TileSprite . prototype , "x" , { get : function ( ) { return this . position . x } , set : function ( a ) { this . position . x = a , this . body && this . body . type === b . Physics . ARCADE && 2 === this . body . phase && ( this . body . _reset = 1 ) } } ) , Object . defineProperty ( b . TileSprite . prototype , "y" , { get : function ( ) { return this . position . y } , set : function ( a ) { this . position . y = a , this . body && this . body . type === b . Physics . ARCADE && 2 === this . body . phase && ( this . body . _reset = 1 ) } } ) , Object . defineProperty ( b . TileSprite . prototype , "destroyPhase" , { get : function ( ) { return ! ! this . _cache [ 8 ] } } ) , b . Rope = function ( a , c , d , e , f , g ) { this . points = [ ] , this . points = g , this . _hasUpdateAnimation = ! 1 , this . _updateAnimationCallback = null , c = c || 0 , d = d || 0 , e = e || null , f = f || null , this . game = a , this . name = "" , this . type = b . ROPE , this . z = 0 , this . events = new b . Events ( this ) , this . animations = new b . AnimationManager ( this ) , this . key = e , this . _frame = 0 , this . _frameName = "" , this . _scroll = new b . Point , PIXI . Rope . call ( this , e , this . points ) , this . pos
this . grabData [ f . charCodeAt ( p ) ] = r . index , PIXI . TextureCache [ q ] = new PIXI . Texture ( PIXI . BaseTextureCache [ c ] , { x : l , y : m , width : this . characterWidth , height : this . characterHeight } ) , n ++ , n == this . characterPerRow ? ( n = 0 , l = this . offsetX , m += this . characterHeight + this . characterSpacingY ) : l += this . characterWidth + this . characterSpacingX } a . cache . updateFrameData ( c , o ) , this . stamp = new b . Image ( a , 0 , 0 , c , 0 ) , b . RenderTexture . call ( this , a , 100 , 100 , "" , b . scaleModes . NEAREST ) , this . type = b . RETROFONT } , b . RetroFont . prototype = Object . create ( b . RenderTexture . prototype ) , b . RetroFont . prototype . constructor = b . RetroFont , b . RetroFont . ALIGN _LEFT = "left" , b . RetroFont . ALIGN _RIGHT = "right" , b . RetroFont . ALIGN _CENTER = "center" , b . RetroFont . TEXT _SET1 = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" , b . RetroFont . TEXT _SET2 = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ" , b . RetroFont . TEXT _SET3 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 " , b . RetroFont . TEXT _SET4 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789" , b . RetroFont . TEXT _SET5 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ.,/() '!?-*:0123456789" , b . RetroFont . TEXT _SET6 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ!?:;0123456789\"(),-.' " , b . RetroFont . TEXT _SET7 = "AGMSY+:4BHNTZ!;5CIOU.?06DJPV,(17EKQW\")28FLRX-'39" , b . RetroFont . TEXT _SET8 = "0123456789 .ABCDEFGHIJKLMNOPQRSTUVWXYZ" , b . RetroFont . TEXT _SET9 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ()-0123456789.:,'\"?!" , b . RetroFont . TEXT _SET10 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" , b . RetroFont . TEXT _SET11 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ.,\"-+!?()':;0123456789" , b . RetroFont . prototype . setFixedWidth = function ( a , b ) { "undefined" == typeof b && ( b = "left" ) , this . fixedWidth = a , this . align = b } , b . RetroFont . prototype . setText = function ( a , b , c , d , e , f ) { this . multiLine = b || ! 1 , this . customSpacingX = c || 0 , this . customSpacingY = d || 0 , this . align = e || "left" , this . autoUpperCase = f ? ! 1 : ! 0 , a . length > 0 && ( this . text = a ) } , b . RetroFont . prototype . buildRetroFontText = function ( ) { var a = 0 , c = 0 ; if ( this . clear ( ) , this . multiLine ) { var d = this . _text . split ( "\n" ) ; this . fixedWidth > 0 ? this . resize ( this . fixedWidth , d . length * ( this . characterHeight + this . customSpacingY ) - this . customSpacingY , ! 0 ) : this . resize ( this . getLongestLine ( ) * ( this . characterWidth + this . customSpacingX ) , d . length * ( this . characterHeight + this . customSpacingY ) - this . customSpacingY , ! 0 ) ; for ( var e = 0 ; e < d . length ; e ++ ) { switch ( this . align ) { case b . RetroFont . ALIGN _LEFT : a = 0 ; break ; case b . RetroFont . ALIGN _RIGHT : a = this . width - d [ e ] . length * ( this . characterWidth + this . customSpacingX ) ; break ; case b . RetroFont . ALIGN _CENTER : a = this . width / 2 - d [ e ] . length * ( this . characterWidth + this . customSpacingX ) / 2 , a += this . customSpacingX / 2 } 0 > a && ( a = 0 ) , this . pasteLine ( d [ e ] , a , c , this . customSpacingX ) , c += this . characterHeight + this . customSpacingY } } else { switch ( this . fixedWidth > 0 ? this . resize ( this . fixedWidth , this . characterHeight , ! 0 ) : this . resize ( this . _text . length * ( this . characterWidth + this . customSpacingX ) , this . characterHeight , ! 0 ) , this . align ) { case b . RetroFont . ALIGN _LEFT : a = 0 ; break ; case b . RetroFont . ALIGN _RIGHT : a = this . width - this . _text . length * ( this . characterWidth + this . customSpacingX ) ; break ; case b . RetroFont . ALIGN _CENTER : a = this . width / 2 - this . _text . length * ( this . characterWidth + this . customSpacingX ) / 2 , a += this . customSpacingX / 2 } this . textureBuffer . clear ( ) , this . pasteLine ( this . _text , a , 0 , this . customSpacingX ) } } , b . RetroFont . prototype . pasteLine = function ( a , c , d , e ) { for ( var f = new b . Point , g = 0 ; g < a . length ; g ++ ) if ( " " == a . charAt ( g ) ) c += this . characterWidth + e ; else if ( this . grabData [ a . charCodeAt ( g ) ] >= 0 && ( this . stamp . frame = this . grabData [ a . charCodeAt ( g ) ] , f . set ( c , d ) , this . render ( this . stamp , f , ! 1 ) , c += this . characterWidth + e , c > this . width ) ) break } , b . RetroFont . prototype . getLongestLine = function ( ) { var a = 0 ; if ( this . _text . length > 0 ) for ( var b = this . _text . split ( "\n" ) , c = 0 ; c < b . length ; c ++ ) b [ c ] . length > a && ( a = b [ c ] . length ) ; return a } , b . RetroFont . prototype . removeUnsupportedCharacters = function ( a ) { for ( var b = "" , c = 0 ; c < this . _text . length ; c ++ ) { var d = this . _text [ c ] , e = d . charCodeAt ( 0 ) ; ( this . grabData [ e ] >= 0 || ! a && "\n" === d ) && ( b = b . concat ( d ) ) } return b } , b . RetroFont . prototype . updateOffset = function ( a , b ) { if ( this . offsetX !== a || this . offsetY !== b ) { for ( var c = a - this . offsetX , d = b - this . offsetY , e = this . game . cache . getFrameData ( this . stamp . key ) . getFrames ( ) , f = e . length ; f -- ; ) e [ f ] . x += c , e [ f ] . y += d , PIXI . TextureCache [ e [ f ] . uuid
h = h > 1 ? 1 : h ; var i = this . _easingFunction ( h ) , j = { } ; for ( c in this . _valuesEnd ) { var k = this . _valuesStart [ c ] || 0 , l = this . _valuesEnd [ c ] ; l instanceof Array ? j [ c ] = this . _interpolationFunction ( l , i ) : ( "string" == typeof l && ( l = k + parseFloat ( l , 10 ) ) , "number" == typeof l && ( j [ c ] = k + ( l - k ) * i ) ) } g . push ( j ) , d += f } if ( this . _yoyo ) { var m = g . slice ( ) ; m . reverse ( ) , g = g . concat ( m ) } return "undefined" != typeof b ? b = b . concat ( g ) : g } , stop : function ( ) { return this . isRunning = ! 1 , this . _onUpdateCallback = null , this . _manager . remove ( this ) , this } , delay : function ( a ) { return this . _delayTime = a , this } , repeat : function ( a ) { return this . _repeat = a , this } , yoyo : function ( a ) { return this . _yoyo = a , a && 0 === this . _repeat && ( this . _repeat = 1 ) , this } , easing : function ( a ) { return this . _easingFunction = a , this } , interpolation : function ( a ) { return this . _interpolationFunction = a , this } , chain : function ( ) { return this . _chainedTweens = arguments , this } , loop : function ( ) { return this . _lastChild . chain ( this ) , this } , onUpdateCallback : function ( a , b ) { return this . _onUpdateCallback = a , this . _onUpdateCallbackContext = b , this } , pause : function ( ) { this . _codePaused = ! 0 , this . _paused = ! 0 , this . _pausedTime = this . game . time . now } , _pause : function ( ) { this . _codePaused || ( this . _paused = ! 0 , this . _pausedTime = this . game . time . now ) } , resume : function ( ) { this . _paused && ( this . _paused = ! 1 , this . _codePaused = ! 1 , this . _startTime += this . game . time . now - this . _pausedTime ) } , _resume : function ( ) { this . _codePaused || ( this . _startTime += this . game . time . pauseDuration , this . _paused = ! 1 ) } , update : function ( a ) { if ( this . pendingDelete ) return ! 1 ; if ( this . _paused || a < this . _startTime ) return ! 0 ; var b ; if ( a < this . _startTime ) return ! 0 ; this . _onStartCallbackFired === ! 1 && ( this . onStart . dispatch ( this . _object ) , this . _onStartCallbackFired = ! 0 ) ; var c = ( a - this . _startTime ) / this . _duration ; c = c > 1 ? 1 : c ; var d = this . _easingFunction ( c ) ; for ( b in this . _valuesEnd ) { var e = this . _valuesStart [ b ] || 0 , f = this . _valuesEnd [ b ] ; f instanceof Array ? this . _object [ b ] = this . _interpolationFunction ( f , d ) : ( "string" == typeof f && ( f = e + parseFloat ( f , 10 ) ) , "number" == typeof f && ( this . _object [ b ] = e + ( f - e ) * d ) ) } if ( null !== this . _onUpdateCallback && ( this . _onUpdateCallback . call ( this . _onUpdateCallbackContext , this , d ) , ! this . isRunning ) ) return ! 1 ; if ( 1 == c ) { if ( this . _repeat > 0 ) { isFinite ( this . _repeat ) && this . _repeat -- ; for ( b in this . _valuesStartRepeat ) { if ( "string" == typeof this . _valuesEnd [ b ] && ( this . _valuesStartRepeat [ b ] = this . _valuesStartRepeat [ b ] + parseFloat ( this . _valuesEnd [ b ] , 10 ) ) , this . _yoyo ) { var g = this . _valuesStartRepeat [ b ] ; this . _valuesStartRepeat [ b ] = this . _valuesEnd [ b ] , this . _valuesEnd [ b ] = g } this . _valuesStart [ b ] = this . _valuesStartRepeat [ b ] } return this . _yoyo && ( this . _reversed = ! this . _reversed ) , this . _startTime = a + this . _delayTime , this . onLoop . dispatch ( this . _object ) , ! 0 } this . isRunning = ! 1 , this . onComplete . dispatch ( this . _object ) ; for ( var h = 0 , i = this . _chainedTweens . length ; i > h ; h ++ ) this . _chainedTweens [ h ] . start ( a ) ; return ! 1 } return ! 0 } } , b . Tween . prototype . constructor = b . Tween , b . Easing = { Linear : { None : function ( a ) { return a } } , Quadratic : { In : function ( a ) { return a * a } , Out : function ( a ) { return a * ( 2 - a ) } , InOut : function ( a ) { return ( a *= 2 ) < 1 ? . 5 * a * a : - . 5 * ( -- a * ( a - 2 ) - 1 ) } } , Cubic : { In : function ( a ) { return a * a * a } , Out : function ( a ) { return -- a * a * a + 1 } , InOut : function ( a ) { return ( a *= 2 ) < 1 ? . 5 * a * a * a : . 5 * ( ( a -= 2 ) * a * a + 2 ) } } , Quartic : { In : function ( a ) { return a * a * a * a } , Out : function ( a ) { return 1 - -- a * a * a * a } , InOut : function ( a ) { return ( a *= 2 ) < 1 ? . 5 * a * a * a * a : - . 5 * ( ( a -= 2 ) * a * a * a - 2 ) } } , Quintic : { In : function ( a ) { return a * a * a * a * a } , Out : function ( a ) { return -- a * a * a * a * a + 1 } , InOut : function ( a ) { return ( a *= 2 ) < 1 ? . 5 * a * a * a * a * a : . 5 * ( ( a -= 2 ) * a * a * a * a + 2 ) } } , Sinusoidal : { In : function ( a ) { return 1 - Math . cos ( a * Math . PI / 2 ) } , Out : function ( a ) { return Math . sin ( a * Math . PI / 2 ) } , InOut : function ( a ) { return . 5 * ( 1 - Math . cos ( Math . PI * a ) ) } } , Exponential : { In : function ( a ) { return 0 === a ? 0 : Math . pow ( 1024 , a - 1 ) } , Out : function ( a ) { return 1 === a ? 1 : 1 - Math . pow ( 2 , - 10 * a ) } , InOut : function ( a ) { return 0 === a ? 0 : 1 === a ? 1 : ( a *= 2 ) < 1 ? . 5 * Math . pow ( 1024 , a - 1 ) : . 5 * ( - Math . pow ( 2 , - 10 * ( a - 1 ) ) + 2 ) } } , Circular : { In : function ( a ) { return 1 - Math . sqrt ( 1 - a * a ) } , Out : function ( a ) { return Math . sqrt ( 1 - -- a * a ) } , InOut : function ( a ) { return ( a *= 2 ) < 1 ? - . 5 * ( Math . sqrt ( 1 - a * a ) - 1 ) : . 5 * ( Math . sqrt ( 1 - ( a -= 2 ) * a ) + 1 ) } } , Elastic : { In : function ( a ) { var b , c = . 1 , d = . 4 ; return 0 === a ? 0 : 1 === a ? 1 : ( ! c || 1 > c ? ( c = 1 , b = d / 4 ) : b = d * Math . asin ( 1 / c ) / ( 2 * Math . PI ) , - ( c * Math . pow ( 2 , 10 * ( a -= 1 )
} , addImage : function ( a , c , d ) { this . _images [ a ] = { url : c , data : d } , this . _images [ a ] . frame = new b . Frame ( 0 , 0 , 0 , d . width , d . height , a , this . game . rnd . uuid ( ) ) , this . _images [ a ] . frameData = new b . FrameData , this . _images [ a ] . frameData . addFrame ( new b . Frame ( 0 , 0 , 0 , d . width , d . height , c , this . game . rnd . uuid ( ) ) ) , PIXI . BaseTextureCache [ a ] = new PIXI . BaseTexture ( d ) , PIXI . TextureCache [ a ] = new PIXI . Texture ( PIXI . BaseTextureCache [ a ] ) } , addSound : function ( a , b , c , d , e ) { d = d || ! 0 , e = e || ! 1 ; var f = ! 1 ; e && ( f = ! 0 ) , this . _sounds [ a ] = { url : b , data : c , isDecoding : ! 1 , decoded : f , webAudio : d , audioTag : e , locked : this . game . sound . touchLocked } } , reloadSound : function ( a ) { var b = this ; this . _sounds [ a ] && ( this . _sounds [ a ] . data . src = this . _sounds [ a ] . url , this . _sounds [ a ] . data . addEventListener ( "canplaythrough" , function ( ) { return b . reloadSoundComplete ( a ) } , ! 1 ) , this . _sounds [ a ] . data . load ( ) ) } , reloadSoundComplete : function ( a ) { this . _sounds [ a ] && ( this . _sounds [ a ] . locked = ! 1 , this . onSoundUnlock . dispatch ( a ) ) } , updateSound : function ( a , b , c ) { this . _sounds [ a ] && ( this . _sounds [ a ] [ b ] = c ) } , decodedSound : function ( a , b ) { this . _sounds [ a ] . data = b , this . _sounds [ a ] . decoded = ! 0 , this . _sounds [ a ] . isDecoding = ! 1 } , getCanvas : function ( a ) { return this . _canvases [ a ] ? this . _canvases [ a ] . canvas : void console . warn ( 'Phaser.Cache.getCanvas: Invalid key: "' + a + '"' ) } , getBitmapData : function ( a ) { return this . _bitmapDatas [ a ] ? this . _bitmapDatas [ a ] : void console . warn ( 'Phaser.Cache.getBitmapData: Invalid key: "' + a + '"' ) } , getBitmapFont : function ( a ) { return this . _bitmapFont [ a ] ? this . _bitmapFont [ a ] : void console . warn ( 'Phaser.Cache.getBitmapFont: Invalid key: "' + a + '"' ) } , getPhysicsData : function ( a , b , c ) { if ( "undefined" == typeof b || null === b ) { if ( this . _physics [ a ] ) return this . _physics [ a ] . data ; console . warn ( 'Phaser.Cache.getPhysicsData: Invalid key: "' + a + '"' ) } else if ( this . _physics [ a ] && this . _physics [ a ] . data [ b ] ) { var d = this . _physics [ a ] . data [ b ] ; if ( ! d || ! c ) return d ; for ( var e in d ) if ( e = d [ e ] , e . fixtureKey === c ) return e ; console . warn ( 'Phaser.Cache.getPhysicsData: Could not find given fixtureKey: "' + c + " in " + a + '"' ) } else console . warn ( 'Phaser.Cache.getPhysicsData: Invalid key/object: "' + a + " / " + b + '"' ) ; return null } , checkKey : function ( a , b ) { return this . _cacheMap [ a ] [ b ] ? ! 0 : ! 1 } , checkCanvasKey : function ( a ) { return this . checkKey ( b . Cache . CANVAS , a ) } , checkImageKey : function ( a ) { return this . checkKey ( b . Cache . IMAGE , a ) } , checkTextureKey : function ( a ) { return this . checkKey ( b . Cache . TEXTURE , a ) } , checkSoundKey : function ( a ) { return this . checkKey ( b . Cache . SOUND , a ) } , checkTextKey : function ( a ) { return this . checkKey ( b . Cache . TEXT , a ) } , checkPhysicsKey : function ( a ) { return this . checkKey ( b . Cache . PHYSICS , a ) } , checkTilemapKey : function ( a ) { return this . checkKey ( b . Cache . TILEMAP , a ) } , checkBinaryKey : function ( a ) { return this . checkKey ( b . Cache . BINARY , a ) } , checkBitmapDataKey : function ( a ) { return this . checkKey ( b . Cache . BITMAPDATA , a ) } , checkBitmapFontKey : function ( a ) { return this . checkKey ( b . Cache . BITMAPFONT , a ) } , checkJSONKey : function ( a ) { return this . checkKey ( b . Cache . JSON , a ) } , getImage : function ( a ) { return this . _images [ a ] ? this . _images [ a ] . data : void console . warn ( 'Phaser.Cache.getImage: Invalid key: "' + a + '"' ) } , getTilemapData : function ( a ) { return this . _tilemaps [ a ] ? this . _tilemaps [ a ] : void console . warn ( 'Phaser.Cache.getTilemapData: Invalid key: "' + a + '"' ) } , getFrameData : function ( a ) { return this . _images [ a ] ? this . _images [ a ] . frameData : null } , updateFrameData : function ( a , b ) { this . _images [ a ] && ( this . _images [ a ] . frameData = b ) } , getFrameByIndex : function ( a , b ) { return this . _images [ a ] ? this . _images [ a ] . frameData . getFrame ( b ) : null } , getFrameByName : function ( a , b ) { return this . _images [ a ] ? this . _images [ a ] . frameData . getFrameByName ( b ) : null } , getFrame : function ( a ) { return this . _images [ a ] ? this . _images [ a ] . frame : null } , getTextureFrame : function ( a ) { return this . _textures [ a ] ? this . _textures [ a ] . frame : null } , getTexture : function ( a ) { return this . _textures [ a ] ? this . _textures [ a ] : void console . warn ( 'Phaser.Cache.getTexture: Invalid key: "' + a + '"' ) } , getSound : function ( a ) { return this . _sounds [ a ] ? this . _sounds [ a ] : void console . warn ( 'Phaser.Cache.getSound: Invalid key: "' + a + '"' ) } , getSoundData : function ( a ) { return this . _sounds [ a ] ? this . _sounds [ a ] . data : void console . warn ( 'Phaser.Cache.getSoundData: Invalid key: "' + a + '"' ) } , isSoundDecoded : function ( a ) { return this . _sounds [ a ] ? this . _sounds [ a
} , set : function ( a ) { a = a || null , a ? ( this . _muted = ! 0 , this . usingWebAudio ? ( this . _muteVolume = this . gainNode . gain . value , this . gainNode . gain . value = 0 ) : this . usingAudioTag && this . _sound && ( this . _muteVolume = this . _sound . volume , this . _sound . volume = 0 ) ) : ( this . _muted = ! 1 , this . usingWebAudio ? this . gainNode . gain . value = this . _muteVolume : this . usingAudioTag && this . _sound && ( this . _sound . volume = this . _muteVolume ) ) , this . onMute . dispatch ( this ) } } ) , Object . defineProperty ( b . Sound . prototype , "volume" , { get : function ( ) { return this . _volume } , set : function ( a ) { this . usingWebAudio ? ( this . _volume = a , this . gainNode . gain . value = a ) : this . usingAudioTag && this . _sound && a >= 0 && 1 >= a && ( this . _volume = a , this . _sound . volume = a ) } } ) , b . SoundManager = function ( a ) { this . game = a , this . onSoundDecode = new b . Signal , this . _codeMuted = ! 1 , this . _muted = ! 1 , this . _unlockSource = null , this . _volume = 1 , this . _sounds = [ ] , this . context = null , this . usingWebAudio = ! 0 , this . usingAudioTag = ! 1 , this . noAudio = ! 1 , this . connectToMaster = ! 0 , this . touchLocked = ! 1 , this . channels = 32 } , b . SoundManager . prototype = { boot : function ( ) { if ( this . game . device . iOS && this . game . device . webAudio === ! 1 && ( this . channels = 1 ) , ! this . game . device . cocoonJS && this . game . device . iOS || window . PhaserGlobal && window . PhaserGlobal . fakeiOSTouchLock ? ( this . game . input . touch . callbackContext = this , this . game . input . touch . touchStartCallback = this . unlock , this . game . input . mouse . callbackContext = this , this . game . input . mouse . mouseDownCallback = this . unlock , this . touchLocked = ! 0 ) : this . touchLocked = ! 1 , window . PhaserGlobal ) { if ( window . PhaserGlobal . disableAudio === ! 0 ) return this . usingWebAudio = ! 1 , void ( this . noAudio = ! 0 ) ; if ( window . PhaserGlobal . disableWebAudio === ! 0 ) return this . usingWebAudio = ! 1 , this . usingAudioTag = ! 0 , void ( this . noAudio = ! 1 ) } if ( window . AudioContext ) try { this . context = new window . AudioContext } catch ( a ) { this . context = null , this . usingWebAudio = ! 1 , this . noAudio = ! 0 } else if ( window . webkitAudioContext ) try { this . context = new window . webkitAudioContext } catch ( a ) { this . context = null , this . usingWebAudio = ! 1 , this . noAudio = ! 0 } window . Audio && null === this . context && ( this . usingWebAudio = ! 1 , this . usingAudioTag = ! 0 , this . noAudio = ! 1 ) , null !== this . context && ( this . masterGain = "undefined" == typeof this . context . createGain ? this . context . createGainNode ( ) : this . context . createGain ( ) , this . masterGain . gain . value = 1 , this . masterGain . connect ( this . context . destination ) ) } , unlock : function ( ) { if ( this . touchLocked !== ! 1 ) if ( this . game . device . webAudio === ! 1 || window . PhaserGlobal && window . PhaserGlobal . disableWebAudio === ! 0 ) this . touchLocked = ! 1 , this . _unlockSource = null , this . game . input . touch . callbackContext = null , this . game . input . touch . touchStartCallback = null , this . game . input . mouse . callbackContext = null , this . game . input . mouse . mouseDownCallback = null ; else { var a = this . context . createBuffer ( 1 , 1 , 22050 ) ; this . _unlockSource = this . context . createBufferSource ( ) , this . _unlockSource . buffer = a , this . _unlockSource . connect ( this . context . destination ) , this . _unlockSource . noteOn ( 0 ) } } , stopAll : function ( ) { for ( var a = 0 ; a < this . _sounds . length ; a ++ ) this . _sounds [ a ] && this . _sounds [ a ] . stop ( ) } , pauseAll : function ( ) { for ( var a = 0 ; a < this . _sounds . length ; a ++ ) this . _sounds [ a ] && this . _sounds [ a ] . pause ( ) } , resumeAll : function ( ) { for ( var a = 0 ; a < this . _sounds . length ; a ++ ) this . _sounds [ a ] && this . _sounds [ a ] . resume ( ) } , decode : function ( a , b ) { b = b || null ; var c = this . game . cache . getSoundData ( a ) ; if ( c && this . game . cache . isSoundDecoded ( a ) === ! 1 ) { this . game . cache . updateSound ( a , "isDecoding" , ! 0 ) ; var d = this ; this . context . decodeAudioData ( c , function ( c ) { d . game . cache . decodedSound ( a , c ) , b && d . onSoundDecode . dispatch ( a , b ) } ) } } , update : function ( ) { this . touchLocked && this . game . device . webAudio && null !== this . _unlockSource && ( this . _unlockSource . playbackState === this . _unlockSource . PLAYING _STATE || this . _unlockSource . playbackState === this . _unlockSource . FINISHED _STATE ) && ( this . touchLocked = ! 1 , this . _unlockSource = null , this . game . input . touch . callbackContext = null , this . game . input . touch . touchStartCallback = null ) ; for ( var a = 0 ; a < this . _sounds . length ; a ++ ) this . _sounds [ a ] . update ( ) } , add : function ( a , c , d , e ) { "undefined" == typeof c && ( c = 1 ) , "undefined" == typeof d && ( d = ! 1 ) , "undefined" == typeof e && ( e = this . connectToMaster ) ; var f = new b . Sound ( this . game , a , c , d , e ) ; return this . _sounds . push ( f ) , f } , remove : function ( a ) { for ( var b = this . _sounds . length ; b -- ; ) if ( this . _sounds [ b ]
( c . faceTop || c . faceBottom ) && ( e = this . tileCheckY ( b , c ) ) } else { if ( ( c . faceTop || c . faceBottom ) && ( e = this . tileCheckY ( b , c ) , 0 !== e && ! c . intersects ( b . position . x , b . position . y , b . right , b . bottom ) ) ) return ! 0 ; ( c . faceLeft || c . faceRight ) && ( d = this . tileCheckX ( b , c ) ) } return 0 !== d || 0 !== e } , tileCheckX : function ( a , b ) { var c = 0 ; return a . deltaX ( ) < 0 && ! a . blocked . left && b . collideRight && a . checkCollision . left ? b . faceRight && a . x < b . right && ( c = a . x - b . right , c < - this . TILE _BIAS && ( c = 0 ) ) : a . deltaX ( ) > 0 && ! a . blocked . right && b . collideLeft && a . checkCollision . right && b . faceLeft && a . right > b . left && ( c = a . right - b . left , c > this . TILE _BIAS && ( c = 0 ) ) , 0 !== c && this . processTileSeparationX ( a , c ) , c } , tileCheckY : function ( a , b ) { var c = 0 ; return a . deltaY ( ) < 0 && ! a . blocked . up && b . collideDown && a . checkCollision . up ? b . faceBottom && a . y < b . bottom && ( c = a . y - b . bottom , c < - this . TILE _BIAS && ( c = 0 ) ) : a . deltaY ( ) > 0 && ! a . blocked . down && b . collideUp && a . checkCollision . down && b . faceTop && a . bottom > b . top && ( c = a . bottom - b . top , c > this . TILE _BIAS && ( c = 0 ) ) , 0 !== c && this . processTileSeparationY ( a , c ) , c } , processTileSeparationX : function ( a , b ) { 0 > b ? a . blocked . left = ! 0 : b > 0 && ( a . blocked . right = ! 0 ) , a . position . x -= b , a . velocity . x = 0 === a . bounce . x ? 0 : - a . velocity . x * a . bounce . x } , processTileSeparationY : function ( a , b ) { 0 > b ? a . blocked . up = ! 0 : b > 0 && ( a . blocked . down = ! 0 ) , a . position . y -= b , a . velocity . y = 0 === a . bounce . y ? 0 : - a . velocity . y * a . bounce . y } , getObjectsUnderPointer : function ( a , c , d , e ) { if ( 0 !== c . length && a . exists ) { 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 ( c ) ; var f = new b . Rectangle ( a . x , a . y , 1 , 1 ) , g = [ ] ; this . _potentials = this . quadTree . retrieve ( f ) ; for ( var h = 0 , i = this . _potentials . length ; i > h ; h ++ ) this . _potentials [ h ] . hitTest ( a . x , a . y ) && ( d && d . call ( e , a , this . _potentials [ h ] . sprite ) , g . push ( this . _potentials [ h ] . sprite ) ) ; return g } } , moveToObject : function ( a , b , c , d ) { return "undefined" == typeof c && ( c = 60 ) , "undefined" == typeof d && ( d = 0 ) , this . _angle = Math . atan2 ( b . y - a . y , b . x - a . x ) , d > 0 && ( c = this . distanceBetween ( a , b ) / ( d / 1e3 ) ) , a . body . velocity . x = Math . cos ( this . _angle ) * c , a . body . velocity . y = Math . sin ( this . _angle ) * c , this . _angle } , moveToPointer : function ( a , b , c , d ) { return "undefined" == typeof b && ( b = 60 ) , c = c || this . game . input . activePointer , "undefined" == typeof d && ( d = 0 ) , this . _angle = this . angleToPointer ( a , c ) , d > 0 && ( b = this . distanceToPointer ( a , c ) / ( d / 1e3 ) ) , a . body . velocity . x = Math . cos ( this . _angle ) * b , a . body . velocity . y = Math . sin ( this . _angle ) * b , this . _angle } , moveToXY : function ( a , b , c , d , e ) { return "undefined" == typeof d && ( d = 60 ) , "undefined" == typeof e && ( e = 0 ) , this . _angle = Math . atan2 ( c - a . y , b - a . x ) , e > 0 && ( d = this . distanceToXY ( a , b , c ) / ( e / 1e3 ) ) , a . body . velocity . x = Math . cos ( this . _angle ) * d , a . body . velocity . y = Math . sin ( this . _angle ) * d , this . _angle } , velocityFromAngle : function ( a , c , d ) { return "undefined" == typeof c && ( c = 60 ) , d = d || new b . Point , d . setTo ( Math . cos ( this . game . math . degToRad ( a ) ) * c , Math . sin ( this . game . math . degToRad ( a ) ) * c ) } , velocityFromRotation : function ( a , c , d ) { return "undefined" == typeof c && ( c = 60 ) , d = d || new b . Point , d . setTo ( Math . cos ( a ) * c , Math . sin ( a ) * c ) } , accelerationFromRotation : function ( a , c , d ) { return "undefined" == typeof c && ( c = 60 ) , d = d || new b . Point , d . setTo ( Math . cos ( a ) * c , Math . sin ( a ) * c ) } , accelerateToObject : function ( a , b , c , d , e ) { return "undefined" == typeof c && ( c = 60 ) , "undefined" == typeof d && ( d = 1e3 ) , "undefined" == typeof e && ( e = 1e3 ) , this . _angle = this . angleBetween ( a , b ) , a . body . acceleration . setTo ( Math . cos ( this . _angle ) * c , Math . sin ( this . _angle ) * c ) , a . body . maxVelocity . setTo ( d , e ) , this . _angle } , accelerateToPointer : function ( a , b , c , d , e ) { return "undefined" == typeof c && ( c = 60 ) , "undefined" == typeof b && ( b = this . game . input . activePointer ) , "undefined" == typeof d && ( d = 1e3 ) , "undefined" == typeof e && ( e = 1e3 ) , this . _angle = this . angleToPointer ( a , b ) , a . body . acceleration . setTo ( Math . cos ( this . _angle ) * c , Math . sin ( this . _angle ) * c ) , a . body . maxVelocity . setTo ( d , e ) , this . _angle } , accelerateToXY : function ( a , b , c , d , e , f ) { return "undefined" == typeof d && ( d = 60 ) , "undefined" == typeof e && ( e = 1e3 ) , "undefined" == typeof f && ( f = 1e3 ) , this . _angle = this . angleToXY ( a , b , c ) , a . body . acceleration . setTo ( Math . cos ( this . _angle ) * d , Math . sin ( this . _angle ) * d ) , a . body . maxVelocity . setTo ( e , f ) , this . _angle } , distanceBetween : function ( a , b ) { return this . _dx = a . x - b . x , this
if ( c ) { for ( var f = this . layers [ d ] . height - 1 ; f >= 0 ; f -- ) for ( var g = this . layers [ d ] . width - 1 ; g >= 0 ; g -- ) if ( this . layers [ d ] . data [ f ] [ g ] . index === a ) { if ( e === b ) return this . layers [ d ] . data [ f ] [ g ] ; e ++ } } else for ( var f = 0 ; f < this . layers [ d ] . height ; f ++ ) for ( var g = 0 ; g < this . layers [ d ] . width ; g ++ ) if ( this . layers [ d ] . data [ f ] [ g ] . index === a ) { if ( e === b ) return this . layers [ d ] . data [ f ] [ g ] ; e ++ } return null } , getTile : function ( a , b , c , d ) { return "undefined" == typeof d && ( d = ! 1 ) , c = this . getLayer ( c ) , a >= 0 && a < this . layers [ c ] . width && b >= 0 && b < this . layers [ c ] . height ? - 1 === this . layers [ c ] . data [ b ] [ a ] . index ? d ? this . layers [ c ] . data [ b ] [ a ] : null : this . layers [ c ] . data [ b ] [ a ] : null } , getTileWorldXY : function ( a , b , c , d , e ) { return "undefined" == typeof c && ( c = this . tileWidth ) , "undefined" == typeof d && ( d = this . tileHeight ) , e = this . getLayer ( e ) , a = this . game . math . snapToFloor ( a , c ) / c , b = this . game . math . snapToFloor ( b , d ) / d , this . getTile ( a , b , e ) } , copy : function ( a , b , c , d , e ) { if ( e = this . getLayer ( e ) , ! this . layers [ e ] ) return void ( this . _results . length = 0 ) ; "undefined" == typeof a && ( a = 0 ) , "undefined" == typeof b && ( b = 0 ) , "undefined" == typeof c && ( c = this . layers [ e ] . width ) , "undefined" == typeof d && ( d = this . layers [ e ] . height ) , 0 > a && ( a = 0 ) , 0 > b && ( b = 0 ) , c > this . layers [ e ] . width && ( c = this . layers [ e ] . width ) , d > this . layers [ e ] . height && ( d = this . layers [ e ] . height ) , this . _results . length = 0 , this . _results . push ( { x : a , y : b , width : c , height : d , layer : e } ) ; for ( var f = b ; b + d > f ; f ++ ) for ( var g = a ; a + c > g ; g ++ ) this . _results . push ( this . layers [ e ] . data [ f ] [ g ] ) ; return this . _results } , paste : function ( a , b , c , d ) { if ( "undefined" == typeof a && ( a = 0 ) , "undefined" == typeof b && ( b = 0 ) , d = this . getLayer ( d ) , c && ! ( c . length < 2 ) ) { for ( var e = c [ 1 ] . x - a , f = c [ 1 ] . y - b , g = 1 ; g < c . length ; g ++ ) this . layers [ d ] . data [ f + c [ g ] . y ] [ e + c [ g ] . x ] . copy ( c [ g ] ) ; this . layers [ d ] . dirty = ! 0 , this . calculateFaces ( d ) } } , swap : function ( a , b , c , d , e , f , g ) { g = this . getLayer ( g ) , this . copy ( c , d , e , f , g ) , this . _results . length < 2 || ( this . _tempA = a , this . _tempB = b , this . _results . forEach ( this . swapHandler , this ) , this . paste ( c , d , this . _results , g ) ) } , swapHandler : function ( a ) { a . index === this . _tempA ? a . index = this . _tempB : a . index === this . _tempB && ( a . index = this . _tempA ) } , forEach : function ( a , b , c , d , e , f , g ) { g = this . getLayer ( g ) , this . copy ( c , d , e , f , g ) , this . _results . length < 2 || ( this . _results . forEach ( a , b ) , this . paste ( c , d , this . _results , g ) ) } , replace : function ( a , b , c , d , e , f , g ) { if ( g = this . getLayer ( g ) , this . copy ( c , d , e , f , g ) , ! ( this . _results . length < 2 ) ) { for ( var h = 1 ; h < this . _results . length ; h ++ ) this . _results [ h ] . index === a && ( this . _results [ h ] . index = b ) ; this . paste ( c , d , this . _results , g ) } } , random : function ( a , b , c , d , e ) { if ( e = this . getLayer ( e ) , this . copy ( a , b , c , d , e ) , ! ( this . _results . length < 2 ) ) { for ( var f = [ ] , g = 1 ; g < this . _results . length ; g ++ ) if ( this . _results [ g ] . index ) { var h = this . _results [ g ] . index ; - 1 === f . indexOf ( h ) && f . push ( h ) } for ( var i = 1 ; i < this . _results . length ; i ++ ) this . _results [ i ] . index = this . game . rnd . pick ( f ) ; this . paste ( a , b , this . _results , e ) } } , shuffle : function ( a , c , d , e , f ) { if ( f = this . getLayer ( f ) , this . copy ( a , c , d , e , f ) , ! ( this . _results . length < 2 ) ) { for ( var g = [ ] , h = 1 ; h < this . _results . length ; h ++ ) this . _results [ h ] . index && g . push ( this . _results [ h ] . index ) ; b . Utils . shuffle ( g ) ; for ( var i = 1 ; i < this . _results . length ; i ++ ) this . _results [ i ] . index = g [ i - 1 ] ; this . paste ( a , c , this . _results , f ) } } , fill : function ( a , b , c , d , e , f ) { if ( f = this . getLayer ( f ) , this . copy ( b , c , d , e , f ) , ! ( this . _results . length < 2 ) ) { for ( var g = 1 ; g < this . _results . length ; g ++ ) this . _results [ g ] . index = a ; this . paste ( b , c , this . _results , f ) } } , removeAllLayers : function ( ) { this . layers . length = 0 , this . currentLayer = 0 } , dump : function ( ) { for ( var a = "" , b = [ "" ] , c = 0 ; c < this . layers [ this . currentLayer ] . height ; c ++ ) { for ( var d = 0 ; d < this . layers [ this . currentLayer ] . width ; d ++ ) a += "%c " , b . push ( this . layers [ this . currentLayer ] . data [ c ] [ d ] > 1 ? this . debugMap [ this . layers [ this . currentLayer ] . data [ c ] [ d ] ] ? "background: " + this . debugMap [ this . layers [ this . currentLayer ] . data [ c ] [ d ] ] : "background: #ffffff" : "background: rgb(0, 0, 0)" ) ; a += "\n" } b [ 0 ] = a , console . log . apply ( console , b ) } , destroy : function ( ) { this . removeAllLayers ( ) , this . data = [ ] , this . game = null } } , b . Tilemap . prototype . constructor = b . Tilemap , Object . defineProperty ( b . Tilemap . prototype , "layer" , { get : function ( ) { return this . layers [ this . currentLayer ] } , set : function ( a ) { a !== this . currentLayer && this . setLayer ( a ) } } ) , b . TilemapLayer = function ( a , c , d , e , f ) { this . game = a , this . map = c , this . index = d , this . layer = c . l
} function xb ( a , b , c ) { yb ( "number" == typeof a , "cannot write a non-number as a number" ) , yb ( b >= a , "value larger than maximum allowed value" ) , yb ( a >= c , "value smaller than minimum allowed value" ) } function yb ( a , b ) { if ( ! a ) throw new Error ( b || "Failed assertion" ) } var zb = a ( "typedarray" ) , Ab = "undefined" == typeof DataView ? zb . DataView : DataView , Bb = "undefined" == typeof ArrayBuffer ? zb . ArrayBuffer : ArrayBuffer , Cb = "undefined" == typeof Uint8Array ? zb . Uint8Array : Uint8Array ; c . Buffer = d , c . SlowBuffer = d , c . INSPECT _MAX _BYTES = 50 , d . poolSize = 8192 ; var Db ; d . isEncoding = function ( a ) { switch ( ( a + "" ) . toLowerCase ( ) ) { case "hex" : case "utf8" : case "utf-8" : case "ascii" : case "binary" : case "base64" : case "ucs2" : case "ucs-2" : case "utf16le" : case "utf-16le" : case "raw" : return ! 0 ; default : return ! 1 } } , d . isBuffer = function ( a ) { return a && a . _isBuffer } , d . byteLength = function ( a , b ) { switch ( b || "utf8" ) { case "hex" : return a . length / 2 ; case "utf8" : case "utf-8" : return qb ( a ) . length ; case "ascii" : case "binary" : return a . length ; case "base64" : return sb ( a ) . length ; default : throw new Error ( "Unknown encoding" ) } } , d . concat = function ( a , b ) { if ( ! Array . isArray ( a ) ) throw new Error ( "Usage: Buffer.concat(list, [totalLength])\nlist should be an Array." ) ; var c , e ; if ( 0 === a . length ) return new d ( 0 ) ; if ( 1 === a . length ) return a [ 0 ] ; if ( "number" != typeof b ) for ( b = 0 , c = 0 ; c < a . length ; c ++ ) e = a [ c ] , b += e . length ; var f = new d ( b ) , g = 0 ; for ( c = 0 ; c < a . length ; c ++ ) e = a [ c ] , e . copy ( f , g ) , g += e . length ; return f } , kb . prototype . write = j , kb . prototype . toString = k , kb . prototype . toLocaleString = k , kb . prototype . toJSON = l , kb . prototype . copy = m , kb . prototype . slice = s , kb . prototype . readUInt8 = t , kb . prototype . readUInt16LE = v , kb . prototype . readUInt16BE = w , kb . prototype . readUInt32LE = y , kb . prototype . readUInt32BE = z , kb . prototype . readInt8 = A , kb . prototype . readInt16LE = C , kb . prototype . readInt16BE = D , kb . prototype . readInt32LE = F , kb . prototype . readInt32BE = G , kb . prototype . readFloatLE = I , kb . prototype . readFloatBE = J , kb . prototype . readDoubleLE = L , kb . prototype . readDoubleBE = M , kb . prototype . writeUInt8 = N , kb . prototype . writeUInt16LE = P , kb . prototype . writeUInt16BE = Q , kb . prototype . writeUInt32LE = S , kb . prototype . writeUInt32BE = T , kb . prototype . writeInt8 = U , kb . prototype . writeInt16LE = W , kb . prototype . writeInt16BE = X , kb . prototype . writeInt32LE = Z , kb . prototype . writeInt32BE = $ , kb . prototype . writeFloatLE = ab , kb . prototype . writeFloatBE = bb , kb . prototype . writeDoubleLE = db , kb . prototype . writeDoubleBE = eb , kb . prototype . fill = fb , kb . prototype . inspect = gb , kb . prototype . toArrayBuffer = hb , kb . prototype . _isBuffer = ! 0 , kb . prototype . subarray = function ( ) { return this . _arr . subarray . apply ( this . _arr , arguments ) } , kb . prototype . set = function ( ) { return this . _arr . set . apply ( this . _arr , arguments ) } ; var Eb = { get : function ( a , b ) { return b in a ? a [ b ] : a . _arr [ b ] } , set : function ( a , b , c ) { a . _arr [ b ] = c } } } , { "base64-js" : 3 , typedarray : 4 } ] , "native-buffer-browserify" : [ function ( a , b ) { b . exports = a ( "PcZj9L" ) } , { } ] , 3 : [ function ( a , b ) { ! function ( ) { "use strict" ; function a ( a ) { var b , c , e , f , g , h ; if ( a . length % 4 > 0 ) throw "Invalid string. Length must be a multiple of 4" ; for ( g = a . indexOf ( "=" ) , g = g > 0 ? a . length - g : 0 , h = [ ] , e = g > 0 ? a . length - 4 : a . length , b = 0 , c = 0 ; e > b ; b += 4 , c += 3 ) f = d . indexOf ( a [ b ] ) << 18 | d . indexOf ( a [ b + 1 ] ) << 12 | d . indexOf ( a [ b + 2 ] ) << 6 | d . indexOf ( a [ b + 3 ] ) , h . push ( ( 16711680 & f ) >> 16 ) , h . push ( ( 65280 & f ) >> 8 ) , h . push ( 255 & f ) ; return 2 === g ? ( f = d . indexOf ( a [ b ] ) << 2 | d . indexOf ( a [ b + 1 ] ) >> 4 , h . push ( 255 & f ) ) : 1 === g && ( f = d . indexOf ( a [ b ] ) << 10 | d . indexOf ( a [ b + 1 ] ) << 4 | d . indexOf ( a [ b + 2 ] ) >> 2 , h . push ( f >> 8 & 255 ) , h . push ( 255 & f ) ) , h } function c ( a ) { function b ( a ) { return d [ a >> 18 & 63 ] + d [ a >> 12 & 63 ] + d [ a >> 6 & 63 ] + d [ 63 & a ] } var c , e , f , g = a . length % 3 , h = "" ; for ( c = 0 , f = a . length - g ; f > c ; c += 3 ) e = ( a [ c ] << 16 ) + ( a [ c + 1 ] << 8 ) + a [ c + 2 ] , h += b ( e ) ; switch ( g ) { case 1 : e = a [ a . length - 1 ] , h += d [ e >> 2 ] , h += d [ e << 4 & 63 ] , h += "==" ; break ; case 2 : e = ( a [ a . length - 2 ] << 8 ) + a [ a . length - 1 ] , h += d [ e >> 10 ] , h += d [ e >> 4 & 63 ] , h += d [ e << 2 & 63 ] , h += "=" } return h } var d = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" ; b . exports . toByteArray = a , b . exports . fromByteArray = c } ( ) } , { } ] , 4 : [ function ( a , b , c ) { function d ( a ) { if ( L && K ) { var b , c = L ( a ) ; for ( b = 0 ; b < c . length ; b += 1 ) K ( a , c [ b ] , { value : a [ c [ b ] ] , writable : ! 1 , enumerable : ! 1 , configurable : ! 1 } ) } } function e ( a ) { function b ( b ) { K ( a , b , { get : function ( ) { return a . _getter ( b ) } , set : function ( c ) { a . _setter ( b , c ) } , enumerable : ! 0 , configurable : ! 1 } ) } if ( K ) { if ( a . length > B ) throw new RangeError ( " Array
var n = this . circleConvex ( g , h , l , j , a , b , c , e , k , h . radius ) ; if ( k && ( m || n ) ) return ! 0 ; var o = M ; d ( o , h ) ; var p = this . convexConvex ( a , b , c , e , g , o , i , j , k ) ; return p + m + n } , c . prototype [ q . CAPSULE | q . LINE ] = c . prototype . lineCapsule = function ( a , b , c , d , e , f , g , h , i ) { return i ? ! 1 : 0 } ; var O = f . create ( ) , P = f . create ( ) , Q = new r ( 1 , 1 ) ; c . prototype [ q . CAPSULE | q . CAPSULE ] = c . prototype . capsuleCapsule = function ( a , b , c , e , g , h , i , j , k ) { for ( var l , m = O , n = P , o = 0 , p = 0 ; 2 > p ; p ++ ) { f . set ( m , ( 0 === p ? - 1 : 1 ) * b . length / 2 , 0 ) , f . rotate ( m , m , e ) , f . add ( m , m , c ) ; for ( var q = 0 ; 2 > q ; q ++ ) { f . set ( n , ( 0 === q ? - 1 : 1 ) * h . length / 2 , 0 ) , f . rotate ( n , n , j ) , f . add ( n , n , i ) , this . enableFrictionReduction && ( l = this . enableFriction , this . enableFriction = ! 1 ) ; var r = this . circleCircle ( a , b , m , e , g , h , n , j , k , b . radius , h . radius ) ; if ( this . enableFrictionReduction && ( this . enableFriction = l ) , k && r ) return ! 0 ; o += r } } this . enableFrictionReduction && ( l = this . enableFriction , this . enableFriction = ! 1 ) ; var s = Q ; d ( s , b ) ; var t = this . convexCapsule ( a , s , c , e , g , h , i , j , k ) ; if ( this . enableFrictionReduction && ( this . enableFriction = l ) , k && t ) return ! 0 ; if ( o += t , this . enableFrictionReduction ) { var l = this . enableFriction ; this . enableFriction = ! 1 } d ( s , h ) ; var u = this . convexCapsule ( g , s , i , j , a , b , c , e , k ) ; return this . enableFrictionReduction && ( this . enableFriction = l ) , k && u ? ! 0 : ( o += u , this . enableFrictionReduction && o && this . enableFriction && this . frictionEquations . push ( this . createFrictionFromAverage ( o ) ) , o ) } , c . prototype [ q . LINE | q . LINE ] = c . prototype . lineLine = function ( a , b , c , d , e , f , g , h , i ) { return i ? ! 1 : 0 } , c . prototype [ q . PLANE | q . LINE ] = c . prototype . planeLine = function ( a , b , c , d , e , j , k , l , m ) { var n = t , o = u , p = v , q = w , r = x , C = y , D = z , E = A , F = B , G = L , H = 0 ; f . set ( n , - j . length / 2 , 0 ) , f . set ( o , j . length / 2 , 0 ) , f . rotate ( p , n , l ) , f . rotate ( q , o , l ) , h ( p , p , k ) , h ( q , q , k ) , f . copy ( n , p ) , f . copy ( o , q ) , g ( r , o , n ) , f . normalize ( C , r ) , f . rotate90cw ( F , C ) , f . rotate ( E , s , d ) , G [ 0 ] = n , G [ 1 ] = o ; for ( var I = 0 ; I < G . length ; I ++ ) { var J = G [ I ] ; g ( D , J , c ) ; var K = i ( D , E ) ; if ( 0 > K ) { if ( m ) return ! 0 ; var M = this . createContactEquation ( a , e , b , j ) ; H ++ , f . copy ( M . normalA , E ) , f . normalize ( M . normalA , M . normalA ) , f . scale ( D , E , K ) , g ( M . contactPointA , J , D ) , g ( M . contactPointA , M . contactPointA , a . position ) , g ( M . contactPointB , J , k ) , h ( M . contactPointB , M . contactPointB , k ) , g ( M . contactPointB , M . contactPointB , e . position ) , this . contactEquations . push ( M ) , this . enableFrictionReduction || this . enableFriction && this . frictionEquations . push ( this . createFrictionFromContact ( M ) ) } } return m ? ! 1 : ( this . enableFrictionReduction || H && this . enableFriction && this . frictionEquations . push ( this . createFrictionFromAverage ( H ) ) , H ) } , c . prototype [ q . PARTICLE | q . CAPSULE ] = c . prototype . particleCapsule = function ( a , b , c , d , e , f , g , h , i ) { return this . circleLine ( a , b , c , d , e , f , g , h , i , f . radius , 0 ) } , c . prototype [ q . CIRCLE | q . LINE ] = c . prototype . circleLine = function ( a , b , c , d , e , j , k , l , m , n , o ) { var n = n || 0 , o = "undefined" != typeof o ? o : b . radius , p = t , q = u , r = v , s = w , H = x , I = y , J = z , K = A , M = B , N = C , O = D , P = E , Q = F , R = G , S = L ; f . set ( K , - j . length / 2 , 0 ) , f . set ( M , j . length / 2 , 0 ) , f . rotate ( N , K , l ) , f . rotate ( O , M , l ) , h ( N , N , k ) , h ( O , O , k ) , f . copy ( K , N ) , f . copy ( M , O ) , g ( I , M , K ) , f . normalize ( J , I ) , f . rotate90cw ( H , J ) , g ( P , c , K ) ; var T = i ( P , H ) ; g ( s , K , k ) , g ( Q , c , k ) ; var U = o + n ; if ( Math . abs ( T ) < U ) { f . scale ( p , H , T ) , g ( r , c , p ) , f . scale ( q , H , i ( H , Q ) ) , f . normalize ( q , q ) , f . scale ( q , q , n ) , h ( r , r , q ) ; var V = i ( J , r ) , W = i ( J , K ) , X = i ( J , M ) ; if ( V > W && X > V ) { if ( m ) return ! 0 ; var Y = this . createContactEquation ( a , e , b , j ) ; return f . scale ( Y . normalA , p , - 1 ) , f . normalize ( Y . normalA , Y . normalA ) , f . scale ( Y . contactPointA , Y . normalA , o ) , h ( Y . contactPointA , Y . contactPointA , c ) , g ( Y . contactPointA , Y . contactPointA , a . position ) , g ( Y . contactPointB , r , k ) , h ( Y . contactPointB , Y . contactPointB , k ) , g ( Y . contactPointB , Y . contactPointB , e . position ) , this . contactEquations . push ( Y ) , this . enableFriction && this . frictionEquations . push ( this . createFrictionFromContact ( Y ) ) , 1 } } S [ 0 ] = K , S [ 1 ] = M ; for ( var Z = 0 ; Z < S . length ; Z ++ ) { var $ = S [ Z ] ; if ( g ( P , $ , c ) , f . squaredLength ( P ) < Math . pow ( U , 2 ) ) { if ( m ) return ! 0 ; var Y = this . createContactEquation ( a , e , b , j ) ; return f . copy ( Y . normalA , P ) , f . normalize ( Y . normalA , Y . normalA ) , f . scale ( Y . contactPointA , Y . normalA , o ) , h ( Y . contactPointA , Y . contactPointA , c ) , g ( Y . contactPointA , Y . contactPointA , a . position ) , g ( Y . contactPointB , $ , k ) , f . scale ( R , Y . normalA , - n ) , h ( Y . contactPointB , Y . contactPointB , R ) , h ( Y . contactPointB , Y . contactPointB , k ) , g ( Y . contactPointB , Y . contactPointB , e . position ) , this . contactEquations . push ( Y ) , this . enableFriction && this . frict
} } , { "../math/vec2" : 31 , "./Equation" : 23 , _ _browserify _Buffer : 1 , _ _browserify _process : 2 } ] , 22 : [ function ( a , b ) { function c ( a , b ) { d . call ( this , a , b , 0 , Number . MAX _VALUE ) , this . contactPointA = e . create ( ) , this . penetrationVec = e . create ( ) , this . contactPointB = e . create ( ) , this . normalA = e . create ( ) , this . restitution = 0 , this . firstImpact = ! 1 , this . shapeA = null , this . shapeB = null } var d = ( a ( "__browserify_process" ) , a ( "__browserify_Buffer" ) , a ( "./Equation" ) ) , e = a ( "../math/vec2" ) ; b . exports = c , c . prototype = new d , c . prototype . constructor = c , c . prototype . computeB = function ( a , b , c ) { var d = this . bodyA , f = this . bodyB , g = this . contactPointA , h = this . contactPointB , i = d . position , j = f . position , k = this . penetrationVec , l = this . normalA , m = this . G , n = e . crossLength ( g , l ) , o = e . crossLength ( h , l ) ; m [ 0 ] = - l [ 0 ] , m [ 1 ] = - l [ 1 ] , m [ 2 ] = - n , m [ 3 ] = l [ 0 ] , m [ 4 ] = l [ 1 ] , m [ 5 ] = o , e . add ( k , j , h ) , e . sub ( k , k , i ) , e . sub ( k , k , g ) ; var p , q ; this . firstImpact && 0 !== this . restitution ? ( q = 0 , p = 1 / b * ( 1 + this . restitution ) * this . computeGW ( ) ) : ( q = e . dot ( l , k ) + this . offset , p = this . computeGW ( ) ) ; var r = this . computeGiMf ( ) , s = - q * a - p * b - c * r ; return s } } , { "../math/vec2" : 31 , "./Equation" : 23 , _ _browserify _Buffer : 1 , _ _browserify _process : 2 } ] , 23 : [ function ( a , b ) { function c ( a , b , d , f ) { this . minForce = "undefined" == typeof d ? - Number . MAX _VALUE : d , this . maxForce = "undefined" == typeof f ? Number . MAX _VALUE : f , this . bodyA = a , this . bodyB = b , this . stiffness = c . DEFAULT _STIFFNESS , this . relaxation = c . DEFAULT _RELAXATION , this . G = new e . ARRAY _TYPE ( 6 ) ; for ( var g = 0 ; 6 > g ; g ++ ) this . G [ g ] = 0 ; this . offset = 0 , this . a = 0 , this . b = 0 , this . epsilon = 0 , this . timeStep = 1 / 60 , this . needsUpdate = ! 0 , this . multiplier = 0 , this . relativeVelocity = 0 , this . enabled = ! 0 } a ( "__browserify_process" ) , a ( "__browserify_Buffer" ) ; b . exports = c ; { var d = a ( "../math/vec2" ) , e = a ( "../utils/Utils" ) ; a ( "../objects/Body" ) } c . prototype . constructor = c , c . DEFAULT _STIFFNESS = 1e6 , c . DEFAULT _RELAXATION = 4 , c . prototype . update = function ( ) { var a = this . stiffness , b = this . relaxation , c = this . timeStep ; this . a = 4 / ( c * ( 1 + 4 * b ) ) , this . b = 4 * b / ( 1 + 4 * b ) , this . epsilon = 4 / ( c * c * a * ( 1 + 4 * b ) ) , this . needsUpdate = ! 1 } , c . prototype . gmult = function ( a , b , c , d , e ) { return a [ 0 ] * b [ 0 ] + a [ 1 ] * b [ 1 ] + a [ 2 ] * c + a [ 3 ] * d [ 0 ] + a [ 4 ] * d [ 1 ] + a [ 5 ] * e } , c . prototype . computeB = function ( a , b , c ) { var d = this . computeGW ( ) , e = this . computeGq ( ) , f = this . computeGiMf ( ) ; return - e * a - d * b - f * c } ; var f = d . create ( ) , g = d . create ( ) ; c . prototype . computeGq = function ( ) { var a = this . G , b = this . bodyA , c = this . bodyB , d = ( b . position , c . position , b . angle ) , e = c . angle ; return this . gmult ( a , f , d , g , e ) + this . offset } , c . prototype . 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 ) + this . relativeVelocity } , c . prototype . computeGWlambda = function ( ) { var a = this . G , b = this . bodyA , c = this . bodyB , d = b . vlambda , e = c . vlambda , f = b . wlambda , g = c . wlambda ; return this . gmult ( a , d , f , e , g ) } ; var h = d . create ( ) , i = d . create ( ) ; c . prototype . computeGiMf = function ( ) { var a = this . bodyA , b = this . bodyB , c = a . force , e = a . angularForce , f = b . force , g = b . angularForce , j = a . invMassSolve , k = b . invMassSolve , l = a . invInertiaSolve , m = b . invInertiaSolve , n = this . G ; return d . scale ( h , c , j ) , d . scale ( i , f , k ) , this . gmult ( n , h , e * l , i , g * m ) } , c . prototype . computeGiMGt = function ( ) { var a = this . bodyA , b = this . bodyB , c = a . invMassSolve , d = b . invMassSolve , e = a . invInertiaSolve , f = b . invInertiaSolve , g = this . G ; return g [ 0 ] * g [ 0 ] * c + g [ 1 ] * g [ 1 ] * c + g [ 2 ] * g [ 2 ] * e + g [ 3 ] * g [ 3 ] * d + g [ 4 ] * g [ 4 ] * d + g [ 5 ] * g [ 5 ] * f } ; { var j = d . create ( ) , k = d . create ( ) , l = d . create ( ) ; d . create ( ) , d . create ( ) , d . create ( ) } c . prototype . addToWlambda = function ( a ) { var b = this . bodyA , c = this . bodyB , e = j , f = k , g = l , h = b . invMassSolve , i = c . invMassSolve , m = b . invInertiaSolve , n = c . invInertiaSolve , o = this . G ; f [ 0 ] = o [ 0 ] , f [ 1 ] = o [ 1 ] , g [ 0 ] = o [ 3 ] , g [ 1 ] = o [ 4 ] , d . scale ( e , f , h * a ) , d . add ( b . vlambda , b . vlambda , e ) , b . wlambda += m * o [ 2 ] * a , d . scale ( e , g , i * a ) , d . add ( c . vlambda , c . vlambda , e ) , c . wlambda += n * o [ 5 ] * a } , c . prototype . computeInvC = function ( a ) { return 1 / ( this . computeGiMGt ( ) + a ) } } , { "../math/vec2" : 31 , "../objects/Body" : 32 , "../utils/Utils" : 50 , _ _browserify _Buffer : 1 , _ _browserify _process : 2 } ] , 24 : [ function ( a , b ) { function c ( a , b , c ) { e . call ( this , a , b , - c , c ) , this . contactPointA = d . create ( ) , this . contactPointB = d . create ( ) , this . t = d . create ( ) , this . contactEquations = [ ] , this . shapeA = null , this . shapeB = null , this . frictionCoefficient = . 3 } { var d = ( a ( "__browserify_process" ) , a ( "__browserify_Buffer" ) , a ( "../math/vec2" ) ) , e = a ( "
} ; d . create ( ) , d . create ( ) , d . create ( ) , d . create ( ) ; c . prototype . computeAABB = function ( a , b , c ) { a . setFromPoints ( this . vertices , b , c , 0 ) } , c . prototype . updateArea = function ( ) { this . area = this . width * this . height } } , { "../math/vec2" : 31 , "./Convex" : 39 , "./Shape" : 45 , _ _browserify _Buffer : 1 , _ _browserify _process : 2 } ] , 45 : [ function ( a , b ) { function c ( a ) { this . type = a , this . id = c . idCounter ++ , this . boundingRadius = 0 , this . collisionGroup = 1 , this . collisionMask = 1 , a && this . updateBoundingRadius ( ) , this . material = null , this . area = 0 , this . sensor = ! 1 , this . updateArea ( ) } a ( "__browserify_process" ) , a ( "__browserify_Buffer" ) ; b . exports = c , c . idCounter = 0 , c . CIRCLE = 1 , c . PARTICLE = 2 , c . PLANE = 4 , c . CONVEX = 8 , c . LINE = 16 , c . RECTANGLE = 32 , c . CAPSULE = 64 , c . HEIGHTFIELD = 128 , c . prototype . computeMomentOfInertia = function ( ) { throw new Error ( "Shape.computeMomentOfInertia is not implemented in this Shape..." ) } , c . prototype . updateBoundingRadius = function ( ) { throw new Error ( "Shape.updateBoundingRadius is not implemented in this Shape..." ) } , c . prototype . updateArea = function ( ) { } , c . prototype . computeAABB = function ( ) { } } , { _ _browserify _Buffer : 1 , _ _browserify _process : 2 } ] , 46 : [ function ( a , b ) { function c ( a ) { f . call ( this , a , f . GS ) , a = a || { } , this . iterations = a . iterations || 10 , this . tolerance = a . tolerance || 1e-10 , this . arrayStep = 30 , this . lambda = new g . ARRAY _TYPE ( this . arrayStep ) , this . Bs = new g . ARRAY _TYPE ( this . arrayStep ) , this . invCs = new g . ARRAY _TYPE ( this . arrayStep ) , this . useZeroRHS = ! 1 , this . frictionIterations = 0 , this . usedIterations = 0 } function d ( a ) { for ( var b = a . length ; b -- ; ) a [ b ] = 0 } var e = ( a ( "__browserify_process" ) , a ( "__browserify_Buffer" ) , a ( "../math/vec2" ) ) , f = a ( "./Solver" ) , g = a ( "../utils/Utils" ) , h = a ( "../equations/FrictionEquation" ) ; b . exports = c , c . prototype = new f , c . prototype . solve = function ( a , b ) { this . sortEquations ( ) ; var f = 0 , i = this . iterations , j = this . frictionIterations , k = this . equations , l = k . length , m = Math . pow ( this . tolerance * l , 2 ) , n = b . bodies , o = b . bodies . length , p = ( e . add , e . set , this . useZeroRHS ) , q = this . lambda ; if ( this . usedIterations = 0 , l ) for ( var r = 0 ; r !== o ; r ++ ) { var s = n [ r ] ; s . updateSolveMassProperties ( ) } q . length < l && ( q = this . lambda = new g . ARRAY _TYPE ( l + this . arrayStep ) , this . Bs = new g . ARRAY _TYPE ( l + this . arrayStep ) , this . invCs = new g . ARRAY _TYPE ( l + this . arrayStep ) ) , d ( q ) ; for ( var t = this . invCs , u = this . Bs , q = this . lambda , r = 0 ; r !== k . length ; r ++ ) { var v = k [ r ] ; ( v . timeStep !== a || v . needsUpdate ) && ( v . timeStep = a , v . update ( ) ) , u [ r ] = v . computeB ( v . a , v . b , a ) , t [ r ] = v . computeInvC ( v . epsilon ) } var v , w , r , x ; if ( 0 !== l ) { for ( r = 0 ; r !== o ; r ++ ) { var s = n [ r ] ; s . resetConstraintVelocity ( ) } if ( j ) { for ( f = 0 ; f !== j ; f ++ ) { for ( w = 0 , x = 0 ; x !== l ; x ++ ) { v = k [ x ] ; var y = c . iterateEquation ( x , v , v . epsilon , u , t , q , p , a , f ) ; w += Math . abs ( y ) } if ( this . usedIterations ++ , m >= w * w ) break } for ( c . updateMultipliers ( k , q , 1 / a ) , x = 0 ; x !== l ; x ++ ) { var z = k [ x ] ; if ( z instanceof h ) { for ( var A = 0 , B = 0 ; B !== z . contactEquations . length ; B ++ ) A += z . contactEquations [ B ] . multiplier ; A *= z . frictionCoefficient / z . contactEquations . length , z . maxForce = A , z . minForce = - A } } } for ( f = 0 ; f !== i ; f ++ ) { for ( w = 0 , x = 0 ; x !== l ; x ++ ) { v = k [ x ] ; var y = c . iterateEquation ( x , v , v . epsilon , u , t , q , p , a , f ) ; w += Math . abs ( y ) } if ( this . usedIterations ++ , m >= w * w ) break } for ( r = 0 ; r !== o ; r ++ ) n [ r ] . addConstraintVelocity ( ) ; c . updateMultipliers ( k , q , 1 / a ) } } , c . updateMultipliers = function ( a , b , c ) { for ( var d = a . length ; d -- ; ) a [ d ] . multiplier = b [ d ] * c } , c . iterateEquation = function ( a , b , c , d , e , f , g , h ) { var i = d [ a ] , j = e [ a ] , k = f [ a ] , l = b . computeGWlambda ( ) , m = b . maxForce , n = b . minForce ; g && ( i = 0 ) ; var o = j * ( i - l - c * k ) , p = k + o ; return n * h > p ? o = n * h - k : p > m * h && ( o = m * h - k ) , f [ a ] += o , b . addToWlambda ( o ) , o } } , { "../equations/FrictionEquation" : 24 , "../math/vec2" : 31 , "../utils/Utils" : 50 , "./Solver" : 47 , _ _browserify _Buffer : 1 , _ _browserify _process : 2 } ] , 47 : [ function ( a , b ) { function c ( a , b ) { a = a || { } , d . call ( this ) , this . type = b , this . equations = [ ] , this . equationSortFunction = a . equationSortFunction || ! 1 } var d = ( a ( "__browserify_process" ) , a ( "__browserify_Buffer" ) , a ( "../utils/Utils" ) , a ( "../events/EventEmitter" ) ) ; b . exports = c , c . prototype = new d , c . prototype . solve = function ( ) { throw new Error ( "Solver.solve should be implemented by subclasses!" ) } ; var e = { bodies : [ ] } ; c . prototype . solveIsland = function ( a , b ) { this . removeAllEquations ( ) , b . equations . length && ( this . addEquations ( b . equations ) , e . bodies . length = 0 , b . getBodies ( e . bodies ) , e . bodies . length && this . solve ( a , e ) ) } , c . prototype . sortEquations = function ( ) { this
} , pause : function ( ) { this . paused = ! 0 } , resume : function ( ) { this . paused = ! 1 } , update : function ( ) { this . paused || this . world . step ( this . useElapsedTime ? this . game . time . physicsElapsed : this . frameRate ) } , clear : function ( ) { this . world . clear ( ) , this . world . off ( "beginContact" , this . beginContactHandler , this ) , this . world . off ( "endContact" , this . endContactHandler , this ) , this . postBroadphaseCallback = null , this . callbackContext = null , this . impactCallback = null , this . collisionGroups = [ ] , this . _toRemove = [ ] , this . _collisionGroupID = 2 , this . boundsCollidesWith = [ ] } , destroy : function ( ) { this . clear ( ) , this . game = null } , addBody : function ( a ) { return a . data . world ? ! 1 : ( this . world . addBody ( a . data ) , this . onBodyAdded . dispatch ( a ) , ! 0 ) } , removeBody : function ( a ) { return a . data . world == this . world && ( this . world . removeBody ( a . data ) , this . onBodyRemoved . dispatch ( a ) ) , a } , addSpring : function ( a ) { return this . world . addSpring ( a instanceof Phaser . Physics . P2 . Spring || a instanceof Phaser . Physics . P2 . RotationalSpring ? a . data : a ) , this . onSpringAdded . dispatch ( a ) , a } , removeSpring : function ( a ) { return this . world . removeSpring ( a instanceof Phaser . Physics . P2 . Spring || a instanceof Phaser . Physics . P2 . RotationalSpring ? a . data : a ) , this . onSpringRemoved . dispatch ( a ) , a } , createDistanceConstraint : function ( a , b , c , d ) { return a = this . getBody ( a ) , b = this . getBody ( b ) , a && b ? this . addConstraint ( new Phaser . Physics . P2 . DistanceConstraint ( this , a , b , c , d ) ) : void console . warn ( "Cannot create Constraint, invalid body objects given" ) } , createGearConstraint : function ( a , b , c , d ) { return a = this . getBody ( a ) , b = this . getBody ( b ) , a && b ? this . addConstraint ( new Phaser . Physics . P2 . GearConstraint ( this , a , b , c , d ) ) : void console . warn ( "Cannot create Constraint, invalid body objects given" ) } , createRevoluteConstraint : function ( a , b , c , d , e , f ) { return a = this . getBody ( a ) , c = this . getBody ( c ) , a && c ? this . addConstraint ( new Phaser . Physics . P2 . RevoluteConstraint ( this , a , b , c , d , e , f ) ) : void console . warn ( "Cannot create Constraint, invalid body objects given" ) } , createLockConstraint : function ( a , b , c , d , e ) { return a = this . getBody ( a ) , b = this . getBody ( b ) , a && b ? this . addConstraint ( new Phaser . Physics . P2 . LockConstraint ( this , a , b , c , d , e ) ) : void console . warn ( "Cannot create Constraint, invalid body objects given" ) } , createPrismaticConstraint : function ( a , b , c , d , e , f , g ) { return a = this . getBody ( a ) , b = this . getBody ( b ) , a && b ? this . addConstraint ( new Phaser . Physics . P2 . PrismaticConstraint ( this , a , b , c , d , e , f , g ) ) : void console . warn ( "Cannot create Constraint, invalid body objects given" ) } , addConstraint : function ( a ) { return this . world . addConstraint ( a ) , this . onConstraintAdded . dispatch ( a ) , a } , removeConstraint : function ( a ) { return this . world . removeConstraint ( a ) , this . onConstraintRemoved . dispatch ( a ) , a } , addContactMaterial : function ( a ) { return this . world . addContactMaterial ( a ) , this . onContactMaterialAdded . dispatch ( a ) , a } , removeContactMaterial : function ( a ) { return this . world . removeContactMaterial ( a ) , this . onContactMaterialRemoved . dispatch ( a ) , a } , getContactMaterial : function ( a , b ) { return this . world . getContactMaterial ( a , b ) } , setMaterial : function ( a , b ) { for ( var c = b . length ; c -- ; ) b [ c ] . setMaterial ( a ) } , createMaterial : function ( a , b ) { a = a || "" ; var c = new Phaser . Physics . P2 . Material ( a ) ; return this . materials . push ( c ) , "undefined" != typeof b && b . setMaterial ( c ) , c } , createContactMaterial : function ( a , b , c ) { "undefined" == typeof a && ( a = this . createMaterial ( ) ) , "undefined" == typeof b && ( b = this . createMaterial ( ) ) ; var d = new Phaser . Physics . P2 . ContactMaterial ( a , b , c ) ; return this . addContactMaterial ( d ) } , getBodies : function ( ) { for ( var a = [ ] , b = this . world . bodies . length ; b -- ; ) a . push ( this . world . bodies [ b ] . parent ) ; return a } , getBody : function ( a ) { return a instanceof p2 . Body ? a : a instanceof Phaser . Physics . P2 . Body ? a . data : a . body && a . body . type === Phaser . Physics . P2JS ? a . body . data : null } , getSprings : function ( ) { for ( var a = [ ] , b = this . world . springs . length ; b -- ; ) a . push ( this . world . springs [ b ] . parent ) ; return a } , getConstraints : function ( ) { for ( var a = [ ] , b = this . world . constraints . length ; b -- ; ) a . push ( this . world . constraints [ b ] . parent ) ; return a } , hitTest : function ( a , b , c , d ) { "undefined" == typeof b && ( b = this . world . bodies ) , "undefined" == typeof c && ( c = 5 ) , "undefined" == typeof d && ( d = ! 1 ) ; for ( var e = [ this . pxmi ( a . x ) , this . pxmi ( a . y ) ] , f = [ ] , g = b . length ; g -- ; ) b [ g ] instanceof Phaser . Physics . P2 . Body && ( ! d || b [ g ] . data . type
var h = { distance : d , localAnchorA : e , localAnchorB : f , maxForce : g } ; p2 . DistanceConstraint . call ( this , b , c , h ) } , Phaser . Physics . P2 . DistanceConstraint . prototype = Object . create ( p2 . DistanceConstraint . prototype ) , Phaser . Physics . P2 . DistanceConstraint . prototype . constructor = Phaser . Physics . P2 . DistanceConstraint , Phaser . Physics . P2 . GearConstraint = function ( a , b , c , d , e ) { "undefined" == typeof d && ( d = 0 ) , "undefined" == typeof e && ( e = 1 ) , this . game = a . game , this . world = a ; var f = { angle : d , ratio : e } ; p2 . GearConstraint . call ( this , b , c , f ) } , Phaser . Physics . P2 . GearConstraint . prototype = Object . create ( p2 . GearConstraint . prototype ) , Phaser . Physics . P2 . GearConstraint . prototype . constructor = Phaser . Physics . P2 . GearConstraint , Phaser . Physics . P2 . LockConstraint = function ( a , b , c , d , e , f ) { "undefined" == typeof d && ( d = [ 0 , 0 ] ) , "undefined" == typeof e && ( e = 0 ) , "undefined" == typeof f && ( f = Number . MAX _VALUE ) , this . game = a . game , this . world = a , d = [ a . pxm ( d [ 0 ] ) , a . pxm ( d [ 1 ] ) ] ; var g = { localOffsetB : d , localAngleB : e , maxForce : f } ; p2 . LockConstraint . call ( this , b , c , g ) } , Phaser . Physics . P2 . LockConstraint . prototype = Object . create ( p2 . LockConstraint . prototype ) , Phaser . Physics . P2 . LockConstraint . prototype . constructor = Phaser . Physics . P2 . LockConstraint , Phaser . Physics . P2 . PrismaticConstraint = function ( a , b , c , d , e , f , g , h ) { "undefined" == typeof d && ( d = ! 0 ) , "undefined" == typeof e && ( e = [ 0 , 0 ] ) , "undefined" == typeof f && ( f = [ 0 , 0 ] ) , "undefined" == typeof g && ( g = [ 0 , 0 ] ) , "undefined" == typeof h && ( h = Number . MAX _VALUE ) , this . game = a . game , this . world = a , e = [ a . pxmi ( e [ 0 ] ) , a . pxmi ( e [ 1 ] ) ] , f = [ a . pxmi ( f [ 0 ] ) , a . pxmi ( f [ 1 ] ) ] ; var i = { localAnchorA : e , localAnchorB : f , localAxisA : g , maxForce : h , disableRotationalLock : ! d } ; p2 . PrismaticConstraint . call ( this , b , c , i ) } , Phaser . Physics . P2 . PrismaticConstraint . prototype = Object . create ( p2 . PrismaticConstraint . prototype ) , Phaser . Physics . P2 . PrismaticConstraint . prototype . constructor = Phaser . Physics . P2 . PrismaticConstraint , Phaser . Physics . P2 . RevoluteConstraint = function ( a , b , c , d , e , f , g ) { "undefined" == typeof f && ( f = Number . MAX _VALUE ) , "undefined" == typeof g && ( g = null ) , this . game = a . game , this . world = a , c = [ a . pxmi ( c [ 0 ] ) , a . pxmi ( c [ 1 ] ) ] , e = [ a . pxmi ( e [ 0 ] ) , a . pxmi ( e [ 1 ] ) ] , g && ( g = [ a . pxmi ( g [ 0 ] ) , a . pxmi ( g [ 1 ] ) ] ) ; var h = { worldPivot : g , localPivotA : c , localPivotB : e , maxForce : f } ; p2 . RevoluteConstraint . call ( this , b , d , h ) } , Phaser . Physics . P2 . RevoluteConstraint . prototype = Object . create ( p2 . RevoluteConstraint . prototype ) , Phaser . Physics . P2 . RevoluteConstraint . prototype . constructor = Phaser . Physics . P2 . RevoluteConstraint ;
2014-02-28 09:30:53 +00:00
//# sourceMappingURL=phaser.map