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 )
2014-09-01 02:56:40 +00:00
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
} , b . Stage . prototype . update = function ( ) { for ( var a = this . children . length ; a -- ; ) this . children [ a ] . update ( ) } , b . Stage . prototype . postUpdate = function ( ) { if ( this . game . world . camera . target ) { this . game . world . camera . target . postUpdate ( ) , this . game . world . camera . update ( ) ; for ( var a = this . children . length ; a -- ; ) this . children [ a ] !== this . game . world . camera . target && this . children [ a ] . postUpdate ( ) } else { this . game . world . camera . update ( ) ; for ( var a = this . children . length ; a -- ; ) this . children [ a ] . postUpdate ( ) } } , b . Stage . prototype . checkVisibility = function ( ) { this . _hiddenVar = void 0 !== document . webkitHidden ? "webkitvisibilitychange" : void 0 !== document . mozHidden ? "mozvisibilitychange" : void 0 !== document . msHidden ? "msvisibilitychange" : void 0 !== document . hidden ? "visibilitychange" : null , this . _hiddenVar && document . addEventListener ( this . _hiddenVar , this . _onChange , ! 1 ) , window . onpagehide = this . _onChange , window . onpageshow = this . _onChange , window . onblur = this . _onChange , window . onfocus = this . _onChange ; var a = this ; this . game . device . cocoonJSApp && ( CocoonJS . App . onSuspended . addEventListener ( function ( ) { b . Stage . prototype . visibilityChange . call ( a , { type : "pause" } ) } ) , CocoonJS . App . onActivated . addEventListener ( function ( ) { b . Stage . prototype . visibilityChange . call ( a , { type : "resume" } ) } ) ) } , b . Stage . prototype . visibilityChange = function ( a ) { return "pagehide" === a . type || "blur" === a . type || "pageshow" === a . type || "focus" === a . type ? void ( "pagehide" === a . type || "blur" === a . type ? this . game . focusLoss ( a ) : ( "pageshow" === a . type || "focus" === a . type ) && this . game . focusGain ( a ) ) : void ( this . disableVisibilityChange || ( document . hidden || document . mozHidden || document . msHidden || document . webkitHidden || "pause" === a . type ? this . game . gamePaused ( a ) : this . game . gameResumed ( a ) ) ) } , b . Stage . prototype . setBackgroundColor = function ( a ) { if ( "string" == typeof a ) { var c = b . Color . hexToColor ( a ) ; this . _backgroundColor = b . Color . getColor ( c . r , c . g , c . b ) } else { var c = b . Color . getRGB ( a ) ; this . _backgroundColor = a } this . backgroundColorSplit = [ c . r / 255 , c . g / 255 , c . b / 255 ] , this . backgroundColorString = b . Color . RGBtoString ( c . r , c . g , c . b , 255 , "#" ) } , b . Stage . prototype . destroy = function ( ) { this . _hiddenVar && document . removeEventListener ( this . _hiddenVar , this . _onChange , ! 1 ) , window . onpagehide = null , window . onpageshow = null , window . onblur = null , window . onfocus = null } , Object . defineProperty ( b . Stage . prototype , "backgroundColor" , { get : function ( ) { return this . _backgroundColor } , set : function ( a ) { this . game . transparent || this . setBackgroundColor ( a ) } } ) , Object . defineProperty ( b . Stage . prototype , "smoothed" , { get : function ( ) { return ! PIXI . scaleModes . LINEAR } , set : function ( a ) { PIXI . scaleModes . LINEAR = a ? 0 : 1 } } ) , b . Group = function ( a , c , d , e , f , g ) { "undefined" == typeof e && ( e = ! 1 ) , "undefined" == typeof f && ( f = ! 1 ) , "undefined" == typeof g && ( g = b . Physics . ARCADE ) , this . game = a , "undefined" == typeof c && ( c = a . world ) , this . name = d || "group" , PIXI . DisplayObjectContainer . call ( this ) , e ? this . game . stage . addChild ( this ) : c && c . addChild ( this ) , this . z = 0 , this . type = b . GROUP , this . alive = ! 0 , this . exists = ! 0 , this . classType = b . Sprite , this . scale = new b . Point ( 1 , 1 ) , this . cursor = null , this . cameraOffset = new b . Point , this . enableBody = f , this . enableBodyDebug = ! 1 , this . physicsBodyType = g , this . onDestroy = new b . Signal , this . _sortProperty = "z" , this . _cache = [ 0 , 0 , 0 , 0 , 1 , 0 , 1 , 0 , 0 , 0 ] } , b . Group . prototype = Object . create ( PIXI . DisplayObjectContainer . prototype ) , b . Group . prototype . constructor = b . Group , b . Group . RETURN _NONE = 0 , b . Group . RETURN _TOTAL = 1 , b . Group . RETURN _CHILD = 2 , b . Group . SORT _ASCENDING = - 1 , b . Group . SORT _DESCENDING = 1 , b . Group . prototype . add = function ( a , b ) { return "undefined" == typeof b && ( b = ! 1 ) , a . parent !== this && ( this . enableBody && this . game . physics . enable ( a , this . physicsBodyType ) , this . addChild ( a ) , a . z = this . children . length , ! b && a . events && a . events . onAddedToGroup . dispatch ( a , this ) , null === this . cursor && ( this . cursor = a ) ) , a } , b . Group . prototype . addAt = function ( a , b , c ) { return "undefined" == typeof c && ( c = ! 1 ) , a . parent !== this && ( this . enableBody && this . game . physics . enable ( a , this . physicsBodyType ) , this . addChildAt ( a , b ) , this . updateZ ( ) , ! c && a . events && a . events . onAddedToGroup . dispatch ( a , this ) , null === this . cursor && ( this . cursor = a ) ) , a } , b . Group . prototype . getAt = function ( a ) { return 0 > a || a >= this . children . length ? - 1 : this . getChildAt ( a ) } , b . Group . prototype . create = function ( a , b , c , d , e ) { "undefined" == typeof e && ( e = ! 0 ) ; var f = new t
} , showDebugHeader : function ( ) { var a = b . VERSION , c = "Canvas" , d = "HTML Audio" , e = 1 ; if ( this . renderType === b . WEBGL ? ( c = "WebGL" , e ++ ) : this . renderType == b . HEADLESS && ( c = "Headless" ) , this . device . webAudio && ( d = "WebAudio" , e ++ ) , this . device . chrome ) { for ( var f = [ "%c %c %c Phaser v" + a + " | Pixi.js " + PIXI . VERSION + " | " + c + " | " + d + " %c %c http://phaser.io %c %c ♥%c♥%c♥ " , "background: #0cf300" , "background: #00bc17" , "color: #ffffff; background: #00711f;" , "background: #00bc17" , "background: #0cf300" , "background: #00bc17" ] , g = 0 ; 3 > g ; g ++ ) f . push ( e > g ? "color: #ff2424; background: #fff" : "color: #959595; background: #fff" ) ; console . log . apply ( console , f ) } else window . console && console . log ( "Phaser v" + a + " | Pixi.js " + PIXI . VERSION + " | " + c + " | " + d + " | http://phaser.io" ) } , setUpRenderer : function ( ) { if ( this . device . trident && ( this . renderType = b . CANVAS ) , this . canvas = this . config . canvasID ? b . Canvas . create ( this . width , this . height , this . config . canvasID ) : b . Canvas . create ( this . width , this . height ) , this . config . canvasStyle ? this . canvas . style = this . config . canvasStyle : this . canvas . style [ "-webkit-full-screen" ] = "width: 100%; height: 100%" , this . device . cocoonJS && ( this . canvas . screencanvas = ! 1 ) , this . renderType === b . HEADLESS || this . renderType === b . CANVAS || this . renderType === b . AUTO && this . device . webGL === ! 1 ) { if ( ! this . device . canvas ) throw new Error ( "Phaser.Game - cannot create Canvas or WebGL context, aborting." ) ; this . renderType === b . AUTO && ( this . renderType = b . CANVAS ) , this . renderer = new PIXI . CanvasRenderer ( this . width , this . height , this . canvas , this . transparent ) , this . context = this . renderer . context } else this . renderType = b . WEBGL , this . renderer = new PIXI . WebGLRenderer ( this . width , this . height , this . canvas , this . transparent , this . antialias , this . preserveDrawingBuffer ) , this . context = null ; this . renderType !== b . HEADLESS && ( this . stage . smoothed = this . antialias , b . Canvas . addToDOM ( this . canvas , this . parent , ! 1 ) , b . Canvas . setTouchAction ( this . canvas ) ) } , update : function ( a ) { this . time . update ( a ) , this . _paused || this . pendingStep ? ( this . state . pauseUpdate ( ) , this . config . enableDebug && this . debug . preUpdate ( ) ) : ( this . stepping && ( this . pendingStep = ! 0 ) , this . scale . preUpdate ( ) , this . config . enableDebug && this . debug . preUpdate ( ) , this . physics . preUpdate ( ) , this . state . preUpdate ( ) , this . plugins . preUpdate ( ) , this . stage . preUpdate ( ) , this . state . update ( ) , this . stage . update ( ) , this . tweens . update ( ) , this . sound . update ( ) , this . input . update ( ) , this . physics . update ( ) , this . particles . update ( ) , this . plugins . update ( ) , this . stage . postUpdate ( ) , this . plugins . postUpdate ( ) ) , this . renderType != b . HEADLESS && ( this . state . preRender ( ) , this . renderer . render ( this . stage ) , this . plugins . render ( ) , this . state . render ( ) , 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 , b . Canvas . removeFromDOM ( this . canvas ) } , 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 . g
} , leave : function ( a ) { this . withinGame = ! 1 , this . move ( a , ! 1 ) } , stop : function ( a ) { return this . _stateReset ? void a . preventDefault ( ) : ( this . timeUp = this . game . time . now , ( this . game . input . multiInputOverride === b . Input . MOUSE _OVERRIDES _TOUCH || this . game . input . multiInputOverride === b . Input . MOUSE _TOUCH _COMBINE || this . game . input . multiInputOverride === b . Input . TOUCH _OVERRIDES _MOUSE && 0 === this . game . input . currentPointers ) && ( this . game . input . onUp . dispatch ( this , a ) , this . duration >= 0 && this . duration <= this . game . input . tapRate && ( this . timeUp - this . previousTapTime < this . game . input . doubleTapRate ? this . game . input . onTap . dispatch ( this , ! 0 ) : this . game . input . onTap . dispatch ( this , ! 1 ) , this . previousTapTime = this . timeUp ) ) , this . id > 0 && ( this . active = ! 1 ) , this . withinGame = ! 1 , this . isDown = ! 1 , this . isUp = ! 0 , this . pointerId = null , this . identifier = null , this . positionUp . setTo ( this . x , this . y ) , this . isMouse === ! 1 && this . game . input . currentPointers -- , this . game . input . interactiveItems . callAll ( "_releasedHandler" , this ) , this . targetObject = null , this ) } , justPressed : function ( a ) { return a = a || this . game . input . justPressedRate , this . isDown === ! 0 && this . timeDown + a > this . game . time . now } , justReleased : function ( a ) { return a = a || this . game . input . justReleasedRate , this . isUp === ! 0 && this . timeUp + a > this . game . time . now } , reset : function ( ) { this . isMouse === ! 1 && ( this . active = ! 1 ) , this . pointerId = null , this . identifier = null , this . dirty = ! 1 , this . isDown = ! 1 , this . isUp = ! 0 , this . totalTouches = 0 , this . _holdSent = ! 1 , this . _history . length = 0 , this . _stateReset = ! 0 , this . targetObject && this . targetObject . _releasedHandler ( this ) , this . targetObject = null } , resetMovement : function ( ) { this . movementX = 0 , this . movementY = 0 } } , b . Pointer . prototype . constructor = b . Pointer , Object . defineProperty ( b . Pointer . prototype , "duration" , { get : function ( ) { return this . isUp ? - 1 : this . game . time . now - this . timeDown } } ) , Object . defineProperty ( b . Pointer . prototype , "worldX" , { get : function ( ) { return this . game . world . camera . x + this . x } } ) , Object . defineProperty ( b . Pointer . prototype , "worldY" , { get : function ( ) { return this . game . world . camera . y + this . y } } ) , b . Touch = function ( a ) { this . game = a , this . disabled = ! 1 , this . callbackContext = this . game , this . touchStartCallback = null , this . touchMoveCallback = null , this . touchEndCallback = null , this . touchEnterCallback = null , this . touchLeaveCallback = null , this . touchCancelCallback = null , this . preventDefault = ! 0 , this . event = null , this . _onTouchStart = null , this . _onTouchMove = null , this . _onTouchEnd = null , this . _onTouchEnter = null , this . _onTouchLeave = null , this . _onTouchCancel = null , this . _onTouchMove = null } , b . Touch . prototype = { start : function ( ) { if ( null === this . _onTouchStart ) { var a = this ; this . game . device . touch && ( this . _onTouchStart = function ( b ) { return a . onTouchStart ( b ) } , this . _onTouchMove = 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 ,
} , b . Events . prototype = { destroy : function ( ) { this . parent = null , this . onDestroy . dispose ( ) , this . onAddedToGroup . dispose ( ) , this . onRemovedFromGroup . dispose ( ) , this . onKilled . dispose ( ) , this . onRevived . dispose ( ) , this . onOutOfBounds . dispose ( ) , this . onInputOver && ( this . onInputOver . dispose ( ) , this . onInputOut . dispose ( ) , this . onInputDown . dispose ( ) , this . onInputUp . dispose ( ) , this . onDragStart . dispose ( ) , this . onDragStop . dispose ( ) ) , this . onAnimationStart && ( this . onAnimationStart . dispose ( ) , this . onAnimationComplete . dispose ( ) , this . onAnimationLoop . dispose ( ) ) } } , b . Events . prototype . constructor = b . Events , b . GameObjectFactory = function ( a ) { this . game = a , this . world = this . game . world } , b . GameObjectFactory . prototype = { existing : function ( a ) { return this . world . add ( a ) } , image : function ( a , c , d , e , f ) { return "undefined" == typeof f && ( f = this . world ) , f . add ( new b . Image ( this . game , a , c , d , e ) ) } , sprite : function ( a , b , c , d , e ) { return "undefined" == typeof e && ( e = this . world ) , e . create ( a , b , c , d ) } , tween : function ( a ) { return this . game . tweens . create ( a ) } , group : function ( a , c , d , e , f ) { return new b . Group ( this . game , a , c , d , e , f ) } , physicsGroup : function ( a , c , d , e ) { return new b . Group ( this . game , c , d , e , ! 0 , a ) } , spriteBatch : function ( a , c , d ) { return "undefined" == typeof a && ( a = null ) , "undefined" == typeof c && ( c = "group" ) , "undefined" == typeof d && ( d = ! 1 ) , new b . SpriteBatch ( this . game , a , c , d ) } , audio : function ( a , b , c , d ) { return this . game . sound . add ( a , b , c , d ) } , sound : function ( a , b , c , d ) { return this . game . sound . add ( a , b , c , d ) } , tileSprite : function ( a , c , d , e , f , g , h ) { return "undefined" == typeof h && ( h = this . world ) , h . add ( new b . TileSprite ( this . game , a , c , d , e , f , g ) ) } , rope : function ( a , c , d , e , f , g ) { return "undefined" == typeof g && ( g = this . world ) , g . add ( new b . Rope ( this . game , a , c , d , e , f ) ) } , text : function ( a , c , d , e , f ) { return "undefined" == typeof f && ( f = this . world ) , f . add ( new b . Text ( this . game , a , c , d , e ) ) } , button : function ( a , c , d , e , f , g , h , i , j , k ) { return "undefined" == typeof k && ( k = this . world ) , k . add ( new b . Button ( this . game , a , c , d , e , f , g , h , i , j ) ) } , graphics : function ( a , c , d ) { return "undefined" == typeof d && ( d = this . world ) , d . add ( new b . Graphics ( this . game , a , c ) ) } , emitter : function ( a , c , d ) { return this . game . particles . add ( new b . Particles . Arcade . Emitter ( this . game , a , c , d ) ) } , retroFont : function ( a , c , d , e , f , g , h , i , j ) { return new b . RetroFont ( this . game , a , c , d , e , f , g , h , i , j ) } , bitmapText : function ( a , c , d , e , f , g ) { return "undefined" == typeof g && ( g = this . world ) , g . add ( new b . BitmapText ( this . game , a , c , d , e , f ) ) } , tilemap : function ( a , c , d , e , f ) { return new b . Tilemap ( this . game , a , c , d , e , f ) } , renderTexture : 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
for ( var a = 0 , b = this . children . length ; b > a ; a ++ ) this . children [ a ] . preUpdate ( ) ; return ! 0 } , b . TileSprite . prototype . update = function ( ) { } , b . TileSprite . prototype . postUpdate = function ( ) { this . exists && this . body && this . body . postUpdate ( ) , 1 === this . _cache [ 7 ] && ( this . position . x = this . game . camera . view . x + this . cameraOffset . x , this . position . y = this . game . camera . view . y + this . cameraOffset . y ) ; for ( var a = 0 , b = this . children . length ; b > a ; a ++ ) this . children [ a ] . postUpdate ( ) } , b . TileSprite . prototype . autoScroll = function ( a , b ) { this . _scroll . set ( a , b ) } , b . TileSprite . prototype . stopScroll = function ( ) { this . _scroll . set ( 0 , 0 ) } , b . TileSprite . prototype . loadTexture = function ( a , c ) { c = c || 0 , this . key = a , a instanceof b . RenderTexture ? ( this . key = a . key , this . setTexture ( a ) ) : a instanceof b . BitmapData ? this . setTexture ( a . texture ) : a instanceof PIXI . Texture ? this . setTexture ( a ) : null === a || "undefined" == typeof a ? ( this . key = "__default" , this . setTexture ( PIXI . TextureCache [ this . key ] ) ) : "string" != typeof a || this . game . cache . checkImageKey ( a ) ? ( this . setTexture ( new PIXI . Texture ( PIXI . BaseTextureCache [ a ] ) ) , this . animations . loadFrameData ( this . game . cache . getFrameData ( a ) , c ) ) : ( console . warn ( "Texture with key '" + a + "' not found." ) , this . key = "__missing" , this . setTexture ( PIXI . TextureCache [ this . key ] ) ) } , 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 . p
} , b . SpriteBatch = function ( a , c , d , e ) { ( "undefined" == typeof c || null === c ) && ( c = a . world ) , PIXI . SpriteBatch . call ( this ) , b . Group . call ( this , a , c , d , e ) , this . type = b . SPRITEBATCH } , b . SpriteBatch . prototype = b . Utils . extend ( ! 0 , b . SpriteBatch . prototype , b . Group . prototype , PIXI . SpriteBatch . prototype ) , b . SpriteBatch . prototype . constructor = b . SpriteBatch , b . RetroFont = function ( a , c , d , e , f , g , h , i , j , k ) { if ( ! a . cache . checkImageKey ( c ) ) return ! 1 ; ( "undefined" == typeof g || null === g ) && ( g = a . cache . getImage ( c ) . width / d ) , this . characterWidth = d , this . characterHeight = e , this . characterSpacingX = h || 0 , this . characterSpacingY = i || 0 , this . characterPerRow = g , this . offsetX = j || 0 , this . offsetY = k || 0 , this . align = "left" , this . multiLine = ! 1 , this . autoUpperCase = ! 0 , this . customSpacingX = 0 , this . customSpacingY = 0 , this . fixedWidth = 0 , this . fontSet = a . cache . getImage ( c ) , this . _text = "" , this . grabData = [ ] ; for ( var l = this . offsetX , m = this . offsetY , n = 0 , o = new b . FrameData , p = 0 ; p < f . length ; p ++ ) { var q = a . rnd . uuid ( ) , r = o . addFrame ( new b . Frame ( p , l , m , this . characterWidth , this . characterHeight , "" , q ) ) ; 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
} , from : function ( a , b , c , d , e , f , g ) { var h = { } ; for ( var i in a ) h [ i ] = this . _object [ i ] , this . _object [ i ] = a [ i ] ; return this . to ( h , b , c , d , e , f , g ) } , start : function ( ) { if ( null !== this . game && null !== this . _object ) { this . _manager . add ( this ) , this . isRunning = ! 0 , this . _onStartCallbackFired = ! 1 , this . _startTime = this . game . time . now + this . _delayTime ; for ( var a in this . _valuesEnd ) { if ( Array . isArray ( this . _valuesEnd [ a ] ) ) { if ( 0 === this . _valuesEnd [ a ] . length ) continue ; this . _valuesEnd [ a ] = [ this . _object [ a ] ] . concat ( this . _valuesEnd [ a ] ) } this . _valuesStart [ a ] = this . _object [ a ] , Array . isArray ( this . _valuesStart [ a ] ) || ( this . _valuesStart [ a ] *= 1 ) , this . _valuesStartRepeat [ a ] = this . _valuesStart [ a ] || 0 } return this } } , generateData : function ( a , b ) { if ( null === this . game || null === this . _object ) return null ; this . _startTime = 0 ; for ( var c in this . _valuesEnd ) { if ( Array . isArray ( this . _valuesEnd [ c ] ) ) { if ( 0 === this . _valuesEnd [ c ] . length ) continue ; this . _valuesEnd [ c ] = [ this . _object [ c ] ] . concat ( this . _valuesEnd [ c ] ) } this . _valuesStart [ c ] = this . _object [ c ] , Array . isArray ( this . _valuesStart [ c ] ) || ( this . _valuesStart [ c ] *= 1 ) , this . _valuesStartRepeat [ c ] = this . _valuesStart [ c ] || 0 } for ( var d = 0 , e = Math . floor ( a * ( this . _duration / 1e3 ) ) , f = this . _duration / e , g = [ ] ; e -- ; ) { var c , h = ( d - this . _startTime ) / this . _duration ; h = h > 1 ? 1 : h ; var i = this . _easingFunction ( h ) , j = { } ; for ( c in this . _valuesEnd ) { var k = this . _valuesStart [ c ] || 0 , l = this . _valuesEnd [ c ] ; l instanceof Array ? j [ c ] = this . _interpolationFunction ( l , i ) : ( "string" == typeof l && ( l = k + parseFloat ( l , 10 ) ) , "number" == typeof l && ( j [ c ] = k + ( l - k ) * i ) ) } g . push ( j ) , d += f } if ( this . _yoyo ) { var m = g . slice ( ) ; m . reverse ( ) , g = g . concat ( m ) } return "undefined" != typeof b ? b = b . concat ( g ) : g } , stop : function ( ) { return this . isRunning = ! 1 , this . _onUpdateCallback = null , this . _manager . remove ( this ) , this } , delay : function ( a ) { return this . _delayTime = a , this } , repeat : function ( a ) { return this . _repeat = a , this } , yoyo : function ( a ) { return this . _yoyo = a , 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
} , addMissingImage : function ( ) { var a = new Image ; a . src = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAIAAAD8GO2jAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJ9JREFUeNq01ssOwyAMRFG46v//Mt1ESmgh+DFmE2GPOBARKb2NVjo+17PXLD8a1+pl5+A+wSgFygymWYHBb0FtsKhJDdZlncG2IzJ4ayoMDv20wTmSMzClEgbWYNTAkQ0Z+OJ+A/eWnAaR9+oxCF4Os0H8htsMUp+pwcgBBiMNnAwF8GqIgL2hAzaGFFgZauDPKABmowZ4GL369/0rwACp2yA/ttmvsQAAAABJRU5ErkJggg==" , this . _images . _ _missing = { url : null , data : a } , this . _images . _ _missing . frame = new b . Frame ( 0 , 0 , 0 , 32 , 32 , "" , "" ) , this . _images . _ _missing . frameData = new b . FrameData , this . _images . _ _missing . frameData . addFrame ( new b . Frame ( 0 , 0 , 0 , 32 , 32 , null , this . game . rnd . uuid ( ) ) ) , PIXI . BaseTextureCache . _ _missing = new PIXI . BaseTexture ( a ) , PIXI . TextureCache . _ _missing = new PIXI . Texture ( PIXI . BaseTextureCache . _ _missing ) } , addText : function ( a , b , c ) { this . _text [ a ] = { url : b , data : c } } , addJSON : function ( a , b , c ) { this . _json [ a ] = { url : b , data : c } } , 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 :
var b = this . currentMarker ; "" !== this . currentMarker && this . onMarkerComplete . dispatch ( this . currentMarker , this ) , this . currentMarker = "" , this . paused || this . onStop . dispatch ( this , b ) } , destroy : function ( a ) { "undefined" == typeof a && ( a = ! 0 ) , this . stop ( ) , a ? this . game . sound . remove ( this ) : ( this . markers = { } , this . context = null , this . _buffer = null , this . externalNode = null , this . onDecoded . dispose ( ) , this . onPlay . dispose ( ) , this . onPause . dispose ( ) , this . onResume . dispose ( ) , this . onLoop . dispose ( ) , this . onStop . dispose ( ) , this . onMute . dispose ( ) , this . onMarkerComplete . dispose ( ) ) } } , b . Sound . prototype . constructor = b . Sound , Object . defineProperty ( b . Sound . prototype , "isDecoding" , { get : function ( ) { return this . game . cache . getSound ( this . key ) . isDecoding } } ) , Object . defineProperty ( b . Sound . prototype , "isDecoded" , { get : function ( ) { return this . game . cache . isSoundDecoded ( this . key ) } } ) , Object . defineProperty ( b . Sound . prototype , "mute" , { get : function ( ) { return this . _muted || this . game . sound . mute } , 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 . getSoundDa
} , separateTile : function ( a , b , c ) { if ( ! b . enable || ! c . intersects ( b . position . x , b . position . y , b . right , b . bottom ) ) return ! 1 ; if ( c . collisionCallback && ! c . collisionCallback . call ( c . collisionCallbackContext , b . sprite , c ) ) return ! 1 ; if ( c . layer . callbacks [ c . index ] && ! c . layer . callbacks [ c . index ] . callback . call ( c . layer . callbacks [ c . index ] . callbackContext , b . sprite , c ) ) return ! 1 ; if ( ! ( c . faceLeft || c . faceRight || c . faceTop || c . faceBottom ) ) return ! 1 ; var d = 0 , e = 0 , f = 0 , g = 1 ; if ( b . deltaAbsX ( ) > b . deltaAbsY ( ) ? f = - 1 : b . deltaAbsX ( ) < b . deltaAbsY ( ) && ( g = - 1 ) , 0 !== b . deltaX ( ) && 0 !== b . deltaY ( ) && ( c . faceLeft || c . faceRight ) && ( c . faceTop || c . faceBottom ) && ( f = Math . min ( Math . abs ( b . position . x - c . right ) , Math . abs ( b . right - c . left ) ) , g = Math . min ( Math . abs ( b . position . y - c . bottom ) , Math . abs ( b . bottom - c . top ) ) ) , g > f ) { if ( ( c . faceLeft || c . faceRight ) && ( d = this . tileCheckX ( b , c ) , 0 !== d && ! c . intersects ( b . position . x , b . position . y , b . right , b . bottom ) ) ) return ! 0 ; ( 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" == type
return a instanceof b . Tile ? ( f = a . index , this . hasTile ( c , d , e ) ? this . layers [ e ] . data [ d ] [ c ] . copy ( a ) : this . layers [ e ] . data [ d ] [ c ] = new b . Tile ( e , f , c , d , a . width , a . height ) ) : ( f = a , this . hasTile ( c , d , e ) ? this . layers [ e ] . data [ d ] [ c ] . index = f : this . layers [ e ] . data [ d ] [ c ] = new b . Tile ( this . layers [ e ] , f , c , d , this . tileWidth , this . tileHeight ) ) , this . collideIndexes . indexOf ( f ) > - 1 ? this . layers [ e ] . data [ d ] [ c ] . setCollision ( ! 0 , ! 0 , ! 0 , ! 0 ) : this . layers [ e ] . data [ d ] [ c ] . resetCollision ( ) , this . layers [ e ] . dirty = ! 0 , this . calculateFaces ( e ) , this . layers [ e ] . data [ d ] [ c ] } return null } , putTileWorldXY : function ( a , b , c , d , e , f ) { return f = this . getLayer ( f ) , b = this . game . math . snapToFloor ( b , d ) / d , c = this . game . math . snapToFloor ( c , e ) / e , this . putTile ( a , b , c , f ) } , searchTileIndex : function ( a , b , c , d ) { "undefined" == typeof b && ( b = 0 ) , "undefined" == typeof c && ( c = ! 1 ) , d = this . getLayer ( d ) ; var e = 0 ; 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 . curre
return b } function rb ( a ) { for ( var b = [ ] , c = 0 ; c < a . length ; c ++ ) b . push ( 255 & a . charCodeAt ( c ) ) ; return b } function sb ( b ) { return a ( "base64-js" ) . toByteArray ( b ) } function tb ( a , b , c , d ) { for ( var e = 0 ; d > e && ! ( e + c >= b . length || e >= a . length ) ; ) b [ e + c ] = a [ e ] , e ++ ; return e } function ub ( a ) { try { return decodeURIComponent ( a ) } catch ( b ) { return String . fromCharCode ( 65533 ) } } function vb ( a , b ) { yb ( "number" == typeof a , "cannot write a non-number as a number" ) , yb ( a >= 0 , "specified a negative value for writing an unsigned value" ) , yb ( b >= a , "value is larger than maximum value for type" ) , yb ( Math . floor ( a ) === a , "value has a fractional component" ) } function wb ( 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" ) , yb ( Math . floor ( a ) === a , "value has a fractional component" ) } 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 >
var g = 1 / a ; return f . scale ( c . contactPointA , c . contactPointA , g ) , f . scale ( c . contactPointB , c . contactPointB , g ) , f . normalize ( c . t , c . t ) , f . rotate90cw ( c . t , c . t ) , c } , c . prototype [ q . LINE | q . CONVEX ] = c . prototype . convexLine = function ( a , b , c , d , e , f , g , h , i ) { return i ? ! 1 : 0 } , c . prototype [ q . LINE | q . RECTANGLE ] = c . prototype . lineRectangle = function ( a , b , c , d , e , f , g , h , i ) { return i ? ! 1 : 0 } ; var M = new r ( 1 , 1 ) , N = f . create ( ) ; c . prototype [ q . CAPSULE | q . CONVEX ] = c . prototype [ q . CAPSULE | q . RECTANGLE ] = c . prototype . convexCapsule = function ( a , b , c , e , g , h , i , j , k ) { var l = N ; f . set ( l , h . length / 2 , 0 ) , f . rotate ( l , l , j ) , f . add ( l , l , i ) ; var m = this . circleConvex ( g , h , l , j , a , b , c , e , k , h . radius ) ; f . set ( l , - h . length / 2 , 0 ) , f . rotate ( l , l , j ) , f . add ( l , l , i ) ; var n = this . circleConvex ( g , h , l , j , a , b , c , e , k , h . radius ) ; if ( k && ( m || n ) ) return ! 0 ; var o = M ; d ( o , h ) ; var p = this . convexConvex ( a , b , c , e , g , o , i , j , k ) ; return p + m + n } , c . prototype [ q . CAPSULE | q . LINE ] = c . prototype . lineCapsule = function ( a , b , c , d , e , f , g , h , i ) { return i ? ! 1 : 0 } ; var O = f . create ( ) , P = f . create ( ) , Q = new r ( 1 , 1 ) ; c . prototype [ q . CAPSULE | q . CAPSULE ] = c . prototype . capsuleCapsule = function ( a , b , c , e , g , h , i , j , k ) { for ( var l , 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
} { var d = ( a ( "__browserify_process" ) , a ( "__browserify_Buffer" ) , a ( "./Equation" ) ) ; a ( "../math/vec2" ) } b . exports = c , c . prototype = new d , c . prototype . constructor = c , c . prototype . computeGq = function ( ) { return this . ratio * this . bodyA . angle - this . bodyB . angle + this . angle } , c . prototype . setRatio = function ( a ) { var b = this . G ; b [ 2 ] = a , b [ 5 ] = - 1 , this . ratio = a } , c . prototype . setMaxTorque = function ( a ) { this . maxForce = a , this . minForce = - a } } , { "../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 , " .
f . call ( this , c , g ) , this . type = e . RECTANGLE } var d = ( a ( "__browserify_process" ) , a ( "__browserify_Buffer" ) , a ( "../math/vec2" ) ) , e = a ( "./Shape" ) , f = a ( "./Convex" ) ; b . exports = c , c . prototype = new f ( [ ] ) , c . prototype . computeMomentOfInertia = function ( a ) { var b = this . width , c = this . height ; return a * ( c * c + b * b ) / 12 } , c . prototype . updateBoundingRadius = function ( ) { var a = this . width , b = this . height ; this . boundingRadius = Math . sqrt ( a * a + b * b ) / 2 } ; 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 ( " . . / event
2014-08-29 17:13:33 +00:00
} , 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