2014-04-15 14:39:23 +00:00
/* Phaser v2.0.4 - http://phaser.io - @photonstorm - (c) 2014 Photon Storm Ltd. */
2014-02-28 09:30:53 +00:00
2014-04-01 02:02:36 +00:00
( function ( ) { var a = this , b = b || { } ; b . WEBGL _RENDERER = 0 , b . CANVAS _RENDERER = 1 , b . VERSION = "v1.5.2" , b . blendModes = { NORMAL : 0 , ADD : 1 , MULTIPLY : 2 , SCREEN : 3 , OVERLAY : 4 , DARKEN : 5 , LIGHTEN : 6 , COLOR _DODGE : 7 , COLOR _BURN : 8 , HARD _LIGHT : 9 , SOFT _LIGHT : 10 , DIFFERENCE : 11 , EXCLUSION : 12 , HUE : 13 , SATURATION : 14 , COLOR : 15 , LUMINOSITY : 16 } , b . scaleModes = { DEFAULT : 0 , LINEAR : 0 , NEAREST : 1 } , b . INTERACTION _FREQUENCY = 30 , b . AUTO _PREVENT _DEFAULT = ! 0 , b . RAD _TO _DEG = 180 / Math . PI , b . DEG _TO _RAD = Math . PI / 180 , b . Point = function ( a , b ) { this . x = a || 0 , this . y = b || 0 } , b . Point . prototype . clone = function ( ) { return new b . Point ( this . x , this . y ) } , b . Point . prototype . constructor = b . Point , b . Point . prototype . set = function ( a , b ) { this . x = a || 0 , this . y = b || ( 0 !== b ? this . x : 0 ) } , b . Rectangle = function ( a , b , c , d ) { this . x = a || 0 , this . y = b || 0 , this . width = c || 0 , this . height = d || 0 } , b . Rectangle . prototype . clone = function ( ) { return new b . Rectangle ( this . x , this . y , this . width , this . height ) } , b . Rectangle . prototype . contains = function ( a , b ) { if ( this . width <= 0 || this . height <= 0 ) return ! 1 ; var c = this . x ; if ( a >= c && a <= c + this . width ) { var d = this . y ; if ( b >= d && b <= d + this . height ) return ! 0 } return ! 1 } , b . Rectangle . prototype . constructor = b . Rectangle , b . EmptyRectangle = new b . Rectangle ( 0 , 0 , 0 , 0 ) , b . Polygon = function ( a ) { if ( a instanceof Array || ( a = Array . prototype . slice . call ( arguments ) ) , "number" == typeof a [ 0 ] ) { for ( var c = [ ] , d = 0 , e = a . length ; e > d ; d += 2 ) c . push ( new b . Point ( a [ d ] , a [ d + 1 ] ) ) ; a = c } this . points = a } , b . Polygon . prototype . clone = function ( ) { for ( var a = [ ] , c = 0 ; c < this . points . length ; c ++ ) a . push ( this . points [ c ] . clone ( ) ) ; return new b . Polygon ( a ) } , b . Polygon . prototype . contains = function ( a , b ) { for ( var c = ! 1 , d = 0 , e = this . points . length - 1 ; d < this . points . length ; e = d ++ ) { var f = this . points [ d ] . x , g = this . points [ d ] . y , h = this . points [ e ] . x , i = this . points [ e ] . y , j = g > b != i > b && ( h - f ) * ( b - g ) / ( i - g ) + f > a ; j && ( c = ! c ) } return c } , b . Polygon . prototype . constructor = b . Polygon , b . Circle = function ( a , b , c ) { this . x = a || 0 , this . y = b || 0 , this . radius = c || 0 } , b . Circle . prototype . clone = function ( ) { return new b . Circle ( this . x , this . y , this . radius ) } , b . Circle . prototype . contains = function ( a , b ) { if ( this . radius <= 0 ) return ! 1 ; var c = this . x - a , d = this . y - b , e = this . radius * this . radius ; return c *= c , d *= d , e >= c + d } , b . Circle . prototype . constructor = b . Circle , b . Ellipse = function ( a , b , c , d ) { this . x = a || 0 , this . y = b || 0 , this . width = c || 0 , this . height = d || 0 } , b . Ellipse . prototype . clone = function ( ) { return new b . Ellipse ( this . x , this . y , this . width , this . height ) } , b . Ellipse . prototype . contains = function ( a , b ) { if ( this . width <= 0 || this . height <= 0 ) return ! 1 ; var c = ( a - this . x ) / this . width , d = ( b - this . y ) / this . height ; return c *= c , d *= d , 1 >= c + d } , b . Ellipse . prototype . getBounds = function ( ) { return new b . Rectangle ( this . x , this . y , this . width , this . height ) } , b . Ellipse . prototype . constructor = b . Ellipse , b . determineMatrixArrayType = function ( ) { return "undefined" != typeof Float32Array ? Float32Array : Array } , b . Matrix2 = b . determineMatrixArrayType ( ) , b . Matrix = function ( ) { this . a = 1 , this . b = 0 , this . c = 0 , this . d = 1 , this . tx = 0 , this . ty = 0 } , b . Matrix . prototype . fromArray = function ( a ) { this . a = a [ 0 ] , this . b = a [ 1 ] , this . c = a [ 3 ] , this . d = a [ 4 ] , this . tx = a [ 2 ] , this . ty = a [ 5 ] } , b . Matrix . prototype . toArray = function ( a ) { this . array || ( this . array = new Float32Array ( 9 ) ) ; var b = this . array ; return a ? ( this . array [ 0 ] = this . a , this . array [ 1 ] = this . c , this . array [ 2 ] = 0 , this . array [ 3 ] = this . b , this . array [ 4 ] = this . d , this . array [ 5 ] = 0 , this . array [ 6 ] = this . tx , this . array [ 7 ] = this . ty , this . array [ 8 ] = 1 ) : ( this . array [ 0 ] = this . a , this . array [ 1 ] = this . b , this . array [ 2 ] = this . tx , this . array [ 3 ] = this . c , this . array [ 4 ] = this . d , this . array [ 5 ] = this . ty , this . array [ 6 ] = 0 , this . array [ 7 ] = 0 , this . array [ 8 ] = 1 ) , b } , b . identityMatrix = new b . Matrix , b . DisplayObject = function ( ) { this . position = new b . Point , this . scale = new b . Point ( 1 , 1 ) , this . pivot = new b . Point ( 0 , 0 ) , this . rotation = 0 , this . alpha = 1 , this . visible = ! 0 , this . hitArea = null , this . buttonMode = ! 1 , this . renderable = ! 1 , this . parent = null , this . stage = null , this . worldAlpha = 1 , this . _interactive = ! 1 , this . defaultCursor = "pointer" , this . worldTransform = new b . Matrix , this . color = [ ] , this . dynamic = ! 0 , this . _sr = 0 , this . _cr = 1 , this . filterArea = null , this . _bounds = new b . Rectangle ( 0 , 0 , 1 , 1 ) , this . _currentBounds = null , this . _mask = null , this . _cacheAsBitmap = ! 1 , this . _cacheIsDirty = ! 1 } , b . DisplayObject . prototype . constructor = b . DisplayObject , b . DisplayObject . prototype . setInteractive = function ( a ) { this . interactive = a } , Object . defineProp
} , 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 ( ) { this . program = null , this . fragmentSrc = [ "precision mediump float;" , "varying vec2 vTextureCoord;" , "varying float vColor;" , "uniform float alpha;" , "uniform sampler2D uSampler;" , "void main(void) {" , " gl_FragColor = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y));" , " gl_FragColor = gl_FragColor * alpha;" , "}" ] , this . vertexSrc = [ "attribute vec2 aVertexPosition;" , "attribute vec2 aTextureCoord;" , "attribute float aColor;" , "uniform mat3 translationMatrix;" , "uniform vec2 projectionVector;" , "varying vec2 vTextureCoord;" , "uniform vec2 offsetVector;" , "varying float 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 + 1.0 , 0.0, 1.0);" , " vTextureCoord = aTextureCoord;" , " vColor = aColor;" , "}" ] } , b . StripShader . prototype . init = function ( ) { var a = b . 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 . translationMatrix = a . getUniformLocation ( c , "translationMatrix" ) , this . alpha = a . getUniformLocation ( c , "alpha" ) , this . program = c } , b . PrimitiveShader = function ( a ) { 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 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 + 1.0 , 0.0, 1.0);" , " vColor = aColor * vec4(tint * alpha, alpha);" , "}" ] , this . init ( ) } , 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 . aVertexPosition = a . getAttribLocation ( c , "aVertexPosition" ) , this . colorAttribute = a . getAttribLocation ( c , "aColor" ) , this . attributes = [ this . aVertexPosition , this . colorAttribute ] , this . translationMatrix = a . getUniformLocation ( c , "translationMatrix" ) , this . alpha = a . getUniformLocation ( c , "alpha" ) , this . program = c } , b . PrimitiveShader . prototype . destroy = function ( ) { this . gl . deleteProgram ( this . program ) , this . uniforms = null , this . gl = null , this . attribute = null } , b . WebGLGraphics = function ( ) { } , b . WebGLGraphics . renderGraphics = function ( a , c ) { var d = c . gl , e = c . projection , f = c . offset , g = c . shaderManager . primitiveShader ; a . _w
2014-04-15 14:39:23 +00:00
} , b . WebGLFilterManager . prototype . applyFilterPass = function ( a , c , d , e ) { var f = this . gl , g = a . shaders [ f . id ] ; g || ( g = new b . PixiShader ( f ) , g . fragmentSrc = a . fragmentSrc , g . uniforms = a . uniforms , g . init ( ) , a . shaders [ f . id ] = g ) , f . useProgram ( g . program ) , f . uniform2f ( g . projectionVector , d / 2 , - e / 2 ) , f . uniform2f ( g . offsetVector , 0 , 0 ) , a . uniforms . dimensions && ( a . uniforms . dimensions . value [ 0 ] = this . width , a . uniforms . dimensions . value [ 1 ] = this . height , a . uniforms . dimensions . value [ 2 ] = this . vertexArray [ 0 ] , a . uniforms . dimensions . value [ 3 ] = this . vertexArray [ 5 ] ) , g . syncUniforms ( ) , f . bindBuffer ( f . ARRAY _BUFFER , this . vertexBuffer ) , f . vertexAttribPointer ( g . aVertexPosition , 2 , f . FLOAT , ! 1 , 0 , 0 ) , f . bindBuffer ( f . ARRAY _BUFFER , this . uvBuffer ) , f . vertexAttribPointer ( g . aTextureCoord , 2 , f . FLOAT , ! 1 , 0 , 0 ) , f . bindBuffer ( f . ARRAY _BUFFER , this . colorBuffer ) , f . vertexAttribPointer ( g . colorAttribute , 2 , f . FLOAT , ! 1 , 0 , 0 ) , f . bindBuffer ( f . ELEMENT _ARRAY _BUFFER , this . indexBuffer ) , f . drawElements ( f . TRIANGLES , 6 , f . UNSIGNED _SHORT , 0 ) , this . renderSession . drawCount ++ } , b . WebGLFilterManager . prototype . initShaderBuffers = function ( ) { var a = this . gl ; this . vertexBuffer = a . createBuffer ( ) , this . uvBuffer = a . createBuffer ( ) , this . colorBuffer = a . createBuffer ( ) , this . indexBuffer = a . createBuffer ( ) , this . vertexArray = new Float32Array ( [ 0 , 0 , 1 , 0 , 0 , 1 , 1 , 1 ] ) , a . bindBuffer ( a . ARRAY _BUFFER , this . vertexBuffer ) , a . bufferData ( a . ARRAY _BUFFER , this . vertexArray , a . STATIC _DRAW ) , this . uvArray = new Float32Array ( [ 0 , 0 , 1 , 0 , 0 , 1 , 1 , 1 ] ) , a . bindBuffer ( a . ARRAY _BUFFER , this . uvBuffer ) , a . bufferData ( a . ARRAY _BUFFER , this . uvArray , a . STATIC _DRAW ) , this . colorArray = new Float32Array ( [ 1 , 16777215 , 1 , 16777215 , 1 , 16777215 , 1 , 16777215 ] ) , a . bindBuffer ( a . ARRAY _BUFFER , this . colorBuffer ) , a . bufferData ( a . ARRAY _BUFFER , this . colorArray , a . STATIC _DRAW ) , a . bindBuffer ( a . ELEMENT _ARRAY _BUFFER , this . indexBuffer ) , a . bufferData ( a . ELEMENT _ARRAY _BUFFER , new Uint16Array ( [ 0 , 1 , 2 , 1 , 3 , 2 ] ) , a . STATIC _DRAW ) } , b . WebGLFilterManager . prototype . destroy = function ( ) { var a = this . gl ; this . filterStack = null , this . offsetX = 0 , this . offsetY = 0 ; for ( var b = 0 ; b < this . texturePool . length ; b ++ ) this . texturePool . destroy ( ) ; this . texturePool = null , a . deleteBuffer ( this . vertexBuffer ) , a . deleteBuffer ( this . uvBuffer ) , a . deleteBuffer ( this . colorBuffer ) , a . deleteBuffer ( this . indexBuffer ) } , b . FilterTexture = function ( a , b , c ) { this . gl = a , this . frameBuffer = a . createFramebuffer ( ) , this . texture = a . createTexture ( ) , a . bindTexture ( a . TEXTURE _2D , this . texture ) , a . texParameteri ( a . TEXTURE _2D , a . TEXTURE _MAG _FILTER , a . LINEAR ) , a . texParameteri ( a . TEXTURE _2D , a . TEXTURE _MIN _FILTER , a . LINEAR ) , a . texParameteri ( a . TEXTURE _2D , a . TEXTURE _WRAP _S , a . CLAMP _TO _EDGE ) , a . texParameteri ( a . TEXTURE _2D , a . TEXTURE _WRAP _T , a . CLAMP _TO _EDGE ) , a . bindFramebuffer ( a . FRAMEBUFFER , this . framebuffer ) , a . bindFramebuffer ( a . FRAMEBUFFER , this . frameBuffer ) , a . framebufferTexture2D ( a . FRAMEBUFFER , a . COLOR _ATTACHMENT0 , a . TEXTURE _2D , this . texture , 0 ) , this . resize ( b , c ) } , b . FilterTexture . prototype . clear = function ( ) { var a = this . gl ; a . clearColor ( 0 , 0 , 0 , 0 ) , a . clear ( a . COLOR _BUFFER _BIT ) } , b . FilterTexture . prototype . resize = function ( a , b ) { if ( this . width !== a || this . height !== b ) { this . width = a , this . height = b ; var c = this . gl ; c . bindTexture ( c . TEXTURE _2D , this . texture ) , c . texImage2D ( c . TEXTURE _2D , 0 , c . RGBA , a , b , 0 , c . RGBA , c . UNSIGNED _BYTE , null ) } } , b . FilterTexture . prototype . destroy = function ( ) { var a = this . gl ; a . deleteFramebuffer ( this . frameBuffer ) , a . deleteTexture ( this . texture ) , this . frameBuffer = null , this . texture = null } , b . CanvasMaskManager = function ( ) { } , b . CanvasMaskManager . prototype . pushMask = function ( a , c ) { c . save ( ) ; var d = a . alpha , e = a . worldTransform ; c . setTransform ( e . a , e . c , e . b , e . d , e . tx , e . ty ) , b . CanvasGraphics . renderGraphicsMask ( a , c ) , c . clip ( ) , a . worldAlpha = d } , b . CanvasMaskManager . prototype . popMask = function ( a ) { a . restore ( ) } , b . CanvasTinter = function ( ) { } , b . CanvasTinter . getTintedTexture = function ( a , c ) { var d = a . texture ; c = b . CanvasTinter . roundColor ( c ) ; var e = "#" + ( "00000" + ( 0 | c ) . toString ( 16 ) ) . substr ( - 6 ) ; if ( d . tintCache = d . tintCache || { } , d . tintCache [ e ] ) return d . tintCache [ e ] ; var f = b . CanvasTinter . canvas || document . createElement ( "canvas" ) ; if ( b . CanvasTinter . tintMethod ( d , c , f ) , b . CanvasTinter . convertTintToImage ) { var g = new Image ; g . src = f . toDataURL ( ) , d . tintCache [ e ] = g } else d . tintCache [ e ] = f , b . CanvasTinter . canvas = null ; return f } , b . CanvasTinter . tintWithMultiply = function ( a , b , c ) { v
var e = 0 ; if ( b + 1 >= a . length ) switch ( d ) { case 1 : a = new Array ( b + 1 - a . length ) . join ( c ) + a ; break ; case 3 : var f = Math . ceil ( ( e = b - a . length ) / 2 ) , g = e - f ; a = new Array ( g + 1 ) . join ( c ) + a + new Array ( f + 1 ) . join ( c ) ; break ; default : a += new Array ( b + 1 - a . length ) . join ( c ) } return a } , isPlainObject : function ( a ) { if ( "object" != typeof a || a . nodeType || a === a . window ) return ! 1 ; try { if ( a . constructor && ! { } . hasOwnProperty . call ( a . constructor . prototype , "isPrototypeOf" ) ) return ! 1 } catch ( b ) { return ! 1 } return ! 0 } , extend : function ( ) { var a , c , d , e , f , g , h = arguments [ 0 ] || { } , i = 1 , j = arguments . length , k = ! 1 ; for ( "boolean" == typeof h && ( k = h , h = arguments [ 1 ] || { } , i = 2 ) , j === i && ( h = this , -- i ) ; j > i ; i ++ ) if ( null != ( a = arguments [ i ] ) ) for ( c in a ) d = h [ c ] , e = a [ c ] , h !== e && ( k && e && ( b . Utils . isPlainObject ( e ) || ( f = Array . isArray ( e ) ) ) ? ( f ? ( f = ! 1 , g = d && Array . isArray ( d ) ? d : [ ] ) : g = d && b . Utils . isPlainObject ( d ) ? d : { } , h [ c ] = b . Utils . extend ( k , g , e ) ) : void 0 !== e && ( h [ c ] = e ) ) ; return h } } , "function" != typeof Function . prototype . bind && ( Function . prototype . bind = function ( ) { var a = Array . prototype . slice ; return function ( b ) { function c ( ) { var f = e . concat ( a . call ( arguments ) ) ; d . apply ( this instanceof c ? this : b , f ) } var d = this , e = a . call ( arguments , 1 ) ; if ( "function" != typeof d ) throw new TypeError ; return c . prototype = function f ( a ) { return a && ( f . prototype = a ) , this instanceof f ? void 0 : new f } ( d . prototype ) , c } } ( ) ) , Array . isArray || ( Array . isArray = function ( a ) { return "[object Array]" == Object . prototype . toString . call ( a ) } ) , Array . prototype . forEach || ( Array . prototype . forEach = function ( a ) { "use strict" ; if ( void 0 === this || null === this ) throw new TypeError ; var b = Object ( this ) , c = b . length >>> 0 ; if ( "function" != typeof a ) throw new TypeError ; for ( var d = arguments . length >= 2 ? arguments [ 1 ] : void 0 , e = 0 ; c > e ; e ++ ) e in b && a . call ( d , b [ e ] , e , b ) } ) , b . Circle = function ( a , b , c ) { a = a || 0 , b = b || 0 , c = c || 0 , this . x = a , this . y = b , this . _diameter = c , this . _radius = c > 0 ? . 5 * c : 0 } , b . Circle . prototype = { circumference : function ( ) { return 2 * Math . PI * this . _radius } , setTo : function ( a , b , c ) { return this . x = a , this . y = b , this . _diameter = c , this . _radius = . 5 * c , this } , copyFrom : function ( a ) { return this . setTo ( a . x , a . y , a . diameter ) } , copyTo : function ( a ) { return a . x = this . x , a . y = this . y , a . diameter = this . _diameter , a } , distance : function ( a , c ) { return "undefined" == typeof c && ( c = ! 1 ) , c ? b . Math . distanceRound ( this . x , this . y , a . x , a . y ) : b . Math . distance ( this . x , this . y , a . x , a . y ) } , clone : function ( a ) { return "undefined" == typeof a ? a = new b . Circle ( this . x , this . y , this . diameter ) : a . setTo ( this . x , this . y , this . diameter ) , a } , contains : function ( a , c ) { return b . Circle . contains ( this , a , c ) } , circumferencePoint : function ( a , c , d ) { return b . Circle . circumferencePoint ( this , a , c , d ) } , offset : function ( a , b ) { return this . x += a , this . y += b , this } , offsetPoint : function ( a ) { return this . offset ( a . x , a . y ) } , toString : function ( ) { return "[{Phaser.Circle (x=" + this . x + " y=" + this . y + " diameter=" + this . diameter + " radius=" + this . radius + ")}]" } } , b . Circle . prototype . constructor = b . Circle , Object . defineProperty ( b . Circle . prototype , "diameter" , { get : function ( ) { return this . _diameter } , set : function ( a ) { a > 0 && ( this . _diameter = a , this . _radius = . 5 * a ) } } ) , Object . defineProperty ( b . Circle . prototype , "radius" , { get : function ( ) { return this . _radius } , set : function ( a ) { a > 0 && ( this . _radius = a , this . _diameter = 2 * a ) } } ) , Object . defineProperty ( b . Circle . prototype , "left" , { get : function ( ) { return this . x - this . _radius } , set : function ( a ) { a > this . x ? ( this . _radius = 0 , this . _diameter = 0 ) : this . radius = this . x - a } } ) , Object . defineProperty ( b . Circle . prototype , "right" , { get : function ( ) { return this . x + this . _radius } , set : function ( a ) { a < this . x ? ( this . _radius = 0 , this . _diameter = 0 ) : this . radius = a - this . x } } ) , Object . defineProperty ( b . Circle . prototype , "top" , { get : function ( ) { return this . y - this . _radius } , set : function ( a ) { a > this . y ? ( this . _radius = 0 , this . _diameter = 0 ) : this . radius = this . y - a } } ) , Object . defineProperty ( b . Circle . prototype , "bottom" , { get : function ( ) { return this . y + this . _radius } , set : function ( a ) { a < this . y ? ( this . _radius = 0 , this . _diameter = 0 ) : this . radius = a - this . y } } ) , Object . defineProperty ( b . Circle . prototype , "area" , { get : function ( ) { return this . _radius > 0 ? Math . PI * this . _radius * this . _radius : 0 } } ) , Object . defineProperty ( b . Circle . prototype , "empty" , { get : function ( ) { return 0 === this . _diameter } , set : function ( a ) { a === ! 0 && this . setTo ( 0 , 0 , 0 ) } } ) , b . Circle . contains = function ( a , b , c ) { if ( a . radius > 0 && b >= a . left && b <= a . right && c >= a . top && c <
} } , b . SignalBinding . prototype . constructor = b . SignalBinding , b . Filter = function ( a , c , d ) { this . game = a , this . type = b . WEBGL _FILTER , this . passes = [ this ] , this . shaders = [ ] , this . dirty = ! 0 , this . padding = 0 , this . uniforms = { time : { type : "1f" , value : 0 } , resolution : { type : "2f" , value : { x : 256 , y : 256 } } , mouse : { type : "2f" , value : { x : 0 , y : 0 } } } , this . fragmentSrc = d || [ ] } , b . Filter . prototype = { init : function ( ) { } , setResolution : function ( a , b ) { this . uniforms . resolution . value . x = a , this . uniforms . resolution . value . y = b } , update : function ( a ) { "undefined" != typeof a && ( a . x > 0 && ( this . uniforms . mouse . x = a . x . toFixed ( 2 ) ) , a . y > 0 && ( this . uniforms . mouse . y = a . y . toFixed ( 2 ) ) ) , this . uniforms . time . value = this . game . time . totalElapsedSeconds ( ) } , destroy : function ( ) { this . game = null } } , b . Filter . prototype . constructor = b . Filter , Object . defineProperty ( b . Filter . prototype , "width" , { get : function ( ) { return this . uniforms . resolution . value . x } , set : function ( a ) { this . uniforms . resolution . value . x = a } } ) , Object . defineProperty ( b . Filter . prototype , "height" , { get : function ( ) { return this . uniforms . resolution . value . y } , set : function ( a ) { this . uniforms . resolution . value . y = a } } ) , b . Plugin = function ( a , b ) { "undefined" == typeof b && ( b = null ) , this . game = a , this . parent = b , this . active = ! 1 , this . visible = ! 1 , this . hasPreUpdate = ! 1 , this . hasUpdate = ! 1 , this . hasPostUpdate = ! 1 , this . hasRender = ! 1 , this . hasPostRender = ! 1 } , b . Plugin . prototype = { preUpdate : function ( ) { } , update : function ( ) { } , render : function ( ) { } , postRender : function ( ) { } , destroy : function ( ) { this . game = null , this . parent = null , this . active = ! 1 , this . visible = ! 1 } } , b . Plugin . prototype . constructor = b . Plugin , b . PluginManager = function ( a ) { this . game = a , this . plugins = [ ] , this . _len = 0 , this . _i = 0 } , b . PluginManager . prototype = { add : function ( a ) { var b = ! 1 ; return "function" == typeof a ? a = new a ( this . game , this . _parent ) : ( a . game = this . game , a . parent = this ) , "function" == typeof a . preUpdate && ( a . hasPreUpdate = ! 0 , b = ! 0 ) , "function" == typeof a . update && ( a . hasUpdate = ! 0 , b = ! 0 ) , "function" == typeof a . postUpdate && ( a . hasPostUpdate = ! 0 , b = ! 0 ) , "function" == typeof a . render && ( a . hasRender = ! 0 , b = ! 0 ) , "function" == typeof a . postRender && ( a . hasPostRender = ! 0 , b = ! 0 ) , b ? ( ( a . hasPreUpdate || a . hasUpdate || a . hasPostUpdate ) && ( a . active = ! 0 ) , ( a . hasRender || a . hasPostRender ) && ( a . visible = ! 0 ) , this . _len = this . plugins . push ( a ) , "function" == typeof a . init && a . init ( ) , a ) : null } , remove : function ( a ) { for ( this . _i = this . _len ; this . _i -- ; ) if ( this . plugins [ this . _i ] === a ) return a . destroy ( ) , this . plugins . splice ( this . _i , 1 ) , void this . _len -- } , removeAll : function ( ) { for ( this . _i = this . _len ; this . _i -- ; ) this . plugins [ this . _i ] . destroy ( ) ; this . plugins . length = 0 , this . _len = 0 } , preUpdate : function ( ) { for ( this . _i = this . _len ; this . _i -- ; ) this . plugins [ this . _i ] . active && this . plugins [ this . _i ] . hasPreUpdate && this . plugins [ this . _i ] . preUpdate ( ) } , update : function ( ) { for ( this . _i = this . _len ; this . _i -- ; ) this . plugins [ this . _i ] . active && this . plugins [ this . _i ] . hasUpdate && this . plugins [ this . _i ] . update ( ) } , postUpdate : function ( ) { for ( this . _i = this . _len ; this . _i -- ; ) this . plugins [ this . _i ] . active && this . plugins [ this . _i ] . hasPostUpdate && this . plugins [ this . _i ] . postUpdate ( ) } , render : function ( ) { for ( this . _i = this . _len ; this . _i -- ; ) this . plugins [ this . _i ] . visible && this . plugins [ this . _i ] . hasRender && this . plugins [ this . _i ] . render ( ) } , postRender : function ( ) { for ( this . _i = this . _len ; this . _i -- ; ) this . plugins [ this . _i ] . visible && this . plugins [ this . _i ] . hasPostRender && this . plugins [ this . _i ] . postRender ( ) } , destroy : function ( ) { this . removeAll ( ) , this . game = null } } , b . PluginManager . prototype . constructor = b . PluginManager , b . Stage = function ( a , c , d ) { this . game = a , this . offset = new b . Point , PIXI . Stage . call ( this , 0 , ! 1 ) , this . name = "_stage_root" , this . interactive = ! 1 , this . disableVisibilityChange = ! 1 , this . checkOffsetInterval = 2500 , this . exists = ! 0 , this . currentRenderOrderID = 0 , this . _hiddenVar = "hidden" , this . _nextOffsetCheck = 0 , this . _backgroundColor = 0 , a . config ? this . parseConfig ( a . config ) : ( this . game . canvas = b . Canvas . create ( c , d ) , this . game . canvas . style [ "-webkit-full-screen" ] = "width: 100%; height: 100%" ) } , b . Stage . prototype = Object . create ( PIXI . Stage . prototype ) , b . Stage . prototype . constructor = b . Stage , b . Stage . prototype . preUpdate = function ( ) { this . currentRenderOrderID = 0 ; for ( var a = this . children . length , b = 0 ; a > b ; b ++ ) this . children [ b ] . preUpdate ( ) } , b . Stage . prototype . update = function ( ) { for ( var a = this . children . length ; a --
} , showDebugHeader : function ( ) { var a = b . DEV _VERSION , c = "Canvas" , d = "HTML Audio" , e = 1 ; if ( this . renderType === b . WEBGL ? ( c = "WebGL" , e ++ ) : this . renderType == b . HEADLESS && ( c = "Headless" ) , this . device . webAudio && ( d = "WebAudio" , e ++ ) , this . device . chrome ) { for ( var f = [ "%c %c %c Phaser v" + a + " - " + c + " - " + d + " %c %c http://phaser.io %c %c ♥%c♥%c♥ " , "background: #0cf300" , "background: #00bc17" , "color: #ffffff; background: #00711f;" , "background: #00bc17" , "background: #0cf300" , "background: #00bc17" ] , g = 0 ; 3 > g ; g ++ ) f . push ( e > g ? "color: #ff2424; background: #fff" : "color: #959595; background: #fff" ) ; console . log . apply ( console , f ) } else console . log ( "Phaser v" + a + " - Renderer: " + c + " - Audio: " + d + " - http://phaser.io" ) } , setUpRenderer : function ( ) { if ( this . device . trident && ( this . renderType = b . CANVAS ) , this . renderType === b . HEADLESS || this . renderType === b . CANVAS || this . renderType === b . AUTO && this . device . webGL === ! 1 ) { if ( ! this . device . canvas ) throw new Error ( "Phaser.Game - cannot create Canvas or WebGL context, aborting." ) ; this . renderType === b . AUTO && ( this . renderType = b . CANVAS ) , this . renderer = new PIXI . CanvasRenderer ( this . width , this . height , this . canvas , this . transparent ) , this . context = this . renderer . context } else this . renderType = b . WEBGL , this . renderer = new PIXI . WebGLRenderer ( this . width , this . height , this . canvas , this . transparent , this . antialias ) , this . context = null ; this . renderType !== b . HEADLESS && ( this . stage . smoothed = this . antialias , b . Canvas . addToDOM ( this . canvas , this . parent , ! 0 ) , b . Canvas . setTouchAction ( this . canvas ) ) } , update : function ( a ) { this . time . update ( a ) , this . _paused || this . pendingStep ? this . debug . preUpdate ( ) : ( this . stepping && ( this . pendingStep = ! 0 ) , this . debug . preUpdate ( ) , this . physics . preUpdate ( ) , this . state . preUpdate ( ) , this . plugins . preUpdate ( ) , this . stage . preUpdate ( ) , this . state . update ( ) , this . stage . update ( ) , this . tweens . update ( ) , this . sound . update ( ) , this . input . update ( ) , this . physics . update ( ) , this . particles . update ( ) , this . plugins . update ( ) , this . stage . postUpdate ( ) , this . plugins . postUpdate ( ) ) , this . renderType != b . HEADLESS && ( this . renderer . render ( this . stage ) , this . plugins . render ( ) , this . state . render ( ) , this . plugins . postRender ( ) ) } , enableStep : function ( ) { this . stepping = ! 0 , this . pendingStep = ! 1 , this . stepCount = 0 } , disableStep : function ( ) { this . stepping = ! 1 , this . pendingStep = ! 1 } , step : function ( ) { this . pendingStep = ! 1 , this . stepCount ++ } , destroy : function ( ) { this . raf . stop ( ) , this . input . destroy ( ) , this . state . destroy ( ) , this . physics . destroy ( ) , this . state = null , this . cache = null , this . input = null , this . load = null , this . sound = null , this . stage = null , this . time = null , this . world = null , this . isBooted = ! 1 } , gamePaused : function ( a ) { this . _paused || ( this . _paused = ! 0 , this . time . gamePaused ( ) , this . sound . setMute ( ) , this . onPause . dispatch ( a ) ) } , gameResumed : function ( a ) { this . _paused && ! this . _codePaused && ( this . _paused = ! 1 , this . time . gameResumed ( ) , this . input . reset ( ) , this . sound . unsetMute ( ) , this . onResume . dispatch ( a ) ) } , focusLoss : function ( a ) { this . onBlur . dispatch ( a ) , this . gamePaused ( a ) } , focusGain : function ( a ) { this . onFocus . dispatch ( a ) , this . gameResumed ( a ) } } , b . Game . prototype . constructor = b . Game , Object . defineProperty ( b . Game . prototype , "paused" , { get : function ( ) { return this . _paused } , set : function ( a ) { a === ! 0 ? this . _paused === ! 1 && ( this . _paused = ! 0 , this . _codePaused = ! 0 , this . sound . mute = ! 0 , this . time . gamePaused ( ) , this . onPause . dispatch ( this ) ) : this . _paused && ( this . _paused = ! 1 , this . _codePaused = ! 1 , this . input . reset ( ) , this . sound . mute = ! 1 , this . time . gameResumed ( ) , this . onResume . dispatch ( this ) ) } } ) , b . Input = function ( a ) { this . game = a , this . hitCanvas = null , this . hitContext = null , this . moveCallback = null , this . moveCallbackContext = this , this . pollRate = 0 , this . disabled = ! 1 , this . multiInputOverride = b . Input . MOUSE _TOUCH _COMBINE , this . position = null , this . speed = null , this . circle = null , this . scale = null , this . maxPointers = 10 , this . currentPointers = 0 , this . tapRate = 200 , this . doubleTapRate = 300 , this . holdRate = 2e3 , this . justPressedRate = 200 , this . justReleasedRate = 200 , this . recordPointerHistory = ! 1 , this . recordRate = 100 , this . recordLimit = 100 , this . pointer1 = null , this . pointer2 = null , this . pointer3 = null , this . pointer4 = null , this . pointer5 = null , this . pointer6 = null , this . pointer7 = null , this . pointer8 = null , this . pointer9 = null , this . pointer10 = null , this . activePointer = null , this . mousePointer = null , this . mouse = nu
2014-04-11 12:09:28 +00:00
} } , b . Touch . prototype . constructor = b . Touch , b . Gamepad = function ( a ) { this . game = a , this . _gamepads = [ new b . SinglePad ( a , this ) , new b . SinglePad ( a , this ) , new b . SinglePad ( a , this ) , new b . SinglePad ( a , this ) ] , this . _gamepadIndexMap = { } , this . _rawPads = [ ] , this . _active = ! 1 , this . disabled = ! 1 , this . _gamepadSupportAvailable = ! ! navigator . webkitGetGamepads || ! ! navigator . webkitGamepads || - 1 != navigator . userAgent . indexOf ( "Firefox/" ) || ! ! navigator . getGamepads , this . _prevRawGamepadTypes = [ ] , this . _prevTimestamps = [ ] , this . callbackContext = this , this . onConnectCallback = null , this . onDisconnectCallback = null , this . onDownCallback = null , this . onUpCallback = null , this . onAxisCallback = null , this . onFloatCallback = null , this . _ongamepadconnected = null , this . _gamepaddisconnected = null } , b . Gamepad . prototype = { addCallbacks : function ( a , b ) { "undefined" != typeof b && ( this . onConnectCallback = "function" == typeof b . onConnect ? b . onConnect : this . onConnectCallback , this . onDisconnectCallback = "function" == typeof b . onDisconnect ? b . onDisconnect : this . onDisconnectCallback , this . onDownCallback = "function" == typeof b . onDown ? b . onDown : this . onDownCallback , this . onUpCallback = "function" == typeof b . onUp ? b . onUp : this . onUpCallback , this . onAxisCallback = "function" == typeof b . onAxis ? b . onAxis : this . onAxisCallback , this . onFloatCallback = "function" == typeof b . onFloat ? b . onFloat : this . onFloatCallback ) } , start : function ( ) { if ( ! this . _active ) { this . _active = ! 0 ; var a = this ; this . _ongamepadconnected = function ( b ) { var c = b . gamepad ; a . _rawPads . push ( c ) , a . _gamepads [ c . index ] . connect ( c ) } , window . addEventListener ( "gamepadconnected" , this . _ongamepadconnected , ! 1 ) , this . _ongamepaddisconnected = function ( b ) { var c = b . gamepad ; for ( var d in a . _rawPads ) a . _rawPads [ d ] . index === c . index && a . _rawPads . splice ( d , 1 ) ; a . _gamepads [ c . index ] . disconnect ( ) } , window . addEventListener ( "gamepaddisconnected" , this . _ongamepaddisconnected , ! 1 ) } } , update : function ( ) { this . _pollGamepads ( ) ; for ( var a = 0 ; a < this . _gamepads . length ; a ++ ) this . _gamepads [ a ] . _connected && this . _gamepads [ a ] . pollStatus ( ) } , _pollGamepads : function ( ) { var a = navigator . getGamepads || navigator . webkitGetGamepads && navigator . webkitGetGamepads ( ) || navigator . webkitGamepads ; if ( a ) { this . _rawPads = [ ] ; for ( var b = ! 1 , c = 0 ; c < a . length && ( typeof a [ c ] !== this . _prevRawGamepadTypes [ c ] && ( b = ! 0 , this . _prevRawGamepadTypes [ c ] = typeof a [ c ] ) , a [ c ] && this . _rawPads . push ( a [ c ] ) , 3 !== c ) ; c ++ ) ; if ( b ) { for ( var d , e = { rawIndices : { } , padIndices : { } } , f = 0 ; f < this . _gamepads . length ; f ++ ) if ( d = this . _gamepads [ f ] , d . connected ) for ( var g = 0 ; g < this . _rawPads . length ; g ++ ) this . _rawPads [ g ] . index === d . index && ( e . rawIndices [ d . index ] = ! 0 , e . padIndices [ f ] = ! 0 ) ; for ( var h = 0 ; h < this . _gamepads . length ; h ++ ) if ( d = this . _gamepads [ h ] , ! e . padIndices [ h ] ) { this . _rawPads . length < 1 && d . disconnect ( ) ; for ( var i = 0 ; i < this . _rawPads . length && ! e . padIndices [ h ] ; i ++ ) { var j = this . _rawPads [ i ] ; if ( j ) { if ( e . rawIndices [ j . index ] ) { d . disconnect ( ) ; continue } d . connect ( j ) , e . rawIndices [ j . index ] = ! 0 , e . padIndices [ h ] = ! 0 } else d . disconnect ( ) } } } } } , setDeadZones : function ( a ) { for ( var b = 0 ; b < this . _gamepads . length ; b ++ ) this . _gamepads [ b ] . deadZone = a } , stop : function ( ) { this . _active = ! 1 , window . removeEventListener ( "gamepadconnected" , this . _ongamepadconnected ) , window . removeEventListener ( "gamepaddisconnected" , this . _ongamepaddisconnected ) } , reset : function ( ) { this . update ( ) ; for ( var a = 0 ; a < this . _gamepads . length ; a ++ ) this . _gamepads [ a ] . reset ( ) } , justPressed : function ( a , b ) { for ( var c = 0 ; c < this . _gamepads . length ; c ++ ) if ( this . _gamepads [ c ] . justPressed ( a , b ) === ! 0 ) return ! 0 ; return ! 1 } , justReleased : function ( a , b ) { for ( var c = 0 ; c < this . _gamepads . length ; c ++ ) if ( this . _gamepads [ c ] . justReleased ( a , b ) === ! 0 ) return ! 0 ; return ! 1 } , isDown : function ( a ) { for ( var b = 0 ; b < this . _gamepads . length ; b ++ ) if ( this . _gamepads [ b ] . isDown ( a ) === ! 0 ) return ! 0 ; return ! 1 } } , b . Gamepad . prototype . constructor = b . Gamepad , Object . defineProperty ( b . Gamepad . prototype , "active" , { get : function ( ) { return this . _active } } ) , Object . defineProperty ( b . Gamepad . prototype , "supported" , { get : function ( ) { return this . _gamepadSupportAvailable } } ) , Object . defineProperty ( b . Gamepad . prototype , "padsConnected" , { get : function ( ) { return this . _rawPads . length } } ) , Object . defineProperty ( b . Gamepad . prototype , "pad1" , { get : function ( ) { return this . _gamepads [ 0 ] } } ) , Object . defineProperty ( b . Gamepad . prototype , "pad2" , { get : function ( ) { return this . _gamepads [ 1 ]
} , getPixels : function ( a ) { return this . context . getImageData ( a . x , a . y , a . width , a . height ) } , copyPixels : function ( a , b , c , d ) { "string" == typeof a && ( a = this . game . cache . getImage ( a ) ) , a && this . context . drawImage ( a , b . x , b . y , b . width , b . height , c , d , b . width , b . height ) } , draw : function ( a , b , c ) { "string" == typeof a && ( a = this . game . cache . getImage ( a ) ) , a && this . context . drawImage ( a , 0 , 0 , a . width , a . height , b , c , a . width , a . height ) } , alphaMask : function ( a , b ) { var c = this . context . globalCompositeOperation ; "string" == typeof b && ( b = this . game . cache . getImage ( b ) ) , b && this . context . drawImage ( b , 0 , 0 ) , this . context . globalCompositeOperation = "source-atop" , "string" == typeof a && ( a = this . game . cache . getImage ( a ) ) , a && this . context . drawImage ( a , 0 , 0 ) , this . context . globalCompositeOperation = c } , render : function ( ) { this . game . renderType === b . WEBGL && this . dirty && ( PIXI . updateWebGLTexture ( this . baseTexture , this . game . renderer . gl ) , this . dirty = ! 1 ) } } , b . BitmapData . prototype . constructor = b . BitmapData , b . Sprite = function ( a , c , d , e , f ) { c = c || 0 , d = d || 0 , e = e || null , f = f || null , this . game = a , this . name = "" , this . type = b . SPRITE , this . z = 0 , this . events = new b . Events ( this ) , this . animations = new b . AnimationManager ( this ) , this . key = e , this . _frame = 0 , this . _frameName = "" , PIXI . Sprite . call ( this , PIXI . TextureCache . _ _default ) , this . loadTexture ( e , f ) , this . position . set ( c , d ) , this . world = new b . Point ( c , d ) , this . autoCull = ! 1 , this . input = null , this . body = null , this . health = 1 , this . lifespan = 0 , this . checkWorldBounds = ! 1 , this . outOfBoundsKill = ! 1 , this . debug = ! 1 , this . cameraOffset = new b . Point , this . _cache = [ 0 , 0 , 0 , 0 , 1 , 0 , 1 , 0 ] , this . _bounds = new b . Rectangle } , b . Sprite . prototype = Object . create ( PIXI . Sprite . prototype ) , b . Sprite . prototype . constructor = b . Sprite , b . Sprite . prototype . preUpdate = function ( ) { if ( 1 === this . _cache [ 4 ] && this . exists ) return this . world . setTo ( this . parent . position . x + this . position . x , this . parent . position . y + this . position . y ) , this . worldTransform . tx = this . world . x , this . worldTransform . ty = this . world . y , this . _cache [ 0 ] = this . world . x , this . _cache [ 1 ] = this . world . y , this . _cache [ 2 ] = this . rotation , this . body && this . body . preUpdate ( ) , this . _cache [ 4 ] = 0 , ! 1 ; if ( this . _cache [ 0 ] = this . world . x , this . _cache [ 1 ] = this . world . y , this . _cache [ 2 ] = this . rotation , ! this . exists || ! this . parent . exists ) return this . _cache [ 3 ] = - 1 , ! 1 ; if ( this . lifespan > 0 && ( this . lifespan -= this . game . time . elapsed , this . lifespan <= 0 ) ) return this . kill ( ) , ! 1 ; if ( ( this . autoCull || this . checkWorldBounds ) && this . _bounds . copyFrom ( this . getBounds ( ) ) , this . autoCull && ( this . renderable = this . game . world . camera . screenView . intersects ( this . _bounds ) ) , this . checkWorldBounds ) if ( 1 === this . _cache [ 5 ] && this . game . world . bounds . intersects ( this . _bounds ) ) this . _cache [ 5 ] = 0 , this . events . onEnterBounds . dispatch ( this ) ; else if ( 0 === this . _cache [ 5 ] && ! this . game . world . bounds . intersects ( this . _bounds ) && ( this . _cache [ 5 ] = 1 , this . events . onOutOfBounds . dispatch ( this ) , this . outOfBoundsKill ) ) return this . kill ( ) , ! 1 ; this . world . setTo ( this . game . camera . x + this . worldTransform . tx , this . game . camera . y + this . worldTransform . ty ) , this . visible && ( this . _cache [ 3 ] = this . game . stage . currentRenderOrderID ++ ) , this . animations . update ( ) , this . body && this . body . preUpdate ( ) ; for ( var a = 0 , b = this . children . length ; b > a ; a ++ ) this . children [ a ] . preUpdate ( ) ; return ! 0 } , b . Sprite . prototype . update = function ( ) { } , b . Sprite . prototype . postUpdate = function ( ) { this . key instanceof b . BitmapData && this . key . render ( ) , this . exists && this . body && this . body . postUpdate ( ) , 1 === this . _cache [ 7 ] && ( this . position . x = ( this . game . camera . view . x + this . cameraOffset . x ) / this . game . camera . scale . x , this . position . y = ( this . game . camera . view . y + this . cameraOffset . y ) / this . game . camera . scale . y ) ; for ( var a = 0 , c = this . children . length ; c > a ; a ++ ) this . children [ a ] . postUpdate ( ) } , b . Sprite . prototype . loadTexture = function ( a , c ) { return c = c || 0 , a instanceof b . RenderTexture ? ( this . key = a . key , void this . setTexture ( a ) ) : a instanceof b . BitmapData ? ( this . key = a , void this . setTexture ( a . texture ) ) : a instanceof PIXI . Texture ? ( this . key = a , void this . setTexture ( a ) ) : null === a || "undefined" == typeof a ? ( this . key = "__default" , void this . setTexture ( PIXI . TextureCache [ this . key ] ) ) : "string" != typeof a || this . game . cache . checkImageKey ( a ) ? this . game . cache . isSpriteSheet ( a ) ? ( this . key = a , this . animations . loadFrameData ( this . game . cache . getFrameData ( a ) ) , "string" == typeof c ? this . frameName = c : this . frame = c , void 0 ) : ( this . ke
2014-04-15 14:39:23 +00:00
} } ) , Object . defineProperty ( b . BitmapText . prototype , "inputEnabled" , { get : function ( ) { return this . input && this . input . enabled } , set : function ( a ) { a ? null === this . input ? ( this . input = new b . InputHandler ( this ) , this . input . start ( ) ) : this . input && ! this . input . enabled && this . input . start ( ) : this . input && this . input . enabled && this . input . stop ( ) } } ) , Object . defineProperty ( b . BitmapText . prototype , "fixedToCamera" , { get : function ( ) { return ! ! this . _cache [ 7 ] } , set : function ( a ) { a ? ( this . _cache [ 7 ] = 1 , this . cameraOffset . set ( this . x , this . y ) ) : this . _cache [ 7 ] = 0 } } ) , b . Button = function ( a , c , d , e , f , g , h , i , j , k ) { c = c || 0 , d = d || 0 , e = e || null , f = f || null , g = g || this , b . Image . call ( this , a , c , d , e , i ) , this . type = b . BUTTON , this . _onOverFrameName = null , this . _onOutFrameName = null , this . _onDownFrameName = null , this . _onUpFrameName = null , this . _onOverFrameID = null , this . _onOutFrameID = null , this . _onDownFrameID = null , this . _onUpFrameID = null , this . onOverSound = null , this . onOutSound = null , this . onDownSound = null , this . onUpSound = null , this . onOverSoundMarker = "" , this . onOutSoundMarker = "" , this . onDownSoundMarker = "" , this . onUpSoundMarker = "" , this . onInputOver = new b . Signal , this . onInputOut = new b . Signal , this . onInputDown = new b . Signal , this . onInputUp = new b . Signal , this . freezeFrames = ! 1 , this . forceOut = ! 1 , this . inputEnabled = ! 0 , this . input . start ( 0 , ! 0 ) , this . setFrames ( h , i , j , k ) , null !== f && this . onInputUp . add ( f , g ) , this . events . onInputOver . add ( this . onInputOverHandler , this ) , this . events . onInputOut . add ( this . onInputOutHandler , this ) , this . events . onInputDown . add ( this . onInputDownHandler , this ) , this . events . onInputUp . add ( this . onInputUpHandler , this ) } , b . Button . prototype = Object . create ( b . Image . prototype ) , b . Button . prototype . constructor = b . Button , b . Button . prototype . clearFrames = function ( ) { this . _onOverFrameName = null , this . _onOverFrameID = null , this . _onOutFrameName = null , this . _onOutFrameID = null , this . _onDownFrameName = null , this . _onDownFrameID = null , this . _onUpFrameName = null , this . _onUpFrameID = null } , b . Button . prototype . setFrames = function ( a , b , c , d ) { this . clearFrames ( ) , null !== a && ( "string" == typeof a ? ( this . _onOverFrameName = a , this . input . pointerOver ( ) && ( this . frameName = a ) ) : ( this . _onOverFrameID = a , this . input . pointerOver ( ) && ( this . frame = a ) ) ) , null !== b && ( "string" == typeof b ? ( this . _onOutFrameName = b , this . input . pointerOver ( ) === ! 1 && ( this . frameName = b ) ) : ( this . _onOutFrameID = b , this . input . pointerOver ( ) === ! 1 && ( this . frame = b ) ) ) , null !== c && ( "string" == typeof c ? ( this . _onDownFrameName = c , this . input . pointerDown ( ) && ( this . frameName = c ) ) : ( this . _onDownFrameID = c , this . input . pointerDown ( ) && ( this . frame = c ) ) ) , null !== d && ( "string" == typeof d ? ( this . _onUpFrameName = d , this . input . pointerUp ( ) && ( this . frameName = d ) ) : ( this . _onUpFrameID = d , this . input . pointerUp ( ) && ( this . frame = d ) ) ) } , b . Button . prototype . setSounds = function ( a , b , c , d , e , f , g , h ) { this . setOverSound ( a , b ) , this . setOutSound ( e , f ) , this . setDownSound ( c , d ) , this . setUpSound ( g , h ) } , b . Button . prototype . setOverSound = function ( a , c ) { this . onOverSound = null , this . onOverSoundMarker = "" , a instanceof b . Sound && ( this . onOverSound = a ) , "string" == typeof c && ( this . onOverSoundMarker = c ) } , b . Button . prototype . setOutSound = function ( a , c ) { this . onOutSound = null , this . onOutSoundMarker = "" , a instanceof b . Sound && ( this . onOutSound = a ) , "string" == typeof c && ( this . onOutSoundMarker = c ) } , b . Button . prototype . setDownSound = function ( a , c ) { this . onDownSound = null , this . onDownSoundMarker = "" , a instanceof b . Sound && ( this . onDownSound = a ) , "string" == typeof c && ( this . onDownSoundMarker = c ) } , b . Button . prototype . setUpSound = function ( a , c ) { this . onUpSound = null , this . onUpSoundMarker = "" , a instanceof b . Sound && ( this . onUpSound = a ) , "string" == typeof c && ( this . onUpSoundMarker = c ) } , b . Button . prototype . onInputOverHandler = function ( a , b ) { this . freezeFrames === ! 1 && this . setState ( 1 ) , this . onOverSound && this . onOverSound . play ( this . onOverSoundMarker ) , this . onInputOver && this . onInputOver . dispatch ( this , b ) } , b . Button . prototype . onInputOutHandler = function ( a , b ) { this . freezeFrames === ! 1 && this . setState ( 2 ) , this . onOutSound && this . onOutSound . play ( this . onOutSoundMarker ) , this . onInputOut && this . onInputOut . dispatch ( this , b ) } , b . Button . prototype . onInputDownHandler = function ( a , b ) { this . freezeFrames === ! 1 && this . setState ( 3 ) , this . onDownSound && this . onDownSound . play ( this . onDownSoundMarker ) , this . onInputDown && this . onInputDown . dispatch ( this , b ) } , b . Button . proto
} , b . QuadTree . prototype = { reset : function ( a , b , c , d , e , f , g ) { this . maxObjects = e || 10 , this . maxLevels = f || 4 , this . level = g || 0 , this . bounds = { x : Math . round ( a ) , y : Math . round ( b ) , width : c , height : d , subWidth : Math . floor ( c / 2 ) , subHeight : Math . floor ( d / 2 ) , right : Math . round ( a ) + Math . floor ( c / 2 ) , bottom : Math . round ( b ) + Math . floor ( d / 2 ) } , this . objects . length = 0 , this . nodes . length = 0 } , populate : function ( a ) { a . forEach ( this . populateHandler , this , ! 0 ) } , populateHandler : function ( a ) { a . body && a . exists && this . insert ( a . body ) } , split : function ( ) { this . level ++ , this . nodes [ 0 ] = new b . QuadTree ( this . bounds . right , this . bounds . y , this . bounds . subWidth , this . bounds . subHeight , this . maxObjects , this . maxLevels , this . level ) , this . nodes [ 1 ] = new b . QuadTree ( this . bounds . x , this . bounds . y , this . bounds . subWidth , this . bounds . subHeight , this . maxObjects , this . maxLevels , this . level ) , this . nodes [ 2 ] = new b . QuadTree ( this . bounds . x , this . bounds . bottom , this . bounds . subWidth , this . bounds . subHeight , this . maxObjects , this . maxLevels , this . level ) , this . nodes [ 3 ] = new b . QuadTree ( this . bounds . right , this . bounds . bottom , this . bounds . subWidth , this . bounds . subHeight , this . maxObjects , this . maxLevels , this . level ) } , insert : function ( a ) { var b , c = 0 ; if ( null != this . nodes [ 0 ] && ( b = this . getIndex ( a ) , - 1 !== b ) ) return void this . nodes [ b ] . insert ( a ) ; if ( this . objects . push ( a ) , this . objects . length > this . maxObjects && this . level < this . maxLevels ) for ( null == this . nodes [ 0 ] && this . split ( ) ; c < this . objects . length ; ) b = this . getIndex ( this . objects [ c ] ) , - 1 !== b ? this . nodes [ b ] . insert ( this . objects . splice ( c , 1 ) [ 0 ] ) : c ++ } , getIndex : function ( a ) { var b = - 1 ; return a . x < this . bounds . right && a . right < this . bounds . right ? a . y < this . bounds . bottom && a . bottom < this . bounds . bottom ? b = 1 : a . y > this . bounds . bottom && ( b = 2 ) : a . x > this . bounds . right && ( a . y < this . bounds . bottom && a . bottom < this . bounds . bottom ? b = 0 : a . y > this . bounds . bottom && ( b = 3 ) ) , b } , retrieve : function ( a ) { var b = this . objects , c = this . getIndex ( a . body ) ; return this . nodes [ 0 ] && ( - 1 !== c ? b = b . concat ( this . nodes [ c ] . retrieve ( a ) ) : ( b = b . concat ( this . nodes [ 0 ] . retrieve ( a ) ) , b = b . concat ( this . nodes [ 1 ] . retrieve ( a ) ) , b = b . concat ( this . nodes [ 2 ] . retrieve ( a ) ) , b = b . concat ( this . nodes [ 3 ] . retrieve ( a ) ) ) ) , b } , clear : function ( ) { this . objects . length = 0 ; for ( var a = this . nodes . length ; a -- ; ) this . nodes [ a ] . clear ( ) , this . nodes . splice ( a , 1 ) ; this . nodes . length = 0 } } , b . QuadTree . prototype . constructor = b . QuadTree , b . Net = function ( a ) { this . game = a } , b . Net . prototype = { getHostName : function ( ) { return window . location && window . location . hostname ? window . location . hostname : null } , checkDomainName : function ( a ) { return - 1 !== window . location . hostname . indexOf ( a ) } , updateQueryString : function ( a , b , c , d ) { "undefined" == typeof c && ( c = ! 1 ) , ( "undefined" == typeof d || "" === d ) && ( d = window . location . href ) ; var e = "" , f = new RegExp ( "([?|&])" + a + "=.*?(&|#|$)(.*)" , "gi" ) ; if ( f . test ( d ) ) e = "undefined" != typeof b && null !== b ? d . replace ( f , "$1" + a + "=" + b + "$2$3" ) : d . replace ( f , "$1$3" ) . replace ( /(&|\?)$/ , "" ) ; else if ( "undefined" != typeof b && null !== b ) { var g = - 1 !== d . indexOf ( "?" ) ? "&" : "?" , h = d . split ( "#" ) ; d = h [ 0 ] + g + a + "=" + b , h [ 1 ] && ( d += "#" + h [ 1 ] ) , e = d } else e = d ; return c ? void ( window . location . href = e ) : e } , getQueryString : function ( a ) { "undefined" == typeof a && ( a = "" ) ; var b = { } , c = location . search . substring ( 1 ) . split ( "&" ) ; for ( var d in c ) { var e = c [ d ] . split ( "=" ) ; if ( e . length > 1 ) { if ( a && a == this . decodeURI ( e [ 0 ] ) ) return this . decodeURI ( e [ 1 ] ) ; b [ this . decodeURI ( e [ 0 ] ) ] = this . decodeURI ( e [ 1 ] ) } } return b } , decodeURI : function ( a ) { return decodeURIComponent ( a . replace ( /\+/g , " " ) ) } } , b . Net . prototype . constructor = b . Net , b . TweenManager = function ( a ) { this . game = a , this . _tweens = [ ] , this . _add = [ ] , this . game . onPause . add ( this . _pauseAll , this ) , this . game . onResume . add ( this . _resumeAll , this ) } , b . TweenManager . prototype = { getAll : function ( ) { return this . _tweens } , removeAll : function ( ) { for ( var a = 0 ; a < this . _tweens . length ; a ++ ) this . _tweens [ a ] . pendingDelete = ! 0 ; this . _add = [ ] } , add : function ( a ) { a . _manager = this , this . _add . push ( a ) } , create : function ( a ) { return new b . Tween ( a , this . game , this ) } , remove : function ( a ) { var b = this . _tweens . indexOf ( a ) ; - 1 !== b && ( this . _tweens [ b ] . pendingDelete = ! 0 ) } , update : function ( ) { if ( 0 === this . _tweens . length && 0 === this . _add . length ) return ! 1 ; for ( var a = 0 , b = this . _tweens . length ; b > a ; ) this . _tweens [ a ] . update ( this . game . time . now ) ? a ++ : ( this . _tweens . splice ( a , 1 ) , b -- ) ; return this . _add . length > 0 && ( this . _tweens = this . _tweens . concat ( this . _ad
return q } } , b . Cache = function ( a ) { this . game = a , this . _canvases = { } , this . _images = { } , this . _textures = { } , this . _sounds = { } , this . _text = { } , this . _json = { } , this . _physics = { } , this . _tilemaps = { } , this . _binary = { } , this . _bitmapDatas = { } , this . _bitmapFont = { } , this . addDefaultImage ( ) , this . addMissingImage ( ) , this . onSoundUnlock = new b . Signal } , b . Cache . CANVAS = 1 , b . Cache . IMAGE = 2 , b . Cache . TEXTURE = 3 , b . Cache . SOUND = 4 , b . Cache . TEXT = 5 , b . Cache . PHYSICS = 6 , b . Cache . TILEMAP = 7 , b . Cache . BINARY = 8 , b . Cache . BITMAPDATA = 9 , b . Cache . BITMAPFONT = 10 , b . Cache . JSON = 11 , b . Cache . prototype = { addCanvas : function ( a , b , c ) { this . _canvases [ a ] = { canvas : b , context : c } } , addBinary : function ( a , b ) { this . _binary [ a ] = b } , addBitmapData : function ( a , b ) { return this . _bitmapDatas [ a ] = b , b } , addRenderTexture : function ( a , c ) { var d = new b . Frame ( 0 , 0 , 0 , c . width , c . height , "" , "" ) ; this . _textures [ a ] = { texture : c , frame : d } } , addSpriteSheet : function ( a , c , d , e , f , g , h , i ) { this . _images [ a ] = { url : c , data : d , spriteSheet : ! 0 , frameWidth : e , frameHeight : f , margin : h , spacing : i } , PIXI . BaseTextureCache [ a ] = new PIXI . BaseTexture ( d ) , PIXI . TextureCache [ a ] = new PIXI . Texture ( PIXI . BaseTextureCache [ a ] ) , this . _images [ a ] . frameData = b . AnimationParser . spriteSheet ( this . game , a , e , f , g , h , i ) } , addTilemap : function ( a , b , c , d ) { this . _tilemaps [ a ] = { url : b , data : c , format : d } } , addTextureAtlas : function ( a , c , d , e , f ) { this . _images [ a ] = { url : c , data : d , spriteSheet : ! 0 } , PIXI . BaseTextureCache [ a ] = new PIXI . BaseTexture ( d ) , PIXI . TextureCache [ a ] = new PIXI . Texture ( PIXI . BaseTextureCache [ a ] ) , f == b . Loader . TEXTURE _ATLAS _JSON _ARRAY ? this . _images [ a ] . frameData = b . AnimationParser . JSONData ( this . game , e , a ) : f == b . Loader . TEXTURE _ATLAS _JSON _HASH ? this . _images [ a ] . frameData = b . AnimationParser . JSONDataHash ( this . game , e , a ) : f == b . Loader . TEXTURE _ATLAS _XML _STARLING && ( this . _images [ a ] . frameData = b . AnimationParser . XMLData ( this . game , e , a ) ) } , addBitmapFont : function ( a , c , d , e , f , g ) { this . _images [ a ] = { url : c , data : d , spriteSheet : ! 0 } , PIXI . BaseTextureCache [ a ] = new PIXI . BaseTexture ( d ) , PIXI . TextureCache [ a ] = new PIXI . Texture ( PIXI . BaseTextureCache [ a ] ) , b . LoaderParser . bitmapFont ( this . game , e , a , f , g ) } , addPhysicsData : function ( a , b , c , d ) { this . _physics [ a ] = { url : b , data : c , format : d } } , addDefaultImage : function ( ) { var a = new Image ; a . src = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgAQMAAABJtOi3AAAAA1BMVEX///+nxBvIAAAAAXRSTlMAQObYZgAAABVJREFUeF7NwIEAAAAAgKD9qdeocAMAoAABm3DkcAAAAABJRU5ErkJggg==" , this . _images . _ _default = { url : null , data : a , spriteSheet : ! 1 } , this . _images . _ _default . frame = new b . Frame ( 0 , 0 , 0 , 32 , 32 , "" , "" ) , PIXI . BaseTextureCache . _ _default = new PIXI . BaseTexture ( a ) , PIXI . TextureCache . _ _default = new PIXI . Texture ( PIXI . BaseTextureCache . _ _default ) } , addMissingImage : function ( ) { var a = new Image ; a . src = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAIAAAD8GO2jAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJ9JREFUeNq01ssOwyAMRFG46v//Mt1ESmgh+DFmE2GPOBARKb2NVjo+17PXLD8a1+pl5+A+wSgFygymWYHBb0FtsKhJDdZlncG2IzJ4ayoMDv20wTmSMzClEgbWYNTAkQ0Z+OJ+A/eWnAaR9+oxCF4Os0H8htsMUp+pwcgBBiMNnAwF8GqIgL2hAzaGFFgZauDPKABmowZ4GL369/0rwACp2yA/ttmvsQAAAABJRU5ErkJggg==" , this . _images . _ _missing = { url : null , data : a , spriteSheet : ! 1 } , this . _images . _ _missing . frame = new b . Frame ( 0 , 0 , 0 , 32 , 32 , "" , "" ) , PIXI . BaseTextureCache . _ _missing = new PIXI . BaseTexture ( a ) , PIXI . TextureCache . _ _missing = new PIXI . Texture ( PIXI . BaseTextureCache . _ _missing ) } , addText : function ( a , b , c ) { this . _text [ a ] = { url : b , data : c } } , addJSON : function ( a , b , c ) { this . _json [ a ] = { url : b , data : c } } , addImage : function ( a , c , d ) { this . _images [ a ] = { url : c , data : d , spriteSheet : ! 1 } , this . _images [ a ] . frame = new b . Frame ( 0 , 0 , 0 , d . width , d . height , a , this . game . rnd . uuid ( ) ) , PIXI . BaseTextureCache [ a ] = new PIXI . BaseTexture ( d ) , PIXI . TextureCache [ a ] = new PIXI . Texture ( PIXI . BaseTextureCache [ a ] ) } , addSound : function ( a , b , c , d , e ) { d = d || ! 0 , e = e || ! 1 ; var f = ! 1 ; e && ( f = ! 0 ) , this . _sounds [ a ] = { url : b , data : c , isDecoding : ! 1 , decoded : f , webAudio : d , audioTag : e , locked : this . game . sound . touchLocked } } , reloadSound : function ( a ) { var b = this ; this . _sounds [ a ] && ( this . _sounds [ a ] . data . src = this . _sounds [ a ] . url , this . _sounds [ a ] . data . addEventListener ( "canplaythrough" , function ( ) { return b . reloadSoundComplete ( a ) } , ! 1 ) , this . _sounds [ a ] . data . load ( ) ) } , reloadSoundComplete : function ( a ) { this . _sounds [ a ] && ( this . _sounds [ a ] . locked = ! 1 , this . onSoundUnlock . dispatch ( a ) ) } , updateSound : function ( a , b , c )
} } ) , b . SoundManager = function ( a ) { this . game = a , this . onSoundDecode = new b . Signal , this . _codeMuted = ! 1 , this . _muted = ! 1 , this . _unlockSource = null , this . _volume = 1 , this . _sounds = [ ] , this . context = null , this . usingWebAudio = ! 0 , this . usingAudioTag = ! 1 , this . noAudio = ! 1 , this . connectToMaster = ! 0 , this . touchLocked = ! 1 , this . channels = 32 } , b . SoundManager . prototype = { boot : function ( ) { if ( this . game . device . iOS && this . game . device . webAudio === ! 1 && ( this . channels = 1 ) , this . game . device . iOS || window . PhaserGlobal && window . PhaserGlobal . fakeiOSTouchLock ? ( this . game . input . touch . callbackContext = this , this . game . input . touch . touchStartCallback = this . unlock , this . game . input . mouse . callbackContext = this , this . game . input . mouse . mouseDownCallback = this . unlock , this . touchLocked = ! 0 ) : this . touchLocked = ! 1 , window . PhaserGlobal ) { if ( window . PhaserGlobal . disableAudio === ! 0 ) return this . usingWebAudio = ! 1 , void ( this . noAudio = ! 0 ) ; if ( window . PhaserGlobal . disableWebAudio === ! 0 ) return this . usingWebAudio = ! 1 , this . usingAudioTag = ! 0 , void ( this . noAudio = ! 1 ) } if ( window . AudioContext ) try { this . context = new window . AudioContext } catch ( a ) { this . context = null , this . usingWebAudio = ! 1 , this . noAudio = ! 0 } else if ( window . webkitAudioContext ) try { this . context = new window . webkitAudioContext } catch ( a ) { this . context = null , this . usingWebAudio = ! 1 , this . noAudio = ! 0 } window . Audio && null === this . context && ( this . usingWebAudio = ! 1 , this . usingAudioTag = ! 0 , this . noAudio = ! 1 ) , null !== this . context && ( this . masterGain = "undefined" == typeof this . context . createGain ? this . context . createGainNode ( ) : this . context . createGain ( ) , this . masterGain . gain . value = 1 , this . masterGain . connect ( this . context . destination ) ) } , unlock : function ( ) { if ( this . touchLocked !== ! 1 ) if ( this . game . device . webAudio === ! 1 || window . PhaserGlobal && window . PhaserGlobal . disableWebAudio === ! 0 ) this . touchLocked = ! 1 , this . _unlockSource = null , this . game . input . touch . callbackContext = null , this . game . input . touch . touchStartCallback = null , this . game . input . mouse . callbackContext = null , this . game . input . mouse . mouseDownCallback = null ; else { var a = this . context . createBuffer ( 1 , 1 , 22050 ) ; this . _unlockSource = this . context . createBufferSource ( ) , this . _unlockSource . buffer = a , this . _unlockSource . connect ( this . context . destination ) , this . _unlockSource . noteOn ( 0 ) } } , stopAll : function ( ) { for ( var a = 0 ; a < this . _sounds . length ; a ++ ) this . _sounds [ a ] && this . _sounds [ a ] . stop ( ) } , pauseAll : function ( ) { for ( var a = 0 ; a < this . _sounds . length ; a ++ ) this . _sounds [ a ] && this . _sounds [ a ] . pause ( ) } , resumeAll : function ( ) { for ( var a = 0 ; a < this . _sounds . length ; a ++ ) this . _sounds [ a ] && this . _sounds [ a ] . resume ( ) } , decode : function ( a , b ) { b = b || null ; var c = this . game . cache . getSoundData ( a ) ; if ( c && this . game . cache . isSoundDecoded ( a ) === ! 1 ) { this . game . cache . updateSound ( a , "isDecoding" , ! 0 ) ; var d = this ; this . context . decodeAudioData ( c , function ( c ) { d . game . cache . decodedSound ( a , c ) , b && d . onSoundDecode . dispatch ( a , b ) } ) } } , update : function ( ) { this . touchLocked && this . game . device . webAudio && null !== this . _unlockSource && ( this . _unlockSource . playbackState === this . _unlockSource . PLAYING _STATE || this . _unlockSource . playbackState === this . _unlockSource . FINISHED _STATE ) && ( this . touchLocked = ! 1 , this . _unlockSource = null , this . game . input . touch . callbackContext = null , this . game . input . touch . touchStartCallback = null ) ; for ( var a = 0 ; a < this . _sounds . length ; a ++ ) this . _sounds [ a ] . update ( ) } , add : function ( a , c , d , e ) { "undefined" == typeof c && ( c = 1 ) , "undefined" == typeof d && ( d = ! 1 ) , "undefined" == typeof e && ( e = this . connectToMaster ) ; var f = new b . Sound ( this . game , a , c , d , e ) ; return this . _sounds . push ( f ) , f } , remove : function ( a ) { for ( var b = this . _sounds . length ; b -- ; ) if ( this . _sounds [ b ] === a ) return this . _sounds [ b ] . destroy ( ! 1 ) , this . _sounds . splice ( b , 1 ) , ! 0 ; return ! 1 } , removeByKey : function ( a ) { for ( var b = this . _sounds . length , c = 0 ; b -- ; ) this . _sounds [ b ] . key === a && ( this . _sounds [ b ] . destroy ( ! 1 ) , this . _sounds . splice ( b , 1 ) , c ++ ) ; return c } , play : function ( a , b , c ) { var d = this . add ( a , b , c ) ; return d . play ( ) , d } , setMute : function ( ) { if ( ! this . _muted ) { this . _muted = ! 0 , this . usingWebAudio && ( this . _muteVolume = this . masterGain . gain . value , this . masterGain . gain . value = 0 ) ; for ( var a = 0 ; a < this . _sounds . length ; a ++ ) this . _sounds [ a ] . usingAudioTag && ( this . _sounds [ a ] . mute = ! 0 ) } } , unsetMute : function ( ) { if ( this . _muted && ! this . _codeMuted ) { this . _muted = ! 1 , this . usingWebAudio && ( this . masterGain . gain . value = this . _muteVolume ) ; for ( var
} , b . Physics . Arcade . Body . prototype = { updateBounds : function ( ) { var a = Math . abs ( this . sprite . scale . x ) , b = Math . abs ( this . sprite . scale . y ) ; ( a !== this . _sx || b !== this . _sy ) && ( this . width = this . sourceWidth * a , this . height = this . sourceHeight * b , this . halfWidth = Math . floor ( this . width / 2 ) , this . halfHeight = Math . floor ( this . height / 2 ) , this . _sx = a , this . _sy = b , this . center . setTo ( this . position . x + this . halfWidth , this . position . y + this . halfHeight ) , this . _reset = ! 0 ) } , preUpdate : function ( ) { this . phase = 1 , this . wasTouching . none = this . touching . none , this . wasTouching . up = this . touching . up , this . wasTouching . down = this . touching . down , this . wasTouching . left = this . touching . left , this . wasTouching . right = this . touching . right , this . touching . none = ! 0 , this . touching . up = ! 1 , this . touching . down = ! 1 , this . touching . left = ! 1 , this . touching . right = ! 1 , this . blocked . up = ! 1 , this . blocked . down = ! 1 , this . blocked . left = ! 1 , this . blocked . right = ! 1 , this . embedded = ! 1 , this . updateBounds ( ) , this . position . x = this . sprite . world . x - this . sprite . anchor . x * this . width + this . offset . x , this . position . y = this . sprite . world . y - this . sprite . anchor . y * this . height + this . offset . y , this . rotation = this . sprite . angle , this . preRotation = this . rotation , ( this . _reset || 1 === this . sprite . _cache [ 4 ] ) && ( this . prev . x = this . position . x , this . prev . y = this . position . y ) , this . moves && ( this . game . physics . arcade . updateMotion ( this ) , this . newVelocity . set ( this . velocity . x * this . game . time . physicsElapsed , this . velocity . y * this . game . time . physicsElapsed ) , this . position . x += this . newVelocity . x , this . position . y += this . newVelocity . y , ( this . position . x !== this . prev . x || this . position . y !== this . prev . y ) && ( this . speed = Math . sqrt ( this . velocity . x * this . velocity . x + this . velocity . y * this . velocity . y ) , this . angle = Math . atan2 ( this . velocity . y , this . velocity . x ) ) , this . collideWorldBounds && this . checkWorldBounds ( ) ) , this . _dx = this . deltaX ( ) , this . _dy = this . deltaY ( ) , this . _reset = ! 1 } , postUpdate : function ( ) { 2 !== this . phase && ( this . phase = 2 , this . deltaX ( ) < 0 ? this . facing = b . LEFT : this . deltaX ( ) > 0 && ( this . facing = b . RIGHT ) , this . deltaY ( ) < 0 ? this . facing = b . UP : this . deltaY ( ) > 0 && ( this . facing = b . DOWN ) , this . moves && ( this . _dx = this . deltaX ( ) , this . _dy = this . deltaY ( ) , 0 !== this . deltaMax . x && 0 !== this . _dx && ( this . _dx < 0 && this . _dx < - this . deltaMax . x ? this . _dx = - this . deltaMax . x : this . _dx > 0 && this . _dx > this . deltaMax . x && ( this . _dx = this . deltaMax . x ) ) , 0 !== this . deltaMax . y && 0 !== this . _dy && ( this . _dy < 0 && this . _dy < - this . deltaMax . y ? this . _dy = - this . deltaMax . y : this . _dy > 0 && this . _dy > this . deltaMax . y && ( this . _dy = this . deltaMax . y ) ) , this . sprite . x += this . _dx , this . sprite . y += this . _dy ) , this . center . setTo ( this . position . x + this . halfWidth , this . position . y + this . halfHeight ) , this . allowRotation && ( this . sprite . angle += this . deltaZ ( ) ) , this . prev . x = this . position . x , this . prev . y = this . position . y ) } , destroy : function ( ) { this . sprite = null } , checkWorldBounds : function ( ) { this . position . x < this . game . physics . arcade . bounds . x && this . game . physics . arcade . checkCollision . left ? ( this . position . x = this . game . physics . arcade . bounds . x , this . velocity . x *= - this . bounce . x , this . blocked . left = ! 0 ) : this . right > this . game . physics . arcade . bounds . right && this . game . physics . arcade . checkCollision . right && ( this . position . x = this . game . physics . arcade . bounds . right - this . width , this . velocity . x *= - this . bounce . x , this . blocked . right = ! 0 ) , this . position . y < this . game . physics . arcade . bounds . y && this . game . physics . arcade . checkCollision . up ? ( this . position . y = this . game . physics . arcade . bounds . y , this . velocity . y *= - this . bounce . y , this . blocked . up = ! 0 ) : this . bottom > this . game . physics . arcade . bounds . bottom && this . game . physics . arcade . checkCollision . down && ( this . position . y = this . game . physics . arcade . bounds . bottom - this . height , this . velocity . y *= - this . bounce . y , this . blocked . down = ! 0 ) } , setSize : function ( a , b , c , d ) { c = c || this . offset . x , d = d || this . offset . y , this . sourceWidth = a , this . sourceHeight = b , this . width = this . sourceWidth * this . _sx , this . height = this . sourceHeight * this . _sy , this . halfWidth = Math . floor ( this . width / 2 ) , this . halfHeight = Math . floor ( this . height / 2 ) , this . offset . setTo ( c , d ) , this . center . setTo ( this . position . x + this . halfWidth , this . position . y + this . halfHeight ) } , reset : function ( a , b ) { this . velocity . set ( 0 ) , this . acceleration . set ( 0 ) , this . angularVelocity = 0 , this . angularAcceleration = 0 , this . position . x = a - this . sprite . anchor . x * this . width + this . offset . x , this . position . y = b - this . sprite . ancho
2014-04-11 12:09:28 +00:00
for ( var d = this . _mc . startY , e = this . _mc . startY + this . _mc . maxY ; e > d ; d ++ ) { this . _column = this . layer . data [ d ] ; for ( var f = this . _mc . startX , g = this . _mc . startX + this . _mc . maxX ; g > f ; f ++ ) this . _column [ f ] && ( a = this . _column [ f ] , c = this . map . tilesets [ this . map . tiles [ a . index ] [ 2 ] ] , this . debug === ! 1 && a . alpha !== this . context . globalAlpha && ( this . context . globalAlpha = a . alpha ) , c . draw ( this . context , Math . floor ( this . _mc . tx ) , Math . floor ( this . _mc . ty ) , a . index ) , a . debug && ( this . context . fillStyle = "rgba(0, 255, 0, 0.4)" , this . context . fillRect ( Math . floor ( this . _mc . tx ) , Math . floor ( this . _mc . ty ) , this . map . tileWidth , this . map . tileHeight ) ) ) , this . _mc . tx += this . map . tileWidth ; this . _mc . tx = this . _mc . dx , this . _mc . ty += this . map . tileHeight } return this . debug && ( this . context . globalAlpha = 1 , this . renderDebug ( ) ) , this . game . renderType === b . WEBGL && PIXI . updateWebGLTexture ( this . baseTexture , this . game . renderer . gl ) , this . dirty = ! 1 , this . layer . dirty = ! 1 , ! 0 } } , b . TilemapLayer . prototype . renderDebug = function ( ) { this . _mc . tx = this . _mc . dx , this . _mc . ty = this . _mc . dy , this . context . strokeStyle = this . debugColor , this . context . fillStyle = this . debugFillColor ; for ( var a = this . _mc . startY , b = this . _mc . startY + this . _mc . maxY ; b > a ; a ++ ) { this . _column = this . layer . data [ a ] ; for ( var c = this . _mc . startX , d = this . _mc . startX + this . _mc . maxX ; d > c ; c ++ ) { var e = this . _column [ c ] ; e && ( e . faceTop || e . faceBottom || e . faceLeft || e . faceRight ) && ( this . _mc . tx = Math . floor ( this . _mc . tx ) , this . debugFill && this . context . fillRect ( this . _mc . tx , this . _mc . ty , this . _mc . cw , this . _mc . ch ) , this . context . beginPath ( ) , e . faceTop && ( this . context . moveTo ( this . _mc . tx , this . _mc . ty ) , this . context . lineTo ( this . _mc . tx + this . _mc . cw , this . _mc . ty ) ) , e . faceBottom && ( this . context . moveTo ( this . _mc . tx , this . _mc . ty + this . _mc . ch ) , this . context . lineTo ( this . _mc . tx + this . _mc . cw , this . _mc . ty + this . _mc . ch ) ) , e . faceLeft && ( this . context . moveTo ( this . _mc . tx , this . _mc . ty ) , this . context . lineTo ( this . _mc . tx , this . _mc . ty + this . _mc . ch ) ) , e . faceRight && ( this . context . moveTo ( this . _mc . tx + this . _mc . cw , this . _mc . ty ) , this . context . lineTo ( this . _mc . tx + this . _mc . cw , this . _mc . ty + this . _mc . ch ) ) , this . context . stroke ( ) ) , this . _mc . tx += this . map . tileWidth } this . _mc . tx = this . _mc . dx , this . _mc . ty += this . map . tileHeight } } , Object . defineProperty ( b . TilemapLayer . prototype , "scrollX" , { get : function ( ) { return this . _mc . x } , set : function ( a ) { a !== this . _mc . x && a >= 0 && this . layer . widthInPixels > this . width && ( this . _mc . x = a , this . _mc . x > this . layer . widthInPixels - this . width && ( this . _mc . x = this . layer . widthInPixels - this . width ) , this . _mc . startX = this . game . math . floor ( this . _mc . x / this . map . tileWidth ) , this . _mc . startX < 0 && ( this . _mc . startX = 0 ) , this . _mc . startX + this . _mc . maxX > this . layer . width && ( this . _mc . startX = this . layer . width - this . _mc . maxX ) , this . dirty = ! 0 ) } } ) , Object . defineProperty ( b . TilemapLayer . prototype , "scrollY" , { get : function ( ) { return this . _mc . y } , set : function ( a ) { a !== this . _mc . y && a >= 0 && this . layer . heightInPixels > this . height && ( this . _mc . y = a , this . _mc . y > this . layer . heightInPixels - this . height && ( this . _mc . y = this . layer . heightInPixels - this . height ) , this . _mc . startY = this . game . math . floor ( this . _mc . y / this . map . tileHeight ) , this . _mc . startY < 0 && ( this . _mc . startY = 0 ) , this . _mc . startY + this . _mc . maxY > this . layer . height && ( this . _mc . startY = this . layer . height - this . _mc . maxY ) , this . dirty = ! 0 ) } } ) , Object . defineProperty ( b . TilemapLayer . prototype , "collisionWidth" , { get : function ( ) { return this . _mc . cw } , set : function ( a ) { this . _mc . cw = a , this . dirty = ! 0 } } ) , Object . defineProperty ( b . TilemapLayer . prototype , "collisionHeight" , { get : function ( ) { return this . _mc . ch } , set : function ( a ) { this . _mc . ch = a , this . dirty = ! 0 } } ) , b . TilemapParser = { parse : function ( a , c , d , e , f , g ) { if ( "undefined" == typeof d && ( d = 32 ) , "undefined" == typeof e && ( e = 32 ) , "undefined" == typeof f && ( f = 10 ) , "undefined" == typeof g && ( g = 10 ) , "undefined" == typeof c ) return this . getEmptyData ( ) ; if ( null === c ) return this . getEmptyData ( d , e , f , g ) ; var h = a . cache . getTilemapData ( c ) ; if ( h ) { if ( h . format === b . Tilemap . CSV ) return this . parseCSV ( c , h . data , d , e ) ; if ( ! h . format || h . format === b . Tilemap . TILED _JSON ) return this . parseTiledJSON ( h . data ) } else console . warn ( "Phaser.TilemapParser.parse - No map data found for key " + c ) } , parseCSV : function ( a , c , d , e ) { var f = this . getEmptyData ( ) ; c = c . trim ( ) ; for ( var g = [ ] , h = c . split ( "\n" ) , i = h . length , j = 0 , k = 0 ; k < h . length ; k ++ ) { g [ k ] = [ ] ; for ( var l = h [ k ] . split ( "," ) , m = 0 ; m < l . length ; m ++ ) g [ k ] [ m ] = new
var a = Math . sqrt ( 5 ) ; this . sx = 1 * this . signx / a , this . sy = 2 * this . signy / a } else if ( this . id == Phaser . Physics . Ninja . Tile . SLOPE _22DEGnnB ) { this . signx = - 1 , this . signy = - 1 ; var a = Math . sqrt ( 5 ) ; this . sx = 1 * this . signx / a , this . sy = 2 * this . signy / a } else if ( this . id == Phaser . Physics . Ninja . Tile . SLOPE _22DEGnpB ) { this . signx = - 1 , this . signy = 1 ; var a = Math . sqrt ( 5 ) ; this . sx = 1 * this . signx / a , this . sy = 2 * this . signy / a } else { if ( this . id != Phaser . Physics . Ninja . Tile . SLOPE _22DEGppB ) return ! 1 ; this . signx = 1 , this . signy = 1 ; var a = Math . sqrt ( 5 ) ; this . sx = 1 * this . signx / a , this . sy = 2 * this . signy / a } else if ( this . id < Phaser . Physics . Ninja . Tile . TYPE _67DEGb ) if ( this . type = Phaser . Physics . Ninja . Tile . TYPE _67DEGs , this . id == Phaser . Physics . Ninja . Tile . SLOPE _67DEGpnS ) { this . signx = 1 , this . signy = - 1 ; var a = Math . sqrt ( 5 ) ; this . sx = 2 * this . signx / a , this . sy = 1 * this . signy / a } else if ( this . id == Phaser . Physics . Ninja . Tile . SLOPE _67DEGnnS ) { this . signx = - 1 , this . signy = - 1 ; var a = Math . sqrt ( 5 ) ; this . sx = 2 * this . signx / a , this . sy = 1 * this . signy / a } else if ( this . id == Phaser . Physics . Ninja . Tile . SLOPE _67DEGnpS ) { this . signx = - 1 , this . signy = 1 ; var a = Math . sqrt ( 5 ) ; this . sx = 2 * this . signx / a , this . sy = 1 * this . signy / a } else { if ( this . id != Phaser . Physics . Ninja . Tile . SLOPE _67DEGppS ) return ! 1 ; this . signx = 1 , this . signy = 1 ; var a = Math . sqrt ( 5 ) ; this . sx = 2 * this . signx / a , this . sy = 1 * this . signy / a } else if ( this . id < Phaser . Physics . Ninja . Tile . TYPE _HALF ) if ( this . type = Phaser . Physics . Ninja . Tile . TYPE _67DEGb , this . id == Phaser . Physics . Ninja . Tile . SLOPE _67DEGpnB ) { this . signx = 1 , this . signy = - 1 ; var a = Math . sqrt ( 5 ) ; this . sx = 2 * this . signx / a , this . sy = 1 * this . signy / a } else if ( this . id == Phaser . Physics . Ninja . Tile . SLOPE _67DEGnnB ) { this . signx = - 1 , this . signy = - 1 ; var a = Math . sqrt ( 5 ) ; this . sx = 2 * this . signx / a , this . sy = 1 * this . signy / a } else if ( this . id == Phaser . Physics . Ninja . Tile . SLOPE _67DEGnpB ) { this . signx = - 1 , this . signy = 1 ; var a = Math . sqrt ( 5 ) ; this . sx = 2 * this . signx / a , this . sy = 1 * this . signy / a } else { if ( this . id != Phaser . Physics . Ninja . Tile . SLOPE _67DEGppB ) return ! 1 ; this . signx = 1 , this . signy = 1 ; var a = Math . sqrt ( 5 ) ; this . sx = 2 * this . signx / a , this . sy = 1 * this . signy / a } else if ( this . type = Phaser . Physics . Ninja . Tile . TYPE _HALF , this . id == Phaser . Physics . Ninja . Tile . HALFd ) this . signx = 0 , this . signy = - 1 , this . sx = this . signx , this . sy = this . signy ; else if ( this . id == Phaser . Physics . Ninja . Tile . HALFu ) this . signx = 0 , this . signy = 1 , this . sx = this . signx , this . sy = this . signy ; else if ( this . id == Phaser . Physics . Ninja . Tile . HALFl ) this . signx = 1 , this . signy = 0 , this . sx = this . signx , this . sy = this . signy ; else { if ( this . id != Phaser . Physics . Ninja . Tile . HALFr ) return ! 1 ; this . signx = - 1 , this . signy = 0 , this . sx = this . signx , this . sy = this . signy } } } , Object . defineProperty ( Phaser . Physics . Ninja . Tile . prototype , "x" , { get : function ( ) { return this . pos . x - this . xw } , set : function ( a ) { this . pos . x = a } } ) , Object . defineProperty ( Phaser . Physics . Ninja . Tile . prototype , "y" , { get : function ( ) { return this . pos . y - this . yw } , set : function ( a ) { this . pos . y = a } } ) , Object . defineProperty ( Phaser . Physics . Ninja . Tile . prototype , "bottom" , { get : function ( ) { return this . pos . y + this . yw } } ) , Object . defineProperty ( Phaser . Physics . Ninja . Tile . prototype , "right" , { get : function ( ) { return this . pos . x + this . xw } } ) , Phaser . Physics . Ninja . Tile . EMPTY = 0 , Phaser . Physics . Ninja . Tile . FULL = 1 , Phaser . Physics . Ninja . Tile . SLOPE _45DEGpn = 2 , Phaser . Physics . Ninja . Tile . SLOPE _45DEGnn = 3 , Phaser . Physics . Ninja . Tile . SLOPE _45DEGnp = 4 , Phaser . Physics . Ninja . Tile . SLOPE _45DEGpp = 5 , Phaser . Physics . Ninja . Tile . CONCAVEpn = 6 , Phaser . Physics . Ninja . Tile . CONCAVEnn = 7 , Phaser . Physics . Ninja . Tile . CONCAVEnp = 8 , Phaser . Physics . Ninja . Tile . CONCAVEpp = 9 , Phaser . Physics . Ninja . Tile . CONVEXpn = 10 , Phaser . Physics . Ninja . Tile . CONVEXnn = 11 , Phaser . Physics . Ninja . Tile . CONVEXnp = 12 , Phaser . Physics . Ninja . Tile . CONVEXpp = 13 , Phaser . Physics . Ninja . Tile . SLOPE _22DEGpnS = 14 , Phaser . Physics . Ninja . Tile . SLOPE _22DEGnnS = 15 , Phaser . Physics . Ninja . Tile . SLOPE _22DEGnpS = 16 , Phaser . Physics . Ninja . Tile . SLOPE _22DEGppS = 17 , Phaser . Physics . Ninja . Tile . SLOPE _22DEGpnB = 18 , Phaser . Physics . Ninja . Tile . SLOPE _22DEGnnB = 19 , Phaser . Physics . Ninja . Tile . SLOPE _22DEGnpB = 20 , Phaser . Physics . Ninja . Tile . SLOPE _22DEGppB = 21 , Phaser . Physics . Ninja . Tile . SLOPE _67DEGpnS = 22 , Phaser . Physics . Ninja . Tile . SLOPE _67DEGnnS = 23 , Phaser . Physics . Ninja . Tile . SLOPE _67DEGnpS = 24 , Phaser . Physics . Ninja . Tile . SLOPE _67DEGppS = 25 , Phaser . Physics . Ninja . Tile . SLOPE _67DEGpnB = 26 , Phaser . Physics . Ninja . Tile . SLOPE _6
} return a . push ( this ) , a } , c . prototype . removeCollinearPoints = function ( a ) { for ( var b = 0 , c = this . vertices . length - 1 ; this . vertices . length > 3 && c >= 0 ; -- c ) f . collinear ( this . at ( c - 1 ) , this . at ( c ) , this . at ( c + 1 ) , a ) && ( this . vertices . splice ( c % this . vertices . length , 1 ) , c -- , b ++ ) ; return b } } , { "./Line" : 2 , "./Point" : 3 , "./Scalar" : 5 } ] , 5 : [ function ( a , b ) { function c ( ) { } b . exports = c , c . eq = function ( a , b , c ) { return c = c || 0 , Math . abs ( a - b ) < c } } , { } ] , 6 : [ function ( a , b ) { b . exports = { Polygon : a ( "./Polygon" ) , Point : a ( "./Point" ) } } , { "./Point" : 3 , "./Polygon" : 4 } ] , 7 : [ function ( a , b ) { b . exports = { name : "p2" , version : "0.5.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-browserify" : "~2.0.1" , "z-schema" : "~2.4.6" } , dependencies : { "poly-decomp" : "git://github.com/schteppe/poly-decomp.js" , "gl-matrix" : "2.1.0" } } } , { } ] , 8 : [ 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 ) { var f = this . lowerBound , g = this . upperBound ; d . set ( f , Number . MAX _VALUE , Number . MAX _VALUE ) , d . set ( g , - Number . MAX _VALUE , - Number . MAX _VALUE ) ; for ( var h = 0 ; h < a . length ; h ++ ) { var i = a [ h ] ; "number" == typeof c && ( d . rotate ( e , i , c ) , i = e ) ; for ( var j = 0 ; 2 > j ; j ++ ) i [ j ] > g [ j ] && ( g [ j ] = i [ j ] ) , i [ j ] < f [ j ] && ( f [ j ] = i [ j ] ) } b && ( d . add ( this . lowerBound , this . lowerBound , b ) , d . add ( this . upperBound , this . upperBound , b ) ) } , 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 = 0 ; 2 > b ; b ++ ) a . lowerBound [ b ] < this . lowerBound [ b ] && ( this . lowerBound [ b ] = a . lowerBound [ b ] ) , a . upperBound [ b ] > this . upperBound [ b ] && ( this . upperBound [ b ] = a . upperBound [ b ] ) } , 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" : 30 , "../utils/Utils" : 45 } ] , 9 : [ 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 . aabbNeedsUpdate && a . updateAABB ( ) , b . aabbNeedsUpdate && b . updateAABB ( ) , a . aabb . overlaps ( b . aabb ) } , 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 . motionState === e . STATIC && b . motionState === e . STATIC ? ! 1 : a . motionState === e . KINEMATIC && b . motionState === e . STATIC || a . motionState === e . STATIC && b . motionState === e . KINEMATIC ? ! 1 : a . motionState === e . KINEMATIC && b . motionState === e . KINEMATIC ? ! 1 : a . sleepState === e . SLEEPING && b . sleepState === e . SLEEPING ? ! 1 : a . sleepState === e . SLEEPING && b . motionState === e . STATIC || b . sleepState === e . SLEEPING && a . motionState === e . STATIC ? ! 1 : ! 0 } , c . NAIVE = 1 , c . SAP = 2 } , { "../math/vec2" : 30 , "../objects/Body" : 31 } ] , 10 : [ function ( a , b ) { function c ( a ) { a = a || { } , d . apply ( this ) , e . extend ( 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
{ var s = this , t = this . motorEquation ; t . computeGW } t . computeGq = function ( ) { return 0 } , t . computeGW = function ( ) { var a = this . G , b = this . bodyA , c = this . bodyB , d = b . velocity , e = c . velocity , f = b . angularVelocity , g = c . angularVelocity ; return this . transformedGmult ( a , d , f , e , g ) + s . motorSpeed } } var d = a ( "./Constraint" ) , e = a ( "../equations/ContactEquation" ) , f = a ( "../equations/Equation" ) , g = a ( "../math/vec2" ) , h = a ( "../equations/RotationalLockEquation" ) ; b . exports = c , c . prototype = new d ; var i = g . create ( ) , j = g . create ( ) , k = g . create ( ) , l = g . create ( ) , m = g . create ( ) , n = g . create ( ) ; c . prototype . update = function ( ) { var a = this . equations , b = a [ 0 ] , c = this . upperLimit , d = this . lowerLimit , e = this . upperLimitEquation , f = this . lowerLimitEquation , h = this . bodyA , o = this . bodyB , p = this . localAxisA , q = this . localAnchorA , r = this . localAnchorB ; b . updateJacobian ( ) , g . rotate ( i , p , h . angle ) , g . rotate ( l , q , h . angle ) , g . add ( j , l , h . position ) , g . rotate ( m , r , o . angle ) , g . add ( k , m , o . position ) ; var s = this . position = g . dot ( k , i ) - g . dot ( j , i ) ; if ( this . motorEnabled ) { var t = this . motorEquation . G ; t [ 0 ] = i [ 0 ] , t [ 1 ] = i [ 1 ] , t [ 2 ] = g . crossLength ( i , m ) , t [ 3 ] = - i [ 0 ] , t [ 4 ] = - i [ 1 ] , t [ 5 ] = - g . crossLength ( i , l ) } if ( this . upperLimitEnabled && s > c ) g . scale ( e . normalA , i , - 1 ) , g . sub ( e . contactPointA , j , h . position ) , g . sub ( e . contactPointB , k , o . position ) , g . scale ( n , i , c ) , g . add ( e . contactPointA , e . contactPointA , n ) , - 1 == a . indexOf ( e ) && a . push ( e ) ; else { var u = a . indexOf ( e ) ; - 1 != u && a . splice ( u , 1 ) } if ( this . lowerLimitEnabled && d > s ) g . scale ( f . normalA , i , 1 ) , g . sub ( f . contactPointA , j , h . position ) , g . sub ( f . contactPointB , k , o . position ) , g . scale ( n , i , d ) , g . sub ( f . contactPointB , f . contactPointB , n ) , - 1 == a . indexOf ( f ) && a . push ( f ) ; else { var u = a . indexOf ( f ) ; - 1 != u && a . splice ( u , 1 ) } } , c . prototype . enableMotor = function ( ) { this . motorEnabled || ( this . equations . push ( this . motorEquation ) , this . motorEnabled = ! 0 ) } , c . prototype . disableMotor = function ( ) { if ( this . motorEnabled ) { var a = this . equations . indexOf ( this . motorEquation ) ; this . equations . splice ( a , 1 ) , this . motorEnabled = ! 1 } } } , { "../equations/ContactEquation" : 21 , "../equations/Equation" : 22 , "../equations/RotationalLockEquation" : 24 , "../math/vec2" : 30 , "./Constraint" : 14 } ] , 19 : [ function ( a , b ) { function c ( a , b , c , n , o ) { o = o || { } , d . call ( this , a , c , d . REVOLUTE , o ) ; var p = this . maxForce = "undefined" != typeof o . maxForce ? o . maxForce : Number . MAX _VALUE ; this . pivotA = b , this . pivotB = n ; var q = this . equations = [ new e ( a , c , - p , p ) , new e ( a , c , - p , p ) ] , r = q [ 0 ] , s = q [ 1 ] , t = this ; r . computeGq = function ( ) { return h . rotate ( i , t . pivotA , a . angle ) , h . rotate ( j , t . pivotB , c . angle ) , h . add ( m , c . position , j ) , h . sub ( m , m , a . position ) , h . sub ( m , m , i ) , h . dot ( m , k ) } , s . computeGq = function ( ) { return h . rotate ( i , t . pivotA , a . angle ) , h . rotate ( j , t . pivotB , c . angle ) , h . add ( m , c . position , j ) , h . sub ( m , m , a . position ) , h . sub ( m , m , i ) , h . dot ( m , l ) } , s . minForce = r . minForce = - p , s . maxForce = r . maxForce = p , this . motorEquation = new f ( a , c ) , this . motorEnabled = ! 1 , this . angle = 0 , this . lowerLimitEnabled = ! 1 , this . upperLimitEnabled = ! 1 , this . lowerLimit = 0 , this . upperLimit = 0 , this . upperLimitEquation = new g ( a , c ) , this . lowerLimitEquation = new g ( a , c ) , this . upperLimitEquation . minForce = 0 , this . lowerLimitEquation . maxForce = 0 } var d = a ( "./Constraint" ) , e = a ( "../equations/Equation" ) , f = a ( "../equations/RotationalVelocityEquation" ) , g = a ( "../equations/RotationalLockEquation" ) , h = a ( "../math/vec2" ) ; b . exports = c ; var i = h . create ( ) , j = h . create ( ) , k = h . fromValues ( 1 , 0 ) , l = h . fromValues ( 0 , 1 ) , m = h . create ( ) ; c . prototype = new d , c . prototype . update = function ( ) { var a = this . bodyA , b = this . bodyB , c = this . pivotA , d = this . pivotB , e = this . equations , f = ( e [ 0 ] , e [ 1 ] , e [ 0 ] ) , g = e [ 1 ] , m = this . upperLimit , n = this . lowerLimit , o = this . upperLimitEquation , p = this . lowerLimitEquation , q = this . angle = b . angle - a . angle ; if ( this . upperLimitEnabled && q > m ) o . angle = m , - 1 == e . indexOf ( o ) && e . push ( o ) ; else { var r = e . indexOf ( o ) ; - 1 != r && e . splice ( r , 1 ) } if ( this . lowerLimitEnabled && n > q ) p . angle = n , - 1 == e . indexOf ( p ) && e . push ( p ) ; else { var r = e . indexOf ( p ) ; - 1 != r && e . splice ( r , 1 ) } h . rotate ( i , c , a . angle ) , h . rotate ( j , d , b . angle ) , f . G [ 0 ] = - 1 , f . G [ 1 ] = 0 , f . G [ 2 ] = - h . crossLength ( i , k ) , f . G [ 3 ] = 1 , f . G [ 4 ] = 0 , f . G [ 5 ] = h . crossLength ( j , k ) , g . G [ 0 ] = 0 , g . G [ 1 ] = - 1 , g . G [ 2 ] = - h . crossLength ( i , l ) , g . G [ 3 ] = 0 , g . G [ 4 ] = 1 , g . G [ 5 ] = h . crossLength ( j , l ) } , c . prototype . enableMotor = function ( ) { this . motorEnabled || ( this . equations . push ( this . motorEquation ) , this . motorEnabled = ! 0 ) } , c . prototype . disableMotor = function ( ) { if ( this . motorEnabled ) { var a = this . equations . indexOf ( th
} , c . prototype . updateArea = function ( ) { } , c . prototype . computeAABB = function ( ) { } } , { } ] , 43 : [ function ( a , b ) { function c ( a ) { f . call ( this , a , f . GS ) , a = a || { } , this . iterations = a . iterations || 10 , this . tolerance = a . tolerance || 1e-10 , this . arrayStep = 30 , this . lambda = new g . ARRAY _TYPE ( this . arrayStep ) , this . Bs = new g . ARRAY _TYPE ( this . arrayStep ) , this . invCs = new g . ARRAY _TYPE ( this . arrayStep ) , this . useZeroRHS = ! 1 , this . frictionIterations = 0 , this . usedIterations = 0 } function d ( a ) { for ( var b = 0 ; b !== a . length ; b ++ ) a [ b ] = 0 } var e = a ( "../math/vec2" ) , f = a ( "./Solver" ) , g = a ( "../utils/Utils" ) , h = a ( "../equations/FrictionEquation" ) ; b . exports = c , c . prototype = new f , c . prototype . solve = function ( a , b ) { this . sortEquations ( ) ; var f = 0 , i = this . iterations , j = this . frictionIterations , k = this . equations , l = k . length , m = Math . pow ( this . tolerance * l , 2 ) , n = b . bodies , o = b . bodies . length , p = ( e . add , e . set , this . useZeroRHS ) , q = this . lambda ; this . usedIterations = 0 , q . length < l && ( q = this . lambda = new g . ARRAY _TYPE ( l + this . arrayStep ) , this . Bs = new g . ARRAY _TYPE ( l + this . arrayStep ) , this . invCs = new g . ARRAY _TYPE ( l + this . arrayStep ) ) , d ( q ) ; for ( var r = this . invCs , s = this . Bs , q = this . lambda , t = 0 ; t !== k . length ; t ++ ) { var u = k [ t ] ; ( u . timeStep !== a || u . needsUpdate ) && ( u . timeStep = a , u . update ( ) ) , s [ t ] = u . computeB ( u . a , u . b , a ) , r [ t ] = u . computeInvC ( u . epsilon ) } var u , v , t , w ; if ( 0 !== l ) { for ( t = 0 ; t !== o ; t ++ ) n [ t ] . resetConstraintVelocity ( ) ; if ( j ) { for ( f = 0 ; f !== j ; f ++ ) { for ( v = 0 , w = 0 ; w !== l ; w ++ ) { u = k [ w ] ; var x = c . iterateEquation ( w , u , u . epsilon , s , r , q , p , a , f ) ; v += Math . abs ( x ) } if ( this . usedIterations ++ , m >= v * v ) break } for ( w = 0 ; w !== l ; w ++ ) { var y = k [ w ] ; if ( y instanceof h ) { var z = y . contactEquation . multiplier * y . frictionCoefficient ; y . maxForce = z , y . minForce = - z } } } for ( f = 0 ; f !== i ; f ++ ) { for ( v = 0 , w = 0 ; w !== l ; w ++ ) { u = k [ w ] ; var x = c . iterateEquation ( w , u , u . epsilon , s , r , q , p , a , f ) ; v += Math . abs ( x ) } if ( this . usedIterations ++ , m >= v * v ) break } for ( t = 0 ; t !== o ; t ++ ) n [ t ] . addConstraintVelocity ( ) } } , c . iterateEquation = function ( a , b , c , d , e , f , g , h ) { var i = d [ a ] , j = e [ a ] , k = f [ a ] , l = b . computeGWlambda ( ) , m = b . maxForce , n = b . minForce ; g && ( i = 0 ) ; var o = j * ( i - l - c * k ) , p = k + o ; return n * h > p ? o = n * h - k : p > m * h && ( o = m * h - k ) , f [ a ] += o , b . multiplier = f [ a ] / h , b . addToWlambda ( o ) , o } } , { "../equations/FrictionEquation" : 23 , "../math/vec2" : 30 , "../utils/Utils" : 45 , "./Solver" : 44 } ] , 44 : [ function ( a , b ) { function c ( a , b ) { a = a || { } , d . call ( this ) , this . type = b , this . equations = [ ] , this . equationSortFunction = a . equationSortFunction || ! 1 } var d = ( a ( "../utils/Utils" ) , a ( "../events/EventEmitter" ) ) ; b . exports = c , c . prototype = new d , c . prototype . solve = function ( ) { throw new Error ( "Solver.solve should be implemented by subclasses!" ) } ; var e = { bodies : [ ] } ; c . prototype . solveIsland = function ( a , b ) { this . removeAllEquations ( ) , b . equations . length && ( this . addEquations ( b . equations ) , e . bodies . length = 0 , b . getBodies ( e . bodies ) , e . bodies . length && this . solve ( a , e ) ) } , c . prototype . sortEquations = function ( ) { this . equationSortFunction && this . equations . sort ( this . equationSortFunction ) } , c . prototype . addEquation = function ( a ) { a . enabled && this . equations . push ( a ) } , c . prototype . addEquations = function ( a ) { for ( var b = 0 , c = a . length ; b !== c ; b ++ ) { var d = a [ b ] ; d . enabled && this . equations . push ( d ) } } , c . prototype . removeEquation = function ( a ) { var b = this . equations . indexOf ( a ) ; - 1 !== b && this . equations . splice ( b , 1 ) } , c . prototype . removeAllEquations = function ( ) { this . equations . length = 0 } , c . GS = 1 , c . ISLAND = 2 } , { "../events/EventEmitter" : 26 , "../utils/Utils" : 45 } ] , 45 : [ function ( a , b ) { function c ( ) { } b . exports = c , c . appendArray = function ( a , b ) { if ( b . length < 15e4 ) a . push . apply ( a , b ) ; else for ( var c = 0 , d = b . length ; c !== d ; ++ c ) a . push ( b [ c ] ) } , c . splice = function ( a , b , c ) { c = c || 1 ; for ( var d = b , e = a . length - c ; e > d ; d ++ ) a [ d ] = a [ d + c ] ; a . length = e } , c . ARRAY _TYPE = Float32Array || Array , c . extend = function ( a , b ) { for ( var c in b ) a [ c ] = b [ c ] } } , { } ] , 46 : [ function ( a , b ) { function c ( ) { this . equations = [ ] , this . bodies = [ ] } var d = a ( "../objects/Body" ) ; b . exports = c , c . prototype . reset = function ( ) { this . equations . length = this . bodies . length = 0 } ; var e = [ ] ; c . prototype . getBodies = function ( a ) { var b = a || [ ] , c = this . equations ; e . length = 0 ; for ( var d = 0 ; d !== c . length ; d ++ ) { var f = c [ d ] ; - 1 === e . indexOf ( f . bodyA . id ) && ( b . push ( f . bodyA ) , e . push ( f . bodyA . id ) ) , - 1 === e . indexOf ( f . bodyB . id ) && ( b . push ( f . bodyB ) , e . push ( f . bodyB . id ) ) } return b } , c . prototype . wantsToSleep = function ( ) { for ( var a = 0 ; a < this . bodies . length ; a ++ ) { var b = this . bodies [ a ] ; if ( b . motionState === d . DYNAMIC && ! b . wantsTo
2014-04-15 14:39:23 +00:00
} , impactHandler : function ( a ) { if ( a . bodyA . parent && a . bodyB . parent ) { var b = a . bodyA . parent , c = a . bodyB . parent ; b . _bodyCallbacks [ a . bodyB . id ] && b . _bodyCallbacks [ a . bodyB . id ] . call ( b . _bodyCallbackContext [ a . bodyB . id ] , b , c , a . shapeA , a . shapeB ) , c . _bodyCallbacks [ a . bodyA . id ] && c . _bodyCallbacks [ a . bodyA . id ] . call ( c . _bodyCallbackContext [ a . bodyA . id ] , c , b , a . shapeB , a . shapeA ) , b . _groupCallbacks [ a . shapeB . collisionGroup ] && b . _groupCallbacks [ a . shapeB . collisionGroup ] . call ( b . _groupCallbackContext [ a . shapeB . collisionGroup ] , b , c , a . shapeA , a . shapeB ) , c . _groupCallbacks [ a . shapeA . collisionGroup ] && c . _groupCallbacks [ a . shapeA . collisionGroup ] . call ( c . _groupCallbackContext [ a . shapeA . collisionGroup ] , c , b , a . shapeB , a . shapeA ) } } , beginContactHandler : function ( a ) { this . onBeginContact . dispatch ( a . bodyA , a . bodyB , a . shapeA , a . shapeB , a . contactEquations ) , a . bodyA . parent && a . bodyA . parent . onBeginContact . dispatch ( a . bodyB . parent , a . shapeA , a . shapeB , a . contactEquations ) , a . bodyB . parent && a . bodyB . parent . onBeginContact . dispatch ( a . bodyA . parent , a . shapeB , a . shapeA , a . contactEquations ) } , endContactHandler : function ( a ) { this . onEndContact . dispatch ( a . bodyA , a . bodyB , a . shapeA , a . shapeB ) , a . bodyA . parent && a . bodyA . parent . onEndContact . dispatch ( a . bodyB . parent , a . shapeA , a . shapeB ) , a . bodyB . parent && a . bodyB . parent . onEndContact . dispatch ( a . bodyA . parent , a . shapeB , a . shapeA ) } , setBoundsToWorld : function ( a , b , c , d , e ) { this . setBounds ( this . game . world . bounds . x , this . game . world . bounds . y , this . game . world . bounds . width , this . game . world . bounds . height , a , b , c , d , e ) } , setWorldMaterial : function ( a , b , c , d , e ) { "undefined" == typeof b && ( b = ! 0 ) , "undefined" == typeof c && ( c = ! 0 ) , "undefined" == typeof d && ( d = ! 0 ) , "undefined" == typeof e && ( e = ! 0 ) , b && this . walls . left && ( this . walls . left . shapes [ 0 ] . material = a ) , c && this . walls . right && ( this . walls . right . shapes [ 0 ] . material = a ) , d && this . walls . top && ( this . walls . top . shapes [ 0 ] . material = a ) , e && this . walls . bottom && ( this . walls . bottom . shapes [ 0 ] . material = a ) } , updateBoundsCollisionGroup : function ( a ) { var b = this . everythingCollisionGroup . mask ; "undefined" == typeof a && ( b = this . boundsCollisionGroup . mask ) , this . walls . left && ( this . walls . left . shapes [ 0 ] . collisionGroup = b ) , this . walls . right && ( this . walls . right . shapes [ 0 ] . collisionGroup = b ) , this . walls . top && ( this . walls . top . shapes [ 0 ] . collisionGroup = b ) , this . walls . bottom && ( this . walls . bottom . shapes [ 0 ] . collisionGroup = b ) } , setBounds : function ( a , b , c , d , e , f , g , h , i ) { "undefined" == typeof e && ( e = ! 0 ) , "undefined" == typeof f && ( f = ! 0 ) , "undefined" == typeof g && ( g = ! 0 ) , "undefined" == typeof h && ( h = ! 0 ) , "undefined" == typeof i && ( i = ! 0 ) , this . walls . left && this . world . removeBody ( this . walls . left ) , this . walls . right && this . world . removeBody ( this . walls . right ) , this . walls . top && this . world . removeBody ( this . walls . top ) , this . walls . bottom && this . world . removeBody ( this . walls . bottom ) , e && ( this . walls . left = new p2 . Body ( { mass : 0 , position : [ this . pxmi ( a ) , this . pxmi ( b ) ] , angle : 1.5707963267948966 } ) , this . walls . left . addShape ( new p2 . Plane ) , i && ( this . walls . left . shapes [ 0 ] . collisionGroup = this . boundsCollisionGroup . mask ) , this . world . addBody ( this . walls . left ) ) , f && ( this . walls . right = new p2 . Body ( { mass : 0 , position : [ this . pxmi ( a + c ) , this . pxmi ( b ) ] , angle : - 1.5707963267948966 } ) , this . walls . right . addShape ( new p2 . Plane ) , i && ( this . walls . right . shapes [ 0 ] . collisionGroup = this . boundsCollisionGroup . mask ) , this . world . addBody ( this . walls . right ) ) , g && ( this . walls . top = new p2 . Body ( { mass : 0 , position : [ this . pxmi ( a ) , this . pxmi ( b ) ] , angle : - 3.141592653589793 } ) , this . walls . top . addShape ( new p2 . Plane ) , i && ( this . walls . top . shapes [ 0 ] . collisionGroup = this . boundsCollisionGroup . mask ) , this . world . addBody ( this . walls . top ) ) , h && ( this . walls . bottom = new p2 . Body ( { mass : 0 , position : [ this . pxmi ( a ) , this . pxmi ( d ) ] } ) , this . walls . bottom . addShape ( new p2 . Plane ) , i && ( this . walls . bottom . shapes [ 0 ] . collisionGroup = this . boundsCollisionGroup . mask ) , this . world . addBody ( this . walls . bottom ) ) } , update : function ( ) { this . world . step ( this . useElapsedTime ? this . game . time . physicsElapsed : this . frameRate ) } , clear : function ( ) { this . world . clear ( ) , this . world . off ( "beginContact" , this . beginContactHandler , this ) , this . world . off ( "endContact" , this . endContactHandler , this ) , this . postBroadphaseCallback = null , this . callbackContext = null , this . impactCallback = null , this . collisionGroups = [ ] , this . _toRemove = [ ] , this . _collisionGroupID = 2 , this . boundsCollidesWit
2014-04-11 12:09:28 +00:00
} , drawPath : function ( a , b , c , d , e ) { var f , g , h , i , j , k , l , m , n , o , p , q , r ; for ( "undefined" == typeof e && ( e = 1 ) , "undefined" == typeof c && ( c = 0 ) , a . lineStyle ( e , c , 1 ) , "number" == typeof d && a . beginFill ( d ) , h = null , i = null , g = 0 ; g < b . length ; ) p = b [ g ] , q = p [ 0 ] , r = p [ 1 ] , ( q !== h || r !== i ) && ( 0 === g ? a . moveTo ( q , r ) : ( j = h , k = i , l = q , m = r , n = b [ ( g + 1 ) % b . length ] [ 0 ] , o = b [ ( g + 1 ) % b . length ] [ 1 ] , f = ( l - j ) * ( o - k ) - ( n - j ) * ( m - k ) , 0 !== f && a . lineTo ( q , r ) ) , h = q , i = r ) , g ++ ; "number" == typeof d && a . endFill ( ) , b . length > 2 && "number" == typeof d && ( a . moveTo ( b [ b . length - 1 ] [ 0 ] , b [ b . length - 1 ] [ 1 ] ) , a . lineTo ( b [ 0 ] [ 0 ] , b [ 0 ] [ 1 ] ) ) } , drawPlane : function ( a , b , c , d , e , f , g , h , i , j ) { var k , l , m ; "undefined" == typeof f && ( f = 1 ) , "undefined" == typeof d && ( d = 16777215 ) , a . lineStyle ( f , e , 11 ) , a . beginFill ( d ) , k = i , a . moveTo ( b , - c ) , l = b + Math . cos ( j ) * this . game . width , m = c + Math . sin ( j ) * this . game . height , a . lineTo ( l , - m ) , a . moveTo ( b , - c ) , l = b + Math . cos ( j ) * - this . game . width , m = c + Math . sin ( j ) * - this . game . height , a . lineTo ( l , - m ) } , randomPastelHex : function ( ) { var a , b , c , d ; return c = [ 255 , 255 , 255 ] , d = Math . floor ( 256 * Math . random ( ) ) , b = Math . floor ( 256 * Math . random ( ) ) , a = Math . floor ( 256 * Math . random ( ) ) , d = Math . floor ( ( d + 3 * c [ 0 ] ) / 4 ) , b = Math . floor ( ( b + 3 * c [ 1 ] ) / 4 ) , a = Math . floor ( ( a + 3 * c [ 2 ] ) / 4 ) , this . rgbToHex ( d , b , a ) } , rgbToHex : function ( a , b , c ) { return this . componentToHex ( a ) + this . componentToHex ( b ) + this . componentToHex ( c ) } , componentToHex : function ( a ) { var b ; return b = a . toString ( 16 ) , 2 === b . len ? b : b + "0" } } ) , Phaser . Physics . P2 . Spring = function ( a , b , c , d , e , f , g , h , i , j ) { this . game = a . game , this . world = a , "undefined" == typeof d && ( d = 1 ) , "undefined" == typeof e && ( e = 100 ) , "undefined" == typeof f && ( f = 1 ) , d = a . pxm ( d ) ; var k = { restLength : d , stiffness : e , damping : f } ; "undefined" != typeof g && null !== g && ( k . worldAnchorA = [ a . pxm ( g [ 0 ] ) , a . pxm ( g [ 1 ] ) ] ) , "undefined" != typeof h && null !== h && ( k . worldAnchorB = [ a . pxm ( h [ 0 ] ) , a . pxm ( h [ 1 ] ) ] ) , "undefined" != typeof i && null !== i && ( k . localAnchorA = [ a . pxm ( i [ 0 ] ) , a . pxm ( i [ 1 ] ) ] ) , "undefined" != typeof j && null !== j && ( k . localAnchorB = [ a . pxm ( j [ 0 ] ) , a . pxm ( j [ 1 ] ) ] ) , p2 . Spring . call ( this , b , c , k ) } , Phaser . Physics . P2 . Spring . prototype = Object . create ( p2 . Spring . prototype ) , Phaser . Physics . P2 . Spring . prototype . constructor = Phaser . Physics . P2 . Spring , Phaser . Physics . P2 . Material = function ( a ) { this . name = a , p2 . Material . call ( this ) } , Phaser . Physics . P2 . Material . prototype = Object . create ( p2 . Material . prototype ) , Phaser . Physics . P2 . Material . prototype . constructor = Phaser . Physics . P2 . Material , Phaser . Physics . P2 . ContactMaterial = function ( a , b , c ) { p2 . ContactMaterial . call ( this , a , b , c ) } , Phaser . Physics . P2 . ContactMaterial . prototype = Object . create ( p2 . ContactMaterial . prototype ) , Phaser . Physics . P2 . ContactMaterial . prototype . constructor = Phaser . Physics . P2 . ContactMaterial , Phaser . Physics . P2 . CollisionGroup = function ( a ) { this . mask = a } , Phaser . Physics . P2 . DistanceConstraint = function ( a , b , c , d , e ) { "undefined" == typeof d && ( d = 100 ) , this . game = a . game , this . world = a , d = a . pxm ( d ) , p2 . DistanceConstraint . call ( this , b , c , d , e ) } , Phaser . Physics . P2 . DistanceConstraint . prototype = Object . create ( p2 . DistanceConstraint . prototype ) , Phaser . Physics . P2 . DistanceConstraint . prototype . constructor = Phaser . Physics . P2 . DistanceConstraint , Phaser . Physics . P2 . GearConstraint = function ( a , b , c , d , e ) { "undefined" == typeof d && ( d = 0 ) , "undefined" == typeof e && ( e = 1 ) , this . game = a . game , this . world = a ; var f = { angle : d , ratio : e } ; p2 . GearConstraint . call ( this , b , c , f ) } , Phaser . Physics . P2 . GearConstraint . prototype = Object . create ( p2 . GearConstraint . prototype ) , Phaser . Physics . P2 . GearConstraint . prototype . constructor = Phaser . Physics . P2 . GearConstraint , Phaser . Physics . P2 . LockConstraint = function ( a , b , c , d , e , f ) { "undefined" == typeof d && ( d = [ 0 , 0 ] ) , "undefined" == typeof e && ( e = 0 ) , "undefined" == typeof f && ( f = Number . MAX _VALUE ) , this . game = a . game , this . world = a , d = [ a . pxm ( d [ 0 ] ) , a . pxm ( d [ 1 ] ) ] ; var g = { localOffsetB : d , localAngleB : e , maxForce : f } ; p2 . LockConstraint . call ( this , b , c , g ) } , Phaser . Physics . P2 . LockConstraint . prototype = Object . create ( p2 . LockConstraint . prototype ) , Phaser . Physics . P2 . LockConstraint . prototype . constructor = Phaser . Physics . P2 . LockConstraint , Phaser . Physics . P2 . PrismaticConstraint = function ( a , b , c , d , e , f , g , h ) { "undefined" == typeof d && ( d = ! 0 ) , "undefined" == typeof e && ( e = [ 0 , 0 ] ) , "undefined" == typeof f && ( f = [ 0 , 0 ] ) , "undefined" == typeof g && ( g = [ 0 , 0 ] ) , "undefined" == typeof h && ( h = Number . MAX _VALUE ) , this . game = a . game , this . world = a , e = [ a . pxmi ( e [ 0 ] ) , a . pxmi ( e [ 1 ] ) ] , f = [ a . pxmi ( f [ 0 ] ) , a . pxm
2014-02-28 09:30:53 +00:00
//# sourceMappingURL=phaser.map