2014-02-11 13:23:54 +00:00
/*! Phaser v1.1.5 | (c) 2014 Photon Storm Ltd. */
! function ( a , b ) { "function" == typeof define && define . amd ? define ( b ) : "object" == typeof exports ? module . exports = b ( ) : a . Phaser = b ( ) } ( this , function ( ) { ! function ( a ) { "object" == typeof exports ? module . exports = a ( ) : "function" == typeof define && define . amd ? define ( a ) : "undefined" != typeof window ? window . p2 = a ( ) : "undefined" != typeof global ? self . p2 = a ( ) : "undefined" != typeof self && ( self . p2 = a ( ) ) } ( function ( ) { return function a ( b , c , d ) { function e ( g , h ) { if ( ! c [ g ] ) { if ( ! b [ g ] ) { var i = "function" == typeof require && require ; if ( ! h && i ) return i ( g , ! 0 ) ; if ( f ) return f ( g , ! 0 ) ; throw new Error ( "Cannot find module '" + g + "'" ) } var j = c [ g ] = { exports : { } } ; b [ g ] [ 0 ] . call ( j . exports , function ( a ) { var c = b [ g ] [ 1 ] [ a ] ; return e ( c ? c : a ) } , j , j . exports , a , b , c , d ) } return c [ g ] . exports } for ( var f = "function" == typeof require && require , g = 0 ; g < d . length ; g ++ ) e ( d [ g ] ) ; return e } ( { 1 : [ function ( a , b , c ) { var d = { } , e = new Float32Array ( [ 1 , 0 , 0 , 1 ] ) ; if ( ! f ) var f = 1e-6 ; d . create = function ( ) { return new Float32Array ( e ) } , d . clone = function ( a ) { var b = new Float32Array ( 4 ) ; return b [ 0 ] = a [ 0 ] , b [ 1 ] = a [ 1 ] , b [ 2 ] = a [ 2 ] , b [ 3 ] = a [ 3 ] , b } , d . copy = function ( a , b ) { return a [ 0 ] = b [ 0 ] , a [ 1 ] = b [ 1 ] , a [ 2 ] = b [ 2 ] , a [ 3 ] = b [ 3 ] , a } , d . identity = function ( a ) { return a [ 0 ] = 1 , a [ 1 ] = 0 , a [ 2 ] = 0 , a [ 3 ] = 1 , a } , d . transpose = function ( a , b ) { if ( a === b ) { var c = b [ 1 ] ; a [ 1 ] = b [ 2 ] , a [ 2 ] = c } else a [ 0 ] = b [ 0 ] , a [ 1 ] = b [ 2 ] , a [ 2 ] = b [ 1 ] , a [ 3 ] = b [ 3 ] ; return a } , d . invert = function ( a , b ) { var c = b [ 0 ] , d = b [ 1 ] , e = b [ 2 ] , f = b [ 3 ] , g = c * f - e * d ; return g ? ( g = 1 / g , a [ 0 ] = f * g , a [ 1 ] = - d * g , a [ 2 ] = - e * g , a [ 3 ] = c * g , a ) : null } , d . adjoint = function ( a , b ) { var c = b [ 0 ] ; return a [ 0 ] = b [ 3 ] , a [ 1 ] = - b [ 1 ] , a [ 2 ] = - b [ 2 ] , a [ 3 ] = c , a } , d . determinant = function ( a ) { return a [ 0 ] * a [ 3 ] - a [ 2 ] * a [ 1 ] } , d . multiply = function ( a , b , c ) { var d = b [ 0 ] , e = b [ 1 ] , f = b [ 2 ] , g = b [ 3 ] , h = c [ 0 ] , i = c [ 1 ] , j = c [ 2 ] , k = c [ 3 ] ; return a [ 0 ] = d * h + e * j , a [ 1 ] = d * i + e * k , a [ 2 ] = f * h + g * j , a [ 3 ] = f * i + g * k , a } , d . mul = d . multiply , d . rotate = function ( a , b , c ) { var d = b [ 0 ] , e = b [ 1 ] , f = b [ 2 ] , g = b [ 3 ] , h = Math . sin ( c ) , i = Math . cos ( c ) ; return a [ 0 ] = d * i + e * h , a [ 1 ] = d * - h + e * i , a [ 2 ] = f * i + g * h , a [ 3 ] = f * - h + g * i , a } , d . scale = function ( a , b , c ) { var d = b [ 0 ] , e = b [ 1 ] , f = b [ 2 ] , g = b [ 3 ] , h = c [ 0 ] , i = c [ 1 ] ; return a [ 0 ] = d * h , a [ 1 ] = e * i , a [ 2 ] = f * h , a [ 3 ] = g * i , a } , d . str = function ( a ) { return "mat2(" + a [ 0 ] + ", " + a [ 1 ] + ", " + a [ 2 ] + ", " + a [ 3 ] + ")" } , "undefined" != typeof c && ( c . mat2 = d ) } , { } ] , 2 : [ function ( a , b , c ) { var d = { } ; if ( ! e ) var e = 1e-6 ; d . create = function ( ) { return new Float32Array ( 2 ) } , d . clone = function ( a ) { var b = new Float32Array ( 2 ) ; return b [ 0 ] = a [ 0 ] , b [ 1 ] = a [ 1 ] , b } , d . fromValues = function ( a , b ) { var c = new Float32Array ( 2 ) ; return c [ 0 ] = a , c [ 1 ] = b , c } , d . copy = function ( a , b ) { return a [ 0 ] = b [ 0 ] , a [ 1 ] = b [ 1 ] , a } , d . set = function ( a , b , c ) { return a [ 0 ] = b , a [ 1 ] = c , a } , d . add = function ( a , b , c ) { return a [ 0 ] = b [ 0 ] + c [ 0 ] , a [ 1 ] = b [ 1 ] + c [ 1 ] , a } , d . subtract = function ( a , b , c ) { return a [ 0 ] = b [ 0 ] - c [ 0 ] , a [ 1 ] = b [ 1 ] - c [ 1 ] , a } , d . sub = d . subtract , d . multiply = function ( a , b , c ) { return a [ 0 ] = b [ 0 ] * c [ 0 ] , a [ 1 ] = b [ 1 ] * c [ 1 ] , a } , d . mul = d . multiply , d . divide = function ( a , b , c ) { return a [ 0 ] = b [ 0 ] / c [ 0 ] , a [ 1 ] = b [ 1 ] / c [ 1 ] , a } , d . div = d . divide , d . min = function ( a , b , c ) { return a [ 0 ] = Math . min ( b [ 0 ] , c [ 0 ] ) , a [ 1 ] = Math . min ( b [ 1 ] , c [ 1 ] ) , a } , d . max = function ( a , b , c ) { return a [ 0 ] = Math . max ( b [ 0 ] , c [ 0 ] ) , a [ 1 ] = Math . max ( b [ 1 ] , c [ 1 ] ) , a } , d . scale = function ( a , b , c ) { return a [ 0 ] = b [ 0 ] * c , a [ 1 ] = b [ 1 ] * c , a } , d . distance = function ( a , b ) { var c = b [ 0 ] - a [ 0 ] , d = b [ 1 ] - a [ 1 ] ; return Math . sqrt ( c * c + d * d ) } , d . dist = d . distance , d . squaredDistance = function ( a , b ) { var c = b [ 0 ] - a [ 0 ] , d = b [ 1 ] - a [ 1 ] ; return c * c + d * d } , d . sqrDist = d . squaredDistance , d . length = function ( a ) { var b = a [ 0 ] , c = a [ 1 ] ; return Math . sqrt ( b * b + c * c ) } , d . len = d . length , d . squaredLength = function ( a ) { var b = a [ 0 ] , c = a [ 1 ] ; return b * b + c * c } , d . sqrLen = d . squaredLength , d . negate = function ( a , b ) { return a [ 0 ] = - b [ 0 ] , a [ 1 ] = - b [ 1 ] , a } , d . normalize = function ( a , b ) { var c = b [ 0 ] , d = b [ 1 ] , e = c * c + d * d ; return e > 0 && ( e = 1 / Math . sqrt ( e ) , a [ 0 ] = b [ 0 ] * e , a [ 1 ] = b [ 1 ] * e ) , a } , d . dot = function ( a , b ) { return a [ 0 ] * b [ 0 ] + a [ 1 ] * b [ 1 ] } , d . cross = function ( a , b , c ) { var d = b [ 0 ] * c [ 1 ] - b [ 1 ] * c [ 0 ] ; return a [ 0 ] = a [ 1 ] = 0 , a [ 2 ] = d , a } , d . lerp = function ( a , b , c , d ) { var e = b [ 0 ] , f = b [ 1 ] ; return a [ 0 ] = e + d * ( c [ 0 ] - e ) , a [ 1 ] = f + d * ( c [ 1 ] - f ) , a } , d . transformMat2 = function ( a , b , c ) { var d = b [ 0 ] , e = b [ 1 ] ; return a [ 0 ] = d * c [ 0 ] + e * c [ 1 ] , a [ 1 ] = d * c [ 2 ] + e * c [ 3 ] , a } , d . forEach = function ( ) { var a = new Float32Array ( 2 ) ; return function ( b , c , d , e , f , g ) { var h , i ; for ( c || ( c = 2 ) , d || ( d = 0 ) , i = e ? Math . min ( e * c + d , b . length ) : b . length , h = d ; i > h ; h += c ) a [ 0 ] = b [ h ] , a [ 1 ] = b [ h + 1 ] , f ( a , a , g ) , b [ h ] = a [ 0 ] , b [ h + 1 ] = a [ 1 ] ; return b } } ( ) , d . str = function ( a ) { return "vec2(" + a [ 0 ] + ", " + a [ 1 ] + ")" } , "undefined" != typeof c && ( c . vec2 =
2014-02-14 18:07:17 +00:00
return this . nodes [ b ] . retrieve ( a ) } return this . children } , d . prototype . findIndex = function ( a ) { var b = this . bounds , c = a . position [ 0 ] - a . boundingRadius > b . x + b . width / 2 ? ! 1 : ! 0 , e = a . position [ 1 ] - a . boundingRadius > b . y + b . height / 2 ? ! 1 : ! 0 ; a instanceof f && ( c = e = ! 1 ) ; var g = d . TOP _LEFT ; return c ? e || ( g = d . BOTTOM _LEFT ) : g = e ? d . TOP _RIGHT : d . BOTTOM _RIGHT , g } , d . prototype . subdivide = function ( ) { var a = this . depth + 1 , b = this . bounds . x , c = this . bounds . y , e = this . bounds . width / 2 , f = this . bounds . height / 2 , g = b + e , h = c + f ; this . nodes [ d . TOP _LEFT ] = new this . classConstructor ( { x : b , y : c , width : e , height : f } , a ) , this . nodes [ d . TOP _RIGHT ] = new this . classConstructor ( { x : g , y : c , width : e , height : f } , a ) , this . nodes [ d . BOTTOM _LEFT ] = new this . classConstructor ( { x : b , y : h , width : e , height : f } , a ) , this . nodes [ d . BOTTOM _RIGHT ] = new this . classConstructor ( { x : g , y : h , width : e , height : f } , a ) } , d . prototype . clear = function ( ) { this . children . length = 0 ; for ( var a = this . nodes . length , b = 0 ; a > b ; b ++ ) this . nodes [ b ] . clear ( ) ; this . nodes . length = 0 } , e . prototype = new d , e . prototype . classConstructor = e , e . prototype . stuckChildren = null , e . prototype . out = [ ] , e . prototype . insert = function ( a ) { if ( this . nodes . length ) { var b = this . findIndex ( a ) , c = this . nodes [ b ] ; return ! ( a instanceof f ) && a . position [ 0 ] - a . boundingRadius >= c . bounds . x && a . position [ 0 ] + a . boundingRadius <= c . bounds . x + c . bounds . width && a . position [ 1 ] - a . boundingRadius >= c . bounds . y && a . position [ 1 ] + a . boundingRadius <= c . bounds . y + c . bounds . height ? this . nodes [ b ] . insert ( a ) : this . stuckChildren . push ( a ) , void 0 } this . children . push ( a ) ; var d = this . children . length ; if ( this . depth < this . maxDepth && d > this . maxChildren ) { this . subdivide ( ) ; for ( var e = 0 ; d > e ; e ++ ) this . insert ( this . children [ e ] ) ; this . children . length = 0 } } , e . prototype . getChildren = function ( ) { return this . children . concat ( this . stuckChildren ) } , e . prototype . retrieve = function ( a ) { var b = this . out ; if ( b . length = 0 , this . nodes . length ) { var c = this . findIndex ( a ) ; b . push . apply ( b , this . nodes [ c ] . retrieve ( a ) ) } return b . push . apply ( b , this . stuckChildren ) , b . push . apply ( b , this . children ) , b } , e . prototype . clear = function ( ) { this . stuckChildren . length = 0 , this . children . length = 0 ; var a = this . nodes . length ; if ( a ) { for ( var b = 0 ; a > b ; b ++ ) this . nodes [ b ] . clear ( ) ; this . nodes . length = 0 } } } , { "../collision/Broadphase" : 10 , "../shapes/Plane" : 42 } ] , 15 : [ function ( a , b ) { function c ( ) { e . apply ( this ) , this . axisList = [ ] , this . world = null , this . axisIndex = 0 ; var a = this . axisList ; this . _addBodyHandler = function ( b ) { a . push ( b . body ) } , this . _removeBodyHandler = function ( b ) { var c = a . indexOf ( b . body ) ; - 1 !== c && a . splice ( c , 1 ) } } var d = ( a ( "../shapes/Circle" ) , a ( "../shapes/Plane" ) , a ( "../shapes/Shape" ) , a ( "../shapes/Particle" ) , a ( "../utils/Utils" ) ) , e = a ( "../collision/Broadphase" ) ; a ( "../math/vec2" ) , b . exports = c , c . prototype = new e , c . prototype . setWorld = function ( a ) { this . axisList . length = 0 , d . appendArray ( this . axisList , a . bodies ) , a . off ( "addBody" , this . _addBodyHandler ) . off ( "removeBody" , this . _removeBodyHandler ) , a . on ( "addBody" , this . _addBodyHandler ) . on ( "removeBody" , this . _removeBodyHandler ) , this . world = a } , c . sortAxisListX = function ( a , b ) { return a . position [ 0 ] - a . boundingRadius - ( b . position [ 0 ] - b . boundingRadius ) } , c . sortAxisListY = function ( a , b ) { return a . position [ 1 ] - a . boundingRadius - ( b . position [ 1 ] - b . boundingRadius ) } , c . prototype . getCollisionPairs = function ( ) { var a , b , d = this . axisList , f = this . result , g = this . axisIndex ; for ( f . length = 0 , d . sort ( 0 === g ? c . sortAxisListX : c . sortAxisListY ) , a = 0 , N = d . length ; a !== N ; a ++ ) { var h = d [ a ] ; for ( b = a + 1 ; N > b ; b ++ ) { var i = d [ b ] ; if ( ! c . checkBounds ( h , i , g ) ) break ; e . boundingRadiusCheck ( h , i ) && f . push ( h , i ) } } return f } , c . checkBounds = function ( a , b , c ) { var d = a . position [ c ] , e = a . boundingRadius , f = b . position [ c ] , g = b . boundingRadius , h = d + e , i = f - g ; return h > i } } , { "../collision/Broadphase" : 10 , "../math/vec2" : 33 , "../shapes/Circle" : 38 , "../shapes/Particle" : 41 , "../shapes/Plane" : 42 , "../shapes/Shape" : 44 , "../utils/Utils" : 49 } ] , 16 : [ function ( a , b ) { function c ( a , b ) { this . equations = [ ] , this . bodyA = a , this . bodyB = b , a && a . wakeUp ( ) , b && b . wakeUp ( ) } b . exports = c } , { } ] , 17 : [ function ( a , b ) { function c ( a , b , c , g ) { d . call ( this , a , b ) , this . distance = c , "undefined" == typeof g && ( g = Number . MAX _VALUE ) ; var h = new e ( a , b , - g , g ) ; this . equations = [ h ] ; var i = f . create ( ) ; h . computeGq = function ( ) { return f . sub ( i , b . position , a . position ) , f . length ( i ) - c } , this . setMaxForce ( g ) } var d = a ( "./Constraint" ) , e = a ( "../equations/Equation" ) , f = a ( "../math/vec2" )
return a * b * b / 2 } , c . prototype . updateBoundingRadius = function ( ) { this . boundingRadius = this . radius } , c . prototype . updateArea = function ( ) { this . area = Math . PI * this . radius * this . radius } , c . prototype . computeAABB = function ( a , b ) { var c = this . radius ; e . set ( a . upperBound , c , c ) , e . set ( a . lowerBound , - c , - c ) , b && ( e . add ( a . lowerBound , a . lowerBound , b ) , e . add ( a . upperBound , a . upperBound , b ) ) } } , { "../math/vec2" : 33 , "./Shape" : 44 } ] , 39 : [ function ( a , b ) { function c ( a ) { this . vertices = a || [ ] ; for ( var b = 0 ; b < this . vertices . length ; b ++ ) { var c = e . fromValues ( ) ; e . copy ( c , this . vertices [ b ] ) , this . vertices [ b ] = c } this . centerOfMass = e . fromValues ( 0 , 0 ) , this . triangles = [ ] , this . vertices . length && ( this . updateTriangles ( ) , this . updateCenterOfMass ( ) ) , this . boundingRadius = 0 , this . updateBoundingRadius ( ) , d . call ( this , d . CONVEX ) } var d = a ( "./Shape" ) , e = a ( "../math/vec2" ) , f = a ( "../math/polyk" ) , g = a ( "poly-decomp" ) ; b . exports = c , c . prototype = new d , c . prototype . updateTriangles = function ( ) { this . triangles . length = 0 ; for ( var a = [ ] , b = 0 ; b < this . vertices . length ; b ++ ) { var c = this . vertices [ b ] ; a . push ( c [ 0 ] , c [ 1 ] ) } for ( var d = f . Triangulate ( a ) , b = 0 ; b < d . length ; b += 3 ) { var e = d [ b ] , g = d [ b + 1 ] , h = d [ b + 2 ] ; this . triangles . push ( [ e , g , h ] ) } } ; { var h = e . create ( ) , i = e . create ( ) , j = e . create ( ) , k = e . create ( ) , l = e . create ( ) ; e . create ( ) , e . create ( ) , e . create ( ) , e . create ( ) } c . prototype . updateCenterOfMass = function ( ) { var a = this . triangles , b = this . vertices , c = this . centerOfMass , d = h , f = j , m = k , n = l , o = i ; e . set ( c , 0 , 0 ) ; for ( var p = 0 , q = 0 ; q !== a . length ; q ++ ) { var r = a [ q ] , f = b [ r [ 0 ] ] , m = b [ r [ 1 ] ] , n = b [ r [ 2 ] ] ; e . centroid ( d , f , m , n ) ; var s = g . Point . area ( f , m , n ) ; p += s , e . scale ( o , d , s ) , e . add ( c , c , o ) } e . scale ( c , c , 1 / p ) } , c . prototype . computeMomentOfInertia = function ( a ) { for ( var b = 0 , c = [ ] , d = 0 ; d < this . vertices . length ; d ++ ) { var h = this . vertices [ d ] ; c . push ( h [ 0 ] , h [ 1 ] ) } var i = f . Triangulate ( c ) ; f . GetArea ( c ) , this . updateArea ( ) ; var j = a / this . area , k = e . create ( ) , l = e . create ( ) , m = e . create ( ) , n = e . create ( ) , o = ( e . create ( ) , e . create ( ) , e . create ( ) ) , p = e . create ( ) ; e . create ( ) ; for ( var d = 0 ; d < i . length ; d += 3 ) { var q = i [ d ] , r = i [ d + 1 ] , s = i [ d + 2 ] ; e . set ( k , c [ 2 * q ] , c [ 2 * q + 1 ] ) , e . set ( l , c [ 2 * r ] , c [ 2 * r + 1 ] ) , e . set ( m , c [ 2 * s ] , c [ 2 * s + 1 ] ) , e . centroid ( n , k , l , m ) , e . sub ( o , m , k ) , e . sub ( p , m , l ) ; var t = g . Point . area ( k , l , m ) , u = e . length ( o ) , v = 2 * t / u , w = t * j , x = w * u * Math . pow ( v , 3 ) / 36 , y = e . squaredLength ( n ) ; b += x + w * y } return b } , c . prototype . updateBoundingRadius = function ( ) { for ( var a = this . vertices , b = 0 , c = 0 ; c !== a . length ; c ++ ) { var d = e . squaredLength ( a [ c ] ) ; d > b && ( b = d ) } this . boundingRadius = Math . sqrt ( b ) } , c . prototype . updateArea = function ( ) { this . updateTriangles ( ) , this . area = 0 ; for ( var a = this . triangles , b = this . vertices , c = 0 ; c !== a . length ; c ++ ) { var d = a [ c ] , e = b [ d [ 0 ] ] , f = b [ d [ 1 ] ] , h = b [ d [ 2 ] ] , i = g . Point . area ( e , f , h ) ; this . area += i } } , c . prototype . computeAABB = function ( a , b , c ) { a . setFromPoints ( this . vertices , b , c ) } } , { "../math/polyk" : 32 , "../math/vec2" : 33 , "./Shape" : 44 , "poly-decomp" : 7 } ] , 40 : [ function ( a , b ) { function c ( a ) { this . length = a , d . call ( this , d . LINE ) } var d = a ( "./Shape" ) , e = a ( "../math/vec2" ) ; b . exports = c , c . prototype = new d , c . prototype . computeMomentOfInertia = function ( a ) { return a * Math . pow ( this . length , 2 ) / 12 } , c . prototype . updateBoundingRadius = function ( ) { this . boundingRadius = this . length / 2 } ; var f = [ e . create ( ) , e . create ( ) ] ; c . prototype . computeAABB = function ( a , b , c ) { var d = this . length ; e . set ( f [ 0 ] , - d / 2 , 0 ) , e . set ( f [ 1 ] , d / 2 , 0 ) , a . setFromPoints ( f , b , c ) } } , { "../math/vec2" : 33 , "./Shape" : 44 } ] , 41 : [ function ( a , b ) { function c ( ) { d . call ( this , d . PARTICLE ) } var d = a ( "./Shape" ) ; b . exports = c , c . prototype = new d , c . prototype . computeMomentOfInertia = function ( ) { return 0 } , c . prototype . updateBoundingRadius = function ( ) { this . boundingRadius = 0 } , c . prototype . computeAABB = function ( a , b ) { this . length , vec2 . copy ( a . lowerBound , b ) , vec2 . copy ( a . upperBound , b ) } } , { "./Shape" : 44 } ] , 42 : [ function ( a , b ) { function c ( ) { d . call ( this , d . PLANE ) } var d = a ( "./Shape" ) , e = a ( "../math/vec2" ) ; a ( "../utils/Utils" ) , b . exports = c , c . prototype = new d , c . prototype . computeMomentOfInertia = function ( ) { return 0 } , c . prototype . updateBoundingRadius = function ( ) { this . boundingRadius = Number . MAX _VALUE } , c . prototype . computeAABB = function ( a , b , c ) { var d = 0 , f = e . set ; "number" == typeof c && ( d = c % ( 2 * Math . PI ) ) , 0 == d ? ( f ( a . lowerBound , - Number . MAX _VALUE , - Number . MAX _VALUE ) , f ( a . upperBound , Number . MAX _VALUE , 0 ) ) : d == Math . PI / 2 ? ( f ( a . lowerBound , 0 , - Number . MAX _VALUE ) , f ( a . upperBound , Number . MAX _VALUE , Number . MAX _VALUE ) ) : d == Math . PI ? ( f ( a . lowerBound , -
} , multiply : function ( a , b ) { return this . x *= a , this . y *= b , this } , divide : function ( a , b ) { return this . x /= a , this . y /= b , this } , clampX : function ( a , c ) { return this . x = b . Math . clamp ( this . x , a , c ) , this } , clampY : function ( a , c ) { return this . y = b . Math . clamp ( this . y , a , c ) , this } , clamp : function ( a , c ) { return this . x = b . Math . clamp ( this . x , a , c ) , this . y = b . Math . clamp ( this . y , a , c ) , this } , clone : function ( a ) { return "undefined" == typeof a ? a = new b . Point ( this . x , this . y ) : a . setTo ( this . x , this . y ) , a } , copyTo : function ( a ) { return a . x = this . x , a . y = this . y , a } , distance : function ( a , c ) { return b . Point . distance ( this , a , c ) } , equals : function ( a ) { return a . x == this . x && a . y == this . y } , rotate : function ( a , c , d , e , f ) { return b . Point . rotate ( this , a , c , d , e , f ) } , getMagnitude : function ( ) { return Math . sqrt ( this . x * this . x + this . y * this . y ) } , setMagnitude : function ( a ) { return this . normalize ( ) . multiply ( a , a ) } , normalize : function ( ) { if ( ! this . isZero ( ) ) { var a = this . getMagnitude ( ) ; this . x /= a , this . y /= a } return this } , isZero : function ( ) { return 0 === this . x && 0 === this . y } , toString : function ( ) { return "[{Point (x=" + this . x + " y=" + this . y + ")}]" } } , b . Point . prototype . constructor = b . Point , b . Point . add = function ( a , c , d ) { return "undefined" == typeof d && ( d = new b . Point ) , d . x = a . x + c . x , d . y = a . y + c . y , d } , b . Point . subtract = function ( a , c , d ) { return "undefined" == typeof d && ( d = new b . Point ) , d . x = a . x - c . x , d . y = a . y - c . y , d } , b . Point . multiply = function ( a , c , d ) { return "undefined" == typeof d && ( d = new b . Point ) , d . x = a . x * c . x , d . y = a . y * c . y , d } , b . Point . divide = function ( a , c , d ) { return "undefined" == typeof d && ( d = new b . Point ) , d . x = a . x / c . x , d . y = a . y / c . y , d } , b . Point . equals = function ( a , b ) { return a . x == b . x && a . y == b . y } , b . Point . distance = function ( a , c , d ) { return "undefined" == typeof d && ( d = ! 1 ) , d ? b . Math . distanceRound ( a . x , a . y , c . x , c . y ) : b . Math . distance ( a . x , a . y , c . x , c . y ) } , b . Point . rotate = function ( a , c , d , e , f , g ) { return f = f || ! 1 , g = g || null , f && ( e = b . Math . degToRad ( e ) ) , null === g && ( g = Math . sqrt ( ( c - a . x ) * ( c - a . x ) + ( d - a . y ) * ( d - a . y ) ) ) , a . setTo ( c + g * Math . cos ( e ) , d + g * Math . sin ( e ) ) } , a . Point = b . Point , b . Rectangle = function ( a , b , c , d ) { a = a || 0 , b = b || 0 , c = c || 0 , d = d || 0 , this . x = a , this . y = b , this . width = c , this . height = d } , b . Rectangle . prototype = { offset : function ( a , b ) { return this . x += a , this . y += b , this } , offsetPoint : function ( a ) { return this . offset ( a . x , a . y ) } , setTo : function ( a , b , c , d ) { return this . x = a , this . y = b , this . width = c , this . height = d , this } , floor : function ( ) { this . x = Math . floor ( this . x ) , this . y = Math . floor ( this . y ) } , floorAll : function ( ) { this . x = Math . floor ( this . x ) , this . y = Math . floor ( this . y ) , this . width = Math . floor ( this . width ) , this . height = Math . floor ( this . height ) } , copyFrom : function ( a ) { return this . setTo ( a . x , a . y , a . width , a . height ) } , copyTo : function ( a ) { return a . x = this . x , a . y = this . y , a . width = this . width , a . height = this . height , a } , inflate : function ( a , c ) { return b . Rectangle . inflate ( this , a , c ) } , size : function ( a ) { return b . Rectangle . size ( this , a ) } , clone : function ( a ) { return b . Rectangle . clone ( this , a ) } , contains : function ( a , c ) { return b . Rectangle . contains ( this , a , c ) } , containsRect : function ( a ) { return b . Rectangle . containsRect ( this , a ) } , equals : function ( a ) { return b . Rectangle . equals ( this , a ) } , intersection : function ( a , c ) { return b . Rectangle . intersection ( this , a , c ) } , intersects : function ( a , c ) { return b . Rectangle . intersects ( this , a , c ) } , intersectsRaw : function ( a , c , d , e , f ) { return b . Rectangle . intersectsRaw ( this , a , c , d , e , f ) } , union : function ( a , c ) { return b . Rectangle . union ( this , a , c ) } , toString : function ( ) { return "[{Rectangle (x=" + this . x + " y=" + this . y + " width=" + this . width + " height=" + this . height + " empty=" + this . empty + ")}]" } , get halfWidth ( ) { return Math . round ( this . width / 2 ) } , get halfHeight ( ) { return Math . round ( this . height / 2 ) } , get bottom ( ) { return this . y + this . height } , set bottom ( a ) { this . height = a <= this . y ? 0 : this . y - a } , get bottomRight ( ) { return new b . Point ( this . right , this . bottom ) } , set bottomRight ( a ) { this . right = a . x , this . bottom = a . y } , get left ( ) { return this . x } , set left ( a ) { this . width = a >= this . right ? 0 : this . right - a , this . x = a } , get right ( ) { return this . x + this . width } , set right ( a ) { this . width = a <= this . x ? 0 : this . x + a } , get volume ( ) { return this . width * this . height } , get perimeter ( ) { return 2 * this . width + 2 * this . height } , get centerX ( ) { return this . x + this . halfWidth } , set centerX ( a ) { this . x = a - this . halfWidth } , get centerY ( ) { return this . y + this . halfHeight } , set centerY ( a ) { this . y = a - this . halfHeight } , get top ( ) { return this . y } , set top ( a ) { a >= thi
} , a . PixiShader . prototype . init = function ( ) { var b = this . gl , c = a . compileProgram ( b , this . vertexSrc || a . PixiShader . defaultVertexSrc , this . fragmentSrc ) ; b . useProgram ( c ) , this . uSampler = b . getUniformLocation ( c , "uSampler" ) , this . projectionVector = b . getUniformLocation ( c , "projectionVector" ) , this . offsetVector = b . getUniformLocation ( c , "offsetVector" ) , this . dimensions = b . getUniformLocation ( c , "dimensions" ) , this . aVertexPosition = b . getAttribLocation ( c , "aVertexPosition" ) , this . aTextureCoord = b . getAttribLocation ( c , "aTextureCoord" ) , this . colorAttribute = b . getAttribLocation ( c , "aColor" ) , - 1 === this . colorAttribute && ( this . colorAttribute = 2 ) , this . attributes = [ this . aVertexPosition , this . aTextureCoord , this . colorAttribute ] ; for ( var d in this . uniforms ) this . uniforms [ d ] . uniformLocation = b . getUniformLocation ( c , d ) ; this . initUniforms ( ) , this . program = c } , a . PixiShader . prototype . initUniforms = function ( ) { this . textureCount = 1 ; var a , b = this . gl ; for ( var c in this . uniforms ) { a = this . uniforms [ c ] ; var d = a . type ; "sampler2D" === d ? ( a . _init = ! 1 , null !== a . value && this . initSampler2D ( a ) ) : "mat2" === d || "mat3" === d || "mat4" === d ? ( a . glMatrix = ! 0 , a . glValueLength = 1 , "mat2" === d ? a . glFunc = b . uniformMatrix2fv : "mat3" === d ? a . glFunc = b . uniformMatrix3fv : "mat4" === d && ( a . glFunc = b . uniformMatrix4fv ) ) : ( a . glFunc = b [ "uniform" + d ] , a . glValueLength = "2f" === d || "2i" === d ? 2 : "3f" === d || "3i" === d ? 3 : "4f" === d || "4i" === d ? 4 : 1 ) } } , a . PixiShader . prototype . initSampler2D = function ( a ) { if ( a . value && a . value . baseTexture && a . value . baseTexture . hasLoaded ) { var b = this . gl ; if ( b . activeTexture ( b [ "TEXTURE" + this . textureCount ] ) , b . bindTexture ( b . TEXTURE _2D , a . value . baseTexture . _glTexture ) , a . textureData ) { var c = a . textureData , d = c . magFilter ? c . magFilter : b . LINEAR , e = c . minFilter ? c . minFilter : b . LINEAR , f = c . wrapS ? c . wrapS : b . CLAMP _TO _EDGE , g = c . wrapT ? c . wrapT : b . CLAMP _TO _EDGE , h = c . luminance ? b . LUMINANCE : b . RGBA ; if ( c . repeat && ( f = b . REPEAT , g = b . REPEAT ) , b . pixelStorei ( b . UNPACK _FLIP _Y _WEBGL , ! ! c . flipY ) , c . width ) { var i = c . width ? c . width : 512 , j = c . height ? c . height : 2 , k = c . border ? c . border : 0 ; b . texImage2D ( b . TEXTURE _2D , 0 , h , i , j , k , h , b . UNSIGNED _BYTE , null ) } else b . texImage2D ( b . TEXTURE _2D , 0 , h , b . RGBA , b . UNSIGNED _BYTE , a . value . baseTexture . source ) ; b . texParameteri ( b . TEXTURE _2D , b . TEXTURE _MAG _FILTER , d ) , b . texParameteri ( b . TEXTURE _2D , b . TEXTURE _MIN _FILTER , e ) , b . texParameteri ( b . TEXTURE _2D , b . TEXTURE _WRAP _S , f ) , b . texParameteri ( b . TEXTURE _2D , b . TEXTURE _WRAP _T , g ) } b . uniform1i ( a . uniformLocation , this . textureCount ) , a . _init = ! 0 , this . textureCount ++ } } , a . PixiShader . prototype . syncUniforms = function ( ) { this . textureCount = 1 ; var b , c = this . gl ; for ( var d in this . uniforms ) b = this . uniforms [ d ] , 1 === b . glValueLength ? b . glMatrix === ! 0 ? b . glFunc . call ( c , b . uniformLocation , b . transpose , b . value ) : b . glFunc . call ( c , b . uniformLocation , b . value ) : 2 === b . glValueLength ? b . glFunc . call ( c , b . uniformLocation , b . value . x , b . value . y ) : 3 === b . glValueLength ? b . glFunc . call ( c , b . uniformLocation , b . value . x , b . value . y , b . value . z ) : 4 === b . glValueLength ? b . glFunc . call ( c , b . uniformLocation , b . value . x , b . value . y , b . value . z , b . value . w ) : "sampler2D" === b . type && ( b . _init ? ( c . activeTexture ( c [ "TEXTURE" + this . textureCount ] ) , c . bindTexture ( c . TEXTURE _2D , b . value . baseTexture . _glTextures [ c . id ] || a . createWebGLTexture ( b . value . baseTexture , c ) ) , c . uniform1i ( b . uniformLocation , this . textureCount ) , this . textureCount ++ ) : this . initSampler2D ( b ) ) } , a . PixiShader . prototype . destroy = function ( ) { this . gl . deleteProgram ( this . program ) , this . uniforms = null , this . gl = null , this . attributes = null } , a . PixiShader . defaultVertexSrc = [ "attribute vec2 aVertexPosition;" , "attribute vec2 aTextureCoord;" , "attribute vec2 aColor;" , "uniform vec2 projectionVector;" , "uniform vec2 offsetVector;" , "varying vec2 vTextureCoord;" , "varying vec4 vColor;" , "const vec2 center = vec2(-1.0, 1.0);" , "void main(void) {" , " gl_Position = vec4( ((aVertexPosition + offsetVector) / projectionVector) + center , 0.0, 1.0);" , " vTextureCoord = aTextureCoord;" , " vec3 color = mod(vec3(aColor.y/65536.0, aColor.y/256.0, aColor.y), 256.0) / 256.0;" , " vColor = vec4(color * aColor.x, aColor.x);" , "}" ] , a . PixiFastShader = function ( a ) { this . gl = a , this . program = null , this . fragmentSrc = [ "precision lowp float;" , "varying vec2 vTextureCoord;" , "varying float vColor;" , "uniform sampler2D uSampler;" , "void main(void) {" , " gl _FragColor = texture2D ( uSampl
} } , a . WebGLFastSpriteBatch . prototype . stop = function ( ) { this . flush ( ) } , a . WebGLFastSpriteBatch . prototype . start = function ( ) { var b = this . gl ; b . activeTexture ( b . TEXTURE0 ) , b . bindBuffer ( b . ARRAY _BUFFER , this . vertexBuffer ) , b . bindBuffer ( b . ELEMENT _ARRAY _BUFFER , this . indexBuffer ) ; var c = this . renderSession . projection ; b . uniform2f ( this . shader . projectionVector , c . x , c . y ) , b . uniformMatrix3fv ( this . shader . uMatrix , ! 1 , this . matrix ) ; var d = 4 * this . vertSize ; b . vertexAttribPointer ( this . shader . aVertexPosition , 2 , b . FLOAT , ! 1 , d , 0 ) , b . vertexAttribPointer ( this . shader . aPositionCoord , 2 , b . FLOAT , ! 1 , d , 8 ) , b . vertexAttribPointer ( this . shader . aScale , 2 , b . FLOAT , ! 1 , d , 16 ) , b . vertexAttribPointer ( this . shader . aRotation , 1 , b . FLOAT , ! 1 , d , 24 ) , b . vertexAttribPointer ( this . shader . aTextureCoord , 2 , b . FLOAT , ! 1 , d , 28 ) , b . vertexAttribPointer ( this . shader . colorAttribute , 1 , b . FLOAT , ! 1 , d , 36 ) , this . currentBlendMode !== a . blendModes . NORMAL && this . setBlendMode ( a . blendModes . NORMAL ) } , a . WebGLFastSpriteBatch . prototype . setBlendMode = function ( b ) { this . flush ( ) , this . currentBlendMode = b ; var c = a . blendModesWebGL [ this . currentBlendMode ] ; this . gl . blendFunc ( c [ 0 ] , c [ 1 ] ) } , a . WebGLFilterManager = function ( a , b ) { this . transparent = b , this . filterStack = [ ] , this . offsetX = 0 , this . offsetY = 0 , this . setContext ( a ) } , a . WebGLFilterManager . prototype . setContext = function ( a ) { this . gl = a , this . texturePool = [ ] , this . initShaderBuffers ( ) } , a . WebGLFilterManager . prototype . begin = function ( a , b ) { this . renderSession = a , this . defaultShader = a . shaderManager . defaultShader ; var c = this . renderSession . projection ; this . width = 2 * c . x , this . height = 2 * - c . y , this . buffer = b } , a . WebGLFilterManager . prototype . pushFilter = function ( b ) { var c = this . gl , d = this . renderSession . projection , e = this . renderSession . offset ; this . filterStack . push ( b ) ; var f = b . filterPasses [ 0 ] ; this . offsetX += b . target . filterArea . x , this . offsetY += b . target . filterArea . y ; var g = this . texturePool . pop ( ) ; g ? g . resize ( this . width , this . height ) : g = new a . FilterTexture ( this . gl , this . width , this . height ) , c . bindTexture ( c . TEXTURE _2D , g . texture ) , b . target . filterArea = b . target . getBounds ( ) ; var h = b . target . filterArea , i = f . padding ; h . x -= i , h . y -= i , h . width += 2 * i , h . height += 2 * i , h . x < 0 && ( h . x = 0 ) , h . width > this . width && ( h . width = this . width ) , h . y < 0 && ( h . y = 0 ) , h . height > this . height && ( h . height = this . height ) , c . bindFramebuffer ( c . FRAMEBUFFER , g . frameBuffer ) , c . viewport ( 0 , 0 , h . width , h . height ) , d . x = h . width / 2 , d . y = - h . height / 2 , e . x = - h . x , e . y = - h . y , c . uniform2f ( this . defaultShader . projectionVector , h . width / 2 , - h . height / 2 ) , c . uniform2f ( this . defaultShader . offsetVector , - h . x , - h . y ) , c . colorMask ( ! 0 , ! 0 , ! 0 , ! 0 ) , c . clearColor ( 0 , 0 , 0 , 0 ) , c . clear ( c . COLOR _BUFFER _BIT ) , b . _glFilterTexture = g } , a . WebGLFilterManager . prototype . popFilter = function ( ) { var b = this . gl , c = this . filterStack . pop ( ) , d = c . target . filterArea , e = c . _glFilterTexture , f = this . renderSession . projection , g = this . renderSession . offset ; if ( c . filterPasses . length > 1 ) { b . viewport ( 0 , 0 , d . width , d . height ) , b . bindBuffer ( b . ARRAY _BUFFER , this . vertexBuffer ) , this . vertexArray [ 0 ] = 0 , this . vertexArray [ 1 ] = d . height , this . vertexArray [ 2 ] = d . width , this . vertexArray [ 3 ] = d . height , this . vertexArray [ 4 ] = 0 , this . vertexArray [ 5 ] = 0 , this . vertexArray [ 6 ] = d . width , this . vertexArray [ 7 ] = 0 , b . bufferSubData ( b . ARRAY _BUFFER , 0 , this . vertexArray ) , b . bindBuffer ( b . ARRAY _BUFFER , this . uvBuffer ) , this . uvArray [ 2 ] = d . width / this . width , this . uvArray [ 5 ] = d . height / this . height , this . uvArray [ 6 ] = d . width / this . width , this . uvArray [ 7 ] = d . height / this . height , b . bufferSubData ( b . ARRAY _BUFFER , 0 , this . uvArray ) ; var h = e , i = this . texturePool . pop ( ) ; i || ( i = new a . FilterTexture ( this . gl , this . width , this . height ) ) , b . bindFramebuffer ( b . FRAMEBUFFER , i . frameBuffer ) , b . clear ( b . COLOR _BUFFER _BIT ) , b . disable ( b . BLEND ) ; for ( var j = 0 ; j < c . filterPasses . length - 1 ; j ++ ) { var k = c . filterPasses [ j ] ; b . bindFramebuffer ( b . FRAMEBUFFER , i . frameBuffer ) , b . activeTexture ( b . TEXTURE0 ) , b . bindTexture ( b . TEXTURE _2D , h . texture ) , this . applyFilterPass ( k , d , d . width , d . height ) ; var l = h ; h = i , i = l } b . enable ( b . BLEND ) , e = h , this . texturePool . push ( i ) } var m = c . filterPasses [ c . filterPasses . length - 1 ] ; this . offsetX -= d . x , this . offsetY -= d . y ; var n = this . width , o = this . height , p = 0 , q = 0 , r = this . buffer ; if ( 0 === this . filterStack . length ) b . colorMask ( ! 0 , ! 0 , ! 0 , this . transparent ) ; else { var s = this . filterStack [ this . filterStack . length - 1 ] ; d = s . target . filterArea , n = d . width , o = d . height , p = d . x , q = d . y , r = s . _glFilter
2014-02-15 01:36:07 +00:00
} , a . Texture . fromFrame = function ( b ) { var c = a . TextureCache [ b ] ; if ( ! c ) throw new Error ( 'The frameId "' + b + '" does not exist in the texture cache ' ) ; return c } , a . Texture . fromCanvas = function ( b , c ) { var d = a . BaseTexture . fromCanvas ( b , c ) ; return new a . Texture ( d ) } , a . Texture . addTextureToCache = function ( b , c ) { a . TextureCache [ c ] = b } , a . Texture . removeTextureFromCache = function ( b ) { var c = a . TextureCache [ b ] ; return a . TextureCache [ b ] = null , c } , a . Texture . frameUpdates = [ ] , a . TextureUvs = function ( ) { this . x0 = 0 , this . y0 = 0 , this . x1 = 0 , this . y1 = 0 , this . x2 = 0 , this . y2 = 0 , this . x3 = 0 , this . y4 = 0 } , a . RenderTexture = function ( b , c , d ) { if ( a . EventTarget . call ( this ) , this . width = b || 100 , this . height = c || 100 , this . frame = new a . Rectangle ( 0 , 0 , this . width , this . height ) , this . baseTexture = new a . BaseTexture , this . baseTexture . width = this . width , this . baseTexture . height = this . height , this . baseTexture . _glTextures = [ ] , this . baseTexture . hasLoaded = ! 0 , this . renderer = d || a . defaultRenderer , this . renderer . type === a . WEBGL _RENDERER ) { var e = this . renderer . gl ; this . textureBuffer = new a . FilterTexture ( e , this . width , this . height ) , this . baseTexture . _glTextures [ e . id ] = this . textureBuffer . texture , this . render = this . renderWebGL , this . projection = new a . Point ( this . width / 2 , - this . height / 2 ) } else this . render = this . renderCanvas , this . textureBuffer = new a . CanvasBuffer ( this . width , this . height ) , this . baseTexture . source = this . textureBuffer . canvas ; a . Texture . frameUpdates . push ( this ) } , a . RenderTexture . prototype = Object . create ( a . Texture . prototype ) , a . RenderTexture . prototype . constructor = a . RenderTexture , a . RenderTexture . prototype . resize = function ( b , c ) { if ( this . width = b , this . height = c , this . frame . width = this . width , this . frame . height = this . height , this . renderer . type === a . WEBGL _RENDERER ) { this . projection . x = this . width / 2 , this . projection . y = - this . height / 2 ; var d = this . renderer . gl ; d . bindTexture ( d . TEXTURE _2D , this . baseTexture . _glTextures [ d . id ] ) , d . texImage2D ( d . TEXTURE _2D , 0 , d . RGBA , this . width , this . height , 0 , d . RGBA , d . UNSIGNED _BYTE , null ) } else this . textureBuffer . resize ( this . width , this . height ) ; a . Texture . frameUpdates . push ( this ) } , a . RenderTexture . prototype . renderWebGL = function ( b , c , d ) { var e = this . renderer . gl ; e . colorMask ( ! 0 , ! 0 , ! 0 , ! 0 ) , e . viewport ( 0 , 0 , this . width , this . height ) , e . bindFramebuffer ( e . FRAMEBUFFER , this . textureBuffer . frameBuffer ) , d && this . textureBuffer . clear ( ) ; var f = b . children , g = b . worldTransform ; b . worldTransform = a . RenderTexture . tempMatrix , b . worldTransform . d = - 1 , b . worldTransform . ty = - 2 * this . projection . y , c && ( b . worldTransform . tx = c . x , b . worldTransform . ty -= c . y ) ; for ( var h = 0 , i = f . length ; i > h ; h ++ ) f [ h ] . updateTransform ( ) ; a . WebGLRenderer . updateTextures ( ) , this . renderer . renderDisplayObject ( b , this . projection , this . textureBuffer . frameBuffer ) , b . worldTransform = g } , a . RenderTexture . prototype . renderCanvas = function ( b , c , d ) { var e = b . children ; b . worldTransform = a . RenderTexture . tempMatrix , c && ( b . worldTransform . tx = c . x , b . worldTransform . ty = c . y ) ; for ( var f = 0 , g = e . length ; g > f ; f ++ ) e [ f ] . updateTransform ( ) ; d && this . textureBuffer . clear ( ) ; var h = this . textureBuffer . context ; this . renderer . renderDisplayObject ( b , h ) , h . setTransform ( 1 , 0 , 0 , 1 , 0 , 0 ) } , a . RenderTexture . tempMatrix = new a . Matrix , b . Camera = function ( a , c , d , e , f , g ) { this . game = a , this . world = a . world , this . id = 0 , this . view = new b . Rectangle ( d , e , f , g ) , this . screenView = new b . Rectangle ( d , e , f , g ) , this . bounds = new b . Rectangle ( d , e , f , g ) , this . deadzone = null , this . visible = ! 0 , this . atLimit = { x : ! 1 , y : ! 1 } , this . target = null , this . _edge = 0 , this . displayObject = null } , b . Camera . FOLLOW _LOCKON = 0 , b . Camera . FOLLOW _PLATFORMER = 1 , b . Camera . FOLLOW _TOPDOWN = 2 , b . Camera . FOLLOW _TOPDOWN _TIGHT = 3 , b . Camera . prototype = { follow : function ( a , c ) { "undefined" == typeof c && ( c = b . Camera . FOLLOW _LOCKON ) , this . target = a ; var d ; switch ( c ) { case b . Camera . FOLLOW _PLATFORMER : var e = this . width / 8 , f = this . height / 3 ; this . deadzone = new b . Rectangle ( ( this . width - e ) / 2 , ( this . height - f ) / 2 - . 25 * f , e , f ) ; break ; case b . Camera . FOLLOW _TOPDOWN : d = Math . max ( this . width , this . height ) / 4 , this . deadzone = new b . Rectangle ( ( this . width - d ) / 2 , ( this . height - d ) / 2 , d , d ) ; break ; case b . Camera . FOLLOW _TOPDOWN _TIGHT : d = Math . max ( this . width , this . height ) / 8 , this . deadzone = new b . Rectangle ( ( this . width - d ) / 2 , ( this . height - d ) / 2 , d , d ) ; break ; case b . Camera . FOLLOW _LOCKON : this . deadzone = null ; break ; default : this . deadzone = null } } , focusOn : function ( a ) { this . setPosition ( Math . round ( a . x - t
} , b . World . prototype . preUpdate = function ( ) { this . currentRenderOrderID = 0 ; for ( var a = this . children . length ; a -- ; ) this . children [ a ] . preUpdate ( ) } , b . World . prototype . update = function ( ) { for ( var a = this . children . length ; a -- ; ) this . children [ a ] . update ( ) } , b . World . prototype . postUpdate = function ( ) { if ( this . game . world . camera . target ) { this . game . world . camera . target . postUpdate ( ) , this . game . world . camera . update ( ) ; for ( var a = this . children . length ; a -- ; ) this . children [ a ] !== this . game . world . camera . target && this . children [ a ] . postUpdate ( ) } else { this . game . world . camera . update ( ) ; for ( var a = this . children . length ; a -- ; ) this . children [ a ] . postUpdate ( ) } } , b . World . prototype . destroy = function ( ) { this . camera . reset ( ) , this . game . input . reset ( ! 0 ) , this . removeAll ( ) } , Object . defineProperty ( b . World . prototype , "width" , { get : function ( ) { return this . bounds . width } , set : function ( a ) { this . bounds . width = a } } ) , Object . defineProperty ( b . World . prototype , "height" , { get : function ( ) { return this . bounds . height } , set : function ( a ) { this . bounds . height = a } } ) , Object . defineProperty ( b . World . prototype , "centerX" , { get : function ( ) { return this . bounds . halfWidth } } ) , Object . defineProperty ( b . World . prototype , "centerY" , { get : function ( ) { return this . bounds . halfHeight } } ) , Object . defineProperty ( b . World . prototype , "randomX" , { get : function ( ) { return this . bounds . x < 0 ? this . game . rnd . integerInRange ( this . bounds . x , this . bounds . width - Math . abs ( this . bounds . x ) ) : this . game . rnd . integerInRange ( this . bounds . x , this . bounds . width ) } } ) , Object . defineProperty ( b . World . prototype , "randomY" , { get : function ( ) { return this . bounds . y < 0 ? this . game . rnd . integerInRange ( this . bounds . y , this . bounds . height - Math . abs ( this . bounds . y ) ) : this . game . rnd . integerInRange ( this . bounds . y , this . bounds . height ) } } ) , b . Game = function ( a , c , d , e , f , g , h ) { this . id = b . GAMES . push ( this ) - 1 , this . config = null , this . parent = "" , this . width = 800 , this . height = 600 , this . transparent = ! 1 , this . antialias = ! 0 , this . renderer = b . AUTO , this . renderType = b . AUTO , this . state = null , this . _paused = ! 1 , this . _loadComplete = ! 1 , this . isBooted = ! 1 , this . isRunning = ! 1 , this . raf = null , this . add = null , this . cache = null , this . input = null , this . load = null , this . math = null , this . net = null , this . scale = null , this . sound = null , this . stage = null , this . time = null , this . tweens = null , this . world = null , this . physics = null , this . rnd = null , this . device = null , this . camera = null , this . canvas = null , this . context = null , this . debug = null , this . particles = null , this . stepping = ! 1 , this . pendingStep = ! 1 , this . stepCount = 0 , 1 === arguments . length && "object" == typeof arguments [ 0 ] ? this . parseConfig ( arguments [ 0 ] ) : ( "undefined" != typeof a && ( this . width = a ) , "undefined" != typeof c && ( this . height = c ) , "undefined" != typeof d && ( this . renderer = d , this . renderType = d ) , "undefined" != typeof e && ( this . parent = e ) , "undefined" != typeof g && ( this . transparent = g ) , "undefined" != typeof h && ( this . antialias = h ) , this . state = new b . StateManager ( this , f ) ) ; var i = this ; return this . _onBoot = function ( ) { return i . boot ( ) } , "complete" === document . readyState || "interactive" === document . readyState ? window . setTimeout ( this . _onBoot , 0 ) : ( document . addEventListener ( "DOMContentLoaded" , this . _onBoot , ! 1 ) , window . addEventListener ( "load" , this . _onBoot , ! 1 ) ) , this } , b . Game . prototype = { parseConfig : function ( a ) { this . config = a , a . width && ( this . width = this . parseDimension ( a . width , 0 ) ) , a . height && ( this . height = this . parseDimension ( a . height , 1 ) ) , a . renderer && ( this . renderer = a . renderer , this . renderType = a . renderer ) , a . parent && ( this . parent = a . parent ) , a . transparent && ( this . transparent = a . transparent ) , a . antialias && ( this . antialias = a . antialias ) ; var c = null ; a . state && ( c = a . state ) , this . state = new b . StateManager ( this , c ) } , parseDimension : function ( a , b ) { var c = 0 , d = 0 ; return "string" == typeof a ? "%" === a . substr ( - 1 ) ? ( c = parseInt ( a , 10 ) / 100 , d = 0 === b ? window . innerWidth * c : window . innerHeight * c ) : d = parseInt ( a , 10 ) : d = a , d } , boot : function ( ) { this . isBooted || ( document . body ? ( document . removeEventListener ( "DOMContentLoaded" , this . _onBoot ) , window . removeEventListener ( "load" , this . _onBoot ) , this . onPause = new b . Signal , this . onResume = new b . Signal , this . isBooted = ! 0 , this . device = new b . Device , this . math = b . Math , this . rnd = new b . RandomDataGenerator ( [ ( Date . now ( ) * Math . random ( ) ) . toString ( ) ] ) , this . stage = new b . Stage ( this , this . width , this . height ) , this . scale = new b . StageScaleMode ( this , this . width , this . height ) , this . setUpRenderer ( ) , this . world = new
} } ) , Object . defineProperty ( b . Pointer . prototype , "worldX" , { get : function ( ) { return this . game . world . camera . x + this . x } } ) , Object . defineProperty ( b . Pointer . prototype , "worldY" , { get : function ( ) { return this . game . world . camera . y + this . y } } ) , b . Touch = function ( a ) { this . game = a , this . disabled = ! 1 , this . callbackContext = this . game , this . touchStartCallback = null , this . touchMoveCallback = null , this . touchEndCallback = null , this . touchEnterCallback = null , this . touchLeaveCallback = null , this . touchCancelCallback = null , this . preventDefault = ! 0 , this . event = null , this . _onTouchStart = null , this . _onTouchMove = null , this . _onTouchEnd = null , this . _onTouchEnter = null , this . _onTouchLeave = null , this . _onTouchCancel = null , this . _onTouchMove = null } , b . Touch . prototype = { start : function ( ) { var a = this ; this . game . device . touch && ( this . _onTouchStart = function ( b ) { return a . onTouchStart ( b ) } , this . _onTouchMove = function ( b ) { return a . onTouchMove ( b ) } , this . _onTouchEnd = function ( b ) { return a . onTouchEnd ( b ) } , this . _onTouchEnter = function ( b ) { return a . onTouchEnter ( b ) } , this . _onTouchLeave = function ( b ) { return a . onTouchLeave ( b ) } , this . _onTouchCancel = function ( b ) { return a . onTouchCancel ( b ) } , this . game . renderer . view . addEventListener ( "touchstart" , this . _onTouchStart , ! 1 ) , this . game . renderer . view . addEventListener ( "touchmove" , this . _onTouchMove , ! 1 ) , this . game . renderer . view . addEventListener ( "touchend" , this . _onTouchEnd , ! 1 ) , this . game . renderer . view . addEventListener ( "touchenter" , this . _onTouchEnter , ! 1 ) , this . game . renderer . view . addEventListener ( "touchleave" , this . _onTouchLeave , ! 1 ) , this . game . renderer . view . addEventListener ( "touchcancel" , this . _onTouchCancel , ! 1 ) ) } , consumeDocumentTouches : function ( ) { this . _documentTouchMove = function ( a ) { a . preventDefault ( ) } , document . addEventListener ( "touchmove" , this . _documentTouchMove , ! 1 ) } , onTouchStart : function ( a ) { if ( this . event = a , this . touchStartCallback && this . touchStartCallback . call ( this . callbackContext , a ) , ! this . game . input . disabled && ! this . disabled ) { this . preventDefault && a . preventDefault ( ) ; for ( var b = 0 ; b < a . changedTouches . length ; b ++ ) this . game . input . startPointer ( a . changedTouches [ b ] ) } } , onTouchCancel : function ( a ) { if ( this . event = a , this . touchCancelCallback && this . touchCancelCallback . call ( this . callbackContext , a ) , ! this . game . input . disabled && ! this . disabled ) { this . preventDefault && a . preventDefault ( ) ; for ( var b = 0 ; b < a . changedTouches . length ; b ++ ) this . game . input . stopPointer ( a . changedTouches [ b ] ) } } , onTouchEnter : function ( a ) { this . event = a , this . touchEnterCallback && this . touchEnterCallback . call ( this . callbackContext , a ) , this . game . input . disabled || this . disabled || this . preventDefault && a . preventDefault ( ) } , onTouchLeave : function ( a ) { this . event = a , this . touchLeaveCallback && this . touchLeaveCallback . call ( this . callbackContext , a ) , this . preventDefault && a . preventDefault ( ) } , onTouchMove : function ( a ) { this . event = a , this . touchMoveCallback && this . touchMoveCallback . call ( this . callbackContext , a ) , this . preventDefault && a . preventDefault ( ) ; for ( var b = 0 ; b < a . changedTouches . length ; b ++ ) this . game . input . updatePointer ( a . changedTouches [ b ] ) } , onTouchEnd : function ( a ) { this . event = a , this . touchEndCallback && this . touchEndCallback . call ( this . callbackContext , a ) , this . preventDefault && a . preventDefault ( ) ; for ( var b = 0 ; b < a . changedTouches . length ; b ++ ) this . game . input . stopPointer ( a . changedTouches [ b ] ) } , stop : function ( ) { this . game . device . touch && ( this . game . canvas . removeEventListener ( "touchstart" , this . _onTouchStart ) , this . game . canvas . removeEventListener ( "touchmove" , this . _onTouchMove ) , this . game . canvas . removeEventListener ( "touchend" , this . _onTouchEnd ) , this . game . canvas . removeEventListener ( "touchenter" , this . _onTouchEnter ) , this . game . canvas . removeEventListener ( "touchleave" , this . _onTouchLeave ) , this . game . canvas . removeEventListener ( "touchcancel" , this . _onTouchCancel ) ) } } , b . Touch . prototype . constructor = b . Touch , b . Gamepad = function ( a ) { this . game = a , this . _gamepads = [ new b . SinglePad ( a , this ) , new b . SinglePad ( a , this ) , new b . SinglePad ( a , this ) , new b . SinglePad ( a , this ) ] , this . _gamepadIndexMap = { } , this . _rawPads = [ ] , this . _active = ! 1 , this . disabled = ! 1 , this . _gamepadSupportAvailable = ! ! navigator . webkitGetGamepads || ! ! navigator . webkitGamepads || - 1 != navigator . userAgent . indexOf ( "Firefox/" ) , this . _prevRawGamepadTypes = [ ] , this . _prevTimestamps = [ ] , this . callbackContext = this , this . onConnectCallb
} , clear : function ( ) { this . context . clearRect ( 0 , 0 , this . width , this . height ) , this . _dirty = ! 0 } , resize : function ( a , b ) { ( a !== this . width || b !== this . height ) && ( console . log ( "bmd resize" , a , b ) , this . width = a , this . height = b , this . canvas . width = a , this . canvas . height = b , this . textureFrame . width = a , this . textureFrame . height = b , this . imageData = this . context . getImageData ( 0 , 0 , a , b ) ) , this . _dirty = ! 0 } , refreshBuffer : function ( ) { this . imageData = this . context . getImageData ( 0 , 0 , this . width , this . height ) , this . pixels = new Int32Array ( this . imageData . data . buffer ) } , setPixel32 : function ( a , b , c , d , e , f ) { a >= 0 && a <= this . width && b >= 0 && b <= this . height && ( this . pixels [ b * this . width + a ] = f << 24 | e << 16 | d << 8 | c , this . context . putImageData ( this . imageData , 0 , 0 ) , this . _dirty = ! 0 ) } , setPixel : function ( a , b , c , d , e ) { this . setPixel32 ( a , b , c , d , e , 255 ) } , getPixel : function ( a , b ) { return a >= 0 && a <= this . width && b >= 0 && b <= this . height ? this . data32 [ b * this . width + a ] : void 0 } , getPixel32 : function ( a , b ) { return a >= 0 && a <= this . width && b >= 0 && b <= this . height ? this . data32 [ b * this . width + a ] : void 0 } , getPixels : function ( a ) { return this . context . getImageData ( a . x , a . y , a . width , a . height ) } , copyPixels : function ( a , b , c , d ) { this . context . drawImage ( a , b . x , b . y , b . width , b . height , c , d , b . width , b . height ) } , render : function ( ) { this . _dirty && ( this . game . renderType == b . WEBGL && a . texturesToUpdate . push ( this . baseTexture ) , this . _dirty = ! 1 ) } } , b . BitmapData . prototype . constructor = b . BitmapData , b . Sprite = function ( c , d , e , f , g ) { d = d || 0 , e = e || 0 , f = f || null , g = g || null , this . game = c , this . name = "" , this . type = b . SPRITE , this . events = new b . Events ( this ) , this . animations = new b . AnimationManager ( this ) , this . key = f , this . _frame = 0 , this . _frameName = "" , a . Sprite . call ( this , a . TextureCache . _ _default ) , this . loadTexture ( f , g ) , this . position . set ( d , e ) , this . world = new b . Point ( d , e ) , this . autoCull = ! 1 , this . input = null , this . body = null , this . health = 1 , this . lifespan = 0 , this . checkWorldBounds = ! 1 , this . outOfBoundsKill = ! 1 , this . debug = ! 1 , this . cameraOffset = new b . Point , this . _cache = new Int16Array ( [ 0 , 0 , 0 , 0 , 1 , 0 , 1 , 0 ] ) , this . _bounds = new b . Rectangle } , b . Sprite . prototype = Object . create ( a . Sprite . prototype ) , b . Sprite . prototype . constructor = b . Sprite , b . Sprite . prototype . preUpdate = function ( ) { if ( 1 === this . _cache [ 4 ] ) return this . world . setTo ( this . parent . position . x + this . position . x , this . parent . position . y + this . position . y ) , this . worldTransform . tx = this . world . x , this . worldTransform . ty = this . world . y , this . _cache [ 0 ] = this . world . x , this . _cache [ 1 ] = this . world . y , this . _cache [ 2 ] = this . rotation , this . _cache [ 4 ] = 0 , ! 1 ; if ( this . _cache [ 0 ] = this . world . x , this . _cache [ 1 ] = this . world . y , this . _cache [ 2 ] = this . rotation , ! this . exists || ! this . parent . exists ) return this . _cache [ 3 ] = - 1 , ! 1 ; if ( this . lifespan > 0 && ( this . lifespan -= this . game . time . elapsed , this . lifespan <= 0 ) ) return this . kill ( ) , ! 1 ; if ( ( this . autoCull || this . checkWorldBounds ) && this . _bounds . copyFrom ( this . getBounds ( ) ) , this . autoCull && ( this . renderable = this . game . world . camera . screenView . intersects ( this . _bounds ) ) , this . checkWorldBounds ) if ( 1 === this . _cache [ 5 ] && this . game . world . bounds . intersects ( this . _bounds ) ) this . _cache [ 5 ] = 0 ; else if ( 0 === this . _cache [ 5 ] && ! this . game . world . bounds . intersects ( this . _bounds ) && ( this . _cache [ 5 ] = 1 , this . events . onOutOfBounds . dispatch ( this ) , this . outOfBoundsKill ) ) return this . kill ( ) , ! 1 ; return this . world . setTo ( this . game . camera . x + this . worldTransform . tx , this . game . camera . y + this . worldTransform . ty ) , this . visible && ( this . _cache [ 3 ] = this . game . world . currentRenderOrderID ++ ) , this . animations . update ( ) , this . body , ! 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 . position . y = this . game . camera . view . y + this . cameraOffset . y ) } , b . Sprite . prototype . loadTexture = function ( c , d ) { return d = d || 0 , c instanceof b . RenderTexture ? ( this . key = c . key , this . setTexture ( c ) , void 0 ) : c instanceof b . BitmapData ? ( this . key = c . key , this . setTexture ( c . texture ) , void 0 ) : c instanceof a . Texture ? ( this . key = c , this . setTexture ( c ) , void 0 ) : null === c || "undefined" == typeof c ? ( this . key = "__default" , this . setTexture ( a . TextureCache [ this . key ] ) , void 0 ) : "string" != typeof c || this . game . cache . checkImageKey ( c ) ? this . game . cache . isSpriteSheet ( c ) ? ( thi
this . lineTo ( a . points [ 0 ] . x , a . points [ 0 ] . y ) } , b . RenderTexture = function ( c , d , e , f ) { this . game = c , this . key = f , this . type = b . RENDERTEXTURE , a . RenderTexture . call ( this , d , e ) } , b . RenderTexture . prototype = Object . create ( a . RenderTexture . prototype ) , b . RenderTexture . prototype . constructor = b . RenderTexture , b . SpriteBatch = function ( c , d , e , f ) { a . SpriteBatch . call ( this ) , b . Group . call ( this , c , d , e , f ) , this . type = b . SPRITEBATCH } , b . SpriteBatch . prototype = b . Utils . extend ( ! 0 , b . SpriteBatch . prototype , b . Group . prototype , a . SpriteBatch . prototype ) , b . SpriteBatch . prototype . constructor = b . SpriteBatch , b . BitmapFont = function ( c , d , e , f , g , h , i , j , k , l ) { this . characterWidth = e , this . characterHeight = f , this . characterSpacingX = i || 0 , this . characterSpacingY = j || 0 , this . characterPerRow = h , this . offsetX = k || 0 , this . offsetY = l || 0 , this . align = "left" , this . multiLine = ! 1 , this . autoUpperCase = ! 0 , this . customSpacingX = 0 , this . customSpacingY = 0 , this . fixedWidth = 0 , this . fontSet = c . cache . getImage ( d ) , this . _text = "" , this . grabData = [ ] ; for ( var m = this . offsetX , n = this . offsetY , o = 0 , p = new b . FrameData , q = 0 ; q < g . length ; q ++ ) { var r = c . rnd . uuid ( ) , s = p . addFrame ( new b . Frame ( q , m , n , this . characterWidth , this . characterHeight , "" , r ) ) ; this . grabData [ g . charCodeAt ( q ) ] = s . index , a . TextureCache [ r ] = new a . Texture ( a . BaseTextureCache [ d ] , { x : m , y : n , width : this . characterWidth , height : this . characterHeight } ) , o ++ , o == this . characterPerRow ? ( o = 0 , m = this . offsetX , n += this . characterHeight + this . characterSpacingY ) : m += this . characterWidth + this . characterSpacingX } c . cache . updateFrameData ( d , p ) , this . stamp = new b . Image ( c , 0 , 0 , d , 0 ) , b . RenderTexture . call ( this , c ) , this . type = b . BITMAPFONT } , b . BitmapFont . prototype = Object . create ( b . RenderTexture . prototype ) , b . BitmapFont . prototype . constructor = b . BitmapFont , b . BitmapFont . ALIGN _LEFT = "left" , b . BitmapFont . ALIGN _RIGHT = "right" , b . BitmapFont . ALIGN _CENTER = "center" , b . BitmapFont . TEXT _SET1 = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" , b . BitmapFont . TEXT _SET2 = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ" , b . BitmapFont . TEXT _SET3 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 " , b . BitmapFont . TEXT _SET4 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789" , b . BitmapFont . TEXT _SET5 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ.,/() '!?-*:0123456789" , b . BitmapFont . TEXT _SET6 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ!?:;0123456789\"(),-.' " , b . BitmapFont . TEXT _SET7 = "AGMSY+:4BHNTZ!;5CIOU.?06DJPV,(17EKQW\")28FLRX-'39" , b . BitmapFont . TEXT _SET8 = "0123456789 .ABCDEFGHIJKLMNOPQRSTUVWXYZ" , b . BitmapFont . TEXT _SET9 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ()-0123456789.:,'\"?!" , b . BitmapFont . TEXT _SET10 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" , b . BitmapFont . TEXT _SET11 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ.,\"-+!?()':;0123456789" , b . BitmapFont . prototype . setFixedWidth = function ( a , b ) { "undefined" == typeof b && ( b = "left" ) , this . fixedWidth = a , this . align = b } , b . BitmapFont . prototype . setText = function ( a , b , c , d , e , f ) { this . multiLine = b || ! 1 , this . customSpacingX = c || 0 , this . customSpacingY = d || 0 , this . align = e || "left" , this . autoUpperCase = f ? ! 1 : ! 0 , a . length > 0 && ( this . text = a ) } , b . BitmapFont . prototype . resize = function ( b , c ) { if ( this . width = b , this . height = c , this . frame . width = this . width , this . frame . height = this . height , this . baseTexture . width = this . width , this . baseTexture . height = this . height , this . renderer . type === a . WEBGL _RENDERER ) { this . projection . x = this . width / 2 , this . projection . y = - this . height / 2 ; var d = this . renderer . gl ; d . bindTexture ( d . TEXTURE _2D , this . baseTexture . _glTextures [ d . id ] ) , d . texImage2D ( d . TEXTURE _2D , 0 , d . RGBA , this . width , this . height , 0 , d . RGBA , d . UNSIGNED _BYTE , null ) } else this . textureBuffer . resize ( this . width , this . height ) ; a . Texture . frameUpdates . push ( this ) } , b . BitmapFont . prototype . buildBitmapFontText = function ( ) { var a = 0 , c = 0 ; if ( this . multiLine ) { var d = this . _text . split ( "\n" ) ; this . fixedWidth > 0 ? this . resize ( fixedWidth , d . length * ( this . characterHeight + this . customSpacingY ) - this . customSpacingY ) : this . resize ( this . getLongestLine ( ) * ( this . characterWidth + this . customSpacingX ) , d . length * ( this . characterHeight + this . customSpacingY ) - this . customSpacingY ) , this . textureBuffer . clear ( ) ; for ( var e = 0 ; e < d . length ; e ++ ) { switch ( this . align ) { case b . BitmapFont . ALIGN _LEFT : a = 0 ; break ; case b . BitmapFont . ALIGN _RIGHT : a = this . width - d [ e ] . length * ( this . characterWidth + this . customSpacingX ) ; break ; case b . BitmapFont . ALIGN _CENTER : a = this . width / 2 - d [ e ] . le
} , insert : function ( a ) { var b , c = 0 ; if ( null != this . nodes [ 0 ] && ( b = this . getIndex ( a ) , - 1 !== b ) ) return this . nodes [ b ] . insert ( a ) , void 0 ; if ( this . objects . push ( a ) , this . objects . length > this . maxObjects && this . level < this . maxLevels ) for ( null == this . nodes [ 0 ] && this . split ( ) ; c < this . objects . length ; ) b = this . getIndex ( this . objects [ c ] ) , - 1 !== b ? this . nodes [ b ] . insert ( this . objects . splice ( c , 1 ) [ 0 ] ) : c ++ } , getIndex : function ( a ) { var b = - 1 ; return a . x < this . bounds . right && a . right < this . bounds . right ? a . y < this . bounds . bottom && a . bottom < this . bounds . bottom ? b = 1 : a . y > this . bounds . bottom && ( b = 2 ) : a . x > this . bounds . right && ( a . y < this . bounds . bottom && a . bottom < this . bounds . bottom ? b = 0 : a . y > this . bounds . bottom && ( b = 3 ) ) , b } , retrieve : function ( a ) { var b = this . objects ; return a . body . quadTreeIndex = this . getIndex ( a . body ) , this . nodes [ 0 ] && ( - 1 !== a . body . quadTreeIndex ? b = b . concat ( this . nodes [ a . body . quadTreeIndex ] . retrieve ( a ) ) : ( b = b . concat ( this . nodes [ 0 ] . retrieve ( a ) ) , b = b . concat ( this . nodes [ 1 ] . retrieve ( a ) ) , b = b . concat ( this . nodes [ 2 ] . retrieve ( a ) ) , b = b . concat ( this . nodes [ 3 ] . retrieve ( a ) ) ) ) , b } , clear : function ( ) { this . objects = [ ] ; for ( var a = 0 , b = this . nodes . length ; b > a ; a ++ ) this . nodes [ a ] && ( this . nodes [ a ] . clear ( ) , delete this . nodes [ a ] ) } } , b . QuadTree . prototype . constructor = b . QuadTree , b . Net = function ( a ) { this . game = a } , b . Net . prototype = { getHostName : function ( ) { return window . location && window . location . hostname ? window . location . hostname : null } , checkDomainName : function ( a ) { return - 1 !== window . location . hostname . indexOf ( a ) } , updateQueryString : function ( a , b , c , d ) { "undefined" == typeof c && ( c = ! 1 ) , ( "undefined" == typeof d || "" === d ) && ( d = window . location . href ) ; var e = "" , f = new RegExp ( "([?|&])" + a + "=.*?(&|#|$)(.*)" , "gi" ) ; if ( f . test ( d ) ) e = "undefined" != typeof b && null !== b ? d . replace ( f , "$1" + a + "=" + b + "$2$3" ) : d . replace ( f , "$1$3" ) . replace ( /(&|\?)$/ , "" ) ; else if ( "undefined" != typeof b && null !== b ) { var g = - 1 !== d . indexOf ( "?" ) ? "&" : "?" , h = d . split ( "#" ) ; d = h [ 0 ] + g + a + "=" + b , h [ 1 ] && ( d += "#" + h [ 1 ] ) , e = d } else e = d ; return c ? ( window . location . href = e , void 0 ) : e } , getQueryString : function ( a ) { "undefined" == typeof a && ( a = "" ) ; var b = { } , c = location . search . substring ( 1 ) . split ( "&" ) ; for ( var d in c ) { var e = c [ d ] . split ( "=" ) ; if ( e . length > 1 ) { if ( a && a == this . decodeURI ( e [ 0 ] ) ) return this . decodeURI ( e [ 1 ] ) ; b [ this . decodeURI ( e [ 0 ] ) ] = this . decodeURI ( e [ 1 ] ) } } return b } , decodeURI : function ( a ) { return decodeURIComponent ( a . replace ( /\+/g , " " ) ) } } , b . Net . prototype . constructor = b . Net , b . TweenManager = function ( a ) { this . game = a , this . _tweens = [ ] , this . _add = [ ] , this . game . onPause . add ( this . pauseAll , this ) , this . game . onResume . add ( this . resumeAll , this ) } , b . TweenManager . prototype = { getAll : function ( ) { return this . _tweens } , removeAll : function ( ) { for ( var a = 0 ; a < this . _tweens . length ; a ++ ) this . _tweens [ a ] . pendingDelete = ! 0 ; this . _add = [ ] } , add : function ( a ) { this . _add . push ( a ) } , create : function ( a ) { return new b . Tween ( a , this . game ) } , remove : function ( a ) { var b = this . _tweens . indexOf ( a ) ; - 1 !== b && ( this . _tweens [ b ] . pendingDelete = ! 0 ) } , update : function ( ) { if ( 0 === this . _tweens . length && 0 === this . _add . length ) return ! 1 ; for ( var a = 0 , b = this . _tweens . length ; b > a ; ) this . _tweens [ a ] . update ( this . game . time . now ) ? a ++ : ( this . _tweens . splice ( a , 1 ) , b -- ) ; return this . _add . length > 0 && ( this . _tweens = this . _tweens . concat ( this . _add ) , this . _add . length = 0 ) , ! 0 } , isTweening : function ( a ) { return this . _tweens . some ( function ( b ) { return b . _object === a } ) } , pauseAll : function ( ) { for ( var a = this . _tweens . length - 1 ; a >= 0 ; a -- ) this . _tweens [ a ] . pause ( ) } , resumeAll : function ( ) { for ( var a = this . _tweens . length - 1 ; a >= 0 ; a -- ) this . _tweens [ a ] . resume ( ) } } , b . TweenManager . prototype . constructor = b . TweenManager , b . Tween = function ( a , c ) { this . _object = a , this . game = c , this . _manager = this . game . tweens , this . _valuesStart = { } , this . _valuesEnd = { } , this . _valuesStartRepeat = { } , this . _duration = 1e3 , this . _repeat = 0 , this . _yoyo = ! 1 , this . _reversed = ! 1 , this . _delayTime = 0 , this . _startTime = null , this . _easingFunction = b . Easing . Linear . None , this . _interpolationFunction = b . Math . linearInterpolation , this . _chainedTweens = [ ] , this . _onStartCallbackFired = ! 1 , this . _onUpdateCallback = null , this . _onUpdateCallbackContext = null , this . _pausedTime = 0 , this . pendingDelete = ! 1 ; for ( var d in a ) this . _valuesStart [ d ] = parseFloat ( a [ d ] , 10 ) ; this . onStart = new b . Signal , this . onLoop = new b . Signal , this . onComplete = new b . Signal , this . isRunning = ! 1 } , b . Tween . prototype = { to : function ( a , b , c , d , e , f , g ) { b = b || 1e3 , c
} , updateSound : function ( a , b , c ) { this . _sounds [ a ] && ( this . _sounds [ a ] [ b ] = c ) } , decodedSound : function ( a , b ) { this . _sounds [ a ] . data = b , this . _sounds [ a ] . decoded = ! 0 , this . _sounds [ a ] . isDecoding = ! 1 } , getCanvas : function ( a ) { return this . _canvases [ a ] ? this . _canvases [ a ] . canvas : ( console . warn ( 'Phaser.Cache.getCanvas: Invalid key: "' + a + '"' ) , void 0 ) } , getBitmapData : function ( a ) { return this . _bitmapDatas [ a ] ? this . _bitmapDatas [ a ] : ( console . warn ( 'Phaser.Cache.getBitmapData: Invalid key: "' + a + '"' ) , void 0 ) } , getBitmapFont : function ( a ) { return this . _bitmapFont [ a ] ? this . _bitmapFont [ a ] : ( console . warn ( 'Phaser.Cache.getBitmapFont: Invalid key: "' + a + '"' ) , void 0 ) } , getPhysicsData : function ( a , b ) { if ( "undefined" == typeof b || null === b ) { if ( this . _physics [ a ] ) return this . _physics [ a ] . data ; console . warn ( 'Phaser.Cache.getPhysicsData: Invalid key: "' + a + '"' ) } else { if ( this . _physics [ a ] && this . _physics [ a ] . data [ b ] ) return this . _physics [ a ] . data [ b ] [ 0 ] ; console . warn ( 'Phaser.Cache.getPhysicsData: Invalid key/object: "' + a + " / " + b + '"' ) } return null } , checkImageKey : function ( a ) { return this . _images [ a ] ? ! 0 : ! 1 } , getImage : function ( a ) { return this . _images [ a ] ? this . _images [ a ] . data : ( console . warn ( 'Phaser.Cache.getImage: Invalid key: "' + a + '"' ) , void 0 ) } , getTilemapData : function ( a ) { return this . _tilemaps [ a ] ? this . _tilemaps [ a ] : ( console . warn ( 'Phaser.Cache.getTilemapData: Invalid key: "' + a + '"' ) , void 0 ) } , getFrameData : function ( a ) { return this . _images [ a ] && this . _images [ a ] . frameData ? this . _images [ a ] . frameData : null } , updateFrameData : function ( a , b ) { this . _images [ a ] && ( this . _images [ a ] . spriteSheet = ! 0 , this . _images [ a ] . frameData = b ) } , getFrameByIndex : function ( a , b ) { return this . _images [ a ] && this . _images [ a ] . frameData ? this . _images [ a ] . frameData . getFrame ( b ) : null } , getFrameByName : function ( a , b ) { return this . _images [ a ] && this . _images [ a ] . frameData ? this . _images [ a ] . frameData . getFrameByName ( b ) : null } , getFrame : function ( a ) { return this . _images [ a ] && this . _images [ a ] . spriteSheet === ! 1 ? this . _images [ a ] . frame : null } , getTextureFrame : function ( a ) { return this . _textures [ a ] ? this . _textures [ a ] . frame : null } , getTexture : function ( a ) { return this . _textures [ a ] ? this . _textures [ a ] : ( console . warn ( 'Phaser.Cache.getTexture: Invalid key: "' + a + '"' ) , void 0 ) } , getSound : function ( a ) { return this . _sounds [ a ] ? this . _sounds [ a ] : ( console . warn ( 'Phaser.Cache.getSound: Invalid key: "' + a + '"' ) , void 0 ) } , getSoundData : function ( a ) { return this . _sounds [ a ] ? this . _sounds [ a ] . data : ( console . warn ( 'Phaser.Cache.getSoundData: Invalid key: "' + a + '"' ) , void 0 ) } , isSoundDecoded : function ( a ) { return this . _sounds [ a ] ? this . _sounds [ a ] . decoded : void 0 } , isSoundReady : function ( a ) { return this . _sounds [ a ] && this . _sounds [ a ] . decoded && this . game . sound . touchLocked === ! 1 } , isSpriteSheet : function ( a ) { return this . _images [ a ] ? this . _images [ a ] . spriteSheet : ! 1 } , getText : function ( a ) { return this . _text [ a ] ? this . _text [ a ] . data : ( console . warn ( 'Phaser.Cache.getText: Invalid key: "' + a + '"' ) , void 0 ) } , getBinary : function ( a ) { return this . _binary [ a ] ? this . _binary [ a ] : ( console . warn ( 'Phaser.Cache.getBinary: Invalid key: "' + a + '"' ) , void 0 ) } , 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 } 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 ] } , removePhysics : function ( a ) { delete this . _text [ a ] } , removeTilemap : function ( a ) { delete this . _text [ a ] } , removeBinary : function ( a ) { delete this . _text [ a ] } , removeBitmapData : function ( a ) { delete this . _text [ a ] } , removeBitmapFont : function ( a ) { delete this . _text [ a ] } , destroy : function ( ) { for ( var a in this . _canvases ) delete this . _canvases [ a . key ] ; for ( var a in this . _images ) delete this . _images [ a . key ] ; for ( var a in this . _sounds ) delete this . _sounds [ a . key ] ; for ( var
for ( var d = 0 ; d < a . objects . length ; d ++ ) this . context . strokeRect ( a . objects [ d ] . x , a . objects [ d ] . y , a . objects [ d ] . width , a . objects [ d ] . height ) } else for ( var d = 0 ; d < a . nodes . length ; d ++ ) this . renderQuadTree ( a . nodes [ d ] ) ; this . stop ( ) } , renderSoundInfo : function ( a , b , c , d ) { null != this . context && ( d = d || "rgb(255,255,255)" , this . start ( b , c , d ) , this . line ( "Sound: " + a . key + " Locked: " + a . game . sound . touchLocked ) , this . line ( "Is Ready?: " + this . game . cache . isSoundReady ( a . key ) + " Pending Playback: " + a . pendingPlayback ) , this . line ( "Decoded: " + a . isDecoded + " Decoding: " + a . isDecoding ) , this . line ( "Total Duration: " + a . totalDuration + " Playing: " + a . isPlaying ) , this . line ( "Time: " + a . currentTime ) , this . line ( "Volume: " + a . volume + " Muted: " + a . mute ) , this . line ( "WebAudio: " + a . usingWebAudio + " Audio: " + a . usingAudioTag ) , "" !== a . currentMarker && ( this . line ( "Marker: " + a . currentMarker + " Duration: " + a . duration ) , this . line ( "Start: " + a . markers [ a . currentMarker ] . start + " Stop: " + a . markers [ a . currentMarker ] . stop ) , this . line ( "Position: " + a . position ) ) , this . stop ( ) ) } , renderCameraInfo : function ( a , b , c , d ) { null != this . context && ( d = d || "rgb(255,255,255)" , this . start ( b , c , d ) , this . line ( "Camera (" + a . width + " x " + a . height + ")" ) , this . line ( "X: " + a . x + " Y: " + a . y ) , this . line ( "Bounds x: " + a . bounds . x + " Y: " + a . bounds . y + " w: " + a . bounds . width + " h: " + a . bounds . height ) , this . line ( "View x: " + a . view . x + " Y: " + a . view . y + " w: " + a . view . width + " h: " + a . view . height ) , this . stop ( ) ) } , renderPointer : function ( a , b , c , d , e ) { null != this . context && null != a && ( "undefined" == typeof b && ( b = ! 1 ) , c = c || "rgba(0,255,0,0.5)" , d = d || "rgba(255,0,0,0.5)" , e = e || "rgb(255,255,255)" , ( b !== ! 0 || a . isUp !== ! 0 ) && ( this . start ( a . x , a . y - 100 , e ) , this . context . beginPath ( ) , this . context . arc ( a . x , a . y , a . circle . radius , 0 , 2 * Math . PI ) , this . context . fillStyle = a . active ? c : d , this . context . fill ( ) , this . context . closePath ( ) , this . context . beginPath ( ) , this . context . moveTo ( a . positionDown . x , a . positionDown . y ) , this . context . lineTo ( a . position . x , a . position . y ) , this . context . lineWidth = 2 , this . context . stroke ( ) , this . context . closePath ( ) , this . line ( "ID: " + a . id + " Active: " + a . active ) , this . line ( "World X: " + a . worldX + " World Y: " + a . worldY ) , this . line ( "Screen X: " + a . x + " Screen Y: " + a . y ) , this . line ( "Duration: " + a . duration + " ms" ) , this . stop ( ) ) ) } , renderSpriteInputInfo : function ( a , b , c , d ) { d = d || "rgb(255,255,255)" , 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 ( ) } , renderInputInfo : function ( a , b , c ) { null != this . context && ( c = c || "rgb(255,255,0)" , 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 ( ) ) } , renderSpriteInfo : function ( a , b , c , d ) { null != this . context && ( d = d || "rgb(255, 255, 255)" , 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 . line ( "body x: " + a . body . x . toFixed ( 1 ) + " y: " + a . body . y . toFixed ( 1 ) ) , this . line ( "id: " + a . _id ) , this . line ( "scale x: " + a . worldTransform [ 0 ] ) , this . line ( "scale y: " + a . worldTransform [ 4 ] ) , this . line ( "tx: " + a . worldTransform [ 2 ] ) , this . line ( "ty: " + a . worldTransform [ 5 ] ) , this . line ( "skew x: " + a . worldTransform [ 3 ] ) , this . line ( "skew y: " + a . worldTransform [ 1 ] ) , this . line ( "sdx: " + a . deltaX ) , this . line ( "sdy: " + a . deltaY ) , this . stop ( ) ) } , renderSpriteCoords : function ( a , b , c , d ) { null != this . context && ( d = d || "rgb(255, 255, 255)" , this . start ( b , c , d , 100 ) , a . name && this . line ( a . name ) , this . splitline ( "x:" , a . x . toFixed ( 2 ) , "y:" , a . y . toFixed ( 2
for ( var f = b ; b + d > f ; f ++ ) for ( var g = a ; a + c > g ; g ++ ) this . _results . push ( this . layers [ e ] . data [ f ] [ g ] ) ; return this . _results } , paste : function ( a , b , c , d ) { if ( "undefined" == typeof a && ( a = 0 ) , "undefined" == typeof b && ( b = 0 ) , d = this . getLayer ( d ) , c && ! ( c . length < 2 ) ) { for ( var e = c [ 1 ] . x - a , f = c [ 1 ] . y - b , g = 1 ; g < c . length ; g ++ ) this . layers [ d ] . data [ f + c [ g ] . y ] [ e + c [ g ] . x ] . copy ( c [ g ] ) ; this . layers [ d ] . dirty = ! 0 , this . calculateFaces ( d ) } } , swap : function ( a , b , c , d , e , f , g ) { g = this . getLayer ( g ) , this . copy ( c , d , e , f , g ) , this . _results . length < 2 || ( this . _tempA = a , this . _tempB = b , this . _results . forEach ( this . swapHandler , this ) , this . paste ( c , d , this . _results , g ) ) } , swapHandler : function ( a , b ) { a . index === this . _tempA ? this . _results [ b ] . index = this . _tempB : a . index === this . _tempB && ( this . _results [ b ] . index = this . _tempA ) } , forEach : function ( a , b , c , d , e , f , g ) { g = this . getLayer ( g ) , this . copy ( c , d , e , f , g ) , this . _results . length < 2 || ( this . _results . forEach ( a , b ) , this . paste ( c , d , this . _results , g ) ) } , replace : function ( a , b , c , d , e , f , g ) { if ( g = this . getLayer ( g ) , this . copy ( c , d , e , f , g ) , ! ( this . _results . length < 2 ) ) { for ( var h = 1 ; h < this . _results . length ; h ++ ) this . _results [ h ] . index === a && ( this . _results [ h ] . index = b ) ; this . paste ( c , d , this . _results , g ) } } , random : function ( a , b , c , d , e ) { if ( e = this . getLayer ( e ) , this . copy ( a , b , c , d , e ) , ! ( this . _results . length < 2 ) ) { for ( var f = [ ] , g = 1 ; g < this . _results . length ; g ++ ) if ( this . _results [ g ] . index ) { var h = this . _results [ g ] . index ; - 1 === f . indexOf ( h ) && f . push ( h ) } for ( var i = 1 ; i < this . _results . length ; i ++ ) this . _results [ i ] . index = this . game . rnd . pick ( f ) ; this . paste ( a , b , this . _results , e ) } } , shuffle : function ( a , c , d , e , f ) { if ( f = this . getLayer ( f ) , this . copy ( a , c , d , e , f ) , ! ( this . _results . length < 2 ) ) { for ( var g = [ ] , h = 1 ; h < this . _results . length ; h ++ ) this . _results [ h ] . index && g . push ( this . _results [ h ] . index ) ; b . Utils . shuffle ( g ) ; for ( var i = 1 ; i < this . _results . length ; i ++ ) this . _results [ i ] . index = g [ i - 1 ] ; this . paste ( a , c , this . _results , f ) } } , fill : function ( a , b , c , d , e , f ) { if ( f = this . getLayer ( f ) , this . copy ( b , c , d , e , f ) , ! ( this . _results . length < 2 ) ) { for ( var g = 1 ; g < this . _results . length ; g ++ ) this . _results [ g ] . index = a ; this . paste ( b , c , this . _results , f ) } } , removeAllLayers : function ( ) { this . layers . length = 0 , this . currentLayer = 0 } , dump : function ( ) { for ( var a = "" , b = [ "" ] , c = 0 ; c < this . layers [ this . currentLayer ] . height ; c ++ ) { for ( var d = 0 ; d < this . layers [ this . currentLayer ] . width ; d ++ ) a += "%c " , this . layers [ this . currentLayer ] . data [ c ] [ d ] > 1 ? this . debugMap [ this . layers [ this . currentLayer ] . data [ c ] [ d ] ] ? b . push ( "background: " + this . debugMap [ this . layers [ this . currentLayer ] . data [ c ] [ d ] ] ) : b . push ( "background: #ffffff" ) : b . push ( "background: rgb(0, 0, 0)" ) ; a += "\n" } b [ 0 ] = a , console . log . apply ( console , b ) } , destroy : function ( ) { this . removeAllLayers ( ) , this . data = [ ] , this . game = null } } , b . Tilemap . prototype . constructor = b . Tilemap , b . TilemapLayer = function ( c , d , e , f , g ) { this . game = c , this . map = d , this . index = e , this . layer = d . layers [ e ] , this . canvas = b . Canvas . create ( f , g ) , this . context = this . canvas . getContext ( "2d" ) , this . baseTexture = new a . BaseTexture ( this . canvas ) , this . texture = new a . Texture ( this . baseTexture ) , this . textureFrame = new b . Frame ( 0 , 0 , 0 , f , g , "tilemapLayer" , c . rnd . uuid ( ) ) , b . Sprite . call ( this , this . game , 0 , 0 , this . texture , this . textureFrame ) , this . name = "" , this . type = b . TILEMAPLAYER , this . fixedToCamera = ! 0 , this . cameraOffset = new b . Point ( 0 , 0 ) , this . tileColor = "rgb(255, 255, 255)" , this . debug = ! 1 , this . debugAlpha = . 5 , this . debugColor = "rgba(0, 255, 0, 1)" , this . debugFill = ! 1 , this . debugFillColor = "rgba(0, 255, 0, 0.2)" , this . debugCallbackColor = "rgba(255, 0, 0, 1)" , this . scrollFactorX = 1 , this . scrollFactorY = 1 , this . dirty = ! 0 , this . _cw = d . tileWidth , this . _ch = d . tileHeight , this . _ga = 1 , this . _dx = 0 , this . _dy = 0 , this . _dw = 0 , this . _dh = 0 , this . _tx = 0 , this . _ty = 0 , this . _tw = 0 , this . _th = 0 , this . _tl = 0 , this . _maxX = 0 , this . _maxY = 0 , this . _startX = 0 , this . _startY = 0 , this . _results = [ ] , this . _x = 0 , this . _y = 0 , this . _prevX = 0 , this . _prevY = 0 , this . updateMax ( ) } , b . TilemapLayer . prototype = Object . create ( b . Sprite . prototype ) , b . TilemapLayer . prototype = b . Utils . extend ( ! 0 , b . TilemapLayer . prototype , b . Sprite . prototype , a . Sprite . prototype ) , b . TilemapLayer . prototype . constructor = b . TilemapLayer , b . TilemapLayer . prototype . postUpdate = function ( ) { b . Sprite . prototype . postUpdate . call ( this ) , this . scrollX = this . game . camera . x * this . scrollFactorX , this . scrollY = this . game . camera . y * this . scrollFactorY , this . render ( ) } , b . TilemapLayer . prototyp