2015-02-25 02:59:00 +00:00
/* Phaser v2.3.0 - http://phaser.io - @photonstorm - (c) 2015 Photon Storm Ltd. */
2014-02-28 09:30:53 +00:00
2015-03-24 16:05:52 +00:00
( function ( ) { var a = this , b = b || { } ; b . WEBGL _RENDERER = 0 , b . CANVAS _RENDERER = 1 , b . VERSION = "v2.2.8" , b . _UID = 0 , "undefined" != typeof Float32Array ? ( b . Float32Array = Float32Array , b . Uint16Array = Uint16Array , b . Uint32Array = Uint32Array , b . ArrayBuffer = ArrayBuffer ) : ( b . Float32Array = Array , b . Uint16Array = Array ) , b . PI _2 = 2 * Math . PI , b . RAD _TO _DEG = 180 / Math . PI , b . DEG _TO _RAD = Math . PI / 180 , b . RETINA _PREFIX = "@2x" , b . defaultRenderOptions = { view : null , transparent : ! 1 , antialias : ! 1 , preserveDrawingBuffer : ! 1 , resolution : 1 , clearBeforeRender : ! 0 , autoResize : ! 1 } , b . DisplayObject = function ( ) { this . position = new b . Point ( 0 , 0 ) , this . scale = new b . Point ( 1 , 1 ) , this . transformCallback = null , this . transformCallbackContext = null , this . pivot = new b . Point ( 0 , 0 ) , this . rotation = 0 , this . alpha = 1 , this . visible = ! 0 , this . hitArea = null , this . renderable = ! 1 , this . parent = null , this . stage = null , this . worldAlpha = 1 , this . worldTransform = new b . Matrix , 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 . destroy = function ( ) { if ( this . children ) { for ( var a = this . children . length ; a -- ; ) this . children [ a ] . destroy ( ) ; this . children = [ ] } this . transformCallback = null , this . transformCallbackContext = null , this . hitArea = null , this . parent = null , this . stage = null , this . worldTransform = null , this . filterArea = null , this . _bounds = null , this . _currentBounds = null , this . _mask = null , this . renderable = ! 1 , this . _destroyCachedSprite ( ) } , 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 ( ) { if ( this . parent ) { var a , c , d , e , f , g , h = this . parent . worldTransform , i = this . worldTransform ; this . rotation % b . PI _2 ? ( this . rotation !== this . rotationCache && ( this . rotationCache = this . rotation , this . _sr = Math . sin ( this . rotation ) , this . _cr = Math . cos ( this . rotation ) ) , a = this . _cr * this . scale . x , c = this . _sr * this . scale . x , d = - this . _sr * this . scale . y , e = this . _cr * this . scale . y , f = this . position . x , g = this . position . y , ( this . pivot . x || this . pivot . y ) && ( f -= this . pivot . x * a + this . pivot . y * d , g -= this . pivot . x * c + this . pivot . y * e ) , i . a = a * h . a + c * h . c , i . b = a * h . b + c * h . d , i . c = d * h . a + e * h . c , i . d = d * h . b + e * h . d , i . tx = f * h . a + g * h . c + h . tx , i . ty = f * h . b + g * h . d + h . ty ) : ( a = this . scale . x , e = this . scale . y , f = this . position . x - this . pivot . x * a , g = this . position . y - this . pivot . y * e , i . a = a * h . a , i . b = a * h . b , i . c = e * h . c , i . d = e * h . d , i . tx = f * h . a + g * h . c + h . tx , i . ty = f * h . b + g * h . d + h . ty ) , this . worldAlpha = this . alpha * this . parent . worldAlpha , this . transformCallback && this . transformCallback . call ( this . transformCallbackContext , i , h ) } } , b . DisplayObject . prototype . displayObjectUpdateTransform = b . DisplayObject . prototype . updateTransform , b . DisplayObject . prototype . getBounds = function ( a ) { return a = a , b . EmptyRectangle } , b . DisplayObject . prototype . getLocalBounds = function ( ) { return this . getBounds ( b . identityMatrix ) } , b . DisplayObject . prototype . setStageReference = function ( a ) { this . stage = a } , b . DisplayObject . prototype . preUpdate = function ( ) { } , b . DisplayObject . prototype . generateTexture = function ( a , c , d ) { var e = this . getLocalBounds ( ) , f = new b . RenderTexture ( 0 | e . width , 0 | e . height , d , c , a ) ; return b . DisplayObject . _tempMatrix . tx = - e . x , b . DisplayObject . _tempMatrix . ty = - e . y , f . render ( this , b . DisplayObject . _tempMatrix ) , f } , b . DisplayObject . prototype . updateCache = function ( ) { this . _generateCachedSprite ( ) } , b . DisplayObject . prototype . toGlobal = function ( a ) { return this . displayObjectUpdateTransfor
} , b . PixiFastShader . prototype . constructor = b . PixiFastShader , 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)) * alpha;" , "}" ] , 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 . constructor = b . StripShader , 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" ) , this . attributes = [ this . aVertexPosition , this . aTextureCoord ] , this . translationMatrix = a . getUniformLocation ( c , "translationMatrix" ) , this . alpha = a . getUniformLocation ( c , "alpha" ) , this . program = c } , b . StripShader . prototype . destroy = function ( ) { this . gl . deleteProgram ( this . program ) , this . uniforms = null , this . gl = null , this . attribute = null } , b . PrimitiveShader = function ( a ) { this . _UID = b . _UID ++ , this . gl = a , this . program = null , this . fragmentSrc = [ "precision mediump float;" , "varying vec4 vColor;" , "void main(void) {" , " gl_FragColor = vColor;" , "}" ] , this . vertexSrc = [ "attribute vec2 aVertexPosition;" , "attribute vec4 aColor;" , "uniform mat3 translationMatrix;" , "uniform vec2 projectionVector;" , "uniform vec2 offsetVector;" , "uniform float alpha;" , "uniform float flipY;" , "uniform vec3 tint;" , "varying vec4 vColor;" , "void main(void) {" , " vec3 v = translationMatrix * vec3(aVertexPosition , 1.0);" , " v -= offsetVector.xyx;" , " gl_Position = vec4( v.x / projectionVector.x -1.0, (v.y / projectionVector.y * -flipY) + flipY , 0.0, 1.0);" , " vColor = aColor * vec4(tint * alpha, alpha);" , "}" ] , this . init ( ) } , b . PrimitiveShader . prototype . constructor = b . PrimitiveShader , b . PrimitiveShader . prototype . init = function ( ) { var a = this . gl , c = b . compileProgram ( a , this . vertexSrc , this . fragmentSrc ) ; a . useProgram ( c ) , this . projectionVector = a . getUniformLocation ( c , "projectionVector" ) , this . offsetVector = a . getUniformLocation ( c , "offsetVector" ) , this . tintColor = a . getUniformLocation ( c , "tint" ) , this . flipY = a . getUniformLocation ( c , "flipY" ) , this . aVertexPosition = a . getAttribLocation ( c , "aVertexPosition" ) , this . colorAttribute = a . getAttribLocation ( c , "aColor" ) , this . attributes = [ this . aVertexPosition , this . colorAttribute ] , this . translationMatrix = a . getUniformLocation
2015-03-25 16:17:53 +00:00
var s = this . renderSession . projection ; c . uniform2f ( a . projectionVector , s . x , s . y ) ; var t = this . renderSession . offset ; c . uniform2f ( a . offsetVector , t . x , t . y ) } j ++ } this . renderBatch ( l , j , k ) , this . currentBatchSize = 0 } } , b . WebGLSpriteBatch . prototype . renderBatch = function ( a , b , c ) { if ( 0 !== b ) { var d = this . gl ; a . _dirty [ d . id ] ? this . renderSession . renderer . updateTexture ( a ) : d . bindTexture ( d . TEXTURE _2D , a . _glTextures [ d . id ] ) , d . drawElements ( d . TRIANGLES , 6 * b , d . UNSIGNED _SHORT , 6 * c * 2 ) , this . renderSession . drawCount ++ } } , b . WebGLSpriteBatch . prototype . stop = function ( ) { this . flush ( ) , this . dirty = ! 0 } , 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 c = 4 * this . size * this . vertSize , d = 6 * this . maxSize ; this . vertices = new b . Float32Array ( c ) , this . indices = new b . Uint16Array ( d ) , this . vertexBuffer = null , this . indexBuffer = null , this . lastIndexCount = 0 ; for ( var e = 0 , f = 0 ; d > e ; e += 6 , f += 4 ) this . indices [ e + 0 ] = f + 0 , this . indices [ e + 1 ] = f + 1 , this . indices [ e + 2 ] = f + 2 , this . indices [ e + 3 ] = f + 0 , this . indices [ e + 4 ] = f + 2 , this . indices [ e + 5 ] = f + 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 . constructor = b . WebGLFastSpriteBatch , 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 ++ ] = a . scale . y , j [ i ++ ] = a . rotation , j [ i ++ ] = b . x0 , j [ i ++ ] = b . y1 , j [ i ++ ] = a . alpha , j [ i ++ ] = e , j [ i ++ ] = h , j [ i ++ ] = a . position . x , j [ i ++ ] = a . position . y , j [ i ++ ] = a . scale . x , j [ i ++ ] = a . scale . y , j [ i ++ ] = a . rotation , j [ i ++ ] = b . x1 , j [ i ++ ] = b . y1 , j [ i ++ ] = a . alpha , j [ i ++ ] = e , j [ i ++ ] = g , j [ i ++ ] = a . position . x , j [ i ++ ] = a . position . y , j [ i ++ ] = a . scale . x , j [ i ++ ] = a . scale . y , j [ i ++ ] = a . rotation , j [ i ++ ] = b . x2 , j [ i ++ ] = b . y2 , j [ i ++ ] = a . alpha , j [ i ++ ] = f , j [ i ++ ] = g , j [ i ++ ] = a . position . x , j [ i ++ ] = a . position . y , j [ i ++ ] = a . scale . x , j [ i ++ ] = a . scale . y , j [ i ++ ] = a . rotation , j [ i ++ ] = b . x3 , j [ i ++ ] = b . y3 , j [ i ++ ] = a . alpha , this . currentBatchSize ++ , this . currentBatchSize >= this . size && this . flush ( ) } } , b . WebGLFastSpriteBatch . prototype . flush = function ( ) { if ( 0 !== this . currentBatchSize ) { var a = this . gl ; if ( this . currentBaseTexture . _glTextures [ a . id ] || this . renderSession . renderer . updateTexture ( this . currentBaseTexture , a ) , a . bindTexture ( a . TEXTURE _2D , this . currentBaseTexture . _glTextures [ a . id ] ) , this . currentBatchSize > . 5 * this . size ) a . bufferSubDat
2015-03-26 02:37:31 +00:00
} return this . _currentBounds } , b . Graphics . prototype . containsPoint = function ( a ) { this . worldTransform . applyInverse ( a , tempPoint ) ; for ( var b = this . graphicsData , c = 0 ; c < b . length ; c ++ ) { var d = b [ c ] ; if ( d . fill && d . shape && d . shape . contains ( tempPoint . x , tempPoint . y ) ) return ! 0 } return ! 1 } , b . Graphics . prototype . updateLocalBounds = function ( ) { var a = 1 / 0 , c = - 1 / 0 , d = 1 / 0 , e = - 1 / 0 ; if ( this . graphicsData . length ) for ( var f , g , h , i , j , k , l = 0 ; l < this . graphicsData . length ; l ++ ) { var m = this . graphicsData [ l ] , n = m . type , o = m . lineWidth ; if ( f = m . shape , n === b . Graphics . RECT || n === b . Graphics . RREC ) h = f . x - o / 2 , i = f . y - o / 2 , j = f . width + o , k = f . height + o , a = a > h ? h : a , c = h + j > c ? h + j : c , d = d > i ? i : d , e = i + k > e ? i + k : e ; else if ( n === b . Graphics . CIRC ) h = f . x , i = f . y , j = f . radius + o / 2 , k = f . radius + o / 2 , a = a > h - j ? h - j : a , c = h + j > c ? h + j : c , d = d > i - k ? i - k : d , e = i + k > e ? i + k : e ; else if ( n === b . Graphics . ELIP ) h = f . x , i = f . y , j = f . width + o / 2 , k = f . height + o / 2 , a = a > h - j ? h - j : a , c = h + j > c ? h + j : c , d = d > i - k ? i - k : d , e = i + k > e ? i + k : e ; else { g = f . points ; for ( var p = 0 ; p < g . length ; p ++ ) g [ p ] instanceof Phaser . Point ? ( h = g [ p ] . x , i = g [ p ] . y ) : ( h = g [ p ] , i = g [ p + 1 ] , p < g . length - 1 && p ++ ) , a = a > h - o ? h - o : a , c = h + o > c ? h + o : c , d = d > i - o ? i - o : d , e = i + o > e ? i + o : e } } else a = 0 , c = 0 , d = 0 , e = 0 ; var q = this . boundsPadding ; this . _localBounds . x = a - q , this . _localBounds . width = c - a + 2 * q , this . _localBounds . y = d - q , this . _localBounds . height = e - d + 2 * q } , 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 ) , this . worldAlpha = 1 , b . CanvasGraphics . renderGraphics ( this , this . _cachedSprite . buffer . context ) , this . _cachedSprite . alpha = this . alpha } , b . Graphics . prototype . updateCachedSpriteTexture = function ( ) { var a = this . _cachedSprite , b = a . texture , c = a . buffer . canvas ; b . baseTexture . width = c . width , b . baseTexture . height = c . height , b . crop . width = b . frame . width = c . width , b . crop . height = b . frame . height = c . height , a . _width = c . width , a . _height = c . height , b . baseTexture . dirty ( ) } , b . Graphics . prototype . destroyCachedSprite = function ( ) { this . _cachedSprite . texture . destroy ( ! 0 ) , this . _cachedSprite = null } , b . Graphics . prototype . drawShape = function ( a ) { this . currentPath && this . currentPath . shape . points . length <= 2 && this . graphicsData . pop ( ) , this . currentPath = null , a instanceof b . Polygon && a . flatten ( ) ; var c = new b . GraphicsData ( this . lineWidth , this . lineColor , this . lineAlpha , this . fillColor , this . fillAlpha , this . filling , a ) ; return this . graphicsData . push ( c ) , c . type === b . Graphics . POLY && ( c . shape . closed = this . filling , this . currentPath = c ) , this . dirty = ! 0 , c } , Object . defineProperty ( b . Graphics . prototype , "cacheAsBitmap" , { get : function ( ) { return this . _cacheAsBitmap } , set : function ( a ) { this . _cacheAsBitmap = a , this . _cacheAsBitmap ? this . _generateCachedSprite ( ) : ( this . destroyCachedSprite ( ) , this . dirty = ! 0 ) } } ) , b . GraphicsData = function ( a , b , c , d , e , f , g ) { this . lineWidth = a , this . lineColor = b , this . lineAlpha = c , this . _lineTint = b , this . fillColor = d , this . fillAlpha = e , this . _fillTint = d , this . fill = f , this . shape = g , this . type = g . type } , b . GraphicsData . prototype . constructor = b . GraphicsData , b . GraphicsData . prototype . clone = function ( ) { return new GraphicsData ( this . lineWidth , this . lineColor , this . lineAlpha , this . fillColor , this . fillAlpha , this . fill , this . shape ) } , 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 . vertices = 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 . blendMode = b . blendModes . NORMAL , this . canvasPadding = 0 , this . drawMode = b . Strip . DrawModes . TRIANGLE _STRIP } , 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 (
} } , c . Ellipse . prototype . constructor = c . Ellipse , Object . defineProperty ( c . Ellipse . prototype , "left" , { get : function ( ) { return this . x } , set : function ( a ) { this . x = a } } ) , Object . defineProperty ( c . Ellipse . prototype , "right" , { get : function ( ) { return this . x + this . width } , set : function ( a ) { this . width = a < this . x ? 0 : a - this . x } } ) , Object . defineProperty ( c . Ellipse . prototype , "top" , { get : function ( ) { return this . y } , set : function ( a ) { this . y = a } } ) , Object . defineProperty ( c . Ellipse . prototype , "bottom" , { get : function ( ) { return this . y + this . height } , set : function ( a ) { this . height = a < this . y ? 0 : a - this . y } } ) , Object . defineProperty ( c . Ellipse . prototype , "empty" , { get : function ( ) { return 0 === this . width || 0 === this . height } , set : function ( a ) { a === ! 0 && this . setTo ( 0 , 0 , 0 , 0 ) } } ) , c . Ellipse . contains = function ( a , b , c ) { if ( a . width <= 0 || a . height <= 0 ) return ! 1 ; var d = ( b - a . x ) / a . width - . 5 , e = ( c - a . y ) / a . height - . 5 ; return d *= d , e *= e , . 25 > d + e } , PIXI . Ellipse = c . Ellipse , c . Line = function ( a , b , d , e ) { a = a || 0 , b = b || 0 , d = d || 0 , e = e || 0 , this . start = new c . Point ( a , b ) , this . end = new c . Point ( d , e ) , this . type = c . LINE } , c . Line . prototype = { setTo : function ( a , b , c , d ) { return this . start . setTo ( a , b ) , this . end . setTo ( c , d ) , this } , fromSprite : function ( a , b , c ) { return "undefined" == typeof c && ( c = ! 1 ) , c ? this . setTo ( a . center . x , a . center . y , b . center . x , b . center . y ) : this . setTo ( a . x , a . y , b . x , b . y ) } , fromAngle : function ( a , b , c , d ) { return this . start . setTo ( a , b ) , this . end . setTo ( a + Math . cos ( c ) * d , b + Math . sin ( c ) * d ) , this } , intersects : function ( a , b , d ) { return c . Line . intersectsPoints ( this . start , this . end , a . start , a . end , b , d ) } , reflect : function ( a ) { return c . Line . reflect ( this , a ) } , pointOnLine : function ( a , b ) { return ( a - this . start . x ) * ( this . end . y - this . start . y ) === ( this . end . x - this . start . x ) * ( b - this . start . y ) } , pointOnSegment : function ( a , b ) { var c = Math . min ( this . start . x , this . end . x ) , d = Math . max ( this . start . x , this . end . x ) , e = Math . min ( this . start . y , this . end . y ) , f = Math . max ( this . start . y , this . end . y ) ; return this . pointOnLine ( a , b ) && a >= c && d >= a && b >= e && f >= b } , coordinatesOnLine : function ( a , b ) { "undefined" == typeof a && ( a = 1 ) , "undefined" == typeof b && ( b = [ ] ) ; var c = Math . round ( this . start . x ) , d = Math . round ( this . start . y ) , e = Math . round ( this . end . x ) , f = Math . round ( this . end . y ) , g = Math . abs ( e - c ) , h = Math . abs ( f - d ) , i = e > c ? 1 : - 1 , j = f > d ? 1 : - 1 , k = g - h ; b . push ( [ c , d ] ) ; for ( var l = 1 ; c != e || d != f ; ) { var m = k << 1 ; m > - h && ( k -= h , c += i ) , g > m && ( k += g , d += j ) , l % a === 0 && b . push ( [ c , d ] ) , l ++ } return b } , clone : function ( a ) { return "undefined" == typeof a || null === a ? a = new c . Line ( this . start . x , this . start . y , this . end . x , this . end . y ) : a . setTo ( this . start . x , this . start . y , this . end . x , this . end . y ) , a } } , Object . defineProperty ( c . Line . prototype , "length" , { get : function ( ) { return Math . sqrt ( ( this . end . x - this . start . x ) * ( this . end . x - this . start . x ) + ( this . end . y - this . start . y ) * ( this . end . y - this . start . y ) ) } } ) , Object . defineProperty ( c . Line . prototype , "angle" , { get : function ( ) { return Math . atan2 ( this . end . y - this . start . y , this . end . x - this . start . x ) } } ) , Object . defineProperty ( c . Line . prototype , "slope" , { get : function ( ) { return ( this . end . y - this . start . y ) / ( this . end . x - this . start . x ) } } ) , Object . defineProperty ( c . Line . prototype , "perpSlope" , { get : function ( ) { return - ( ( this . end . x - this . start . x ) / ( this . end . y - this . start . y ) ) } } ) , Object . defineProperty ( c . Line . prototype , "x" , { get : function ( ) { return Math . min ( this . start . x , this . end . x ) } } ) , Object . defineProperty ( c . Line . prototype , "y" , { get : function ( ) { return Math . min ( this . start . y , this . end . y ) } } ) , Object . defineProperty ( c . Line . prototype , "left" , { get : function ( ) { return Math . min ( this . start . x , this . end . x ) } } ) , Object . defineProperty ( c . Line . prototype , "right" , { get : function ( ) { return Math . max ( this . start . x , this . end . x ) } } ) , Object . defineProperty ( c . Line . prototype , "top" , { get : function ( ) { return Math . min ( this . start . y , this . end . y ) } } ) , Object . defineProperty ( c . Line . prototype , "bottom" , { get : function ( ) { return Math . max ( this . start . y , this . end . y ) } } ) , Object . defineProperty ( c . Line . prototype , "width" , { get : function ( ) { return Math . abs ( this . start . x - this . end . x ) } } ) , Object . defineProperty ( c . Line . prototype , "height" , { get : function ( ) { return Math . abs ( this . start . y - this . end . y ) } } ) , Object . defineProperty ( c . Line . prototype , "normalX" , { get : function ( ) { return Math . cos ( this . angle - 1.5707963267948966 ) } } ) , Object . defineProperty ( c . Line . prototype , "normalY" , { get : function ( ) { return Math . sin ( this . angle - 1.5707963267948966 ) } } ) , Object . defineProperty ( c . Line . p
return this . memorize && this . _prevParams && f . execute ( this . _prevParams ) , f } , _addBinding : function ( a ) { this . _bindings || ( this . _bindings = [ ] ) ; var b = this . _bindings . length ; do b -- ; while ( this . _bindings [ b ] && a . _priority <= this . _bindings [ b ] . _priority ) ; this . _bindings . splice ( b + 1 , 0 , a ) } , _indexOfListener : function ( a , b ) { if ( ! this . _bindings ) return - 1 ; "undefined" == typeof b && ( b = null ) ; for ( var c , d = this . _bindings . length ; d -- ; ) if ( c = this . _bindings [ d ] , c . _listener === a && c . context === b ) return d ; return - 1 } , has : function ( a , b ) { return - 1 !== this . _indexOfListener ( a , b ) } , add : function ( a , b , c ) { return this . validateListener ( a , "add" ) , this . _registerListener ( a , ! 1 , b , c ) } , addOnce : function ( a , b , c ) { return this . validateListener ( a , "addOnce" ) , this . _registerListener ( a , ! 0 , b , c ) } , remove : function ( a , b ) { this . validateListener ( a , "remove" ) ; var c = this . _indexOfListener ( a , b ) ; return - 1 !== c && ( this . _bindings [ c ] . _destroy ( ) , this . _bindings . splice ( c , 1 ) ) , a } , removeAll : function ( a ) { if ( "undefined" == typeof a && ( a = null ) , this . _bindings ) { for ( var b = this . _bindings . length ; b -- ; ) a ? this . _bindings [ b ] . context === a && ( this . _bindings [ b ] . _destroy ( ) , this . _bindings . splice ( b , 1 ) ) : this . _bindings [ b ] . _destroy ( ) ; a || ( this . _bindings . length = 0 ) } } , getNumListeners : function ( ) { return this . _bindings ? this . _bindings . length : 0 } , halt : function ( ) { this . _shouldPropagate = ! 1 } , dispatch : function ( ) { if ( this . active && this . _bindings ) { var a , b = Array . prototype . slice . call ( arguments ) , c = this . _bindings . length ; if ( this . memorize && ( this . _prevParams = b ) , c ) { a = this . _bindings . slice ( ) , this . _shouldPropagate = ! 0 ; do c -- ; while ( a [ c ] && this . _shouldPropagate && a [ c ] . execute ( b ) !== ! 1 ) } } } , forget : function ( ) { this . _prevParams && ( this . _prevParams = null ) } , dispose : function ( ) { this . removeAll ( ) , this . _bindings = null , this . _prevParams && ( this . _prevParams = null ) } , toString : function ( ) { return "[Phaser.Signal active:" + this . active + " numListeners:" + this . getNumListeners ( ) + "]" } } , Object . defineProperty ( c . Signal . prototype , "boundDispatch" , { get : function ( ) { var a = this ; return this . _boundDispatch || ( this . _boundDispatch = function ( ) { return a . dispatch . apply ( a , arguments ) } ) } } ) , c . Signal . prototype . constructor = c . Signal , c . SignalBinding = function ( a , b , c , d , e ) { this . _listener = b , c && ( this . _isOnce = ! 0 ) , null != d && ( this . context = d ) , this . _signal = a , e && ( this . _priority = e ) } , c . SignalBinding . prototype = { context : null , _isOnce : ! 1 , _priority : 0 , callCount : 0 , active : ! 0 , params : null , execute : function ( a ) { var b , c ; return this . active && this . _listener && ( c = this . params ? this . params . concat ( a ) : a , b = this . _listener . apply ( this . context , c ) , this . callCount ++ , this . _isOnce && this . detach ( ) ) , b } , detach : function ( ) { return this . isBound ( ) ? this . _signal . remove ( this . _listener , this . context ) : null } , isBound : function ( ) { return ! ! this . _signal && ! ! this . _listener } , isOnce : function ( ) { return this . _isOnce } , getListener : function ( ) { return this . _listener } , getSignal : function ( ) { return this . _signal } , _destroy : function ( ) { delete this . _signal , delete this . _listener , delete this . context } , toString : function ( ) { return "[Phaser.SignalBinding isOnce:" + this . _isOnce + ", isBound:" + this . isBound ( ) + ", active:" + this . active + "]" } } , c . SignalBinding . prototype . constructor = c . SignalBinding , c . Filter = function ( a , b , d ) { this . game = a , this . type = c . WEBGL _FILTER , this . passes = [ this ] , this . shaders = [ ] , this . dirty = ! 0 , this . padding = 0 , this . prevPoint = new c . Point ; var e = new Date ; if ( this . uniforms = { resolution : { type : "2f" , value : { x : 256 , y : 256 } } , time : { type : "1f" , value : 0 } , mouse : { type : "2f" , value : { x : 0 , y : 0 } } , date : { type : "4fv" , value : [ e . getFullYear ( ) , e . getMonth ( ) , e . getDate ( ) , 60 * e . getHours ( ) * 60 + 60 * e . getMinutes ( ) + e . getSeconds ( ) ] } , sampleRate : { type : "1f" , value : 44100 } , iChannel0 : { type : "sampler2D" , value : null , textureData : { repeat : ! 0 } } , iChannel1 : { type : "sampler2D" , value : null , textureData : { repeat : ! 0 } } , iChannel2 : { type : "sampler2D" , value : null , textureData : { repeat : ! 0 } } , iChannel3 : { type : "sampler2D" , value : null , textureData : { repeat : ! 0 } } } , b ) for ( var f in b ) this . uniforms [ f ] = b [ f ] ; this . fragmentSrc = d || [ ] } , c . Filter . prototype = { init : function ( ) { } , setResolution : function ( a , b ) { this . uniforms . resolution . value . x = a , this . uniforms . resolution . value . y = b } , update : function ( a ) { if ( "undefined" != typeof a ) { var b = a . x / this . game . width , c = 1 - a . y / this . game . height ; ( b !== this . prevPoint . x || c !== this . prevPoint . y ) && ( this . uniforms . mouse . value . x = b . toFixed ( 2 ) , this . u
} , c . ScaleManager . EXACT _FIT = 0 , c . ScaleManager . NO _SCALE = 1 , c . ScaleManager . SHOW _ALL = 2 , c . ScaleManager . RESIZE = 3 , c . ScaleManager . USER _SCALE = 4 , c . ScaleManager . prototype = { boot : function ( ) { var a = this . compatibility ; a . supportsFullScreen = this . game . device . fullscreen && ! this . game . device . cocoonJS , this . game . device . iPad || this . game . device . webApp || this . game . device . desktop || ( a . scrollTo = this . game . device . android && ! this . game . device . chrome ? new c . Point ( 0 , 1 ) : new c . Point ( 0 , 0 ) ) , this . game . device . desktop ? ( a . orientationFallback = "screen" , a . clickTrampoline = "when-not-mouse" ) : ( a . orientationFallback = "" , a . clickTrampoline = "" ) ; var b = this ; this . _orientationChange = function ( a ) { return b . orientationChange ( a ) } , this . _windowResize = function ( a ) { return b . windowResize ( a ) } , window . addEventListener ( "orientationchange" , this . _orientationChange , ! 1 ) , window . addEventListener ( "resize" , this . _windowResize , ! 1 ) , this . compatibility . supportsFullScreen && ( this . _fullScreenChange = function ( a ) { return b . fullScreenChange ( a ) } , this . _fullScreenError = function ( a ) { return b . fullScreenError ( a ) } , document . addEventListener ( "webkitfullscreenchange" , this . _fullScreenChange , ! 1 ) , document . addEventListener ( "mozfullscreenchange" , this . _fullScreenChange , ! 1 ) , document . addEventListener ( "MSFullscreenChange" , this . _fullScreenChange , ! 1 ) , document . addEventListener ( "fullscreenchange" , this . _fullScreenChange , ! 1 ) , document . addEventListener ( "webkitfullscreenerror" , this . _fullScreenError , ! 1 ) , document . addEventListener ( "mozfullscreenerror" , this . _fullScreenError , ! 1 ) , document . addEventListener ( "MSFullscreenError" , this . _fullScreenError , ! 1 ) , document . addEventListener ( "fullscreenerror" , this . _fullScreenError , ! 1 ) ) , this . game . onResume . add ( this . _gameResumed , this ) , this . dom . getOffset ( this . game . canvas , this . offset ) , this . bounds . setTo ( this . offset . x , this . offset . y , this . width , this . height ) , this . setGameSize ( this . game . width , this . game . height ) , this . screenOrientation = this . dom . getScreenOrientation ( this . compatibility . orientationFallback ) , this . grid = new c . FlexGrid ( this , this . width , this . height ) } , parseConfig : function ( a ) { a . scaleMode && ( this . scaleMode = a . scaleMode ) , a . fullScreenScaleMode && ( this . fullScreenScaleMode = a . fullScreenScaleMode ) , a . fullScreenTarget && ( this . fullScreenTarget = a . fullScreenTarget ) } , setupScale : function ( a , b ) { var d , e = new c . Rectangle ; "" !== this . game . parent && ( "string" == typeof this . game . parent ? d = document . getElementById ( this . game . parent ) : this . game . parent && 1 === this . game . parent . nodeType && ( d = this . game . parent ) ) , d ? ( this . parentNode = d , this . parentIsWindow = ! 1 , this . getParentBounds ( this . _parentBounds ) , e . width = this . _parentBounds . width , e . height = this . _parentBounds . height , this . offset . set ( this . _parentBounds . x , this . _parentBounds . y ) ) : ( this . parentNode = null , this . parentIsWindow = ! 0 , e . width = this . dom . visualBounds . width , e . height = this . dom . visualBounds . height , this . offset . set ( 0 , 0 ) ) ; var f = 0 , g = 0 ; "number" == typeof a ? f = a : ( this . parentScaleFactor . x = parseInt ( a , 10 ) / 100 , f = e . width * this . parentScaleFactor . x ) , "number" == typeof b ? g = b : ( this . parentScaleFactor . y = parseInt ( b , 10 ) / 100 , g = e . height * this . parentScaleFactor . y ) , this . _gameSize . setTo ( 0 , 0 , f , g ) , this . updateDimensions ( f , g , ! 1 ) } , _gameResumed : function ( ) { this . queueUpdate ( ! 0 ) } , setGameSize : function ( a , b ) { this . _gameSize . setTo ( 0 , 0 , a , b ) , this . currentScaleMode !== c . ScaleManager . RESIZE && this . updateDimensions ( a , b , ! 0 ) , this . queueUpdate ( ! 0 ) } , setUserScale : function ( a , b , c , d ) { this . _userScaleFactor . setTo ( a , b ) , this . _userScaleTrim . setTo ( 0 | c , 0 | d ) , this . queueUpdate ( ! 0 ) } , setResizeCallback : function ( a , b ) { this . onResize = a , this . onResizeContext = b } , signalSizeChange : function ( ) { if ( ! c . Rectangle . sameDimensions ( this , this . _lastReportedCanvasSize ) || ! c . Rectangle . sameDimensions ( this . game , this . _lastReportedGameSize ) ) { var a = this . width , b = this . height ; this . _lastReportedCanvasSize . setTo ( 0 , 0 , a , b ) , this . _lastReportedGameSize . setTo ( 0 , 0 , this . game . width , this . game . height ) , this . grid . onResize ( a , b ) , this . onSizeChange . dispatch ( this , a , b ) , this . currentScaleMode === c . ScaleManager . RESIZE && ( this . game . state . resize ( a , b ) , this . game . load . resize ( a , b ) ) } } , setMinMax : function ( a , b , c , d ) { this . minWidth = a , this . minHeight = b , "undefined" != typeof c && ( this . maxWidth = c ) , "undefined" != typeof d && ( this . maxHeight = d ) } , preUpdate : function ( ) { if ( ! ( this . game . time . tim
2015-03-24 16:05:52 +00:00
} , getPointer : function ( a ) { "undefined" == typeof a && ( a = ! 1 ) ; for ( var b = 0 ; b < this . pointers . length ; b ++ ) { var c = this . pointers [ b ] ; if ( c . active === a ) return c } return null } , getPointerFromIdentifier : function ( a ) { for ( var b = 0 ; b < this . pointers . length ; b ++ ) { var c = this . pointers [ b ] ; if ( c . identifier === a ) return c } return null } , getPointerFromId : function ( a ) { for ( var b = 0 ; b < this . pointers . length ; b ++ ) { var c = this . pointers [ b ] ; if ( c . pointerId === a ) return c } return null } , getLocalPosition : function ( a , b , d ) { "undefined" == typeof d && ( d = new c . Point ) ; var e = a . worldTransform , f = 1 / ( e . a * e . d + e . c * - e . b ) ; return d . setTo ( e . d * f * b . x + - e . c * f * b . y + ( e . ty * e . c - e . tx * e . d ) * f , e . a * f * b . y + - e . b * f * b . x + ( - e . ty * e . a + e . tx * e . b ) * f ) } , hitTest : function ( a , b , d ) { if ( ! a . worldVisible ) return ! 1 ; if ( this . getLocalPosition ( a , b , this . _localPoint ) , d . copyFrom ( this . _localPoint ) , a . hitArea && a . hitArea . contains ) return a . hitArea . contains ( this . _localPoint . x , this . _localPoint . y ) ; if ( a instanceof c . TileSprite ) { var e = a . width , f = a . height , g = - e * a . anchor . x ; if ( this . _localPoint . x >= g && this . _localPoint . x < g + e ) { var h = - f * a . anchor . y ; if ( this . _localPoint . y >= h && this . _localPoint . y < h + f ) return ! 0 } } else if ( a instanceof PIXI . Sprite ) { var e = a . texture . frame . width , f = a . texture . frame . height , g = - e * a . anchor . x ; if ( this . _localPoint . x >= g && this . _localPoint . x < g + e ) { var h = - f * a . anchor . y ; if ( this . _localPoint . y >= h && this . _localPoint . y < h + f ) return ! 0 } } else if ( a instanceof c . Graphics ) for ( var i = 0 ; i < a . graphicsData . length ; i ++ ) { var j = a . graphicsData [ i ] ; if ( j . fill && j . shape && j . shape . contains ( this . _localPoint . x , this . _localPoint . y ) ) return ! 0 } for ( var i = 0 , k = a . children . length ; k > i ; i ++ ) if ( this . hitTest ( a . children [ i ] , b , d ) ) return ! 0 ; return ! 1 } , onClickTrampoline : function ( ) { this . activePointer . processClickTrampolines ( ) } } , c . Input . prototype . constructor = c . Input , Object . defineProperty ( c . Input . prototype , "x" , { get : function ( ) { return this . _x } , set : function ( a ) { this . _x = Math . floor ( a ) } } ) , Object . defineProperty ( c . Input . prototype , "y" , { get : function ( ) { return this . _y } , set : function ( a ) { this . _y = Math . floor ( a ) } } ) , Object . defineProperty ( c . Input . prototype , "pollLocked" , { get : function ( ) { return this . pollRate > 0 && this . _pollCounter < this . pollRate } } ) , Object . defineProperty ( c . Input . prototype , "totalInactivePointers" , { get : function ( ) { return this . pointers . length - this . countActivePointers ( ) } } ) , Object . defineProperty ( c . Input . prototype , "totalActivePointers" , { get : function ( ) { return this . countActivePointers ( ) } } ) , Object . defineProperty ( c . Input . prototype , "worldX" , { get : function ( ) { return this . game . camera . view . x + this . x } } ) , Object . defineProperty ( c . Input . prototype , "worldY" , { get : function ( ) { return this . game . camera . view . y + this . y } } ) , Object . defineProperty ( c . Input . prototype , "disabled" , { get : function ( ) { return ! this . enabled } , set : function ( a ) { this . enabled = ! a } } ) , c . Mouse = function ( a ) { this . game = a , this . callbackContext = this . game , this . mouseDownCallback = null , this . mouseMoveCallback = null , this . mouseUpCallback = null , this . mouseOutCallback = null , this . mouseOverCallback = null , this . mouseWheelCallback = null , this . capture = ! 1 , this . button = - 1 , this . wheelDelta = 0 , this . enabled = ! 0 , this . locked = ! 1 , this . stopOnGameOut = ! 1 , this . pointerLock = new c . Signal , this . event = null , this . _onMouseDown = null , this . _onMouseMove = null , this . _onMouseUp = null , this . _onMouseOut = null , this . _onMouseOver = null , this . _onMouseWheel = null , this . _wheelEvent = null } , c . Mouse . NO _BUTTON = - 1 , c . Mouse . LEFT _BUTTON = 0 , c . Mouse . MIDDLE _BUTTON = 1 , c . Mouse . RIGHT _BUTTON = 2 , c . Mouse . WHEEL _UP = 1 , c . Mouse . WHEEL _DOWN = - 1 , c . Mouse . prototype = { start : function ( ) { if ( ( ! this . game . device . android || this . game . device . chrome !== ! 1 ) && null === this . _onMouseDown ) { var b = this ; this . _onMouseDown = function ( a ) { return b . onMouseDown ( a ) } , this . _onMouseMove = function ( a ) { return b . onMouseMove ( a ) } , this . _onMouseUp = function ( a ) { return b . onMouseUp ( a ) } , this . _onMouseUpGlobal = function ( a ) { return b . onMouseUpGlobal ( a ) } , this . _onMouseOut = function ( a ) { return b . onMouseOut ( a ) } , this . _onMouseOver = function ( a ) { return b . onMouseOver ( a ) } , this . _onMouseWheel = function ( a ) { return b . onMouseWheel ( a ) } , this . game . canvas . addEventListener ( "mousedown" , this . _onMouseDown , ! 0 ) , this . game . canvas . addEventListener ( "mousemove" , this . _onMouseMove , ! 0 ) , this . game . canvas . addEventListener ( "mouseup" , this . _onMouseUp , ! 0 ) , this . game . device . cocoonJS || ( window . addEventListener ( " mou
2015-03-24 21:35:23 +00:00
} , justOut : function ( a , b ) { return a = a || 0 , b = b || 500 , this . _pointerData [ a ] . isOut && this . game . time . time - this . _pointerData [ a ] . timeOut < b } , justPressed : function ( a , b ) { return a = a || 0 , b = b || 500 , this . _pointerData [ a ] . isDown && this . downDuration ( a ) < b } , justReleased : function ( a , b ) { return a = a || 0 , b = b || 500 , this . _pointerData [ a ] . isUp && this . game . time . time - this . _pointerData [ a ] . timeUp < b } , overDuration : function ( a ) { return a = a || 0 , this . _pointerData [ a ] . isOver ? this . game . time . time - this . _pointerData [ a ] . timeOver : - 1 } , downDuration : function ( a ) { return a = a || 0 , this . _pointerData [ a ] . isDown ? this . game . time . time - this . _pointerData [ a ] . timeDown : - 1 } , enableDrag : function ( a , b , d , e , f , g ) { "undefined" == typeof a && ( a = ! 1 ) , "undefined" == typeof b && ( b = ! 1 ) , "undefined" == typeof d && ( d = ! 1 ) , "undefined" == typeof e && ( e = 255 ) , "undefined" == typeof f && ( f = null ) , "undefined" == typeof g && ( g = null ) , this . _dragPoint = new c . Point , this . draggable = ! 0 , this . bringToTop = b , this . dragOffset = new c . Point , this . dragFromCenter = a , this . pixelPerfectClick = d , this . pixelPerfectAlpha = e , f && ( this . boundsRect = f ) , g && ( this . boundsSprite = g ) } , disableDrag : function ( ) { if ( this . _pointerData ) for ( var a = 0 ; 10 > a ; a ++ ) this . _pointerData [ a ] . isDragged = ! 1 ; this . draggable = ! 1 , this . isDragged = ! 1 , this . _draggedPointerID = - 1 } , startDrag : function ( a ) { var b = this . sprite . x , c = this . sprite . y ; if ( this . isDragged = ! 0 , this . _draggedPointerID = a . id , this . _pointerData [ a . id ] . isDragged = ! 0 , this . sprite . fixedToCamera ) this . dragFromCenter ? ( this . sprite . centerOn ( a . x , a . y ) , this . _dragPoint . setTo ( this . sprite . cameraOffset . x - a . x , this . sprite . cameraOffset . y - a . y ) ) : this . _dragPoint . setTo ( this . sprite . cameraOffset . x - a . x , this . sprite . cameraOffset . y - a . y ) ; else { if ( this . dragFromCenter ) { var d = this . sprite . getBounds ( ) ; this . sprite . x = this . globalToLocalX ( a . x ) + ( this . sprite . x - d . centerX ) , this . sprite . y = this . globalToLocalY ( a . y ) + ( this . sprite . y - d . centerY ) } this . _dragPoint . setTo ( this . sprite . x - this . globalToLocalX ( a . x ) , this . sprite . y - this . globalToLocalY ( a . y ) ) } this . updateDrag ( a ) , this . bringToTop && ( this . _dragPhase = ! 0 , this . sprite . bringToTop ( ) ) , this . dragStartPoint . set ( b , c ) , this . sprite . events . onDragStart$dispatch ( this . sprite , a , b , c ) } , globalToLocalX : function ( a ) { return this . scaleLayer && ( a -= this . game . scale . grid . boundsFluid . x , a *= this . game . scale . grid . scaleFluidInversed . x ) , a } , globalToLocalY : function ( a ) { return this . scaleLayer && ( a -= this . game . scale . grid . boundsFluid . y , a *= this . game . scale . grid . scaleFluidInversed . y ) , a } , stopDrag : function ( a ) { this . isDragged = ! 1 , this . _draggedPointerID = - 1 , this . _pointerData [ a . id ] . isDragged = ! 1 , this . _dragPhase = ! 1 , this . snapOnRelease && ( this . sprite . fixedToCamera ? ( this . sprite . cameraOffset . x = Math . round ( ( this . sprite . cameraOffset . x - this . snapOffsetX % this . snapX ) / this . snapX ) * this . snapX + this . snapOffsetX % this . snapX , this . sprite . cameraOffset . y = Math . round ( ( this . sprite . cameraOffset . y - this . snapOffsetY % this . snapY ) / this . snapY ) * this . snapY + this . snapOffsetY % this . snapY ) : ( this . sprite . x = Math . round ( ( this . sprite . x - this . snapOffsetX % this . snapX ) / this . snapX ) * this . snapX + this . snapOffsetX % this . snapX , this . sprite . y = Math . round ( ( this . sprite . y - this . snapOffsetY % this . snapY ) / this . snapY ) * this . snapY + this . snapOffsetY % this . snapY ) ) , this . sprite . events . onDragStop$dispatch ( this . sprite , a ) , this . checkPointerOver ( a ) === ! 1 && this . _pointerOutHandler ( a ) } , setDragLock : function ( a , b ) { "undefined" == typeof a && ( a = ! 0 ) , "undefined" == typeof b && ( b = ! 0 ) , this . allowHorizontalDrag = a , this . allowVerticalDrag = b } , enableSnap : function ( a , b , c , d , e , f ) { "undefined" == typeof c && ( c = ! 0 ) , "undefined" == typeof d && ( d = ! 1 ) , "undefined" == typeof e && ( e = 0 ) , "undefined" == typeof f && ( f = 0 ) , this . snapX = a , this . snapY = b , this . snapOffsetX = e , this . snapOffsetY = f , this . snapOnDrag = c , this . snapOnRelease = d } , disableSnap : function ( ) { this . snapOnDrag = ! 1 , this . snapOnRelease = ! 1 } , checkBoundsRect : function ( ) { this . sprite . fixedToCamera ? ( this . sprite . cameraOffset . x < this . boundsRect . left ? this . sprite . cameraOffset . x = this . boundsRect . left : this . sprite . cameraOffset . x + this . sprite . width > this . boundsRect . right && ( this . sprite . cameraOffset . x = this . boundsRect . right - this . sprite . width ) , this . sprite . cameraOffset . y < this . boundsRect . top ? this . sprite . cameraOffset . y = this . boundsRect . top : this . sprite . cameraOffset . y + this . sprite . height > this . boundsRect . bottom && ( this . sprite . cameraOffset . y = this . boundsRect .
} } } , c . Events = function ( a ) { this . parent = a } , c . Events . prototype = { destroy : function ( ) { this . _parent = null , this . _onDestroy && this . _onDestroy . dispose ( ) , this . _onAddedToGroup && this . _onAddedToGroup . dispose ( ) , this . _onRemovedFromGroup && this . _onRemovedFromGroup . dispose ( ) , this . _onRemovedFromWorld && this . _onRemovedFromWorld . dispose ( ) , this . _onKilled && this . _onKilled . dispose ( ) , this . _onRevived && this . _onRevived . dispose ( ) , this . _onEnterBounds && this . _onEnterBounds . dispose ( ) , this . _onOutOfBounds && this . _onOutOfBounds . dispose ( ) , this . _onInputOver && this . _onInputOver . dispose ( ) , this . _onInputOut && this . _onInputOut . dispose ( ) , this . _onInputDown && this . _onInputDown . dispose ( ) , this . _onInputUp && this . _onInputUp . dispose ( ) , this . _onDragStart && this . _onDragStart . dispose ( ) , this . _onDragStop && this . _onDragStop . dispose ( ) , this . _onAnimationStart && this . _onAnimationStart . dispose ( ) , this . _onAnimationComplete && this . _onAnimationComplete . dispose ( ) , this . _onAnimationLoop && this . _onAnimationLoop . dispose ( ) } , onAddedToGroup : null , onRemovedFromGroup : null , onRemovedFromWorld : null , onDestroy : null , onKilled : null , onRevived : null , onOutOfBounds : null , onEnterBounds : null , onInputOver : null , onInputOut : null , onInputDown : null , onInputUp : null , onDragStart : null , onDragStop : null , onAnimationStart : null , onAnimationComplete : null , onAnimationLoop : null } , c . Events . prototype . constructor = c . Events ; for ( var e in c . Events . prototype ) c . Events . prototype . hasOwnProperty ( e ) && 0 === e . indexOf ( "on" ) && null === c . Events . prototype [ e ] && ! function ( a , b ) { "use strict" ; Object . defineProperty ( c . Events . prototype , a , { get : function ( ) { return this [ b ] || ( this [ b ] = new c . Signal ) } } ) , c . Events . prototype [ a + "$dispatch" ] = function ( ) { return this [ b ] ? this [ b ] . dispatch . apply ( this [ b ] , arguments ) : null } } ( e , "_" + e ) ; c . Component . FixedToCamera = function ( ) { } , c . Component . FixedToCamera . postUpdate = function ( ) { this . fixedToCamera && ( this . position . x = ( this . game . camera . view . x + this . cameraOffset . x ) / this . game . camera . scale . x , this . position . y = ( this . game . camera . view . y + this . cameraOffset . y ) / this . game . camera . scale . y ) } , c . Component . FixedToCamera . prototype = { _fixedToCamera : ! 1 , fixedToCamera : { get : function ( ) { return this . _fixedToCamera } , set : function ( a ) { a ? ( this . _fixedToCamera = ! 0 , this . cameraOffset . set ( this . x , this . y ) ) : this . _fixedToCamera = ! 1 } } , cameraOffset : new c . Point } , c . Component . Health = function ( ) { } , c . Component . Health . prototype = { health : 1 , damage : function ( a ) { return this . alive && ( this . health -= a , this . health <= 0 && this . kill ( ) ) , this } } , c . Component . InCamera = function ( ) { } , c . Component . InCamera . prototype = { inCamera : { get : function ( ) { return this . game . world . camera . view . intersects ( this . _bounds ) } } } , c . Component . InputEnabled = function ( ) { } , c . Component . InputEnabled . prototype = { input : null , inputEnabled : { get : function ( ) { return this . input && this . input . enabled } , set : function ( a ) { a ? null === this . input ? ( this . input = new c . InputHandler ( this ) , this . input . start ( ) ) : this . input && ! this . input . enabled && this . input . start ( ) : this . input && this . input . enabled && this . input . stop ( ) } } } , c . Component . InWorld = function ( ) { } , c . Component . InWorld . preUpdate = function ( ) { if ( ( this . autoCull || this . checkWorldBounds ) && ( this . _bounds . copyFrom ( this . getBounds ( ) ) , this . _bounds . x += this . game . camera . view . x , this . _bounds . y += this . game . camera . view . y , this . autoCull && ( this . game . world . camera . view . intersects ( this . _bounds ) ? ( this . renderable = ! 0 , this . game . world . camera . totalInView ++ ) : this . renderable = ! 1 ) , this . checkWorldBounds ) ) if ( this . _outOfBoundsFired && this . game . world . bounds . intersects ( this . _bounds ) ) this . _outOfBoundsFired = ! 1 , this . events . onEnterBounds$dispatch ( this ) ; else if ( ! this . _outOfBoundsFired && ! this . game . world . bounds . intersects ( this . _bounds ) && ( this . _outOfBoundsFired = ! 0 , this . events . onOutOfBounds$dispatch ( this ) , this . outOfBoundsKill ) ) return this . kill ( ) , ! 1 ; return ! 0 } , c . Component . InWorld . prototype = { checkWorldBounds : ! 1 , outOfBoundsKill : ! 1 , _outOfBoundsFired : ! 1 , inWorld : { get : function ( ) { return this . game . world . bounds . intersects ( this . getBounds ( ) ) } } } , c . Component . LifeSpan = function ( ) { } , c . Component . LifeSpan . preUpdate = function ( ) { return this . lifespan > 0 && ( this . lifespan -= this . game . time . physicsElapsedMS , this . lifespan <= 0 ) ? ( this . kill ( ) , ! 1 ) : ! 0 } , c . Component . LifeSpan . prototype = { alive : ! 0 , lifespan : 0 , revive : function ( a ) { return "undefined" == typeof a && ( a = 1 ) ,
} , copyRect : function ( a , b , c , d , e , f , g ) { return this . copy ( a , b . x , b . y , b . width , b . height , c , d , b . width , b . height , 0 , 0 , 0 , 1 , 1 , e , f , g ) } , draw : function ( a , b , c , d , e , f , g ) { return this . copy ( a , null , null , null , null , b , c , d , e , null , null , null , null , null , null , f , g ) } , drawGroup : function ( a , b , c ) { return a . total > 0 && a . forEachExists ( this . copy , this , null , null , null , null , null , null , null , null , null , null , null , null , null , null , b , c ) , this } , shadow : function ( a , b , c , d ) { "undefined" == typeof a || null === a ? this . context . shadowColor = "rgba(0,0,0,0)" : ( this . context . shadowColor = a , this . context . shadowBlur = b || 5 , this . context . shadowOffsetX = c || 10 , this . context . shadowOffsetY = d || 10 ) } , alphaMask : function ( a , b , c , d ) { return "undefined" == typeof d || null === d ? this . draw ( b ) . blendSourceAtop ( ) : this . draw ( b , d . x , d . y , d . width , d . height ) . blendSourceAtop ( ) , "undefined" == typeof c || null === c ? this . draw ( a ) . blendReset ( ) : this . draw ( a , c . x , c . y , c . width , c . height ) . blendReset ( ) , this } , extract : function ( a , b , c , d , e , f , g , h , i ) { return "undefined" == typeof e && ( e = 255 ) , "undefined" == typeof f && ( f = ! 1 ) , "undefined" == typeof g && ( g = b ) , "undefined" == typeof h && ( h = c ) , "undefined" == typeof i && ( i = d ) , f && a . resize ( this . width , this . height ) , this . processPixelRGB ( function ( f , j , k ) { return f . r === b && f . g === c && f . b === d && a . setPixel32 ( j , k , g , h , i , e , ! 1 ) , ! 1 } , this ) , a . context . putImageData ( a . imageData , 0 , 0 ) , a . dirty = ! 0 , a } , rect : function ( a , b , c , d , e ) { return "undefined" != typeof e && ( this . context . fillStyle = e ) , this . context . fillRect ( a , b , c , d ) , this } , text : function ( a , b , c , d , e , f ) { "undefined" == typeof b && ( b = 0 ) , "undefined" == typeof c && ( c = 0 ) , "undefined" == typeof d && ( d = "14px Courier" ) , "undefined" == typeof e && ( e = "rgb(255,255,255)" ) , "undefined" == typeof f && ( f = ! 0 ) ; var g = this . context . font ; this . context . font = d , f && ( this . context . fillStyle = "rgb(0,0,0)" , this . context . fillText ( a , b + 1 , c + 1 ) ) , this . context . fillStyle = e , this . context . fillText ( a , b , c ) , this . context . font = g } , circle : function ( a , b , c , d ) { return "undefined" != typeof d && ( this . context . fillStyle = d ) , this . context . beginPath ( ) , this . context . arc ( a , b , c , 0 , 2 * Math . PI , ! 1 ) , this . context . closePath ( ) , this . context . fill ( ) , this } , textureLine : function ( a , b , d ) { if ( "undefined" == typeof d && ( d = "repeat-x" ) , "string" != typeof b || ( b = this . game . cache . getImage ( b ) ) ) { var e = a . length ; return "no-repeat" === d && e > b . width && ( e = b . width ) , this . context . fillStyle = this . context . createPattern ( b , d ) , this . _circle = new c . Circle ( a . start . x , a . start . y , b . height ) , this . _circle . circumferencePoint ( a . angle - 1.5707963267948966 , ! 1 , this . _pos ) , this . context . save ( ) , this . context . translate ( this . _pos . x , this . _pos . y ) , this . context . rotate ( a . angle ) , this . context . fillRect ( 0 , 0 , e , b . height ) , this . context . restore ( ) , this . dirty = ! 0 , this } } , render : function ( ) { return ! this . disableTextureUpload && this . dirty && ( this . baseTexture . dirty ( ) , this . dirty = ! 1 ) , this } , blendReset : function ( ) { return this . context . globalCompositeOperation = "source-over" , this } , blendSourceOver : function ( ) { return this . context . globalCompositeOperation = "source-over" , this } , blendSourceIn : function ( ) { return this . context . globalCompositeOperation = "source-in" , this } , blendSourceOut : function ( ) { return this . context . globalCompositeOperation = "source-out" , this } , blendSourceAtop : function ( ) { return this . context . globalCompositeOperation = "source-atop" , this } , blendDestinationOver : function ( ) { return this . context . globalCompositeOperation = "destination-over" , this } , blendDestinationIn : function ( ) { return this . context . globalCompositeOperation = "destination-in" , this } , blendDestinationOut : function ( ) { return this . context . globalCompositeOperation = "destination-out" , this } , blendDestinationAtop : function ( ) { return this . context . globalCompositeOperation = "destination-atop" , this } , blendXor : function ( ) { return this . context . globalCompositeOperation = "xor" , this } , blendAdd : function ( ) { return this . context . globalCompositeOperation = "lighter" , this } , blendMultiply : function ( ) { return this . context . globalCompositeOperation = "multiply" , this } , blendScreen : function ( ) { return this . context . globalCompositeOperation = "screen" , this } , blendOverlay : function ( ) { return this . context . globalCompositeOperation = "overlay" , this } , blendDarken : function ( ) { return this . context . globalCompositeOperation = "darken" , this } , blendLighten : function ( ) { return this . context . globalCompositeOperation = "lighten" , this } , blendColorDodge : function ( ) { re
} catch ( c ) { } } function g ( ) { k . pixelRatio = window . devicePixelRatio || 1 , k . iPhone = - 1 != navigator . userAgent . toLowerCase ( ) . indexOf ( "iphone" ) , k . iPhone4 = 2 == k . pixelRatio && k . iPhone , k . iPad = - 1 != navigator . userAgent . toLowerCase ( ) . indexOf ( "ipad" ) , k . typedArray = "undefined" != typeof Int8Array ? ! 0 : ! 1 , "undefined" != typeof ArrayBuffer && "undefined" != typeof Uint8Array && "undefined" != typeof Uint32Array && ( k . littleEndian = h ( ) , k . LITTLE _ENDIAN = k . littleEndian ) , k . support32bit = "undefined" != typeof ArrayBuffer && "undefined" != typeof Uint8ClampedArray && "undefined" != typeof Int32Array && null !== k . littleEndian && i ( ) , navigator . vibrate = navigator . vibrate || navigator . webkitVibrate || navigator . mozVibrate || navigator . msVibrate , navigator . vibrate && ( k . vibration = ! 0 ) } function h ( ) { var a = new ArrayBuffer ( 4 ) , b = new Uint8Array ( a ) , c = new Uint32Array ( a ) ; return b [ 0 ] = 161 , b [ 1 ] = 178 , b [ 2 ] = 195 , b [ 3 ] = 212 , 3569595041 == c [ 0 ] ? ! 0 : 2712847316 == c [ 0 ] ? ! 1 : null } function i ( ) { if ( "undefined" == typeof Uint8ClampedArray ) return ! 1 ; var a = document . createElement ( "canvas" ) , b = a . getContext ( "2d" ) ; if ( ! b ) return ! 1 ; var c = b . createImageData ( 1 , 1 ) ; return c . data instanceof Uint8ClampedArray } function j ( ) { var a , b = document . createElement ( "p" ) , c = { webkitTransform : "-webkit-transform" , OTransform : "-o-transform" , msTransform : "-ms-transform" , MozTransform : "-moz-transform" , transform : "transform" } ; document . body . insertBefore ( b , null ) ; for ( var d in c ) void 0 !== b . style [ d ] && ( b . style [ d ] = "translate3d(1px,1px,1px)" , a = window . getComputedStyle ( b ) . getPropertyValue ( c [ d ] ) ) ; document . body . removeChild ( b ) , k . css3D = void 0 !== a && a . length > 0 && "none" !== a } var k = this ; a ( ) , f ( ) , e ( ) , j ( ) , g ( ) , b ( ) , d ( ) , c ( ) } , c . Device . canPlayAudio = function ( a ) { return "mp3" == a && this . mp3 ? ! 0 : "ogg" == a && ( this . ogg || this . opus ) ? ! 0 : "m4a" == a && this . m4a ? ! 0 : "opus" == a && this . opus ? ! 0 : "wav" == a && this . wav ? ! 0 : "webm" == a && this . webm ? ! 0 : ! 1 } , c . Device . isConsoleOpen = function ( ) { return window . console && window . console . firebug ? ! 0 : window . console && ( console . profile ( ) , console . profileEnd ( ) , console . clear && console . clear ( ) , console . profiles ) ? console . profiles . length > 0 : ! 1 } , c . Device . isAndroidStockBrowser = function ( ) { var a = window . navigator . userAgent . match ( /Android.*AppleWebKit\/([\d.]+)/ ) ; return a && a [ 1 ] < 537 } , c . DOM = { getOffset : function ( a , b ) { b = b || new c . Point ; var d = a . getBoundingClientRect ( ) , e = c . DOM . scrollY , f = c . DOM . scrollX , g = document . documentElement . clientTop , h = document . documentElement . clientLeft ; return b . x = d . left + f - h , b . y = d . top + e - g , b } , getBounds : function ( a , b ) { return "undefined" == typeof b && ( b = 0 ) , a = a && ! a . nodeType ? a [ 0 ] : a , a && 1 === a . nodeType ? this . calibrate ( a . getBoundingClientRect ( ) , b ) : ! 1 } , calibrate : function ( a , b ) { b = + b || 0 ; var c = { width : 0 , height : 0 , left : 0 , right : 0 , top : 0 , bottom : 0 } ; return c . width = ( c . right = a . right + b ) - ( c . left = a . left - b ) , c . height = ( c . bottom = a . bottom + b ) - ( c . top = a . top - b ) , c } , getAspectRatio : function ( a ) { a = null == a ? this . visualBounds : 1 === a . nodeType ? this . getBounds ( a ) : a ; var b = a . width , c = a . height ; return "function" == typeof b && ( b = b . call ( a ) ) , "function" == typeof c && ( c = c . call ( a ) ) , b / c } , inLayoutViewport : function ( a , b ) { var c = this . getBounds ( a , b ) ; return ! ! c && c . bottom >= 0 && c . right >= 0 && c . top <= this . layoutBounds . width && c . left <= this . layoutBounds . height } , getScreenOrientation : function ( a ) { var b = window . screen , c = b . orientation || b . mozOrientation || b . msOrientation ; if ( c && "string" == typeof c . type ) return c . type ; if ( "string" == typeof c ) return c ; var d = "portrait-primary" , e = "landscape-primary" ; if ( "screen" === a ) return b . height > b . width ? d : e ; if ( "viewport" === a ) return this . visualBounds . height > this . visualBounds . width ? d : e ; if ( "window.orientation" === a && "number" == typeof window . orientation ) return 0 === window . orientation || 180 === window . orientation ? d : e ; if ( window . matchMedia ) { if ( window . matchMedia ( "(orientation: portrait)" ) . matches ) return d ; if ( window . matchMedia ( "(orientation: landscape)" ) . matches ) return e } return this . visualBounds . height > this . visualBounds . width ? d : e } , visualBounds : new c . Rectangle , layoutBounds : new c . Rectangle , documentBounds : new c . Rectangle } , c . Device . whenReady ( function ( a ) { var b = window && "pageXOffset" in window ? function ( ) { return window . pageXOffset } : function ( ) { return document . documentElement . scrollLeft } , d = window && "pageYOffset" in window ? function ( ) { return window . pageYOffset } : function ( ) { return document . documentElement . scrollTop } ; O
2015-03-25 16:17:53 +00:00
this . parent . target [ a ] = Array . isArray ( d ) ? this . interpolationFunction . call ( this . interpolationContext , d , this . value ) : b + ( d - b ) * this . value } return ! this . parent . reverse && 1 === this . percent || this . parent . reverse && 0 === this . percent ? this . repeat ( ) : c . TweenData . RUNNING } , generateData : function ( a ) { this . dt = this . parent . reverse ? this . duration : 0 ; var b = [ ] , c = ! 1 , d = 1 / a * 1e3 ; do { this . parent . reverse ? ( this . dt -= d , this . dt = Math . max ( this . dt , 0 ) ) : ( this . dt += d , this . dt = Math . min ( this . dt , this . duration ) ) , this . percent = this . dt / this . duration , this . value = this . easingFunction ( this . percent ) ; var e = { } ; for ( var f in this . vEnd ) { var g = this . vStart [ f ] , h = this . vEnd [ f ] ; e [ f ] = Array . isArray ( h ) ? this . interpolationFunction ( h , this . value ) : g + ( h - g ) * this . value } b . push ( e ) , ( ! this . parent . reverse && 1 === this . percent || this . parent . reverse && 0 === this . percent ) && ( c = ! 0 ) } while ( ! c ) ; if ( this . yoyo ) { var i = b . slice ( ) ; i . reverse ( ) , b = b . concat ( i ) } return b } , repeat : function ( ) { if ( this . yoyo ) { if ( this . inReverse && 0 === this . repeatCounter ) return c . TweenData . COMPLETE ; this . inReverse = ! this . inReverse } else if ( 0 === this . repeatCounter ) return c . TweenData . COMPLETE ; if ( this . inReverse ) for ( var a in this . vStartCache ) this . vStart [ a ] = this . vEndCache [ a ] , this . vEnd [ a ] = this . vStartCache [ a ] ; else { for ( var a in this . vStartCache ) this . vStart [ a ] = this . vStartCache [ a ] , this . vEnd [ a ] = this . vEndCache [ a ] ; this . repeatCounter > 0 && this . repeatCounter -- } return this . startTime = this . game . time . time , this . yoyo && this . inReverse ? this . startTime += this . yoyoDelay : this . inReverse || ( this . startTime += this . repeatDelay ) , this . dt = this . parent . reverse ? this . duration : 0 , c . TweenData . LOOPED } } , c . TweenData . prototype . constructor = c . TweenData , c . Easing = { Linear : { None : function ( a ) { return a } } , Quadratic : { In : function ( a ) { return a * a } , Out : function ( a ) { return a * ( 2 - a ) } , InOut : function ( a ) { return ( a *= 2 ) < 1 ? . 5 * a * a : - . 5 * ( -- a * ( a - 2 ) - 1 ) } } , Cubic : { In : function ( a ) { return a * a * a } , Out : function ( a ) { return -- a * a * a + 1 } , InOut : function ( a ) { return ( a *= 2 ) < 1 ? . 5 * a * a * a : . 5 * ( ( a -= 2 ) * a * a + 2 ) } } , Quartic : { In : function ( a ) { return a * a * a * a } , Out : function ( a ) { return 1 - -- a * a * a * a } , InOut : function ( a ) { return ( a *= 2 ) < 1 ? . 5 * a * a * a * a : - . 5 * ( ( a -= 2 ) * a * a * a - 2 ) } } , Quintic : { In : function ( a ) { return a * a * a * a * a } , Out : function ( a ) { return -- a * a * a * a * a + 1 } , InOut : function ( a ) { return ( a *= 2 ) < 1 ? . 5 * a * a * a * a * a : . 5 * ( ( a -= 2 ) * a * a * a * a + 2 ) } } , Sinusoidal : { In : function ( a ) { return 0 === a ? 0 : 1 === a ? 1 : 1 - Math . cos ( a * Math . PI / 2 ) } , Out : function ( a ) { return 0 === a ? 0 : 1 === a ? 1 : Math . sin ( a * Math . PI / 2 ) } , InOut : function ( a ) { return 0 === a ? 0 : 1 === a ? 1 : . 5 * ( 1 - Math . cos ( Math . PI * a ) ) } } , Exponential : { In : function ( a ) { return 0 === a ? 0 : Math . pow ( 1024 , a - 1 ) } , Out : function ( a ) { return 1 === a ? 1 : 1 - Math . pow ( 2 , - 10 * a ) } , InOut : function ( a ) { return 0 === a ? 0 : 1 === a ? 1 : ( a *= 2 ) < 1 ? . 5 * Math . pow ( 1024 , a - 1 ) : . 5 * ( - Math . pow ( 2 , - 10 * ( a - 1 ) ) + 2 ) } } , Circular : { In : function ( a ) { return 1 - Math . sqrt ( 1 - a * a ) } , Out : function ( a ) { return Math . sqrt ( 1 - -- a * a ) } , InOut : function ( a ) { return ( a *= 2 ) < 1 ? - . 5 * ( Math . sqrt ( 1 - a * a ) - 1 ) : . 5 * ( Math . sqrt ( 1 - ( a -= 2 ) * a ) + 1 ) } } , Elastic : { In : function ( a ) { var b , c = . 1 , d = . 4 ; return 0 === a ? 0 : 1 === a ? 1 : ( ! c || 1 > c ? ( c = 1 , b = d / 4 ) : b = d * Math . asin ( 1 / c ) / ( 2 * Math . PI ) , - ( c * Math . pow ( 2 , 10 * ( a -= 1 ) ) * Math . sin ( 2 * ( a - b ) * Math . PI / d ) ) ) } , Out : function ( a ) { var b , c = . 1 , d = . 4 ; return 0 === a ? 0 : 1 === a ? 1 : ( ! c || 1 > c ? ( c = 1 , b = d / 4 ) : b = d * Math . asin ( 1 / c ) / ( 2 * Math . PI ) , c * Math . pow ( 2 , - 10 * a ) * Math . sin ( 2 * ( a - b ) * Math . PI / d ) + 1 ) } , InOut : function ( a ) { var b , c = . 1 , d = . 4 ; return 0 === a ? 0 : 1 === a ? 1 : ( ! c || 1 > c ? ( c = 1 , b = d / 4 ) : b = d * Math . asin ( 1 / c ) / ( 2 * Math . PI ) , ( a *= 2 ) < 1 ? - . 5 * c * Math . pow ( 2 , 10 * ( a -= 1 ) ) * Math . sin ( 2 * ( a - b ) * Math . PI / d ) : c * Math . pow ( 2 , - 10 * ( a -= 1 ) ) * Math . sin ( 2 * ( a - b ) * Math . PI / d ) * . 5 + 1 ) } } , Back : { In : function ( a ) { var b = 1.70158 ; return a * a * ( ( b + 1 ) * a - b ) } , Out : function ( a ) { var b = 1.70158 ; return -- a * a * ( ( b + 1 ) * a + b ) + 1 } , InOut : function ( a ) { var b = 2.5949095 ; return ( a *= 2 ) < 1 ? . 5 * a * a * ( ( b + 1 ) * a - b ) : . 5 * ( ( a -= 2 ) * a * ( ( b + 1 ) * a + b ) + 2 ) } } , Bounce : { In : function ( a ) { return 1 - c . Easing . Bounce . Out ( 1 - a ) } , Out : function ( a ) { return 1 / 2.75 > a ? 7.5625 * a * a : 2 / 2.75 > a ? 7.5625 * ( a -= 1.5 / 2.75 ) * a + . 75 : 2.5 / 2.75 > a ? 7.5625 * ( a -= 2.25 / 2.75 ) * a + . 9375 : 7.5625 * ( a -= 2.625 / 2.75 ) * a + . 984375 } , InOut : function ( a ) { return . 5 > a ? . 5 * c . Easing . Bounce . In ( 2 * a ) : . 5 * c . Easing . Bounce . Out ( 2 * a - 1 ) + . 5 } } } , c . Easing . Default = c . Easing . Linear . None , c . Easing . Power0 = c . Easing . Linear . None , c . Easing . Power1 = c . Easing . Quadratic . Out , c . Easing . Power2 = c . Easing . Cubic . Out , c . Easing . Power3 = c . Easing . Quartic . Out , c . Easing . Power4 = c . Easing . Quintic . Out , c .
} , addText : function ( a , b , c ) { this . _text [ a ] = { url : b , data : c } , this . _resolveURL ( b , this . _text [ a ] ) } , addJSON : function ( a , b , c ) { this . _json [ a ] = { url : b , data : c } , this . _resolveURL ( b , this . _json [ a ] ) } , addXML : function ( a , b , c ) { this . _xml [ a ] = { url : b , data : c } , this . _resolveURL ( b , this . _xml [ a ] ) } , addImage : function ( a , b , d ) { this . checkImageKey ( a ) && this . removeImage ( a ) , this . _images [ a ] = { url : b , data : d } , this . _images [ a ] . frame = new c . Frame ( 0 , 0 , 0 , d . width , d . height , a , this . game . rnd . uuid ( ) ) , this . _images [ a ] . frameData = new c . FrameData , this . _images [ a ] . frameData . addFrame ( new c . Frame ( 0 , 0 , 0 , d . width , d . height , b , this . game . rnd . uuid ( ) ) ) , PIXI . BaseTextureCache [ a ] = new PIXI . BaseTexture ( d ) , PIXI . TextureCache [ a ] = new PIXI . Texture ( PIXI . BaseTextureCache [ a ] ) , this . _resolveURL ( b , this . _images [ 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 } , this . _resolveURL ( b , this . _sounds [ a ] ) } , 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 : ( console . warn ( 'Phaser.Cache.getCanvas: Invalid key: "' + a + '"' ) , null ) } , getBitmapData : function ( a ) { return this . _bitmapDatas [ a ] ? this . _bitmapDatas [ a ] . data : ( console . warn ( 'Phaser.Cache.getBitmapData: Invalid key: "' + a + '"' ) , null ) } , getBitmapFont : function ( a ) { return this . _bitmapFont [ a ] ? this . _bitmapFont [ a ] : ( console . warn ( 'Phaser.Cache.getBitmapFont: Invalid key: "' + a + '"' ) , null ) } , 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 ( c . Cache . CANVAS , a ) } , checkImageKey : function ( a ) { return this . checkKey ( c . Cache . IMAGE , a ) } , checkTextureKey : function ( a ) { return this . checkKey ( c . Cache . TEXTURE , a ) } , checkSoundKey : function ( a ) { return this . checkKey ( c . Cache . SOUND , a ) } , checkTextKey : function ( a ) { return this . checkKey ( c . Cache . TEXT , a ) } , checkPhysicsKey : function ( a ) { return this . checkKey ( c . Cache . PHYSICS , a ) } , checkTilemapKey : function ( a ) { return this . checkKey ( c . Cache . TILEMAP , a ) } , checkBinaryKey : function ( a ) { return this . checkKey ( c . Cache . BINARY , a ) } , checkBitmapDataKey : function ( a ) { return this . checkKey ( c . Cache . BITMAPDATA , a ) } , checkBitmapFontKey : function ( a ) { return this . checkKey ( c . Cache . BITMAPFONT , a ) } , checkJSONKey : function ( a ) { return this . checkKey ( c . Cache . JSON , a ) } , checkXMLKey : function ( a ) { return this . checkKey ( c . Cache . XML , a ) } , checkURL : function ( a ) { return this . _urlMap [ this . _resolveURL ( a ) ] ? ! 0 : ! 1 } , getImage : function ( a ) { return this . _images [ a ] ? this . _images [ a ] . data : ( console . warn ( 'Phaser.Cache.getImage: Invalid key: "' + a + '"' ) , null ) } , getTilemapData : function ( a ) { return this . _tilemaps [ a ] ? this . _tilemaps [ a ] : ( console . warn ( 'Phaser.Cache.getTilemapData: Invalid key: "' + a + '"' ) , null ) } , getFrameData : function ( a , b ) { return "undefined" == typeof b && ( b = c . Cache . IMAGE ) , this . _cacheMap [ b ] [ a ] ? this . _cacheMap [ b ] [ a ] . frameData : null } , updateFrameData : function ( a , b ) { this . _images [ a ] && ( this . _images [ a ] . frameData = b ) } , getFrameByIndex : function ( a , b ) { return this . _images [ a ] ? this . _images [ a ] . frameData . getFrame ( b ) : null } , getFrameByName : function ( a , b ) { return this . _images [ a ] ? this . _images [ a ] . frameData . getFrameByName ( b ) : null } , getFrame : function ( a ) { return this . _images [ a ] ? t
2015-03-24 21:35:23 +00:00
} else b = b || 0 , "undefined" == typeof c && ( c = this . _volume ) , "undefined" == typeof d && ( d = this . loop ) , this . position = b , this . volume = c , this . loop = d , this . duration = 0 , this . durationMS = 0 , this . _tempMarker = a , this . _tempPosition = b , this . _tempVolume = c , this . _tempLoop = d ; return this . usingWebAudio ? this . game . cache . isSoundDecoded ( this . key ) ? ( null === this . _buffer && ( this . _buffer = this . game . cache . getSoundData ( this . key ) ) , this . _sound = this . context . createBufferSource ( ) , this . _sound . buffer = this . _buffer , this . _sound . connect ( this . externalNode ? this . externalNode : this . gainNode ) , this . loop && "" === a && ( this . _sound . loop = ! 0 ) , this . loop || "" !== a || ( this . _sound . onended = this . onEndedHandler . bind ( this ) ) , this . totalDuration = this . _sound . buffer . duration , 0 === this . duration && ( this . duration = this . totalDuration , this . durationMS = Math . ceil ( 1e3 * this . totalDuration ) ) , "undefined" == typeof this . _sound . start ? this . _sound . noteGrainOn ( 0 , this . position , this . duration ) : this . loop && "" === a ? this . _sound . start ( 0 ) : this . _sound . start ( 0 , this . position , this . duration ) , this . isPlaying = ! 0 , this . startTime = this . game . time . time , this . currentTime = 0 , this . stopTime = this . startTime + this . durationMS , this . onPlay . dispatch ( this ) ) : ( this . pendingPlayback = ! 0 , this . game . cache . getSound ( this . key ) && this . game . cache . getSound ( this . key ) . isDecoding === ! 1 && this . game . sound . decode ( this . key , this ) ) : this . game . cache . getSound ( this . key ) && this . game . cache . getSound ( this . key ) . locked ? ( this . game . cache . reloadSound ( this . key ) , this . pendingPlayback = ! 0 ) : this . _sound && ( this . game . device . cocoonJS || 4 === this . _sound . readyState ) ? ( this . _sound . play ( ) , this . totalDuration = this . _sound . duration , 0 === this . duration && ( this . duration = this . totalDuration , this . durationMS = 1e3 * this . totalDuration ) , this . _sound . currentTime = this . position , this . _sound . muted = this . _muted , this . _sound . volume = this . _muted ? 0 : this . _volume , this . isPlaying = ! 0 , this . startTime = this . game . time . time , this . currentTime = 0 , this . stopTime = this . startTime + this . durationMS , this . onPlay . dispatch ( this ) ) : this . pendingPlayback = ! 0 , this } , restart : function ( a , b , c , d ) { a = a || "" , b = b || 0 , c = c || 1 , "undefined" == typeof d && ( d = ! 1 ) , this . play ( a , b , c , d , ! 0 ) } , pause : function ( ) { this . isPlaying && this . _sound && ( this . paused = ! 0 , this . pausedPosition = this . currentTime , this . pausedTime = this . game . time . time , this . onPause . dispatch ( this ) , this . stop ( ) ) } , resume : function ( ) { if ( this . paused && this . _sound ) { if ( this . usingWebAudio ) { var a = this . position + this . pausedPosition / 1e3 ; this . _sound = this . context . createBufferSource ( ) , this . _sound . buffer = this . _buffer , this . _sound . connect ( this . externalNode ? this . externalNode : this . gainNode ) , this . loop && ( this . _sound . loop = ! 0 ) , this . loop || "" !== this . currentMarker || ( this . _sound . onended = this . onEndedHandler . bind ( this ) ) ; var b = this . duration - this . pausedPosition / 1e3 ; "undefined" == typeof this . _sound . start ? this . _sound . noteGrainOn ( 0 , a , b ) : this . _sound . start ( 0 , a , b ) } else this . _sound . play ( ) ; this . isPlaying = ! 0 , this . paused = ! 1 , this . startTime += this . game . time . time - this . pausedTime , this . onResume . dispatch ( this ) } } , stop : function ( ) { if ( this . isPlaying && this . _sound ) if ( this . usingWebAudio ) if ( "undefined" == typeof this . _sound . stop ) this . _sound . noteOff ( 0 ) ; else try { this . _sound . stop ( 0 ) } catch ( a ) { } else this . usingAudioTag && ( this . _sound . pause ( ) , this . _sound . currentTime = 0 ) ; this . pendingPlayback = ! 1 , this . isPlaying = ! 1 ; var b = this . currentMarker ; "" !== this . currentMarker && this . onMarkerComplete . dispatch ( this . currentMarker , this ) , this . currentMarker = "" , null !== this . fadeTween && this . fadeTween . stop ( ) , this . paused || this . onStop . dispatch ( this , b ) } , fadeIn : function ( a , b , c ) { "undefined" == typeof b && ( b = ! 1 ) , "undefined" == typeof c && ( c = this . currentMarker ) , this . paused || ( this . play ( c , 0 , 0 , b ) , this . fadeTo ( a , 1 ) ) } , fadeOut : function ( a ) { this . fadeTo ( a , 0 ) } , fadeTo : function ( a , b ) { if ( this . isPlaying && ! this . paused && b !== this . volume ) { if ( "undefined" == typeof a && ( a = 1e3 ) , "undefined" == typeof b ) return void console . warn ( "Phaser.Sound.fadeTo: No Volume Specified." ) ; this . fadeTween = this . game . add . tween ( this ) . to ( { volume : b } , a , c . Easing . Linear . None , ! 0 ) , this . fadeTween . onComplete . add ( this . fadeComplete , this ) } } , fadeComplete : function ( ) { this . onFadeComplete . dispatch ( this , this . volume ) , 0 === this . volume && this . stop ( ) } , destroy : function ( a ) { "undefined" == typeof a && ( a = ! 0 ) , this . stop ( ) , a ? this . game . sound . remove ( this ) : ( this
} , preUpdate : function ( ) { this . p2 && this . p2 . preUpdate ( ) , this . box2d && this . box2d . preUpdate ( ) } , update : function ( ) { this . p2 && this . p2 . update ( ) , this . box2d && this . box2d . update ( ) } , setBoundsToWorld : function ( ) { this . arcade && this . arcade . setBoundsToWorld ( ) , this . ninja && this . ninja . setBoundsToWorld ( ) , this . p2 && this . p2 . setBoundsToWorld ( ) , this . box2d && this . box2d . setBoundsToWorld ( ) } , clear : function ( ) { this . p2 && this . p2 . clear ( ) , this . box2d && this . box2d . clear ( ) } , reset : function ( ) { this . p2 && this . p2 . reset ( ) , this . box2d && this . box2d . reset ( ) } , destroy : function ( ) { this . p2 && this . p2 . destroy ( ) , this . box2d && this . box2d . destroy ( ) , this . arcade = null , this . ninja = null , this . p2 = null , this . box2d = null } } , c . Physics . prototype . constructor = c . Physics , c . Physics . Arcade = function ( a ) { this . game = a , this . gravity = new c . Point , this . bounds = new c . Rectangle ( 0 , 0 , a . world . width , a . world . height ) , this . checkCollision = { up : ! 0 , down : ! 0 , left : ! 0 , right : ! 0 } , this . maxObjects = 10 , this . maxLevels = 4 , this . OVERLAP _BIAS = 4 , this . forceX = ! 1 , this . sortDirection = c . Physics . Arcade . LEFT _RIGHT , this . skipQuadTree = ! 0 , this . isPaused = ! 1 , this . quadTree = new c . QuadTree ( this . game . world . bounds . x , this . game . world . bounds . y , this . game . world . bounds . width , this . game . world . bounds . height , this . maxObjects , this . maxLevels ) , this . _total = 0 , this . setBoundsToWorld ( ) } , c . Physics . Arcade . prototype . constructor = c . Physics . Arcade , c . Physics . Arcade . SORT _NONE = 0 , c . Physics . Arcade . LEFT _RIGHT = 1 , c . Physics . Arcade . RIGHT _LEFT = 2 , c . Physics . Arcade . TOP _BOTTOM = 3 , c . Physics . Arcade . BOTTOM _TOP = 4 , c . Physics . Arcade . prototype = { setBounds : function ( a , b , c , d ) { this . bounds . setTo ( a , b , c , d ) } , setBoundsToWorld : function ( ) { this . bounds . setTo ( this . game . world . bounds . x , this . game . world . bounds . y , this . game . world . bounds . width , this . game . world . bounds . height ) } , enable : function ( a , b ) { "undefined" == typeof b && ( b = ! 0 ) ; var d = 1 ; if ( Array . isArray ( a ) ) for ( d = a . length ; d -- ; ) a [ d ] instanceof c . Group ? this . enable ( a [ d ] . children , b ) : ( this . enableBody ( a [ d ] ) , b && a [ d ] . hasOwnProperty ( "children" ) && a [ d ] . children . length > 0 && this . enable ( a [ d ] , ! 0 ) ) ; else a instanceof c . Group ? this . enable ( a . children , b ) : ( this . enableBody ( a ) , b && a . hasOwnProperty ( "children" ) && a . children . length > 0 && this . enable ( a . children , ! 0 ) ) } , enableBody : function ( a ) { a . hasOwnProperty ( "body" ) && null === a . body && ( a . body = new c . Physics . Arcade . Body ( a ) ) } , updateMotion : function ( a ) { var b = this . computeVelocity ( 0 , a , a . angularVelocity , a . angularAcceleration , a . angularDrag , a . maxAngular ) - a . angularVelocity ; a . angularVelocity += b , a . rotation += a . angularVelocity * this . game . time . physicsElapsed , a . velocity . x = this . computeVelocity ( 1 , a , a . velocity . x , a . acceleration . x , a . drag . x , a . maxVelocity . x ) , a . velocity . y = this . computeVelocity ( 2 , a , a . velocity . y , a . acceleration . y , a . drag . y , a . maxVelocity . y ) } , computeVelocity : function ( a , b , c , d , e , f ) { return "undefined" == typeof f && ( f = 1e4 ) , 1 === a && b . allowGravity ? c += ( this . gravity . x + b . gravity . x ) * this . game . time . physicsElapsed : 2 === a && b . allowGravity && ( c += ( this . gravity . y + b . gravity . y ) * this . game . time . physicsElapsed ) , d ? c += d * this . game . time . physicsElapsed : e && ( e *= this . game . time . physicsElapsed , c - e > 0 ? c -= e : 0 > c + e ? c += e : c = 0 ) , c > f ? c = f : - f > c && ( c = - f ) , c } , overlap : function ( a , b , c , d , e ) { if ( c = c || null , d = d || null , e = e || c , this . _total = 0 , ! Array . isArray ( a ) && Array . isArray ( b ) ) for ( var f = 0 ; f < b . length ; f ++ ) this . collideHandler ( a , b [ f ] , c , d , e , ! 0 ) ; else if ( Array . isArray ( a ) && ! Array . isArray ( b ) ) for ( var f = 0 ; f < a . length ; f ++ ) this . collideHandler ( a [ f ] , b , c , d , e , ! 0 ) ; else if ( Array . isArray ( a ) && Array . isArray ( b ) ) for ( var f = 0 ; f < a . length ; f ++ ) for ( var g = 0 ; g < b . length ; g ++ ) this . collideHandler ( a [ f ] , b [ g ] , c , d , e , ! 0 ) ; else this . collideHandler ( a , b , c , d , e , ! 0 ) ; return this . _total > 0 } , collide : function ( a , b , c , d , e ) { if ( c = c || null , d = d || null , e = e || c , this . _total = 0 , ! Array . isArray ( a ) && Array . isArray ( b ) ) for ( var f = 0 ; f < b . length ; f ++ ) this . collideHandler ( a , b [ f ] , c , d , e , ! 1 ) ; else if ( Array . isArray ( a ) && ! Array . isArray ( b ) ) for ( var f = 0 ; f < a . length ; f ++ ) this . collideHandler ( a [ f ] , b , c , d , e , ! 1 ) ; else if ( Array . isArray ( a ) && Array . isArray ( b ) ) for ( var f = 0 ; f < a . length ; f ++ ) for ( var g = 0 ; g < b . length ; g ++ ) this . collideHandler ( a [ f ] , b [ g ] , c , d , e , ! 1 ) ; else this . collideHandler ( a , b , c , d , e , ! 1 ) ; return this . _total > 0 } , sort : function ( a ) { this . sortDirection === c . Physics . Arcade . LEFT _RIGHT ? a . _hash . sort ( function ( a , b ) { return a . body && b . body ? a . body . x - b . body . x : - 1 } ) : this . sortDirection ===
} , { "./Point" : 2 , "./Polygon" : 3 } ] , 6 : [ function ( a , b ) { b . exports = { name : "p2" , version : "0.6.0" , description : "A JavaScript 2D physics engine." , author : "Stefan Hedman <schteppe@gmail.com> (http://steffe.se)" , keywords : [ "p2.js" , "p2" , "physics" , "engine" , "2d" ] , main : "./src/p2.js" , engines : { node : "*" } , repository : { type : "git" , url : "https://github.com/schteppe/p2.js.git" } , bugs : { url : "https://github.com/schteppe/p2.js/issues" } , licenses : [ { type : "MIT" } ] , devDependencies : { grunt : "~0.4.0" , "grunt-contrib-jshint" : "~0.9.2" , "grunt-contrib-nodeunit" : "~0.1.2" , "grunt-contrib-uglify" : "~0.4.0" , "grunt-contrib-watch" : "~0.5.0" , "grunt-browserify" : "~2.0.1" , "grunt-contrib-concat" : "^0.4.0" } , dependencies : { "poly-decomp" : "0.1.0" } } } , { } ] , 7 : [ function ( a , b ) { function c ( a ) { this . lowerBound = d . create ( ) , a && a . lowerBound && d . copy ( this . lowerBound , a . lowerBound ) , this . upperBound = d . create ( ) , a && a . upperBound && d . copy ( this . upperBound , a . upperBound ) } { var d = a ( "../math/vec2" ) ; a ( "../utils/Utils" ) } b . exports = c ; var e = d . create ( ) ; c . prototype . setFromPoints = function ( a , b , c , f ) { var g = this . lowerBound , h = this . upperBound ; "number" != typeof c && ( c = 0 ) , 0 !== c ? d . rotate ( g , a [ 0 ] , c ) : d . copy ( g , a [ 0 ] ) , d . copy ( h , g ) ; for ( var i = Math . cos ( c ) , j = Math . sin ( c ) , k = 1 ; k < a . length ; k ++ ) { var l = a [ k ] ; if ( 0 !== c ) { var m = l [ 0 ] , n = l [ 1 ] ; e [ 0 ] = i * m - j * n , e [ 1 ] = j * m + i * n , l = e } for ( var o = 0 ; 2 > o ; o ++ ) l [ o ] > h [ o ] && ( h [ o ] = l [ o ] ) , l [ o ] < g [ o ] && ( g [ o ] = l [ o ] ) } b && ( d . add ( this . lowerBound , this . lowerBound , b ) , d . add ( this . upperBound , this . upperBound , b ) ) , f && ( this . lowerBound [ 0 ] -= f , this . lowerBound [ 1 ] -= f , this . upperBound [ 0 ] += f , this . upperBound [ 1 ] += f ) } , c . prototype . copy = function ( a ) { d . copy ( this . lowerBound , a . lowerBound ) , d . copy ( this . upperBound , a . upperBound ) } , c . prototype . extend = function ( a ) { for ( var b = 2 ; b -- ; ) { var c = a . lowerBound [ b ] ; this . lowerBound [ b ] > c && ( this . lowerBound [ b ] = c ) ; var d = a . upperBound [ b ] ; this . upperBound [ b ] < d && ( this . upperBound [ b ] = d ) } } , c . prototype . overlaps = function ( a ) { var b = this . lowerBound , c = this . upperBound , d = a . lowerBound , e = a . upperBound ; return ( d [ 0 ] <= c [ 0 ] && c [ 0 ] <= e [ 0 ] || b [ 0 ] <= e [ 0 ] && e [ 0 ] <= c [ 0 ] ) && ( d [ 1 ] <= c [ 1 ] && c [ 1 ] <= e [ 1 ] || b [ 1 ] <= e [ 1 ] && e [ 1 ] <= c [ 1 ] ) } } , { "../math/vec2" : 31 , "../utils/Utils" : 50 } ] , 8 : [ function ( a , b ) { function c ( a ) { this . type = a , this . result = [ ] , this . world = null , this . boundingVolumeType = c . AABB } var d = a ( "../math/vec2" ) , e = a ( "../objects/Body" ) ; b . exports = c , c . AABB = 1 , c . BOUNDING _CIRCLE = 2 , c . prototype . setWorld = function ( a ) { this . world = a } , c . prototype . getCollisionPairs = function ( ) { throw new Error ( "getCollisionPairs must be implemented in a subclass!" ) } ; var f = d . create ( ) ; c . boundingRadiusCheck = function ( a , b ) { d . sub ( f , a . position , b . position ) ; var c = d . squaredLength ( f ) , e = a . boundingRadius + b . boundingRadius ; return e * e >= c } , c . aabbCheck = function ( a , b ) { return a . getAABB ( ) . overlaps ( b . getAABB ( ) ) } , c . prototype . boundingVolumeCheck = function ( a , b ) { var d ; switch ( this . boundingVolumeType ) { case c . BOUNDING _CIRCLE : d = c . boundingRadiusCheck ( a , b ) ; break ; case c . AABB : d = c . aabbCheck ( a , b ) ; break ; default : throw new Error ( "Bounding volume type not recognized: " + this . boundingVolumeType ) } return d } , c . canCollide = function ( a , b ) { return a . type === e . STATIC && b . type === e . STATIC ? ! 1 : a . type === e . KINEMATIC && b . type === e . STATIC || a . type === e . STATIC && b . type === e . KINEMATIC ? ! 1 : a . type === e . KINEMATIC && b . type === e . KINEMATIC ? ! 1 : a . sleepState === e . SLEEPING && b . sleepState === e . SLEEPING ? ! 1 : a . sleepState === e . SLEEPING && b . type === e . STATIC || b . sleepState === e . SLEEPING && a . type === e . STATIC ? ! 1 : ! 0 } , c . NAIVE = 1 , c . SAP = 2 } , { "../math/vec2" : 31 , "../objects/Body" : 32 } ] , 9 : [ function ( a , b ) { function c ( a ) { d . apply ( this ) , a = e . defaults ( a , { xmin : - 100 , xmax : 100 , ymin : - 100 , ymax : 100 , nx : 10 , ny : 10 } ) , this . xmin = a . xmin , this . ymin = a . ymin , this . xmax = a . xmax , this . ymax = a . ymax , this . nx = a . nx , this . ny = a . ny , this . binsizeX = ( this . xmax - this . xmin ) / this . nx , this . binsizeY = ( this . ymax - this . ymin ) / this . ny } var d = ( a ( "../shapes/Circle" ) , a ( "../shapes/Plane" ) , a ( "../shapes/Particle" ) , a ( "../collision/Broadphase" ) ) , e = ( a ( "../math/vec2" ) , a ( "../utils/Utils" ) ) ; b . exports = c , c . prototype = new d , c . prototype . constructor = c , c . prototype . getCollisionPairs = function ( a ) { for ( var b = [ ] , c = a . bodies , e = c . length , f = ( this . binsizeX , this . binsizeY , this . nx ) , g = this . ny , h = this . xmin , i = this . ymin , j = this . xmax , k = this . ymax , l = [ ] , m = f * g , n = 0 ; m > n ; n ++ ) l . push ( [ ] ) ; for ( var o = f / ( j - h ) , p = g / ( k - i ) , n = 0 ; n !== e ; n ++ ) for ( var q = c [ n ] , r = q . aabb , s = Math . max ( r
} , c . prototype . reportIntersection = function ( a , b , d , f , g ) { var h = this . from , i = this . to , j = e . distance ( h , b ) , k = this . result ; if ( ! ( this . skipBackfaces && e . dot ( a , this . _direction ) > 0 ) ) switch ( k . hitFaceIndex = "undefined" != typeof g ? g : - 1 , this . mode ) { case c . ALL : this . hasHit = ! 0 , k . set ( h , i , a , b , d , f , j ) , k . hasHit = ! 0 , this . callback ( k ) ; break ; case c . CLOSEST : ( j < k . distance || ! k . hasHit ) && ( this . hasHit = ! 0 , k . hasHit = ! 0 , k . set ( h , i , a , b , d , f , j ) ) ; break ; case c . ANY : this . hasHit = ! 0 , k . hasHit = ! 0 , k . set ( h , i , a , b , d , f , j ) , k . _shouldStop = ! 0 } } ; var z = e . create ( ) , A = e . create ( ) } , { "../collision/AABB" : 7 , "../collision/RaycastResult" : 13 , "../math/vec2" : 31 , "../shapes/Shape" : 45 } ] , 13 : [ function ( a , b ) { function c ( ) { this . rayFromWorld = d . create ( ) , this . rayToWorld = d . create ( ) , this . hitNormalWorld = d . create ( ) , this . hitPointWorld = d . create ( ) , this . hasHit = ! 1 , this . shape = null , this . body = null , this . hitFaceIndex = - 1 , this . distance = - 1 , this . _shouldStop = ! 1 } var d = a ( "../math/vec2" ) ; b . exports = c , c . prototype . reset = function ( ) { d . set ( this . rayFromWorld , 0 , 0 ) , d . set ( this . rayToWorld , 0 , 0 ) , d . set ( this . hitNormalWorld , 0 , 0 ) , d . set ( this . hitPointWorld , 0 , 0 ) , this . hasHit = ! 1 , this . shape = null , this . body = null , this . hitFaceIndex = - 1 , this . distance = - 1 , this . _shouldStop = ! 1 } , c . prototype . abort = function ( ) { this . _shouldStop = ! 0 } , c . prototype . set = function ( a , b , c , e , f , g , h ) { d . copy ( this . rayFromWorld , a ) , d . copy ( this . rayToWorld , b ) , d . copy ( this . hitNormalWorld , c ) , d . copy ( this . hitPointWorld , e ) , this . shape = f , this . body = g , this . distance = h } } , { "../math/vec2" : 31 } ] , 14 : [ function ( a , b ) { function c ( ) { e . call ( this , e . SAP ) , this . axisList = [ ] , this . axisIndex = 0 ; var a = this ; this . _addBodyHandler = function ( b ) { a . axisList . push ( b . body ) } , this . _removeBodyHandler = function ( b ) { var c = a . axisList . indexOf ( b . body ) ; - 1 !== c && a . axisList . splice ( c , 1 ) } } var d = a ( "../utils/Utils" ) , e = a ( "../collision/Broadphase" ) ; b . exports = c , c . prototype = new e , c . prototype . constructor = c , c . prototype . setWorld = function ( a ) { this . axisList . length = 0 , d . appendArray ( this . axisList , a . bodies ) , a . off ( "addBody" , this . _addBodyHandler ) . off ( "removeBody" , this . _removeBodyHandler ) , a . on ( "addBody" , this . _addBodyHandler ) . on ( "removeBody" , this . _removeBodyHandler ) , this . world = a } , c . sortAxisList = function ( a , b ) { b = 0 | b ; for ( var c = 1 , d = a . length ; d > c ; c ++ ) { for ( var e = a [ c ] , f = c - 1 ; f >= 0 && ! ( a [ f ] . aabb . lowerBound [ b ] <= e . aabb . lowerBound [ b ] ) ; f -- ) a [ f + 1 ] = a [ f ] ; a [ f + 1 ] = e } return a } , c . prototype . sortList = function ( ) { var a = this . axisList , b = this . axisIndex ; c . sortAxisList ( a , b ) } , c . prototype . getCollisionPairs = function ( ) { var a = this . axisList , b = this . result , c = this . axisIndex ; b . length = 0 ; for ( var d = a . length ; d -- ; ) { var f = a [ d ] ; f . aabbNeedsUpdate && f . updateAABB ( ) } this . sortList ( ) ; for ( var g = 0 , h = 0 | a . length ; g !== h ; g ++ ) for ( var i = a [ g ] , j = g + 1 ; h > j ; j ++ ) { var k = a [ j ] , l = k . aabb . lowerBound [ c ] <= i . aabb . upperBound [ c ] ; if ( ! l ) break ; e . canCollide ( i , k ) && this . boundingVolumeCheck ( i , k ) && b . push ( i , k ) } return b } , c . prototype . aabbQuery = function ( a , b , c ) { c = c || [ ] , this . sortList ( ) ; var d = this . axisIndex , e = "x" ; 1 === d && ( e = "y" ) , 2 === d && ( e = "z" ) ; for ( var f = this . axisList , g = ( b . lowerBound [ e ] , b . upperBound [ e ] , 0 ) ; g < f . length ; g ++ ) { var h = f [ g ] ; h . aabbNeedsUpdate && h . updateAABB ( ) , h . aabb . overlaps ( b ) && c . push ( h ) } return c } } , { "../collision/Broadphase" : 8 , "../utils/Utils" : 50 } ] , 15 : [ function ( a , b ) { function c ( a , b , c , e ) { this . type = c , e = d . defaults ( e , { collideConnected : ! 0 , wakeUpBodies : ! 0 } ) , this . equations = [ ] , this . bodyA = a , this . bodyB = b , this . collideConnected = e . collideConnected , e . wakeUpBodies && ( a && a . wakeUp ( ) , b && b . wakeUp ( ) ) } b . exports = c ; var d = a ( "../utils/Utils" ) ; c . prototype . update = function ( ) { throw new Error ( "method update() not implmemented in this Constraint subclass!" ) } , c . DISTANCE = 1 , c . GEAR = 2 , c . LOCK = 3 , c . PRISMATIC = 4 , c . REVOLUTE = 5 , c . prototype . setStiffness = function ( a ) { for ( var b = this . equations , c = 0 ; c !== b . length ; c ++ ) { var d = b [ c ] ; d . stiffness = a , d . needsUpdate = ! 0 } } , c . prototype . setRelaxation = function ( a ) { for ( var b = this . equations , c = 0 ; c !== b . length ; c ++ ) { var d = b [ c ] ; d . relaxation = a , d . needsUpdate = ! 0 } } } , { "../utils/Utils" : 50 } ] , 16 : [ function ( a , b ) { function c ( a , b , c ) { c = g . defaults ( c , { localAnchorA : [ 0 , 0 ] , localAnchorB : [ 0 , 0 ] } ) , d . call ( this , a , b , d . DISTANCE , c ) , this . localAnchorA = f . fromValues ( c . localAnchorA [ 0 ] , c . localAnchorA [ 1 ] ) , this . localAnchorB = f . fromValues ( c . localAnchorB [ 0 ] , c . localAnchorB [ 1 ] ) ; var h = this . localAnchorA , i = this . localAnchorB ; if ( this . distance = 0 , " numb
d . set ( b , 0 , 0 ) , a . wlambda = 0 } , c . prototype . addConstraintVelocity = function ( ) { var a = this , b = a . velocity ; d . add ( b , b , a . vlambda ) , a . angularVelocity += a . wlambda } , c . prototype . applyDamping = function ( a ) { if ( this . type === c . DYNAMIC ) { var b = this . velocity ; d . scale ( b , b , Math . pow ( 1 - this . damping , a ) ) , this . angularVelocity *= Math . pow ( 1 - this . angularDamping , a ) } } , c . prototype . wakeUp = function ( ) { var a = this . sleepState ; this . sleepState = c . AWAKE , this . idleTime = 0 , a !== c . AWAKE && this . emit ( c . wakeUpEvent ) } , c . prototype . sleep = function ( ) { this . sleepState = c . SLEEPING , this . angularVelocity = 0 , this . angularForce = 0 , d . set ( this . velocity , 0 , 0 ) , d . set ( this . force , 0 , 0 ) , this . emit ( c . sleepEvent ) } , c . prototype . sleepTick = function ( a , b , e ) { if ( this . allowSleep && this . type !== c . SLEEPING ) { this . wantsToSleep = ! 1 ; var f = ( this . sleepState , d . squaredLength ( this . velocity ) + Math . pow ( this . angularVelocity , 2 ) ) , g = Math . pow ( this . sleepSpeedLimit , 2 ) ; f >= g ? ( this . idleTime = 0 , this . sleepState = c . AWAKE ) : ( this . idleTime += e , this . sleepState = c . SLEEPY ) , this . idleTime > this . sleepTimeLimit && ( b ? this . wantsToSleep = ! 0 : this . sleep ( ) ) } } , c . prototype . getVelocityFromPosition = function ( a , b ) { return a = a || d . create ( ) , d . sub ( a , this . position , this . previousPosition ) , d . scale ( a , a , 1 / b ) , a } , c . prototype . getAngularVelocityFromPosition = function ( a ) { return ( this . angle - this . previousAngle ) / a } , c . prototype . overlaps = function ( a ) { return this . world . overlapKeeper . bodiesAreOverlapping ( this , a ) } ; var o = d . create ( ) , p = d . create ( ) ; c . prototype . integrate = function ( a ) { var b = this . invMass , c = this . force , e = this . position , f = this . velocity ; d . copy ( this . previousPosition , this . position ) , this . previousAngle = this . angle , this . fixedRotation || ( this . angularVelocity += this . angularForce * this . invInertia * a ) , d . scale ( o , c , a * b ) , d . add ( f , o , f ) , this . integrateToTimeOfImpact ( a ) || ( d . scale ( p , f , a ) , d . add ( e , e , p ) , this . fixedRotation || ( this . angle += this . angularVelocity * a ) ) , this . aabbNeedsUpdate = ! 0 } ; var q = d . create ( ) , r = d . create ( ) , s = d . create ( ) , t = d . create ( ) ; c . prototype . integrateToTimeOfImpact = function ( a ) { if ( this . ccdSpeedThreshold < 0 || d . squaredLength ( this . velocity ) < Math . pow ( this . ccdSpeedThreshold , 2 ) ) return ! 1 ; d . normalize ( q , this . velocity ) , d . scale ( r , this . velocity , a ) , d . add ( r , r , this . position ) , d . sub ( s , r , this . position ) ; var b , c = this . angularVelocity * a , e = d . length ( s ) , f = 1 , g = this ; if ( this . world . raycastAll ( this . position , r , { } , function ( a ) { a . body !== g && ( b = a . body , d . copy ( r , a . hitPointWorld ) , d . sub ( s , a . hitPointWorld , g . position ) , f = d . length ( s ) / e , a . abort ( ) ) } ) , ! b ) return ! 1 ; var h = this . angle ; d . copy ( t , this . position ) ; for ( var i = 0 , j = 0 , k = 0 , l = f ; l >= j && i < this . ccdIterations ; ) { i ++ , k = ( l - j ) / 2 , d . scale ( p , s , f ) , d . add ( this . position , t , p ) , this . angle = h + c * f , this . updateAABB ( ) ; var m = this . aabb . overlaps ( b . aabb ) && this . world . narrowphase . bodiesOverlap ( this , b ) ; m ? j = k : l = k } return f = k , d . copy ( this . position , t ) , this . angle = h , d . scale ( p , s , f ) , d . add ( this . position , this . position , p ) , this . fixedRotation || ( this . angle += c * f ) , ! 0 } , c . sleepyEvent = { type : "sleepy" } , c . sleepEvent = { type : "sleep" } , c . wakeUpEvent = { type : "wakeup" } , c . DYNAMIC = 1 , c . STATIC = 2 , c . KINEMATIC = 4 , c . AWAKE = 0 , c . SLEEPY = 1 , c . SLEEPING = 2 } , { "../collision/AABB" : 7 , "../events/EventEmitter" : 27 , "../math/vec2" : 31 , "../shapes/Convex" : 39 , "poly-decomp" : 5 } ] , 33 : [ function ( a , b ) { function c ( a , b , c ) { c = c || { } , e . call ( this , a , b , c ) , this . localAnchorA = d . fromValues ( 0 , 0 ) , this . localAnchorB = d . fromValues ( 0 , 0 ) , c . localAnchorA && d . copy ( this . localAnchorA , c . localAnchorA ) , c . localAnchorB && d . copy ( this . localAnchorB , c . localAnchorB ) , c . worldAnchorA && this . setWorldAnchorA ( c . worldAnchorA ) , c . worldAnchorB && this . setWorldAnchorB ( c . worldAnchorB ) ; var f = d . create ( ) , g = d . create ( ) ; this . getWorldAnchorA ( f ) , this . getWorldAnchorB ( g ) ; var h = d . distance ( f , g ) ; this . restLength = "number" == typeof c . restLength ? c . restLength : h } { var d = a ( "../math/vec2" ) , e = a ( "./Spring" ) ; a ( "../utils/Utils" ) } b . exports = c , c . prototype = new e , c . prototype . constructor = c , c . prototype . setWorldAnchorA = function ( a ) { this . bodyA . toLocalFrame ( this . localAnchorA , a ) } , c . prototype . setWorldAnchorB = function ( a ) { this . bodyB . toLocalFrame ( this . localAnchorB , a ) } , c . prototype . getWorldAnchorA = function ( a ) { this . bodyA . toWorldFrame ( a , this . localAnchorA ) } , c . prototype . getWorldAnchorB = function ( a ) { this . bodyB . toWorldFrame ( a , this . localAnchorB ) } ; var f = d . create ( ) , g = d . create ( ) , h = d . create ( ) , i = d . create ( ) , j = d . create ( ) , k = d . crea
} this . postBroadphaseEvent . pairs = C , this . emit ( this . postBroadphaseEvent ) , p . reset ( this ) ; for ( var x = 0 , H = C . length ; x !== H ; x += 2 ) for ( var I = C [ x ] , J = C [ x + 1 ] , K = 0 , L = I . shapes . length ; K !== L ; K ++ ) for ( var M = I . shapes [ K ] , N = I . shapeOffsets [ K ] , O = I . shapeAngles [ K ] , P = 0 , Q = J . shapes . length ; P !== Q ; P ++ ) { var R = J . shapes [ P ] , S = J . shapeOffsets [ P ] , T = J . shapeAngles [ P ] , U = this . defaultContactMaterial ; if ( M . material && R . material ) { var V = this . getContactMaterial ( M . material , R . material ) ; V && ( U = V ) } this . runNarrowphase ( p , I , M , N , O , J , R , S , T , U , this . frictionGravity ) } for ( var x = 0 ; x !== n ; x ++ ) { var W = j [ x ] ; W . _wakeUpAfterNarrowphase && ( W . wakeUp ( ) , W . _wakeUpAfterNarrowphase = ! 1 ) } if ( this . has ( "endContact" ) ) { this . overlapKeeper . getEndOverlaps ( z ) ; for ( var X = this . endContactEvent , P = z . length ; P -- ; ) { var Y = z [ P ] ; X . shapeA = Y . shapeA , X . shapeB = Y . shapeB , X . bodyA = Y . bodyA , X . bodyB = Y . bodyB , this . emit ( X ) } } var Z = this . preSolveEvent ; Z . contactEquations = p . contactEquations , Z . frictionEquations = p . frictionEquations , this . emit ( Z ) ; var F = q . length ; for ( x = 0 ; x !== F ; x ++ ) q [ x ] . update ( ) ; if ( p . contactEquations . length || p . frictionEquations . length || q . length ) if ( this . islandSplit ) { for ( u . equations . length = 0 , r . appendArray ( u . equations , p . contactEquations ) , r . appendArray ( u . equations , p . frictionEquations ) , x = 0 ; x !== F ; x ++ ) r . appendArray ( u . equations , q [ x ] . equations ) ; u . split ( this ) ; for ( var x = 0 ; x !== u . islands . length ; x ++ ) { var $ = u . islands [ x ] ; $ . equations . length && l . solveIsland ( a , $ ) } } else { for ( l . addEquations ( p . contactEquations ) , l . addEquations ( p . frictionEquations ) , x = 0 ; x !== F ; x ++ ) l . addEquations ( q [ x ] . equations ) ; this . solveConstraints && l . solve ( a , this ) , l . removeAllEquations ( ) } for ( var x = 0 ; x !== n ; x ++ ) { var W = j [ x ] ; W . sleepState !== m . SLEEPING && W . type !== m . STATIC && W . integrate ( a ) } for ( var x = 0 ; x !== n ; x ++ ) j [ x ] . setZeroForce ( ) ; if ( g && ( d = performance . now ( ) , e . lastStepTime = d - b ) , this . emitImpactEvent && this . has ( "impact" ) ) for ( var _ = this . impactEvent , x = 0 ; x !== p . contactEquations . length ; x ++ ) { var ab = p . contactEquations [ x ] ; ab . firstImpact && ( _ . bodyA = ab . bodyA , _ . bodyB = ab . bodyB , _ . shapeA = ab . shapeA , _ . shapeB = ab . shapeB , _ . contactEquation = ab , this . emit ( _ ) ) } if ( this . sleepMode === c . BODY _SLEEPING ) for ( x = 0 ; x !== n ; x ++ ) j [ x ] . sleepTick ( this . time , ! 1 , a ) ; else if ( this . sleepMode === c . ISLAND _SLEEPING && this . islandSplit ) { for ( x = 0 ; x !== n ; x ++ ) j [ x ] . sleepTick ( this . time , ! 0 , a ) ; for ( var x = 0 ; x < this . islandManager . islands . length ; x ++ ) { var $ = this . islandManager . islands [ x ] ; $ . wantsToSleep ( ) && $ . sleep ( ) } } if ( this . stepping = ! 1 , this . bodiesToBeRemoved . length ) { for ( var x = 0 ; x !== this . bodiesToBeRemoved . length ; x ++ ) this . removeBody ( this . bodiesToBeRemoved [ x ] ) ; this . bodiesToBeRemoved . length = 0 } this . emit ( this . postStepEvent ) } , c . prototype . runNarrowphase = function ( a , b , c , d , e , g , h , i , j , k , l ) { if ( 0 !== ( c . collisionGroup & h . collisionMask ) && 0 !== ( h . collisionGroup & c . collisionMask ) ) { f . rotate ( w , d , b . angle ) , f . rotate ( x , i , g . angle ) , f . add ( w , w , b . position ) , f . add ( x , x , g . position ) ; var n = e + b . angle , o = j + g . angle ; a . enableFriction = k . friction > 0 , a . frictionCoefficient = k . friction ; var p ; p = b . type === m . STATIC || b . type === m . KINEMATIC ? g . mass : g . type === m . STATIC || g . type === m . KINEMATIC ? b . mass : b . mass * g . mass / ( b . mass + g . mass ) , a . slipForce = k . friction * l * p , a . restitution = k . restitution , a . surfaceVelocity = k . surfaceVelocity , a . frictionStiffness = k . frictionStiffness , a . frictionRelaxation = k . frictionRelaxation , a . stiffness = k . stiffness , a . relaxation = k . relaxation , a . contactSkinSize = k . contactSkinSize , a . enabledEquations = b . collisionResponse && g . collisionResponse && c . collisionResponse && h . collisionResponse ; var q = a [ c . type | h . type ] , r = 0 ; if ( q ) { var s = c . sensor || h . sensor , t = a . frictionEquations . length ; r = c . type < h . type ? q . call ( a , b , c , w , n , g , h , x , o , s ) : q . call ( a , g , h , x , o , b , c , w , n , s ) ; var u = a . frictionEquations . length - t ; if ( r ) { if ( b . allowSleep && b . type === m . DYNAMIC && b . sleepState === m . SLEEPING && g . sleepState === m . AWAKE && g . type !== m . STATIC ) { var v = f . squaredLength ( g . velocity ) + Math . pow ( g . angularVelocity , 2 ) , y = Math . pow ( g . sleepSpeedLimit , 2 ) ; v >= 2 * y && ( b . _wakeUpAfterNarrowphase = ! 0 ) } if ( g . allowSleep && g . type === m . DYNAMIC && g . sleepState === m . SLEEPING && b . sleepState === m . AWAKE && b . type !== m . STATIC ) { var z = f . squaredLength ( b . velocity ) + Math . pow ( b . angularVelocity , 2 ) , A = Math . pow ( b . sleepSpeedLimit , 2 ) ; z >= 2 * A && ( g . _wakeUpAfterNarrowphase = ! 0 ) } if ( this . overlapKeeper . setOverlapping ( b , c , g , h ) , this . has ( "beginContact" ) && this . overlapKeeper . isNe
} , toWorldFrame : function ( a , b ) { return this . data . toWorldFrame ( a , b ) } , rotateLeft : function ( a ) { this . data . angularVelocity = this . world . pxm ( - a ) } , rotateRight : function ( a ) { this . data . angularVelocity = this . world . pxm ( a ) } , moveForward : function ( a ) { var b = this . world . pxmi ( - a ) , c = this . data . angle + Math . PI / 2 ; this . data . velocity [ 0 ] = b * Math . cos ( c ) , this . data . velocity [ 1 ] = b * Math . sin ( c ) } , moveBackward : function ( a ) { var b = this . world . pxmi ( - a ) , c = this . data . angle + Math . PI / 2 ; this . data . velocity [ 0 ] = - ( b * Math . cos ( c ) ) , this . data . velocity [ 1 ] = - ( b * Math . sin ( c ) ) } , thrust : function ( a ) { var b = this . world . pxmi ( - a ) , c = this . data . angle + Math . PI / 2 ; this . data . force [ 0 ] += b * Math . cos ( c ) , this . data . force [ 1 ] += b * Math . sin ( c ) } , reverse : function ( a ) { var b = this . world . pxmi ( - a ) , c = this . data . angle + Math . PI / 2 ; this . data . force [ 0 ] -= b * Math . cos ( c ) , this . data . force [ 1 ] -= b * Math . sin ( c ) } , moveLeft : function ( a ) { this . data . velocity [ 0 ] = this . world . pxmi ( - a ) } , moveRight : function ( a ) { this . data . velocity [ 0 ] = this . world . pxmi ( a ) } , moveUp : function ( a ) { this . data . velocity [ 1 ] = this . world . pxmi ( - a ) } , moveDown : function ( a ) { this . data . velocity [ 1 ] = this . world . pxmi ( a ) } , preUpdate : function ( ) { this . dirty = ! 0 , this . removeNextStep && ( this . removeFromWorld ( ) , this . removeNextStep = ! 1 ) } , postUpdate : function ( ) { this . sprite . x = this . world . mpxi ( this . data . position [ 0 ] ) , this . sprite . y = this . world . mpxi ( this . data . position [ 1 ] ) , this . fixedRotation || ( this . sprite . rotation = this . data . angle ) , this . debugBody && this . debugBody . updateSpriteTransform ( ) , this . dirty = ! 1 } , reset : function ( a , b , c , d ) { "undefined" == typeof c && ( c = ! 1 ) , "undefined" == typeof d && ( d = ! 1 ) , this . setZeroForce ( ) , this . setZeroVelocity ( ) , this . setZeroRotation ( ) , c && this . setZeroDamping ( ) , d && ( this . mass = 1 ) , this . x = a , this . y = b } , addToWorld : function ( ) { if ( this . game . physics . p2 . _toRemove ) for ( var a = 0 ; a < this . game . physics . p2 . _toRemove . length ; a ++ ) this . game . physics . p2 . _toRemove [ a ] === this && this . game . physics . p2 . _toRemove . splice ( a , 1 ) ; this . data . world !== this . game . physics . p2 . world && this . game . physics . p2 . addBody ( this ) } , removeFromWorld : function ( ) { this . data . world === this . game . physics . p2 . world && this . game . physics . p2 . removeBodyNextStep ( this ) } , destroy : function ( ) { this . removeFromWorld ( ) , this . clearShapes ( ) , this . _bodyCallbacks = { } , this . _bodyCallbackContext = { } , this . _groupCallbacks = { } , this . _groupCallbackContext = { } , this . debugBody && this . debugBody . destroy ( ! 0 , ! 0 ) , this . debugBody = null , this . sprite . body = null , this . sprite = null } , clearShapes : function ( ) { for ( var a = this . data . shapes . length ; a -- ; ) this . data . removeShape ( this . data . shapes [ a ] ) ; this . shapeChanged ( ) } , addShape : function ( a , b , c , d ) { return "undefined" == typeof b && ( b = 0 ) , "undefined" == typeof c && ( c = 0 ) , "undefined" == typeof d && ( d = 0 ) , this . data . addShape ( a , [ this . world . pxmi ( b ) , this . world . pxmi ( c ) ] , d ) , this . shapeChanged ( ) , a } , addCircle : function ( a , b , c , d ) { var e = new p2 . Circle ( this . world . pxm ( a ) ) ; return this . addShape ( e , b , c , d ) } , addRectangle : function ( a , b , c , d , e ) { var f = new p2 . Rectangle ( this . world . pxm ( a ) , this . world . pxm ( b ) ) ; return this . addShape ( f , c , d , e ) } , addPlane : function ( a , b , c ) { var d = new p2 . Plane ; return this . addShape ( d , a , b , c ) } , addParticle : function ( a , b , c ) { var d = new p2 . Particle ; return this . addShape ( d , a , b , c ) } , addLine : function ( a , b , c , d ) { var e = new p2 . Line ( this . world . pxm ( a ) ) ; return this . addShape ( e , b , c , d ) } , addCapsule : function ( a , b , c , d , e ) { var f = new p2 . Capsule ( this . world . pxm ( a ) , this . world . pxm ( b ) ) ; return this . addShape ( f , c , d , e ) } , addPolygon : function ( a , b ) { a = a || { } , Array . isArray ( b ) || ( b = Array . prototype . slice . call ( arguments , 1 ) ) ; var c = [ ] ; if ( 1 === b . length && Array . isArray ( b [ 0 ] ) ) c = b [ 0 ] . slice ( 0 ) ; else if ( Array . isArray ( b [ 0 ] ) ) c = b . slice ( ) ; else if ( "number" == typeof b [ 0 ] ) for ( var d = 0 , e = b . length ; e > d ; d += 2 ) c . push ( [ b [ d ] , b [ d + 1 ] ] ) ; var f = c . length - 1 ; c [ f ] [ 0 ] === c [ 0 ] [ 0 ] && c [ f ] [ 1 ] === c [ 0 ] [ 1 ] && c . pop ( ) ; for ( var g = 0 ; g < c . length ; g ++ ) c [ g ] [ 0 ] = this . world . pxmi ( c [ g ] [ 0 ] ) , c [ g ] [ 1 ] = this . world . pxmi ( c [ g ] [ 1 ] ) ; var h = this . data . fromPolygon ( c , a ) ; return this . shapeChanged ( ) , h } , removeShape : function ( a ) { var b = this . data . removeShape ( a ) ; return this . shapeChanged ( ) , b } , setCircle : function ( a , b , c , d ) { return this . clearShapes ( ) , this . addCircle ( a , b , c , d ) } , setRectangle : function ( a , b , c , d , e ) { return "undefined" == typeof a && ( a = 16 ) , "undefined" == typeof b && ( b = 16 ) , this . clearShapes ( ) , this . addRectangle ( a , b , c , d , e ) } , setRectangleFromSprite : function ( a ) { return "undefined" == typeof a &
2015-03-25 16:17:53 +00:00
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 = a - c [ 1 ] . x , f = b - c [ 1 ] . y , 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 , b , d , e , f ) { if ( f = this . getLayer ( f ) , this . copy ( a , b , 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 ) ; c . Utils . shuffle ( g ) ; for ( var i = 1 ; i < this . _results . length ; i ++ ) this . _results [ i ] . index = g [ i - 1 ] ; this . paste ( a , b , this . _results , f ) } } , fill : function ( a , b , c , d , e , f ) { if ( f = this . getLayer ( f ) , this . copy ( b , c , d , e , f ) , ! ( this . _results . length < 2 ) ) { for ( var g = 1 ; g < this . _results . length ; g ++ ) this . _results [ g ] . index = a ; this . paste ( b , c , this . _results , f ) } } , removeAllLayers : function ( ) { this . layers . length = 0 , this . currentLayer = 0 } , dump : function ( ) { for ( var a = "" , b = [ "" ] , c = 0 ; c < this . layers [ this . currentLayer ] . height ; c ++ ) { for ( var d = 0 ; d < this . layers [ this . currentLayer ] . width ; d ++ ) a += "%c " , b . push ( this . layers [ this . currentLayer ] . data [ c ] [ d ] > 1 ? this . debugMap [ this . layers [ this . currentLayer ] . data [ c ] [ d ] ] ? "background: " + this . debugMap [ this . layers [ this . currentLayer ] . data [ c ] [ d ] ] : "background: #ffffff" : "background: rgb(0, 0, 0)" ) ; a += "\n" } b [ 0 ] = a , console . log . apply ( console , b ) } , destroy : function ( ) { this . removeAllLayers ( ) , this . data = [ ] , this . game = null } } , c . Tilemap . prototype . constructor = c . Tilemap , Object . defineProperty ( c . Tilemap . prototype , "layer" , { get : function ( ) { return this . layers [ this . currentLayer ] } , set : function ( a ) { a !== this . currentLayer && this . setLayer ( a ) } } ) , c . TilemapLayer = function ( a , b , d , e , f ) { e |= 0 , f |= 0 , PIXI . Sprite . call ( this , PIXI . TextureCache . _ _default ) , c . Component . Core . init . call ( this , a , 0 , 0 , null , null ) , this . map = b , this . index = d , this . layer = b . layers [ d ] , this . canvas = c . Canvas . create ( e , f ) , this . context = this . canvas . getConte
2014-02-28 09:30:53 +00:00
//# sourceMappingURL=phaser.map