2014-03-17 21:18:02 +00:00
/* Phaser v2.0.1 - http://phaser.io - @photonstorm - (c) 2014 Photon Storm Ltd. */
2014-02-28 09:30:53 +00:00
2014-03-10 03:06:28 +00:00
( function ( ) { var a = this , b = b || { } ; b . WEBGL _RENDERER = 0 , b . CANVAS _RENDERER = 1 , b . VERSION = "v1.5.0" , 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 = new b . Rectangle ( 0 , 0 , 1 , 1 ) , 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 =
2014-03-04 01:29:04 +00:00
} , 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-03-17 21:18:02 +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
a = Array ( g + 1 ) . join ( c ) + a + Array ( f + 1 ) . join ( c ) ; break ; default : a += 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 && ! hasOwn . 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 ) } ) , 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 <= a . bottom ) { var d = ( a . x - b ) * ( a . x - b ) , e = ( a . y - c ) * ( a . y - c ) ; return d + e <= a . radius * a . radius } return ! 1 } , b . Circle . equals = function ( a , b ) { return a . x == b . x && a . y == b . y && a . diameter == b . diameter } , b . Circle . intersects = function ( a , c ) { return b . Math . distance ( a . x , a . y , c . x , c . y ) <= a . radius + c . radius } , b . Circle . circumferencePoint = function ( a , c , d , e ) { return "undefined" == typeof d && ( d = ! 1 ) , "undefined" == typeof e && ( e = new b . Point ) , d === ! 0 && ( c = b . Math . degToRad ( c ) ) , e . x = a . x + a . radius * Math . cos ( c ) , e
} , 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 , b ) { this . game = a , this . _parent = b , this . plugins = [ ] , this . _pluginsLength = 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 . _parent ) , "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 . _pluginsLength = this . plugins . push ( a ) , "function" == typeof a . init && a . init ( ) , a ) : null } , remove : function ( a ) { if ( 0 !== this . _pluginsLength ) for ( this . _p = 0 ; this . _p < this . _pluginsLength ; this . _p ++ ) if ( this . plugins [ this . _p ] === a ) return a . destroy ( ) , this . plugins . splice ( this . _p , 1 ) , void this . _pluginsLength -- } , removeAll : function ( ) { for ( this . _p = 0 ; this . _p < this . _pluginsLength ; this . _p ++ ) this . plugins [ this . _p ] . destroy ( ) ; this . plugins . length = 0 , this . _pluginsLength = 0 } , preUpdate : function ( ) { if ( 0 !== this . _pluginsLength ) for ( this . _p = 0 ; this . _p < this . _pluginsLength ; this . _p ++ ) this . plugins [ this . _p ] . active && this . plugins [ this . _p ] . hasPreUpdate && this . plugins [ this . _p ] . preUpdate ( ) } , update : function ( ) { if ( 0 !== this . _pluginsLength ) for ( this . _p = 0 ; this . _p < this . _pluginsLength ; this . _p ++ ) this . plugins [ this . _p ] . active && this . plugins [ this . _p ] . hasUpdate && this . plugins [ this . _p ] . update ( ) } , postUpdate : function ( ) { if ( 0 !== this . _pluginsLength ) for ( this . _p = 0 ; this . _p < this . _pluginsLength ; this . _p ++ ) this . plugins [ this . _p ] . active && this . plugins [ this . _p ] . hasPostUpdate && this . plugins [ this . _p ] . postUpdate ( ) } , render : function ( ) { if ( 0 !== this . _pluginsLength ) for ( this . _p = 0 ; this . _p < this . _pluginsLength ; this . _p ++ ) this . plugins [ this . _p ] . visible && this . plugins [ this . _p ] . hasRender && this . plugins [ this . _p ] . render ( ) } , postRender : function ( ) { if ( 0 !== this . _pluginsLength ) for ( this . _p = 0 ; this . _p < this . _pluginsLength ; this . _p ++ ) this . plugins [ this . _p ] . visible && this . plugins [ this . _p ] . hasPostRender && this . plugins [ this . _p ] . postRender ( ) } , destroy : function ( ) { this . plugins . length = 0 , this . _pluginsLength = 0 , this . game = null , this . _parent = 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 -- ; ) this . children [ a ] . update ( ) } , b . Stage . prototype . postUpdate = function ( ) { if ( this . game . world . camera . target ) { this . game . world . camera . target . postUpdate ( ) , this . game . world . camera . update ( ) ; for ( var a = this . children . length ; a -- ; ) this . children [ a ] !== this . game . world . camera . target && this . children [ a ] . postUpdate ( ) } else { this . game . world . camera . update ( ) ; for ( var a = this . children . length ; a -- ; ) this . children [ a ] . postUpdate ( ) } this . checkOffsetInterval !== ! 1 && this . game . time . now > this . _nextOffsetCheck && ( b . Canvas . getOffset ( this . game . canvas , this . offset ) , this . _nextOffsetCheck = this . game . time . now + this . checkOffsetInterval ) } , b . Stage . prototype . parseConfig = function ( a ) { this . game . canvas = a . canvasID ? b . Canvas . create ( this . game . width , this . game . height , a . canvasID ) : b . Canvas . create ( this . game . width , this . game . height ) , a . canvasStyle ? this . game . canvas . stlye = a . canvasStyle : this . game . canvas . style [ "-webkit-full-screen" ] = " width : 1
2014-03-14 04:49:55 +00:00
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 . stage . update ( ) , this . tweens . update ( ) , this . sound . update ( ) , this . input . update ( ) , this . state . 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 = null , this . keyboard = null , this . touch = null , this . mspointer = null , this . gamepad = null , this . onDown = null , this . onUp = null , this . onTap = null , this . onHold = null , this . interactiveItems = new b . LinkedList , this . _localPoint = new b . Point , this . _pollCounter = 0 , this . _oldPosition = null , this . _x = 0 , this . _y = 0 } , b . Input . MOUSE _OVERRIDES _TOUCH = 0 , b . Input . TOUCH _OVERRIDES _MOUSE = 1 , b . Input . MOUSE _TOUCH _COMBINE = 2 , b . Input . prototype = { boot : function ( ) { this . mousePointer = new b . Pointer ( this . game , 0 ) , this . pointer1 = new b . Pointer ( this . game , 1 ) , this . pointer2 = new b . Pointer ( this . game , 2 ) , this . mouse = new b . Mouse ( this . game ) , this . keyboard = new b . Keyboard ( this . game ) , this . touch = new b . Touch ( this . game ) , this . mspointer = new b . MSPointer ( this . game ) , this . gamepad = new b . Gamepad ( this . game ) , this . onDown = new b . Signal , this . onUp = new b . Signal , this . onTap = new b . Signal , this . onHold = new b . Signal , this . scale = new b . Point ( 1 , 1 ) , this . speed = new b . Point , this . position = new b . Point , this . _oldPosition = new b . Point , this . circle = new b . Circle ( 0 , 0 , 44 ) , this . activePointer = this . mousePointer , this . currentPointers = 0 , this . hitCanvas = document . createElement ( "canvas" ) , this . hitCanvas . width = 1 , this . hitCanvas . height = 1 , this . hitContext = this . hitCanvas . getContext ( "2d" ) , this . mouse . start ( ) , this . keyboard . start ( ) , this . touch . start ( ) , this . mspointer . start ( ) , this . mousePointer . active = ! 0 } , destroy : function ( ) { this . mouse . stop ( ) , th
2014-03-18 18:36:46 +00:00
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 ] } } ) , Object . defineProperty ( b . Gamepad . prototype , "pad3" , { get : function ( ) { return this . _gamepads [ 2 ] } } ) , Object . defineProperty ( b . Gamepad . prototype , "pad4" , { get : function ( ) { return this . _gamepads [ 3 ] } } ) , b . Gamepad . BUTTON _0 = 0 , b . Gamepad . BUTTON _1 = 1 , b . Gamepad . BUTTON _2 = 2 , b . Gamepad . BUTTON _3 = 3 , b . Gamepad . BUTTON _4 = 4 , b . Gamepad . BUTTON _5 = 5 , b . Gamepad . BUTTON _6 = 6 , b . Gamepad . BUTTON _7 = 7 , b . Gamepad . BUTTON _8 = 8 , b . Gamepad . BUTTON _9 = 9 , b . Gamepad . BUTTON _10 = 10 , b . Gamepad . BUTTON _11 = 11 , b . Gamepad . BUTTON _12 = 12 , b . Gamepad . BUTTON _13 = 13 , b . Gamepad . BUTTON _14 = 14 , b . Gamepad . BUTTON _15 = 15 , b . Gamepad . AXIS _0 = 0 , b . Gamepad . AXIS _1 = 1 , b . Gamepad . AXIS _2 = 2 , b . Gamepad . AXIS _3 = 3 , b . Gamepad . AXIS _4 = 4 , b . Gamepad . AXIS _5 = 5 , b . Gamepad . AXIS _6 = 6 , b . Gamepad . AXIS _7 = 7 , b . Gamepad . AXIS _8 = 8 , b . Gamepad . AXIS _9 = 9 , b . Gamepad . XBOX360 _A = 0 , b . Gamepad . XBOX360 _B = 1 , b . Gamepad . XBOX360 _X = 2 , b . Gamepad . XBOX360 _Y = 3 , b . Gamepad . XBOX360 _LEFT _BUMPER = 4 , b . Gamepad . XBOX360 _RIGHT _BUMPER = 5 , b . Gamepad . XBOX360 _LEFT _TRIGGER = 6 , b . Gamepad . XBOX360 _RIGHT _TRIGGER = 7 , b . Gamepad . XBOX360 _BACK = 8 , b . Gamepad . XBOX360 _START = 9 , b . Gamepad . XBOX360 _STICK _LEFT _BUTTON = 10 , b . Gamepad . XBOX360 _STICK _RIGHT _BUTTON = 11 , b . Gamepad . XBOX360 _DPAD _LEFT = 14 , b . Gamepad . XBOX360 _DPAD _RIGHT = 15 , b . Gamepad . XBOX360 _DPAD _UP = 12 , b . Gamepad . XBOX360 _DPAD _DOWN = 13 , b . Gamepad . XBOX360 _STICK _LEFT _X = 0 , b . Gamepad . XBOX360 _STICK _LEFT _Y = 1 , b . Gamepad . XBOX360 _STICK _RIGHT _X = 2 , b . Gamepad . XBOX360 _STICK _RIGHT _Y = 3 , b . SinglePad = function ( a , b ) { this . game = a , this . _padParent = b , this . _index = null , this . _rawPad = null , this . _connected = ! 1 , this . _prevTimestamp = null , this . _rawButtons = [ ] , this . _buttons = [ ] , this . _axes = [ ] , this . _hotkeys = [ ] , this . callbackContext = this , this . onConnectCallback = null , this . onDisconnectCallback = null , this . onDownCallback = null , this . onUpCallb
2014-03-18 00:01:39 +00:00
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 . _dirty && 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 . key , 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 . key = a , void this . setTexture ( PIXI . TextureCache [ a ] ) ) : ( this . key = "__missing" , void this . setTexture ( PIXI . TextureCache [ this . key ] ) ) } , b . Sprite . prototype . crop = function ( a ) { if ( "undefined" == typeof a || null === a ) this . texture . hasOwnProperty ( "sourceWidth" ) && this . texture . setFrame ( new b . Rectangle ( 0 , 0 , this . texture . sourceWidth , this . texture . sourceHeight ) ) ; else if ( this . texture instanceof PIXI . Texture ) { var c = { } ; b . Utils . extend ( ! 0 , c , this . texture ) , c . sourceWidth = c . width , c . sourceHeight = c . height , c . frame = a , c . width = a . width , c . height = a . height , this . texture = c , this . texture . updateFrame = ! 0 , PIXI . Texture . frameUpdates . push ( this . texture ) } else this . texture . setFrame ( a ) } , b . Sprite . prototype . revive = function ( a ) { return "undefined" == typeof a && ( a = 1 ) , this . alive = ! 0 , this . exists = ! 0 , this . visible = ! 0 , this . health = a , this . events && this . events . onRevived . dispatch ( this ) , this } , b . Sprite . prototype . kill = function ( ) { return this . alive = ! 1 , this . exists = ! 1 , this . visible = ! 1 , this . events && this . events . onKilled . dispatch ( this ) , this } , b . Sprite . prototype . destroy = function ( a ) { if ( null !== this . game ) { "undefined" == typeof a && ( a = ! 0 ) , this . parent && ( this . parent instanceof b . Group ? this . parent . remove ( this ) : this . parent . removeChild ( this ) ) , this . input && this . input . destroy ( ) , this . animations && this . animations . destroy ( ) , this . body && this . body . destroy ( ) , this . events && this . events . destroy ( ) ; var c = this . children . length ; if ( a ) for ( ; c -- ; ) this . children [ c ] . destroy ( a ) ; else for ( ; c -- ; ) this . removeChild ( this . children [ c ] ) ; this . alive = ! 1 , this . exists = ! 1 , this . visible = ! 1 , this . filters = null , this . mask = null , this . game = null } } , b . Sprite . prototype . damage = function ( a ) { return this . alive && ( this . health -= a , this . health <= 0 && this . kill ( ) ) , this } , b . Sprite . prototype . reset = function ( a , b , c ) { return "undefined" == typeof c && ( c = 1 ) , this . world . setTo ( a , b ) , this . position . x = a , this . position . y = b , this . alive = ! 0 , this . exists = ! 0 , this . visible = ! 0 , this . renderable = ! 0 , this . _outOfBoundsFired = ! 1 , this . health = c , this . body && this . body . reset ( a , b , ! 1 , ! 1 ) , this } , b . Sprite . prototype . bringToTop = function ( ) { return this . parent && this . parent . bringToTop ( this ) , this } , b . Sprite . prototype . play = function ( a , b , c , d ) { return this . animations ? this . animations . play ( a , b , c , d ) : void 0 } , Object . defineProperty ( b . Sprite . prototype , "angle" , { get : function ( ) { return b . Math . wrapAngle ( b . Math . radToDeg ( this . rotation ) ) } , set : function ( a ) { this . rotation = b . Math . degToRad ( b . Math . wrapAngle ( a ) ) } } ) , Object . defineProperty ( b . Sprite . prototype , "deltaX" , { get : function ( ) { return this . world . x - this . _cache [ 0 ] } } ) , Object . defineProperty ( b . Sprite . prototype , "deltaY" , { get : function ( ) { return this . world . y - this . _cache [ 1 ] } } ) , Object . defineProperty ( b . Sprite . prototype , "deltaZ" , { get : function ( ) { return this . rotation - this . _cache [ 2 ] } } ) , Object . defineProperty ( b . Sprite . prototype , "inWorld" , { get : function ( ) { return this . game . world . bounds . intersects ( this . getB
2014-03-18 18:36:46 +00:00
} , b . Graphics . prototype = Object . create ( PIXI . Graphics . prototype ) , b . Graphics . prototype . constructor = b . Graphics , b . Graphics . prototype . preUpdate = function ( ) { return this . _cache [ 0 ] = this . world . x , this . _cache [ 1 ] = this . world . y , this . _cache [ 2 ] = this . rotation , this . exists && this . parent . exists ? ( this . autoCull && ( this . renderable = this . game . world . camera . screenView . intersects ( this . getBounds ( ) ) ) , this . world . setTo ( this . game . camera . x + this . worldTransform [ 2 ] , this . game . camera . y + this . worldTransform [ 5 ] ) , this . visible && ( this . _cache [ 3 ] = this . game . stage . currentRenderOrderID ++ ) , ! 0 ) : ( this . renderOrderID = - 1 , ! 1 ) } , b . Graphics . prototype . update = function ( ) { } , b . Graphics . prototype . postUpdate = function ( ) { 1 === this . _cache [ 7 ] && ( this . position . x = ( this . game . camera . view . x + this . cameraOffset . x ) / this . game . camera . scale . x , this . position . y = ( this . game . camera . view . y + this . cameraOffset . y ) / this . game . camera . scale . y ) } , b . Graphics . prototype . destroy = function ( a ) { "undefined" == typeof a && ( a = ! 0 ) , this . clear ( ) , this . parent && ( this . parent instanceof b . Group ? this . parent . remove ( this ) : this . parent . removeChild ( this ) ) ; var c = this . children . length ; if ( a ) for ( ; c -- ; ) this . children [ c ] . destroy ( a ) ; else for ( ; c -- ; ) this . removeChild ( this . children [ c ] ) ; this . exists = ! 1 , this . visible = ! 1 , this . game = null } , b . Graphics . prototype . drawPolygon = function ( a ) { this . moveTo ( a . points [ 0 ] . x , a . points [ 0 ] . y ) ; for ( var b = 1 ; b < a . points . length ; b += 1 ) this . lineTo ( a . points [ b ] . x , a . points [ b ] . y ) ; this . lineTo ( a . points [ 0 ] . x , a . points [ 0 ] . y ) } , Object . defineProperty ( b . Graphics . prototype , "angle" , { get : function ( ) { return b . Math . radToDeg ( this . rotation ) } , set : function ( a ) { this . rotation = b . Math . degToRad ( a ) } } ) , Object . defineProperty ( b . Graphics . 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 . RenderTexture = function ( a , c , d , e ) { this . game = a , this . key = e , this . type = b . RENDERTEXTURE , this . _temp = new b . Point , PIXI . RenderTexture . call ( this , c , d ) } , b . RenderTexture . prototype = Object . create ( PIXI . RenderTexture . prototype ) , b . RenderTexture . prototype . constructor = b . RenderTexture , b . RenderTexture . prototype . renderXY = function ( a , b , c , d ) { this . _temp . set ( b , c ) , this . render ( a , this . _temp , d ) } , b . SpriteBatch = function ( a , c , d , e ) { PIXI . SpriteBatch . call ( this ) , b . Group . call ( this , a , c , d , e ) , this . type = b . SPRITEBATCH } , b . SpriteBatch . prototype = b . Utils . extend ( ! 0 , b . SpriteBatch . prototype , b . Group . prototype , PIXI . SpriteBatch . prototype ) , b . SpriteBatch . prototype . constructor = b . SpriteBatch , b . RetroFont = function ( a , c , d , e , f , g , h , i , j , k ) { this . characterWidth = d , this . characterHeight = e , this . characterSpacingX = h || 0 , this . characterSpacingY = i || 0 , this . characterPerRow = g , this . offsetX = j || 0 , this . offsetY = k || 0 , this . align = "left" , this . multiLine = ! 1 , this . autoUpperCase = ! 0 , this . customSpacingX = 0 , this . customSpacingY = 0 , this . fixedWidth = 0 , this . fontSet = a . cache . getImage ( c ) , this . _text = "" , this . grabData = [ ] ; for ( var l = this . offsetX , m = this . offsetY , n = 0 , o = new b . FrameData , p = 0 ; p < f . length ; p ++ ) { var q = a . rnd . uuid ( ) , r = o . addFrame ( new b . Frame ( p , l , m , this . characterWidth , this . characterHeight , "" , q ) ) ; this . grabData [ f . charCodeAt ( p ) ] = r . index , PIXI . TextureCache [ q ] = new PIXI . Texture ( PIXI . BaseTextureCache [ c ] , { x : l , y : m , width : this . characterWidth , height : this . characterHeight } ) , n ++ , n == this . characterPerRow ? ( n = 0 , l = this . offsetX , m += this . characterHeight + this . characterSpacingY ) : l += this . characterWidth + this . characterSpacingX } a . cache . updateFrameData ( c , o ) , this . stamp = new b . Image ( a , 0 , 0 , c , 0 ) , b . RenderTexture . call ( this , a ) , this . type = b . RETROFONT } , b . RetroFont . prototype = Object . create ( b . RenderTexture . prototype ) , b . RetroFont . prototype . constructor = b . RetroFont , b . RetroFont . ALIGN _LEFT = "left" , b . RetroFont . ALIGN _RIGHT = "right" , b . RetroFont . ALIGN _CENTER = "center" , b . RetroFont . TEXT _SET1 = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" , b . RetroFont . TEXT _SET2 = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ" , b . RetroFont . TEXT _SET3 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 " , b . RetroFont . TEXT _SET4 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789" , b . RetroFont . TEXT _SET5 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ.,/() '!?-*:0123456789" , b . RetroFont . TEXT _SET6 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ!?:;0123456789\"(),-.' " , b . RetroFont . TEXT _SET7 =
this . _valuesEnd [ c ] = [ this . _object [ c ] ] . concat ( this . _valuesEnd [ c ] ) } this . _valuesStart [ c ] = this . _object [ c ] , Array . isArray ( this . _valuesStart [ c ] ) || ( this . _valuesStart [ c ] *= 1 ) , this . _valuesStartRepeat [ c ] = this . _valuesStart [ c ] || 0 } for ( var d = 0 , e = a * ( this . _duration / 1e3 ) , f = this . _duration / e , g = [ ] ; e -- ; ) { var c , h = ( d - this . _startTime ) / this . _duration ; h = h > 1 ? 1 : h ; var i = this . _easingFunction ( h ) , j = { } ; for ( c in this . _valuesEnd ) { var k = this . _valuesStart [ c ] || 0 , l = this . _valuesEnd [ c ] ; l instanceof Array ? j [ c ] = this . _interpolationFunction ( l , i ) : ( "string" == typeof l && ( l = k + parseFloat ( l , 10 ) ) , "number" == typeof l && ( j [ c ] = k + ( l - k ) * i ) ) } g . push ( j ) , d += f } if ( this . _yoyo ) { var m = g . slice ( ) ; m . reverse ( ) , g = g . concat ( m ) } return "undefined" != typeof b ? b = b . concat ( g ) : g } , stop : function ( ) { return this . isRunning = ! 1 , this . _onUpdateCallback = null , this . _manager . remove ( this ) , this } , delay : function ( a ) { return this . _delayTime = a , this } , repeat : function ( a ) { return this . _repeat = a , this } , yoyo : function ( a ) { return this . _yoyo = a , this } , easing : function ( a ) { return this . _easingFunction = a , this } , interpolation : function ( a ) { return this . _interpolationFunction = a , this } , chain : function ( ) { return this . _chainedTweens = arguments , this } , loop : function ( ) { return this . _lastChild . chain ( this ) , this } , onUpdateCallback : function ( a , b ) { return this . _onUpdateCallback = a , this . _onUpdateCallbackContext = b , this } , pause : function ( ) { this . _codePaused = ! 0 , this . _paused = ! 0 , this . _pausedTime = this . game . time . now } , _pause : function ( ) { this . _codePaused || ( this . _paused = ! 0 , this . _pausedTime = this . game . time . now ) } , resume : function ( ) { this . _paused && ( this . _paused = ! 1 , this . _codePaused = ! 1 , this . _startTime += this . game . time . now - this . _pausedTime ) } , _resume : function ( ) { this . _codePaused || ( this . _startTime += this . game . time . pauseDuration , this . _paused = ! 1 ) } , update : function ( a ) { if ( this . pendingDelete ) return ! 1 ; if ( this . _paused || a < this . _startTime ) return ! 0 ; var b ; if ( a < this . _startTime ) return ! 0 ; this . _onStartCallbackFired === ! 1 && ( this . onStart . dispatch ( this . _object ) , this . _onStartCallbackFired = ! 0 ) ; var c = ( a - this . _startTime ) / this . _duration ; c = c > 1 ? 1 : c ; var d = this . _easingFunction ( c ) ; for ( b in this . _valuesEnd ) { var e = this . _valuesStart [ b ] || 0 , f = this . _valuesEnd [ b ] ; f instanceof Array ? this . _object [ b ] = this . _interpolationFunction ( f , d ) : ( "string" == typeof f && ( f = e + parseFloat ( f , 10 ) ) , "number" == typeof f && ( this . _object [ b ] = e + ( f - e ) * d ) ) } if ( null !== this . _onUpdateCallback && this . _onUpdateCallback . call ( this . _onUpdateCallbackContext , this , d ) , 1 == c ) { if ( this . _repeat > 0 ) { isFinite ( this . _repeat ) && this . _repeat -- ; for ( b in this . _valuesStartRepeat ) { if ( "string" == typeof this . _valuesEnd [ b ] && ( this . _valuesStartRepeat [ b ] = this . _valuesStartRepeat [ b ] + parseFloat ( this . _valuesEnd [ b ] , 10 ) ) , this . _yoyo ) { var g = this . _valuesStartRepeat [ b ] ; this . _valuesStartRepeat [ b ] = this . _valuesEnd [ b ] , this . _valuesEnd [ b ] = g , this . _reversed = ! this . _reversed } this . _valuesStart [ b ] = this . _valuesStartRepeat [ b ] } return this . _startTime = a + this . _delayTime , this . onLoop . dispatch ( this . _object ) , ! 0 } this . isRunning = ! 1 , this . onComplete . dispatch ( this . _object ) ; for ( var h = 0 , i = this . _chainedTweens . length ; i > h ; h ++ ) this . _chainedTweens [ h ] . start ( a ) ; return ! 1 } return ! 0 } } , b . Tween . prototype . constructor = b . Tween , b . Easing = { Linear : { None : function ( a ) { return a } } , Quadratic : { In : function ( a ) { return a * a } , Out : function ( a ) { return a * ( 2 - a ) } , InOut : function ( a ) { return ( a *= 2 ) < 1 ? . 5 * a * a : - . 5 * ( -- a * ( a - 2 ) - 1 ) } } , Cubic : { In : function ( a ) { return a * a * a } , Out : function ( a ) { return -- a * a * a + 1 } , InOut : function ( a ) { return ( a *= 2 ) < 1 ? . 5 * a * a * a : . 5 * ( ( a -= 2 ) * a * a + 2 ) } } , Quartic : { In : function ( a ) { return a * a * a * a } , Out : function ( a ) { return 1 - -- a * a * a * a } , InOut : function ( a ) { return ( a *= 2 ) < 1 ? . 5 * a * a * a * a : - . 5 * ( ( a -= 2 ) * a * a * a - 2 ) } } , Quintic : { In : function ( a ) { return a * a * a * a * a } , Out : function ( a ) { return -- a * a * a * a * a + 1 } , InOut : function ( a ) { return ( a *= 2 ) < 1 ? . 5 * a * a * a * a * a : . 5 * ( ( a -= 2 ) * a * a * a * a + 2 ) } } , Sinusoidal : { In : function ( a ) { return 1 - Math . cos ( a * Math . PI / 2 ) } , Out : function ( a ) { return Math . sin ( a * Math . PI / 2 ) } , InOut : function ( a ) { return . 5 * ( 1 - Math . cos ( Math . PI * a ) ) } } , Exponential : { In : function ( a ) { return 0 === a ? 0 : Math . pow ( 1024 , a - 1 ) } , Out : function ( a ) { return 1 === a ? 1 : 1 - Math . pow ( 2 , - 10 * a ) } , InOut : function ( a ) { return 0 === a ? 0 : 1 === a ? 1 : ( a *= 2 ) < 1 ? . 5 * Math . pow ( 1024 , a - 1 ) : . 5 * ( - Math . pow ( 2 , - 10 * ( a - 1 ) ) + 2 ) } } , Circular : { In : function ( a ) { return 1 - Math . sqrt ( 1 - a * a ) } , Out : function ( a ) { return Math . s
} , isSpriteSheet : function ( a ) { return this . _images [ a ] ? this . _images [ a ] . spriteSheet : ! 1 } , getText : function ( a ) { return this . _text [ a ] ? this . _text [ a ] . data : void console . warn ( 'Phaser.Cache.getText: Invalid key: "' + a + '"' ) } , getJSON : function ( a ) { return this . _json [ a ] ? this . _json [ a ] . data : void console . warn ( 'Phaser.Cache.getJSON: Invalid key: "' + a + '"' ) } , getBinary : function ( a ) { return this . _binary [ a ] ? this . _binary [ a ] : void console . warn ( 'Phaser.Cache.getBinary: Invalid key: "' + a + '"' ) } , getKeys : function ( a ) { var c = null ; switch ( a ) { case b . Cache . CANVAS : c = this . _canvases ; break ; case b . Cache . IMAGE : c = this . _images ; break ; case b . Cache . TEXTURE : c = this . _textures ; break ; case b . Cache . SOUND : c = this . _sounds ; break ; case b . Cache . TEXT : c = this . _text ; break ; case b . Cache . PHYSICS : c = this . _physics ; break ; case b . Cache . TILEMAP : c = this . _tilemaps ; break ; case b . Cache . BINARY : c = this . _binary ; break ; case b . Cache . BITMAPDATA : c = this . _bitmapDatas ; break ; case b . Cache . BITMAPFONT : c = this . _bitmapFont ; break ; case b . Cache . JSON : c = this . _json } if ( c ) { var d = [ ] ; for ( var e in c ) "__default" !== e && "__missing" !== e && d . push ( e ) ; return d } } , removeCanvas : function ( a ) { delete this . _canvases [ a ] } , removeImage : function ( a ) { delete this . _images [ a ] } , removeSound : function ( a ) { delete this . _sounds [ a ] } , removeText : function ( a ) { delete this . _text [ a ] } , removeJSON : function ( a ) { delete this . _json [ a ] } , removePhysics : function ( a ) { delete this . _physics [ a ] } , removeTilemap : function ( a ) { delete this . _tilemaps [ a ] } , removeBinary : function ( a ) { delete this . _binary [ a ] } , removeBitmapData : function ( a ) { delete this . _bitmapDatas [ a ] } , removeBitmapFont : function ( a ) { delete this . _bitmapFont [ a ] } , destroy : function ( ) { for ( var a in this . _canvases ) delete this . _canvases [ a ] ; for ( var a in this . _images ) "__default" !== a && "__missing" !== a && delete this . _images [ a ] ; for ( var a in this . _sounds ) delete this . _sounds [ a ] ; for ( var a in this . _text ) delete this . _text [ a ] ; for ( var a in this . _json ) delete this . _json [ a ] ; for ( var a in this . _textures ) delete this . _textures [ a ] ; for ( var a in this . _physics ) delete this . _physics [ a ] ; for ( var a in this . _tilemaps ) delete this . _tilemaps [ a ] ; for ( var a in this . _binary ) delete this . _binary [ a ] ; for ( var a in this . _bitmapDatas ) delete this . _bitmapDatas [ a ] ; for ( var a in this . _bitmapFont ) delete this . _bitmapFont [ a ] } } , b . Cache . prototype . constructor = b . Cache , b . Loader = function ( a ) { this . game = a , this . _fileList = [ ] , this . _fileIndex = 0 , this . _progressChunk = 0 , this . _xhr = new XMLHttpRequest , this . isLoading = ! 1 , this . hasLoaded = ! 1 , this . progress = 0 , this . progressFloat = 0 , this . preloadSprite = null , this . crossOrigin = ! 1 , this . baseURL = "" , this . onFileComplete = new b . Signal , this . onFileError = new b . Signal , this . onLoadStart = new b . Signal , this . onLoadComplete = new b . Signal } , b . Loader . TEXTURE _ATLAS _JSON _ARRAY = 0 , b . Loader . TEXTURE _ATLAS _JSON _HASH = 1 , b . Loader . TEXTURE _ATLAS _XML _STARLING = 2 , b . Loader . PHYSICS _LIME _CORONA = 3 , b . Loader . prototype = { setPreloadSprite : function ( a , c ) { c = c || 0 , this . preloadSprite = { sprite : a , direction : c , width : a . width , height : a . height , rect : null } , this . preloadSprite . rect = 0 === c ? new b . Rectangle ( 0 , 0 , 1 , a . height ) : new b . Rectangle ( 0 , 0 , a . width , 1 ) , a . crop ( this . preloadSprite . rect ) , a . visible = ! 0 } , checkKeyExists : function ( a , b ) { if ( this . _fileList . length > 0 ) for ( var c = 0 ; c < this . _fileList . length ; c ++ ) if ( this . _fileList [ c ] . type === a && this . _fileList [ c ] . key === b ) return ! 0 ; return ! 1 } , getAssetIndex : function ( a , b ) { if ( this . _fileList . length > 0 ) for ( var c = 0 ; c < this . _fileList . length ; c ++ ) if ( this . _fileList [ c ] . type === a && this . _fileList [ c ] . key === b ) return c ; return - 1 } , getAsset : function ( a , b ) { if ( this . _fileList . length > 0 ) for ( var c = 0 ; c < this . _fileList . length ; c ++ ) if ( this . _fileList [ c ] . type === a && this . _fileList [ c ] . key === b ) return { index : c , file : this . _fileList [ c ] } ; return ! 1 } , reset : function ( ) { this . preloadSprite = null , this . isLoading = ! 1 , this . _fileList . length = 0 , this . _fileIndex = 0 } , addToFileList : function ( a , b , c , d ) { var e = { type : a , key : b , url : c , data : null , error : ! 1 , loaded : ! 1 } ; if ( "undefined" != typeof d ) for ( var f in d ) e [ f ] = d [ f ] ; this . checkKeyExists ( a , b ) === ! 1 && this . _fileList . push ( e ) } , replaceInFileList : function ( a , b , c , d ) { var e = { type : a , key : b , url : c , data : null , error : ! 1 , loaded : ! 1 } ; if ( "undefined" != typeof d ) for ( var f in d ) e [ f ] = d [ f ] ; var g = this . getAssetIndex ( a , b ) ; - 1 === g ? this . _fileList . push ( e ) : this . _fileList [ g ] = e } , image : function ( a , b , c ) { return " u
2014-03-17 21:18:02 +00:00
} , spriteInputInfo : function ( a , b , c , d ) { this . start ( b , c , d ) , this . line ( "Sprite Input: (" + a . width + " x " + a . height + ")" ) , this . line ( "x: " + a . input . pointerX ( ) . toFixed ( 1 ) + " y: " + a . input . pointerY ( ) . toFixed ( 1 ) ) , this . line ( "over: " + a . input . pointerOver ( ) + " duration: " + a . input . overDuration ( ) . toFixed ( 0 ) ) , this . line ( "down: " + a . input . pointerDown ( ) + " duration: " + a . input . downDuration ( ) . toFixed ( 0 ) ) , this . line ( "just over: " + a . input . justOver ( ) + " just out: " + a . input . justOut ( ) ) , this . stop ( ) } , key : function ( a , b , c , d ) { this . start ( b , c , d , 150 ) , this . line ( "Key:" , a . keyCode , "isDown:" , a . isDown ) , this . line ( "justPressed:" , a . justPressed ( ) , "justReleased:" , a . justReleased ( ) ) , this . line ( "Time Down:" , a . timeDown . toFixed ( 0 ) , "duration:" , a . duration . toFixed ( 0 ) ) , this . stop ( ) } , inputInfo : function ( a , b , c ) { this . start ( a , b , c ) , this . line ( "Input" ) , this . line ( "X: " + this . game . input . x + " Y: " + this . game . input . y ) , this . line ( "World X: " + this . game . input . worldX + " World Y: " + this . game . input . worldY ) , this . line ( "Scale X: " + this . game . input . scale . x . toFixed ( 1 ) + " Scale Y: " + this . game . input . scale . x . toFixed ( 1 ) ) , this . line ( "Screen X: " + this . game . input . activePointer . screenX + " Screen Y: " + this . game . input . activePointer . screenY ) , this . stop ( ) } , spriteBounds : function ( a , b , c ) { var d = a . getBounds ( ) ; this . rectangle ( d , b , c ) } , spriteInfo : function ( a , b , c , d ) { this . start ( b , c , d ) , this . line ( "Sprite: (" + a . width + " x " + a . height + ") anchor: " + a . anchor . x + " x " + a . anchor . y ) , this . line ( "x: " + a . x . toFixed ( 1 ) + " y: " + a . y . toFixed ( 1 ) ) , this . line ( "angle: " + a . angle . toFixed ( 1 ) + " rotation: " + a . rotation . toFixed ( 1 ) ) , this . line ( "visible: " + a . visible + " in camera: " + a . inCamera ) , this . stop ( ) } , spriteCoords : function ( a , b , c , d ) { this . start ( b , c , d , 100 ) , a . name && this . line ( a . name ) , this . line ( "x:" , a . x . toFixed ( 2 ) , "y:" , a . y . toFixed ( 2 ) ) , this . line ( "pos x:" , a . position . x . toFixed ( 2 ) , "pos y:" , a . position . y . toFixed ( 2 ) ) , this . line ( "world x:" , a . world . x . toFixed ( 2 ) , "world y:" , a . world . y . toFixed ( 2 ) ) , this . stop ( ) } , lineInfo : function ( a , b , c , d ) { this . start ( b , c , d , 80 ) , this . line ( "start.x:" , a . start . x . toFixed ( 2 ) , "start.y:" , a . start . y . toFixed ( 2 ) ) , this . line ( "end.x:" , a . end . x . toFixed ( 2 ) , "end.y:" , a . end . y . toFixed ( 2 ) ) , this . line ( "length:" , a . length . toFixed ( 2 ) , "angle:" , a . angle ) , this . stop ( ) } , pixel : function ( a , b , c , d ) { d = d || 2 , this . start ( ) , this . context . fillStyle = c , this . context . fillRect ( a , b , d , d ) , this . stop ( ) } , geom : function ( a , c , d , e ) { "undefined" == typeof d && ( d = ! 0 ) , "undefined" == typeof e && ( e = 0 ) , c = c || "rgba(0,255,0,0.4)" , this . start ( ) , this . context . fillStyle = c , this . context . strokeStyle = c , a instanceof b . Rectangle || 1 === e ? d ? this . context . fillRect ( a . x - this . game . camera . x , a . y - this . game . camera . y , a . width , a . height ) : this . context . strokeRect ( a . x - this . game . camera . x , a . y - this . game . camera . y , a . width , a . height ) : a instanceof b . Circle || 2 === e ? ( this . context . beginPath ( ) , this . context . arc ( a . x - this . game . camera . x , a . y - this . game . camera . y , a . radius , 0 , 2 * Math . PI , ! 1 ) , this . context . closePath ( ) , d ? this . context . fill ( ) : this . context . stroke ( ) ) : a instanceof b . Point || 3 === e ? this . context . fillRect ( a . x - this . game . camera . x , a . y - this . game . camera . y , 4 , 4 ) : ( a instanceof b . Line || 4 === e ) && ( this . context . lineWidth = 1 , this . context . beginPath ( ) , this . context . moveTo ( a . start . x + . 5 - this . game . camera . x , a . start . y + . 5 - this . game . camera . y ) , this . context . lineTo ( a . end . x + . 5 - this . game . camera . x , a . end . y + . 5 - this . game . camera . y ) , this . context . closePath ( ) , this . context . stroke ( ) ) , this . stop ( ) } , rectangle : function ( a , b , c ) { "undefined" == typeof c && ( c = ! 0 ) , b = b || "rgba(0, 255, 0, 0.4)" , this . start ( ) , c ? ( this . context . fillStyle = b , this . context . fillRect ( a . x - this . game . camera . x , a . y - this . game . camera . y , a . width , a . height ) ) : ( this . context . strokeStyle = b , this . context . strokeRect ( a . x - this . game . camera . x , a . y - this . game . camera . y , a . width , a . height ) ) , this . stop ( ) } , text : function ( a , b , c , d , e ) { d = d || "rgb(255,255,255)" , e = e || "16px Courier" , this . start ( ) , this . context . font = e , this . renderShadow && ( this . context . fillStyle = "rgb(0,0,0)" , this . context . fillText ( a , b + 1 , c + 1 ) ) , this . context . fillStyle = d , this . context . fillText ( a , b , c ) , this . stop ( ) } , quadTree : function ( a , b ) { b = b || "rgba(255,0,0,0.3)" , this . start ( ) ; var c = a . bounds ; if ( 0 === a . nodes . length ) { this . context . strokeStyle = b , this . context . strokeRect ( c . x , c . y , c . width , c . height ) , this . text ( "size: " + a . objects . length , c . x + 4 , c . y + 16 , "rgb(0,200,0)" , "12px Courier"
2014-03-18 00:01:39 +00:00
a . scale . setTo ( b , b ) } a . frame = "object" == typeof this . _frames ? this . game . rnd . pick ( this . _frames ) : this . _frames , a . body . friction = this . particleFriction , a . body . angularDrag = this . angularDrag } } , b . Particles . Arcade . Emitter . prototype . setSize = function ( a , b ) { this . width = a , this . height = b } , b . Particles . Arcade . Emitter . prototype . setXSpeed = function ( a , b ) { a = a || 0 , b = b || 0 , this . minParticleSpeed . x = a , this . maxParticleSpeed . x = b } , b . Particles . Arcade . Emitter . prototype . setYSpeed = function ( a , b ) { a = a || 0 , b = b || 0 , this . minParticleSpeed . y = a , this . maxParticleSpeed . y = b } , b . Particles . Arcade . Emitter . prototype . setRotation = function ( a , b ) { a = a || 0 , b = b || 0 , this . minRotation = a , this . maxRotation = b } , b . Particles . Arcade . Emitter . prototype . at = function ( a ) { a . center && ( this . emitX = a . center . x , this . emitY = a . center . y ) } , Object . defineProperty ( b . Particles . Arcade . Emitter . prototype , "x" , { get : function ( ) { return this . emitX } , set : function ( a ) { this . emitX = a } } ) , Object . defineProperty ( b . Particles . Arcade . Emitter . prototype , "y" , { get : function ( ) { return this . emitY } , set : function ( a ) { this . emitY = a } } ) , Object . defineProperty ( b . Particles . Arcade . Emitter . prototype , "left" , { get : function ( ) { return Math . floor ( this . x - this . width / 2 ) } } ) , Object . defineProperty ( b . Particles . Arcade . Emitter . prototype , "right" , { get : function ( ) { return Math . floor ( this . x + this . width / 2 ) } } ) , Object . defineProperty ( b . Particles . Arcade . Emitter . prototype , "top" , { get : function ( ) { return Math . floor ( this . y - this . height / 2 ) } } ) , Object . defineProperty ( b . Particles . Arcade . Emitter . prototype , "bottom" , { get : function ( ) { return Math . floor ( this . y + this . height / 2 ) } } ) , b . Tile = function ( a , b , c , d , e , f ) { this . layer = a , this . index = b , this . x = c , this . y = d , this . worldX = c * e , this . worldY = d * f , this . width = e , this . height = f , this . centerX = Math . abs ( e / 2 ) , this . centerY = Math . abs ( f / 2 ) , this . alpha = 1 , this . properties = { } , this . scanned = ! 1 , this . faceTop = ! 1 , this . faceBottom = ! 1 , this . faceLeft = ! 1 , this . faceRight = ! 1 , this . collideLeft = ! 1 , this . collideRight = ! 1 , this . collideUp = ! 1 , this . collideDown = ! 1 , this . collisionCallback = null , this . collisionCallbackContext = this } , b . Tile . prototype = { containsPoint : function ( a , b ) { return ! ( a < this . worldX || b < this . worldY || a > this . right || b > this . bottom ) } , intersects : function ( a , b , c , d ) { return c <= this . worldX ? ! 1 : d <= this . worldY ? ! 1 : a >= this . worldX + this . width ? ! 1 : b >= this . worldY + this . height ? ! 1 : ! 0 } , setCollisionCallback : function ( a , b ) { this . collisionCallback = a , this . collisionCallbackContext = b } , destroy : function ( ) { this . collisionCallback = null , this . collisionCallbackContext = null , this . properties = null } , setCollision : function ( a , b , c , d ) { this . collideLeft = a , this . collideRight = b , this . collideUp = c , this . collideDown = d } , resetCollision : function ( ) { this . collideLeft = ! 1 , this . collideRight = ! 1 , this . collideUp = ! 1 , this . collideDown = ! 1 , this . faceTop = ! 1 , this . faceBottom = ! 1 , this . faceLeft = ! 1 , this . faceRight = ! 1 } , isInteresting : function ( a , b ) { return a && b ? this . collideLeft || this . collideRight || this . collideUp || this . collideDown || this . faceTop || this . faceBottom || this . faceLeft || this . faceRight || this . collisionCallback : a ? this . collideLeft || this . collideRight || this . collideUp || this . collideDown : b ? this . faceTop || this . faceBottom || this . faceLeft || this . faceRight : ! 1 } , copy : function ( a ) { this . index = a . index , this . alpha = a . alpha , this . properties = a . properties , this . collideUp = a . collideUp , this . collideDown = a . collideDown , this . collideLeft = a . collideLeft , this . collideRight = a . collideRight , this . collisionCallback = a . collisionCallback , this . collisionCallbackContext = a . collisionCallbackContext } } , b . Tile . prototype . constructor = b . Tile , Object . defineProperty ( b . Tile . prototype , "collides" , { get : function ( ) { return this . collideLeft || this . collideRight || this . collideUp || this . collideDown } } ) , Object . defineProperty ( b . Tile . prototype , "canCollide" , { get : function ( ) { return this . collideLeft || this . collideRight || this . collideUp || this . collideDown || this . collisionCallback } } ) , Object . defineProperty ( b . Tile . prototype , "left" , { get : function ( ) { return this . worldX } } ) , Object . defineProperty ( b . Tile . prototype , "right" , { get : function ( ) { return this . worldX + this . width } } ) , Object . defineProperty ( b . Tile . prototype , "top" , { get : function ( ) { return this . worldY } } ) , Object . defineProperty ( b . Tile . prototype , "bottom" , { get : function ( ) { return this . worldY + this . height } } ) , b . Tilemap = function ( a , c , d , e , f , g ) { this . game = a , this . key = c
2014-03-17 21:18:02 +00:00
} , collideSpriteVsSprite : function ( a , b , c , d , e , f ) { this . separate ( a . body , b . body , d , e , f ) && ( c && c . call ( e , a , b ) , this . _total ++ ) } , collideSpriteVsGroup : function ( a , b , c , d , e , f ) { if ( 0 !== b . length ) for ( var g = 0 , h = b . children . length ; h > g ; g ++ ) b . children [ g ] . exists && b . children [ g ] . body && this . separate ( a . body , b . children [ g ] . body , d , e , f ) && ( c && c . call ( e , a , b . children [ g ] ) , this . _total ++ ) } , collideGroupVsSelf : function ( a , b , c , d , e ) { if ( 0 !== a . length ) for ( var f = a . children . length , g = 0 ; f > g ; g ++ ) for ( var h = g + 1 ; f >= h ; h ++ ) a . children [ g ] && a . children [ h ] && a . children [ g ] . exists && a . children [ h ] . exists && this . collideSpriteVsSprite ( a . children [ g ] , a . children [ h ] , b , c , d , e ) } , collideGroupVsGroup : function ( a , b , c , d , e , f ) { if ( 0 !== a . length && 0 !== b . length ) for ( var g = 0 , h = a . children . length ; h > g ; g ++ ) a . children [ g ] . exists && this . collideSpriteVsGroup ( a . children [ g ] , b , c , d , e , f ) } , separate : function ( a , b ) { return a . type !== Phaser . Physics . NINJA || b . type !== Phaser . Physics . NINJA ? ! 1 : a . aabb && b . aabb ? a . aabb . collideAABBVsAABB ( b . aabb ) : a . aabb && b . tile ? a . aabb . collideAABBVsTile ( b . tile ) : a . tile && b . aabb ? b . aabb . collideAABBVsTile ( a . tile ) : a . circle && b . tile ? a . circle . collideCircleVsTile ( b . tile ) : a . tile && b . circle ? b . circle . collideCircleVsTile ( a . tile ) : void 0 } } , Phaser . Physics . Ninja . Body = function ( a , b , c , d , e , f , g , h , i ) { b = b || null , "undefined" == typeof c && ( c = 1 ) , "undefined" == typeof d && ( d = 1 ) , "undefined" == typeof e && ( e = 16 ) , this . sprite = b , this . game = a . game , this . type = Phaser . Physics . NINJA , this . system = a , this . aabb = null , this . tile = null , this . circle = null , this . shape = null , this . drag = 1 , this . friction = . 05 , this . gravityScale = 1 , this . bounce = . 3 , this . velocity = new Phaser . Point , this . facing = Phaser . NONE , this . immovable = ! 1 , this . collideWorldBounds = ! 0 , this . checkCollision = { none : ! 1 , any : ! 0 , up : ! 0 , down : ! 0 , left : ! 0 , right : ! 0 } , this . touching = { none : ! 0 , up : ! 1 , down : ! 1 , left : ! 1 , right : ! 1 } , this . wasTouching = { none : ! 0 , up : ! 1 , down : ! 1 , left : ! 1 , right : ! 1 } , this . maxSpeed = 8 , b && ( f = b . x , g = b . y , h = b . width , i = b . height , 0 === b . anchor . x && ( f += . 5 * b . width ) , 0 === b . anchor . y && ( g += . 5 * b . height ) ) , 1 === c ? ( this . aabb = new Phaser . Physics . Ninja . AABB ( this , f , g , h , i ) , this . shape = this . aabb ) : 2 === c ? ( this . circle = new Phaser . Physics . Ninja . Circle ( this , f , g , e ) , this . shape = this . circle ) : 3 === c && ( this . tile = new Phaser . Physics . Ninja . Tile ( this , f , g , h , i , d ) , this . shape = this . tile ) } , Phaser . Physics . Ninja . Body . prototype = { preUpdate : function ( ) { 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 . shape . integrate ( ) , this . collideWorldBounds && this . shape . collideWorldBounds ( ) } , postUpdate : function ( ) { this . sprite && ( this . sprite . type === Phaser . TILESPRITE ? ( this . sprite . x = this . shape . pos . x - this . shape . xw , this . sprite . y = this . shape . pos . y - this . shape . yw ) : ( this . sprite . x = this . shape . pos . x , this . sprite . y = this . shape . pos . y ) ) , this . velocity . x < 0 ? this . facing = Phaser . LEFT : this . velocity . x > 0 && ( this . facing = Phaser . RIGHT ) , this . velocity . y < 0 ? this . facing = Phaser . UP : this . velocity . y > 0 && ( this . facing = Phaser . DOWN ) } , setZeroVelocity : function ( ) { this . shape . oldpos . x = this . shape . pos . x , this . shape . oldpos . y = this . shape . pos . y } , moveTo : function ( a , b ) { var c = a * this . game . time . physicsElapsed , b = this . game . math . degToRad ( b ) ; this . shape . pos . x = this . shape . oldpos . x + c * Math . cos ( b ) , this . shape . pos . y = this . shape . oldpos . y + c * Math . sin ( b ) } , moveFrom : function ( a , b ) { var c = - a * this . game . time . physicsElapsed , b = this . game . math . degToRad ( b ) ; this . shape . pos . x = this . shape . oldpos . x + c * Math . cos ( b ) , this . shape . pos . y = this . shape . oldpos . y + c * Math . sin ( b ) } , moveLeft : function ( a ) { var b = - a * this . game . time . physicsElapsed ; this . shape . pos . x = this . shape . oldpos . x + Math . min ( this . maxSpeed , Math . max ( - this . maxSpeed , this . shape . pos . x - this . shape . oldpos . x + b ) ) } , moveRight : function ( a ) { var b = a * this . game . time . physicsElapsed ; this . shape . pos . x = this . shape . oldpos . x + Math . min ( this . maxSpeed , Math . max ( - this . maxSpeed , this . shape . pos . x - this . shape . oldpos . x + b ) ) } , moveUp : function ( a ) { var b = - a * this . game . time . physicsElapsed ; this . shape . pos . y = this . shape . oldpos . y + Math . min ( this . maxSpeed , Math . max ( - this . maxSpeed , this . shape . pos . y - this . shape . oldpos . y + b ) ) } , moveDown : function ( a ) { var b = a * this . g
} , projCircle _Half : function ( a , b , c , d , e , f ) { var g = f . signx , h = f . signy , i = c * g + d * h ; if ( i > 0 ) return Phaser . Physics . Ninja . Circle . COL _NONE ; if ( 0 == c ) if ( 0 == d ) { var j = e . radius , k = e . pos . x - g * j - f . pos . x , l = e . pos . y - h * j - f . pos . y , m = g , n = h , o = k * m + l * n ; if ( 0 > o ) { m *= - o , n *= - o ; var p = Math . sqrt ( m * m + n * n ) , q = Math . sqrt ( a * a + b * b ) ; return p > q ? ( e . reportCollisionVsWorld ( a , b , a / q , b / q , f ) , Phaser . Physics . Ninja . Circle . COL _AXIS ) : ( e . reportCollisionVsWorld ( m , n , f . signx , f . signy ) , Phaser . Physics . Ninja . Circle . COL _OTHER ) } } else { if ( 0 != i ) return e . reportCollisionVsWorld ( 0 , b * d , 0 , d , f ) , Phaser . Physics . Ninja . Circle . COL _AXIS ; var j = e . radius , r = e . pos . x - f . pos . x ; if ( 0 > r * g ) return e . reportCollisionVsWorld ( 0 , b * d , 0 , d , f ) , Phaser . Physics . Ninja . Circle . COL _AXIS ; var s = e . pos . y - ( f . pos . y + d * f . yw ) , t = Math . sqrt ( r * r + s * s ) , u = e . radius - t ; if ( u > 0 ) return 0 == t ? ( r = g / Math . SQRT2 , s = d / Math . SQRT2 ) : ( r /= t , s /= t ) , e . reportCollisionVsWorld ( r * u , s * u , r , s , f ) , Phaser . Physics . Ninja . Circle . COL _OTHER } else if ( 0 == d ) { if ( 0 != i ) return e . reportCollisionVsWorld ( a * c , 0 , c , 0 , f ) , Phaser . Physics . Ninja . Circle . COL _AXIS ; var j = e . radius , s = e . pos . y - f . pos . y ; if ( 0 > s * h ) return e . reportCollisionVsWorld ( a * c , 0 , c , 0 , f ) , Phaser . Physics . Ninja . Circle . COL _AXIS ; var r = e . pos . x - ( f . pos . x + c * f . xw ) , t = Math . sqrt ( r * r + s * s ) , u = e . radius - t ; if ( u > 0 ) return 0 == t ? ( r = g / Math . SQRT2 , s = d / Math . SQRT2 ) : ( r /= t , s /= t ) , e . reportCollisionVsWorld ( r * u , s * u , r , s , f ) , Phaser . Physics . Ninja . Circle . COL _OTHER } else { var v = f . pos . x + c * f . xw , w = f . pos . y + d * f . yw , r = e . pos . x - v , s = e . pos . y - w , t = Math . sqrt ( r * r + s * s ) , u = e . radius - t ; if ( u > 0 ) return 0 == t ? ( r = c / Math . SQRT2 , s = d / Math . SQRT2 ) : ( r /= t , s /= t ) , e . reportCollisionVsWorld ( r * u , s * u , r , s , f ) , Phaser . Physics . Ninja . Circle . COL _OTHER } return Phaser . Physics . Ninja . Circle . COL _NONE } , projCircle _22DegS : function ( a , b , c , d , e , f ) { var g = f . signx , h = f . signy ; if ( h * d > 0 ) return Phaser . Physics . Ninja . Circle . COL _NONE ; if ( 0 == c ) { if ( 0 != d ) return e . reportCollisionVsWorld ( 0 , b * d , 0 , d , f ) , Phaser . Physics . Ninja . Circle . COL _AXIS ; var i = f . sx , j = f . sy , k = e . radius , l = e . pos . x - ( f . pos . x - g * f . xw ) , m = e . pos . y - f . pos . y , n = l * - j + m * i ; if ( n * g * h > 0 ) { var o = Math . sqrt ( l * l + m * m ) , p = k - o ; if ( p > 0 ) return l /= o , m /= o , e . reportCollisionVsWorld ( l * p , m * p , l , m , f ) , Phaser . Physics . Ninja . Circle . COL _OTHER } else { l -= k * i , m -= k * j ; var q = l * i + m * j ; if ( 0 > q ) { i *= - q , j *= - q ; var r = Math . sqrt ( i * i + j * j ) ; return b > a ? ( lenP = a , b = 0 , e . pos . x - f . pos . x < 0 && ( a *= - 1 ) ) : ( lenP = b , a = 0 , e . pos . y - f . pos . y < 0 && ( b *= - 1 ) ) , r > lenP ? ( e . reportCollisionVsWorld ( a , b , a / lenP , b / lenP , f ) , Phaser . Physics . Ninja . Circle . COL _AXIS ) : ( e . reportCollisionVsWorld ( i , j , f . sx , f . sy , f ) , Phaser . Physics . Ninja . Circle . COL _OTHER ) } } } else if ( 0 == d ) if ( 0 > g * c ) { var s = f . pos . x - g * f . xw , t = f . pos . y , u = e . pos . x - s , v = e . pos . y - t ; if ( 0 > v * h ) return e . reportCollisionVsWorld ( a * c , 0 , c , 0 , f ) , Phaser . Physics . Ninja . Circle . COL _AXIS ; var o = Math . sqrt ( u * u + v * v ) , p = e . radius - o ; if ( p > 0 ) return 0 == o ? ( u = c / Math . SQRT2 , v = d / Math . SQRT2 ) : ( u /= o , v /= o ) , e . reportCollisionVsWorld ( u * p , v * p , u , v , f ) , Phaser . Physics . Ninja . Circle . COL _OTHER } else { var i = f . sx , j = f . sy , l = e . pos . x - ( f . pos . x + c * f . xw ) , m = e . pos . y - ( f . pos . y - h * f . yw ) , n = l * - j + m * i ; if ( 0 > n * g * h ) { var o = Math . sqrt ( l * l + m * m ) , p = e . radius - o ; if ( p > 0 ) return l /= o , m /= o , e . reportCollisionVsWorld ( l * p , m * p , l , m , f ) , Phaser . Physics . Ninja . Circle . COL _OTHER } else { var q = l * i + m * j , p = e . radius - Math . abs ( q ) ; if ( p > 0 ) return e . reportCollisionVsWorld ( i * p , j * p , i , j , f ) , Phaser . Physics . Ninja . Circle . COL _OTHER } } else { var s = f . pos . x + c * f . xw , t = f . pos . y + d * f . yw , u = e . pos . x - s , v = e . pos . y - t , o = Math . sqrt ( u * u + v * v ) , p = e . radius - o ; if ( p > 0 ) return 0 == o ? ( u = c / Math . SQRT2 , v = d / Math . SQRT2 ) : ( u /= o , v /= o ) , e . reportCollisionVsWorld ( u * p , v * p , u , v , f ) , Phaser . Physics . Ninja . Circle . COL _OTHER } return Phaser . Physics . Ninja . Circle . COL _NONE } , projCircle _22DegB : function ( a , b , c , d , e , f ) { var g = f . signx , h = f . signy ; if ( 0 == c ) if ( 0 == d ) { var i = f . sx , j = f . sy , k = e . radius , l = e . pos . x - i * k - ( f . pos . x - g * f . xw ) , m = e . pos . y - j * k - ( f . pos . y + h * f . yw ) , n = l * i + m * j ; if ( 0 > n ) { i *= - n , j *= - n ; var o = Math . sqrt ( i * i + j * j ) ; return b > a ? ( lenP = a , b = 0 , e . pos . x - f . pos . x < 0 && ( a *= - 1 ) ) : ( lenP = b , a = 0 , e . pos . y - f . pos . y < 0 && ( b *= - 1 ) ) , o > lenP ? ( e . reportCollisionVsWorld ( a , b , a / lenP , b / lenP , f ) , Phaser . Physics . Ninja . Circle . COL _AXIS ) : ( e . reportCollisionVsWorld ( i , j , f . sx , f . sy , f ) , Phaser . Physics . Ninja . Circle . COL _OTHER ) } } else { if ( 0 > h * d ) return e . reportCollisionVsWorld ( 0 , b * d , 0 , d , f ) , Phaser . Physics . Ninja . Circle . COL _AXIS ; var i = f . sx , j = f . sy , l = e . pos . x - ( f . pos . x - g * f . xw ) , m = e . pos . y - ( f . pos . y + h * f . yw ) , p = l * - j + m * i ; if ( p * g * h > 0 ) { va
} } Z [ 0 ] = S , Z [ 1 ] = T ; for ( var db = 0 ; db < Z . length ; db ++ ) { var eb = Z [ db ] ; if ( h ( W , eb , H ) , g . squaredLength ( W ) < ( o + n ) * ( o + n ) ) { if ( m ) return ! 0 ; var cb = this . createContactEquation ( I , r , b , f ) ; return g . copy ( cb . ni , W ) , g . normalize ( cb . ni , cb . ni ) , g . scale ( cb . ri , cb . ni , o ) , i ( cb . ri , cb . ri , H ) , h ( cb . ri , cb . ri , I . position ) , h ( cb . rj , eb , G ) , g . scale ( Y , cb . ni , - n ) , i ( cb . rj , cb . rj , Y ) , i ( cb . rj , cb . rj , G ) , h ( cb . rj , cb . rj , r . position ) , this . contactEquations . push ( cb ) , this . enableFriction && this . frictionEquations . push ( this . createFrictionFromContact ( cb ) ) , 1 } } return 0 } , c . prototype [ o . CIRCLE | o . CAPSULE ] = c . prototype . circleCapsule = function ( a , b , c , d , e , f , g , h , i ) { return this . circleLine ( a , b , c , d , e , f , g , h , i , f . radius ) } , c . prototype [ o . CIRCLE | o . CONVEX ] = c . prototype [ o . CIRCLE | o . RECTANGLE ] = c . prototype . circleConvex = function ( a , b , c , d , e , j , k , l , m , n ) { var o = j , p = l , q = e , r = k , x = c , y = a , z = b , n = "number" == typeof n ? n : z . radius , A = s , D = t , I = u , J = v , K = w , L = B , M = C , N = E , O = F , P = G , Q = H , R = ! 1 , S = Number . MAX _VALUE ; verts = o . vertices ; for ( var T = 0 ; T !== verts . length + 1 ; T ++ ) { var U = verts [ T % verts . length ] , V = verts [ ( T + 1 ) % verts . length ] ; if ( g . rotate ( A , U , p ) , g . rotate ( D , V , p ) , i ( A , A , r ) , i ( D , D , r ) , h ( I , D , A ) , g . normalize ( J , I ) , g . rotate ( K , J , - Math . PI / 2 ) , g . scale ( O , K , - z . radius ) , i ( O , O , x ) , f ( O , o , r , p ) ) { g . sub ( P , A , O ) ; var W = Math . abs ( g . dot ( P , K ) ) ; S > W && ( g . copy ( Q , O ) , S = W , g . scale ( N , K , W ) , g . add ( N , N , O ) , R = ! 0 ) } } if ( R ) { if ( m ) return ! 0 ; var X = this . createContactEquation ( y , q , b , j ) ; return g . sub ( X . ni , Q , x ) , g . normalize ( X . ni , X . ni ) , g . scale ( X . ri , X . ni , n ) , i ( X . ri , X . ri , x ) , h ( X . ri , X . ri , y . position ) , h ( X . rj , N , r ) , i ( X . rj , X . rj , r ) , h ( X . rj , X . rj , q . position ) , this . contactEquations . push ( X ) , this . enableFriction && this . frictionEquations . push ( this . createFrictionFromContact ( X ) ) , 1 } if ( n > 0 ) for ( var T = 0 ; T < verts . length ; T ++ ) { var Y = verts [ T ] ; if ( g . rotate ( M , Y , p ) , i ( M , M , r ) , h ( L , M , x ) , g . squaredLength ( L ) < n * n ) { if ( m ) return ! 0 ; var X = this . createContactEquation ( y , q , b , j ) ; return g . copy ( X . ni , L ) , g . normalize ( X . ni , X . ni ) , g . scale ( X . ri , X . ni , n ) , i ( X . ri , X . ri , x ) , h ( X . ri , X . ri , y . position ) , h ( X . rj , M , r ) , i ( X . rj , X . rj , r ) , h ( X . rj , X . rj , q . position ) , this . contactEquations . push ( X ) , this . enableFriction && this . frictionEquations . push ( this . createFrictionFromContact ( X ) ) , 1 } } return 0 } ; var Q = g . create ( ) , R = g . create ( ) , S = g . create ( ) , T = g . create ( ) ; c . prototype [ o . PARTICLE | o . CONVEX ] = c . prototype [ o . PARTICLE | o . RECTANGLE ] = c . prototype . particleConvex = function ( a , b , c , d , e , k , l , m , n ) { var o = k , p = m , q = e , r = l , z = c , A = a , C = s , D = t , F = u , G = v , H = w , K = x , L = y , M = B , N = E , O = I , P = J , Q = Number . MAX _VALUE , R = ! 1 , S = o . vertices ; if ( ! f ( z , o , r , p ) ) return 0 ; if ( n ) return ! 0 ; for ( var T = 0 ; T !== S . length + 1 ; T ++ ) { var U = S [ T % S . length ] , V = S [ ( T + 1 ) % S . length ] ; g . rotate ( C , U , p ) , g . rotate ( D , V , p ) , i ( C , C , r ) , i ( D , D , r ) , h ( F , D , C ) , g . normalize ( G , F ) , g . rotate ( H , G , - Math . PI / 2 ) , h ( M , z , C ) ; { j ( M , H ) } h ( K , C , r ) , h ( L , z , r ) , g . sub ( O , C , z ) ; var W = Math . abs ( g . dot ( O , H ) ) ; Q > W && ( Q = W , g . scale ( N , H , W ) , g . add ( N , N , z ) , g . copy ( P , H ) , R = ! 0 ) } if ( R ) { var X = this . createContactEquation ( A , q , b , k ) ; return g . scale ( X . ni , P , - 1 ) , g . normalize ( X . ni , X . ni ) , g . set ( X . ri , 0 , 0 ) , i ( X . ri , X . ri , z ) , h ( X . ri , X . ri , A . position ) , h ( X . rj , N , r ) , i ( X . rj , X . rj , r ) , h ( X . rj , X . rj , q . position ) , this . contactEquations . push ( X ) , this . enableFriction && this . frictionEquations . push ( this . createFrictionFromContact ( X ) ) , 1 } return 0 } , c . prototype [ o . CIRCLE ] = c . prototype . circleCircle = function ( a , b , c , d , e , f , j , k , l , m , n ) { var o = a , p = b , q = c , r = e , t = f , u = j , v = s , m = m || p . radius , n = n || t . radius ; h ( v , c , j ) ; var w = m + n ; if ( g . squaredLength ( v ) > w * w ) return 0 ; if ( l ) return ! 0 ; var x = this . createContactEquation ( o , r , b , f ) ; return h ( x . ni , u , q ) , g . normalize ( x . ni , x . ni ) , g . scale ( x . ri , x . ni , m ) , g . scale ( x . rj , x . ni , - n ) , i ( x . ri , x . ri , q ) , h ( x . ri , x . ri , o . position ) , i ( x . rj , x . rj , u ) , h ( x . rj , x . rj , r . position ) , this . contactEquations . push ( x ) , this . enableFriction && this . frictionEquations . push ( this . createFrictionFromContact ( x ) ) , 1 } , c . prototype [ o . PLANE | o . CONVEX ] = c . prototype [ o . PLANE | o . RECTANGLE ] = c . prototype . planeConvex = function ( a , b , c , d , e , f , k , l , m ) { var n = e , o = k , p = f , q = l , v = a , w = b , x = c , y = d , z = s , A = t , B = u , C = 0 ; g . rotate ( A , r , y ) ; for ( var D = 0 ; D < p . vertices . length ; D ++ ) { var E = p . vertices [ D ] ; if ( g . rotate ( z , E , q ) , i ( z , z , o ) , h ( B , z , x ) , j ( B , A ) < 0 ) { if ( m ) return ! 0 ; C ++ ; var F = this . createContactEquation ( v , n , w , p ) ; h ( B , z , x ) , g . copy ( F . ni , A ) ; var G = j ( B , F . ni ) ; if ( g . scale ( B , F . ni , G ) , h ( F . rj , z , n . position ) , h ( F . ri , z , B ) , h ( F . ri , F . ri , v . position ) , this . contactEquations . push ( F ) , this . enableFriction && this . frictionEquations . push ( this . createFrictionFromContact
} var d = a ( "./Material" ) ; b . exports = c , c . idCounter = 0 } , { "./Material" : 30 } ] , 30 : [ function ( a , b ) { function c ( ) { this . id = c . idCounter ++ } b . exports = c , c . idCounter = 0 } , { } ] , 31 : [ function ( a , b ) { var c = a ( "../../node_modules/gl-matrix/src/gl-matrix/mat2" ) . mat2 ; b . exports = c } , { "../../node_modules/gl-matrix/src/gl-matrix/mat2" : 1 } ] , 32 : [ function ( a , b ) { var c = { } ; c . GetArea = function ( a ) { if ( a . length < 6 ) return 0 ; for ( var b = a . length - 2 , c = 0 , d = 0 ; b > d ; d += 2 ) c += ( a [ d + 2 ] - a [ d ] ) * ( a [ d + 1 ] + a [ d + 3 ] ) ; return c += ( a [ 0 ] - a [ b ] ) * ( a [ b + 1 ] + a [ 1 ] ) , . 5 * - c } , c . Triangulate = function ( a ) { var b = a . length >> 1 ; if ( 3 > b ) return [ ] ; for ( var d = [ ] , e = [ ] , f = 0 ; b > f ; f ++ ) e . push ( f ) ; for ( var f = 0 , g = b ; g > 3 ; ) { var h = e [ ( f + 0 ) % g ] , i = e [ ( f + 1 ) % g ] , j = e [ ( f + 2 ) % g ] , k = a [ 2 * h ] , l = a [ 2 * h + 1 ] , m = a [ 2 * i ] , n = a [ 2 * i + 1 ] , o = a [ 2 * j ] , p = a [ 2 * j + 1 ] , q = ! 1 ; if ( c . _convex ( k , l , m , n , o , p ) ) { q = ! 0 ; for ( var r = 0 ; g > r ; r ++ ) { var s = e [ r ] ; if ( s != h && s != i && s != j && c . _PointInTriangle ( a [ 2 * s ] , a [ 2 * s + 1 ] , k , l , m , n , o , p ) ) { q = ! 1 ; break } } } if ( q ) d . push ( h , i , j ) , e . splice ( ( f + 1 ) % g , 1 ) , g -- , f = 0 ; else if ( f ++ > 3 * g ) break } return d . push ( e [ 0 ] , e [ 1 ] , e [ 2 ] ) , d } , c . _PointInTriangle = function ( a , b , c , d , e , f , g , h ) { var i = g - c , j = h - d , k = e - c , l = f - d , m = a - c , n = b - d , o = i * i + j * j , p = i * k + j * l , q = i * m + j * n , r = k * k + l * l , s = k * m + l * n , t = 1 / ( o * r - p * p ) , u = ( r * q - p * s ) * t , v = ( o * s - p * q ) * t ; return u >= 0 && v >= 0 && 1 > u + v } , c . _convex = function ( a , b , c , d , e , f ) { return ( b - d ) * ( e - c ) + ( c - a ) * ( f - d ) >= 0 } , b . exports = c } , { } ] , 33 : [ function ( a , b ) { var c = a ( "../../node_modules/gl-matrix/src/gl-matrix/vec2" ) . vec2 ; c . getX = function ( a ) { return a [ 0 ] } , c . getY = function ( a ) { return a [ 1 ] } , c . crossLength = function ( a , b ) { return a [ 0 ] * b [ 1 ] - a [ 1 ] * b [ 0 ] } , c . crossVZ = function ( a , b , d ) { return c . rotate ( a , b , - Math . PI / 2 ) , c . scale ( a , a , d ) , a } , c . crossZV = function ( a , b , d ) { return c . rotate ( a , d , Math . PI / 2 ) , c . scale ( a , a , b ) , a } , c . rotate = function ( a , b , c ) { var d = Math . cos ( c ) , e = Math . sin ( c ) , f = b [ 0 ] , g = b [ 1 ] ; a [ 0 ] = d * f - e * g , a [ 1 ] = e * f + d * g } , c . toLocalFrame = function ( a , b , d , e ) { c . copy ( a , b ) , c . sub ( a , a , d ) , c . rotate ( a , a , - e ) } , c . toGlobalFrame = function ( a , b , d , e ) { c . copy ( a , b ) , c . rotate ( a , a , e ) , c . add ( a , a , d ) } , c . centroid = function ( a , b , d , e ) { return c . add ( a , b , d ) , c . add ( a , a , e ) , c . scale ( a , a , 1 / 3 ) , a } , b . exports = c } , { "../../node_modules/gl-matrix/src/gl-matrix/vec2" : 2 } ] , 34 : [ function ( a , b ) { function c ( a ) { a = a || { } , h . call ( this ) , this . id = ++ c . _idCounter , this . world = null , this . shapes = [ ] , this . shapeOffsets = [ ] , this . shapeAngles = [ ] , this . mass = a . mass || 0 , this . invMass = 0 , this . inertia = 0 , this . invInertia = 0 , this . fixedRotation = ! ! a . fixedRotation || ! 1 , this . position = d . fromValues ( 0 , 0 ) , a . position && d . copy ( this . position , a . position ) , this . interpolatedPosition = d . fromValues ( 0 , 0 ) , this . velocity = d . fromValues ( 0 , 0 ) , a . velocity && d . copy ( this . velocity , a . velocity ) , this . vlambda = d . fromValues ( 0 , 0 ) , this . wlambda = 0 , this . angle = a . angle || 0 , this . angularVelocity = a . angularVelocity || 0 , this . force = d . create ( ) , a . force && d . copy ( this . force , a . force ) , this . angularForce = a . angularForce || 0 , this . damping = "number" == typeof a . damping ? a . damping : . 1 , this . angularDamping = "number" == typeof a . angularDamping ? a . angularDamping : . 1 , this . motionState = 0 == this . mass ? c . STATIC : c . DYNAMIC , this . boundingRadius = 0 , this . aabb = new g , this . aabbNeedsUpdate = ! 0 , this . allowSleep = ! 1 , this . sleepState = c . AWAKE , this . sleepSpeedLimit = . 1 , this . sleepTimeLimit = 1 , this . gravityScale = 1 , this . timeLastSleepy = 0 , this . concavePath = null , this . lastDampingScale = 1 , this . lastAngularDampingScale = 1 , this . lastDampingTimeStep = - 1 , this . updateMassProperties ( ) } var d = a ( "../math/vec2" ) , e = a ( "poly-decomp" ) , f = a ( "../shapes/Convex" ) , g = a ( "../collision/AABB" ) , h = a ( "../events/EventEmitter" ) ; b . exports = c , c . prototype = new h , c . _idCounter = 0 , c . prototype . setDensity = function ( a ) { var b = this . getArea ( ) ; this . mass = b * a , this . updateMassProperties ( ) } , c . prototype . getArea = function ( ) { for ( var a = 0 , b = 0 ; b < this . shapes . length ; b ++ ) a += this . shapes [ b ] . area ; return a } ; var i = new g , j = d . create ( ) ; c . prototype . updateAABB = function ( ) { for ( var a = this . shapes , b = this . shapeOffsets , c = this . shapeAngles , e = a . length , f = 0 ; f !== e ; f ++ ) { var g = a [ f ] , h = j , k = c [ f ] + this . angle ; d . rotate ( h , b [ f ] , this . angle ) , d . add ( h , h , this . position ) , g . computeAABB ( i , h , k ) , 0 === f ? this . aabb . copy ( i ) : this . aabb . extend ( i ) } this . aabbNeedsUpdate = ! 1 } , c . prototype . updateBoundingRadius = function ( ) { for ( var a = this . shapes , b = this . shapeOffsets , c = a . length , e = 0 , f = 0 ; f !== c ; f ++ ) { var g = a [ f ] , h = d . length ( b [ f ] ) , i = g . boundingRadius ; h + i > e && ( e = h + i ) } this . boundingRadius = e } , c . prototype . addShape = function ( a , b
2014-03-18 00:01:39 +00:00
a . fixedRotation || ( a . angularVelocity += a . angularForce * a . invInertia * b , a . angle += a . angularVelocity * b ) , f . scale ( E , d , b * c ) , f . add ( g , E , g ) , f . scale ( F , g , b ) , f . add ( e , e , F ) , a . aabbNeedsUpdate = ! 0 } , c . prototype . runNarrowphase = function ( a , b , c , d , e , g , h , i , j , k , l ) { if ( 0 !== ( c . collisionGroup & h . collisionMask ) && 0 !== ( h . collisionGroup & c . collisionMask ) ) { f . rotate ( C , d , b . angle ) , f . rotate ( D , i , g . angle ) , f . add ( C , C , b . position ) , f . add ( D , D , g . position ) ; var m = e + b . angle , n = j + g . angle ; a . enableFriction = k . friction > 0 , a . frictionCoefficient = k . friction ; var p ; p = b . motionState == o . STATIC || b . motionState == o . KINEMATIC ? g . mass : g . motionState == o . STATIC || g . motionState == o . KINEMATIC ? b . mass : b . mass * g . mass / ( b . mass + g . mass ) , a . slipForce = k . friction * l * p , a . restitution = k . restitution , a . surfaceVelocity = k . surfaceVelocity , a . frictionStiffness = k . frictionStiffness , a . frictionRelaxation = k . frictionRelaxation , a . stiffness = k . stiffness , a . relaxation = k . relaxation ; var q = a [ c . type | h . type ] , r = 0 ; if ( q ) { var s = c . sensor || h . sensor ; if ( r = c . type < h . type ? q . call ( a , b , c , C , m , g , h , D , n , s ) : q . call ( a , g , h , D , n , b , c , C , m , s ) ) { var t = c . id < h . id ? c . id + " " + h . id : h . id + " " + c . id ; if ( ! this . overlappingShapesLastState [ t ] ) { var u = this . beginContactEvent ; if ( u . shapeA = c , u . shapeB = h , u . bodyA = b , u . bodyB = g , "number" == typeof r ) { u . contactEquations . length = 0 ; for ( var v = a . contactEquations . length - r ; v < a . contactEquations . length ; v ++ ) u . contactEquations . push ( a . contactEquations [ v ] ) } this . emit ( u ) } var w = this . overlappingShapesCurrentState ; w [ t ] || ( w [ t ] = ! 0 , w . keys . push ( t ) , w [ t + "_shapeA" ] = c , w . keys . push ( t + "_shapeA" ) , w [ t + "_shapeB" ] = h , w . keys . push ( t + "_shapeB" ) , w [ t + "_bodyA" ] = b , w . keys . push ( t + "_bodyA" ) , w [ t + "_bodyB" ] = g , w . keys . push ( t + "_bodyB" ) ) } } } } , c . prototype . addSpring = function ( a ) { this . springs . push ( a ) , this . addSpringEvent . spring = a , this . emit ( this . addSpringEvent ) } , c . prototype . removeSpring = function ( a ) { var b = this . springs . indexOf ( a ) ; - 1 === b && y . splice ( this . springs , b , 1 ) } , c . prototype . addBody = function ( a ) { if ( a . world ) throw new Error ( "This body is already added to a World." ) ; this . bodies . push ( a ) , a . world = this , this . addBodyEvent . body = a , this . emit ( this . addBodyEvent ) } , c . prototype . removeBody = function ( a ) { if ( a . world !== this ) throw new Error ( "The body was never added to this World, cannot remove it." ) ; a . world = null ; var b = this . bodies . indexOf ( a ) ; - 1 !== b && ( y . splice ( this . bodies , b , 1 ) , this . removeBodyEvent . body = a , a . resetConstraintVelocity ( ) , this . emit ( this . removeBodyEvent ) ) } , c . prototype . getBodyById = function ( a ) { for ( var b = this . bodies , c = 0 ; c < b . length ; c ++ ) { var d = b [ c ] ; if ( d . id === a ) return d } return ! 1 } , c . prototype . toJSON = function ( ) { function a ( a ) { return a ? [ a [ 0 ] , a [ 1 ] ] : a } for ( var b = { p2 : z , bodies : [ ] , springs : [ ] , solver : { } , gravity : a ( this . gravity ) , broadphase : { } , constraints : [ ] , contactMaterials : [ ] } , c = 0 ; c !== this . springs . length ; c ++ ) { var d = this . springs [ c ] ; b . springs . push ( { bodyA : this . bodies . indexOf ( d . bodyA ) , bodyB : this . bodies . indexOf ( d . bodyB ) , stiffness : d . stiffness , damping : d . damping , restLength : d . restLength , localAnchorA : a ( d . localAnchorA ) , localAnchorB : a ( d . localAnchorB ) } ) } for ( var c = 0 ; c < this . constraints . length ; c ++ ) { var e = this . constraints [ c ] , f = { bodyA : this . bodies . indexOf ( e . bodyA ) , bodyB : this . bodies . indexOf ( e . bodyB ) } ; if ( e instanceof s ) f . type = "DistanceConstraint" , f . distance = e . distance , f . maxForce = e . getMaxForce ( ) ; else if ( e instanceof u ) f . type = "RevoluteConstraint" , f . pivotA = a ( e . pivotA ) , f . pivotB = a ( e . pivotB ) , f . maxForce = e . maxForce , f . motorSpeed = e . getMotorSpeed ( ) , f . lowerLimit = e . lowerLimit , f . lowerLimitEnabled = e . lowerLimitEnabled , f . upperLimit = e . upperLimit , f . upperLimitEnabled = e . upperLimitEnabled ; else if ( e instanceof v ) f . type = "PrismaticConstraint" , f . localAxisA = a ( e . localAxisA ) , f . localAnchorA = a ( e . localAnchorA ) , f . localAnchorB = a ( e . localAnchorB ) , f . maxForce = e . maxForce ; else { if ( ! ( e instanceof t ) ) { console . error ( "Constraint not supported yet!" ) ; continue } f . type = "LockConstraint" , f . localOffsetB = a ( e . localOffsetB ) , f . localAngleB = e . localAngleB , f . maxForce = e . maxForce } b . constraints . push ( f ) } for ( var c = 0 ; c !== this . bodies . length ; c ++ ) { for ( var n = this . bodies [ c ] , o = n . shapes , p = [ ] , q = 0 ; q < o . length ; q ++ ) { var r , d = o [ q ] ; if ( d instanceof g ) r = { type : "Circle" , radius : d . radius } ; else if ( d instanceof k ) r = { type : "Plane" } ; else if ( d instanceof m ) r = { type : "Particle" } ; else if ( d instanceof j ) r = { type : "Line" , length : d . length } ; else if ( d instanceof h ) r =
2014-03-18 18:36:46 +00:00
var h = this . data . fromPolygon ( c , a ) ; return this . shapeChanged ( ) , h } , removeShape : function ( a ) { return this . data . removeShape ( a ) } , setCircle : function ( a , b , c , d ) { this . clearShapes ( ) , this . addCircle ( a , b , c , d ) } , setRectangle : function ( a , b , c , d , e ) { return "undefined" == typeof a && ( a = 16 ) , "undefined" == typeof b && ( b = 16 ) , this . clearShapes ( ) , this . addRectangle ( a , b , c , d , e ) } , setRectangleFromSprite : function ( a ) { return "undefined" == typeof a && ( a = this . sprite ) , this . clearShapes ( ) , this . addRectangle ( a . width , a . height , 0 , 0 , a . rotation ) } , setMaterial : function ( a , b ) { if ( "undefined" == typeof b ) for ( var c = this . data . shapes . length - 1 ; c >= 0 ; c -- ) this . data . shapes [ c ] . material = a ; else b . material = a } , shapeChanged : function ( ) { this . debugBody && this . debugBody . draw ( ) } , loadPolygon : function ( a , b , c ) { var d = this . game . cache . getPhysicsData ( a , b ) ; if ( 1 === d . length ) { var e = [ ] ; d = d . pop ( ) ; for ( var f = 0 , g = d . shape . length ; g > f ; f += 2 ) e . push ( [ d . shape [ f ] , d . shape [ f + 1 ] ] ) ; return this . addPolygon ( c , e ) } for ( var h = p2 . vec2 . create ( ) , f = 0 ; f < d . length ; f ++ ) { for ( var i = [ ] , j = 0 ; j < d [ f ] . shape . length ; j += 2 ) i . push ( [ this . world . pxmi ( d [ f ] . shape [ j ] ) , this . world . pxmi ( d [ f ] . shape [ j + 1 ] ) ] ) ; for ( var k = new p2 . Convex ( i ) , l = 0 ; l !== k . vertices . length ; l ++ ) { var m = k . vertices [ l ] ; p2 . vec2 . sub ( m , m , k . centerOfMass ) } p2 . vec2 . scale ( h , k . centerOfMass , 1 ) , h [ 0 ] -= this . world . pxmi ( this . sprite . width / 2 ) , h [ 1 ] -= this . world . pxmi ( this . sprite . height / 2 ) , k . updateTriangles ( ) , k . updateCenterOfMass ( ) , k . updateBoundingRadius ( ) , this . data . addShape ( k , h ) } return this . data . aabbNeedsUpdate = ! 0 , this . shapeChanged ( ) , ! 0 } , loadData : function ( a , b , c ) { var d = this . game . cache . getPhysicsData ( a , b ) ; d && d . shape && ( this . mass = d . density , this . loadPolygon ( a , b , c ) ) } } , Phaser . Physics . P2 . Body . prototype . constructor = Phaser . Physics . P2 . Body , Phaser . Physics . P2 . Body . DYNAMIC = 1 , Phaser . Physics . P2 . Body . STATIC = 2 , Phaser . Physics . P2 . Body . KINEMATIC = 4 , Object . defineProperty ( Phaser . Physics . P2 . Body . prototype , "static" , { get : function ( ) { return this . data . motionState === Phaser . Physics . P2 . STATIC } , set : function ( a ) { a && this . data . motionState !== Phaser . Physics . P2 . STATIC ? ( this . data . motionState = Phaser . Physics . P2 . STATIC , this . mass = 0 ) : a || this . data . motionState !== Phaser . Physics . P2 . STATIC || ( this . data . motionState = Phaser . Physics . P2 . DYNAMIC , 0 === this . mass && ( this . mass = 1 ) ) } } ) , Object . defineProperty ( Phaser . Physics . P2 . Body . prototype , "dynamic" , { get : function ( ) { return this . data . motionState === Phaser . Physics . P2 . DYNAMIC } , set : function ( a ) { a && this . data . motionState !== Phaser . Physics . P2 . DYNAMIC ? ( this . data . motionState = Phaser . Physics . P2 . DYNAMIC , 0 === this . mass && ( this . mass = 1 ) ) : a || this . data . motionState !== Phaser . Physics . P2 . DYNAMIC || ( this . data . motionState = Phaser . Physics . P2 . STATIC , this . mass = 0 ) } } ) , Object . defineProperty ( Phaser . Physics . P2 . Body . prototype , "kinematic" , { get : function ( ) { return this . data . motionState === Phaser . Physics . P2 . KINEMATIC } , set : function ( a ) { a && this . data . motionState !== Phaser . Physics . P2 . KINEMATIC ? ( this . data . motionState = Phaser . Physics . P2 . KINEMATIC , this . mass = 4 ) : a || this . data . motionState !== Phaser . Physics . P2 . KINEMATIC || ( this . data . motionState = Phaser . Physics . P2 . STATIC , this . mass = 0 ) } } ) , Object . defineProperty ( Phaser . Physics . P2 . Body . prototype , "allowSleep" , { get : function ( ) { return this . data . allowSleep } , set : function ( a ) { a !== this . data . allowSleep && ( this . data . allowSleep = a ) } } ) , Object . defineProperty ( Phaser . Physics . P2 . Body . prototype , "angle" , { get : function ( ) { return Phaser . Math . wrapAngle ( Phaser . Math . radToDeg ( this . data . angle ) ) } , set : function ( a ) { this . data . angle = Phaser . Math . degToRad ( Phaser . Math . wrapAngle ( a ) ) } } ) , Object . defineProperty ( Phaser . Physics . P2 . Body . prototype , "angularDamping" , { get : function ( ) { return this . data . angularDamping } , set : function ( a ) { this . data . angularDamping = a } } ) , Object . defineProperty ( Phaser . Physics . P2 . Body . prototype , "angularForce" , { get : function ( ) { return this . data . angularForce } , set : function ( a ) { this . data . angularForce = a } } ) , Object . defineProperty ( Phaser . Physics . P2 . Body . prototype , "angularVelocity" , { get : function ( ) { return this . data . angularVelocity } , set : function ( a ) { this . data . angularVelocity = a } } ) , Object . defineProperty ( Phaser . Physics . P2 . Body . prototype , "damping" , { get : function ( ) { return this . data . damping } , set : function ( a ) { this . data . damping = a } } ) , Object . defineProperty ( Phaser . Physics . P2 . Body . prototype , "fixedRotation" , { get : function ( ) {
2014-02-28 09:30:53 +00:00
//# sourceMappingURL=phaser.map