2014-02-18 03:01:51 +00:00
/*! Phaser v1.2 | (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 =
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 . axisListX = [ ] , this . axisListY = [ ] , this . world = null ; var a = this . axisListX , b = this . axisListY ; this . _addBodyHandler = function ( c ) { a . push ( c . body ) , b . push ( c . body ) } , this . _removeBodyHandler = function ( c ) { var d = a . indexOf ( c . body ) ; - 1 !== d && a . splice ( d , 1 ) , d = b . indexOf ( c . body ) , - 1 !== d && b . splice ( d , 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 . axisListX . length = this . axisListY . length = 0 , d . appendArray ( this . axisListX , a . bodies ) , d . appendArray ( this . axisListY , 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 ) { for ( var b = 1 , c = a . length ; c > b ; b ++ ) { for ( var d = a [ b ] , e = b - 1 ; e >= 0 && ! ( a [ e ] . aabb . lowerBound [ 0 ] <= d . aabb . lowerBound [ 0 ] ) ; e -- ) a [ e + 1 ] = a [ e ] ; a [ e + 1 ] = d } return a } , c . sortAxisListY = function ( a ) { for ( var b = 1 , c = a . length ; c > b ; b ++ ) { for ( var d = a [ b ] , e = b - 1 ; e >= 0 && ! ( a [ e ] . aabb . lowerBound [ 1 ] <= d . aabb . lowerBound [ 1 ] ) ; e -- ) a [ e + 1 ] = a [ e ] ; a [ e + 1 ] = d } return a } ; var f = { keys : [ ] } ; c . prototype . getCollisionPairs = function ( ) { var a , b , d = this . axisListX , g = this . axisListY , h = this . result ; for ( this . axisIndex , h . length = 0 , a = 0 ; a !== d . length ; a ++ ) { var i = d [ a ] ; i . aabbNeedsUpdate && i . updateAABB ( ) } for ( c . sortAxisListX ( d ) , c . sortAxisListY ( g ) , a = 0 , N = d . length ; a !== N ; a ++ ) { var j = d [ a ] ; for ( b = a + 1 ; N > b ; b ++ ) { var k = d [ b ] ; if ( ! c . checkBounds ( j , k , 0 ) ) break ; var l = j . id < k . id ? j . id + " " + k . id : k . id + " " + j . id ; f [ l ] = ! 0 , f . keys . push ( l ) } } for ( a = 0 , N = g . length ; a !== N ; a ++ ) { var j = g [ a ] ; for ( b = a + 1 ; N > b ; b ++ ) { var k = g [ b ] ; if ( ! c . checkBounds ( j , k , 1 ) ) break ; var l = j . id < k . id ? j . id + " " + k . id : k . id + " " + j . id ; f [ l ] && e . boundingRadiusCheck ( j , k ) && h . push ( j , k ) } } var m = f . keys ; for ( a = 0 , N = m . length ; a !== N ; a ++ ) delete f [ m [ a ] ] ; return m . length = 0 , h } , c . checkBounds = function ( a , b , c ) { return b . aabb . lowerBound [ c ] < a . aabb . upperBound [ c ] } } , { "../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 ,
} ; var f = e . create ( ) ; c . prototype . computeAABB = function ( a , b , c ) { var d = this . radius ; e . set ( f , this . length , 0 ) , e . rotate ( f , f , c ) , e . set ( a . upperBound , Math . max ( f [ 0 ] + d , - f [ 0 ] + d ) , Math . max ( f [ 1 ] + d , - f [ 1 ] + d ) ) , e . set ( a . lowerBound , Math . min ( f [ 0 ] - d , - f [ 0 ] - d ) , Math . min ( f [ 1 ] - d , - f [ 1 ] - d ) ) , e . add ( a . lowerBound , a . lowerBound , b ) , e . add ( a . upperBound , a . upperBound , b ) } } , { "../math/vec2" : 33 , "./Shape" : 44 } ] , 38 : [ function ( a , b ) { function c ( a ) { this . radius = a || 1 , d . call ( this , d . CIRCLE ) } var d = a ( "./Shape" ) , e = a ( "../math/vec2" ) ; b . exports = c , c . prototype = new d , c . prototype . computeMomentOfInertia = function ( a ) { var b = this . radius ; 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 } if ( this . centerOfMass = e . fromValues ( 0 , 0 ) , this . triangles = [ ] , this . vertices . length && ( this . updateTriangles ( ) , this . updateCenterOfMass ( ) ) , this . boundingRadius = 0 , d . call ( this , d . CONVEX ) , this . updateBoundingRadius ( ) , this . updateArea ( ) , this . area < 0 ) throw new Error ( "Convex vertices must be given in conter-clockwise winding." ) } var d = a ( "./Shape" ) , e = a ( "../math/vec2" ) , f = a ( "../math/polyk" ) ; 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 g = e . create ( ) , h = e . create ( ) , i = e . create ( ) , j = e . create ( ) , k = e . create ( ) ; e . create ( ) , e . create ( ) , e . create ( ) , e . create ( ) } c . prototype . updateCenterOfMass = function ( ) { var a = this . triangles , b = this . vertices , d = this . centerOfMass , f = g , l = i , m = j , n = k , o = h ; e . set ( d , 0 , 0 ) ; for ( var p = 0 , q = 0 ; q !== a . length ; q ++ ) { var r = a [ q ] , l = b [ r [ 0 ] ] , m = b [ r [ 1 ] ] , n = b [ r [ 2 ] ] ; e . centroid ( f , l , m , n ) ; var s = c . triangleArea ( l , m , n ) ; p += s , e . scale ( o , f , s ) , e . add ( d , d , o ) } e . scale ( d , d , 1 / p ) } , c . prototype . computeMomentOfInertia = function ( a ) { for ( var b = 0 , c = 0 , d = this . vertices . length , f = d - 1 , g = 0 ; d > g ; f = g , g ++ ) { var h = this . vertices [ f ] , i = this . vertices [ g ] , j = Math . abs ( e . crossLength ( h , i ) ) , k = e . dot ( i , i ) + e . dot ( i , h ) + e . dot ( h , h ) ; b += j * k , c += j } return a / 6 * ( b / c ) } , 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 . triangleArea = function ( a , b , c ) { return . 5 * ( ( b [ 0 ] - a [ 0 ] ) * ( c [ 1 ] - a [ 1 ] ) - ( c [ 0 ] - a [ 0 ] ) * ( b [ 1 ] - a [ 1 ] ) ) } , c . prototype . updateArea = function ( ) { this . updateTriangles ( ) , this . area = 0 ; for ( var a = this . triangles , b = this . vertices , d = 0 ; d !== a . length ; d ++ ) { var e = a [ d ] , f = b [ e [ 0 ] ] , g = b [ e [ 1 ] ] , h = b [ e [ 2 ] ] , i = c . triangleArea ( f , g , 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 }
} , 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 . radToDeg ( c ) ) , e . x = a . x + a . radius * Math . cos ( c ) , e . y = a . y + a . radius * Math . sin ( c ) , e } , b . Circle . intersectsRectangle = function ( a , b ) { var c = Math . abs ( a . x - b . x - b . halfWidth ) , d = b . halfWidth + a . radius ; if ( c > d ) return ! 1 ; var e = Math . abs ( a . y - b . y - b . halfHeight ) , f = b . halfHeight + a . radius ; if ( e > f ) return ! 1 ; if ( c <= b . halfWidth || e <= b . halfHeight ) return ! 0 ; var g = c - b . halfWidth , h = e - b . halfHeight , i = g * g , j = h * h , k = a . radius * a . radius ; return k >= i + j } , a . Circle = b . Circle , b . Point = function ( a , b ) { a = a || 0 , b = b || 0 , this . x = a , this . y = b } , b . Point . prototype = { copyFrom : function ( a ) { return this . setTo ( a . x , a . y ) } , invert : function ( ) { return this . setTo ( this . y , this . x ) } , setTo : function ( a , b ) { return this . x = a || 0 , this . y = b || ( 0 !== b ? this . x : 0 ) , this } , set : function ( a , b ) { return this . x = a || 0 , this . y = b || ( 0 !== b ? this . x : 0 ) , this } , add : function ( a , b ) { return this . x += a , this . y += b , this } , subtract : function ( a , b ) { return this . x -= a , this . y -= b , this } , 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 . f
} , a . Stage . prototype = Object . create ( a . DisplayObjectContainer . prototype ) , a . Stage . prototype . constructor = a . Stage , a . Stage . prototype . setInteractionDelegate = function ( a ) { this . interactionManager . setTargetDomElement ( a ) } , a . Stage . prototype . updateTransform = function ( ) { this . worldAlpha = 1 ; for ( var a = 0 , b = this . children . length ; b > a ; a ++ ) this . children [ a ] . updateTransform ( ) ; this . dirty && ( this . dirty = ! 1 , this . interactionManager . dirty = ! 0 ) , this . interactive && this . interactionManager . update ( ) } , a . Stage . prototype . setBackgroundColor = function ( b ) { this . backgroundColor = b || 0 , this . backgroundColorSplit = a . hex2rgb ( this . backgroundColor ) ; var c = this . backgroundColor . toString ( 16 ) ; c = "000000" . substr ( 0 , 6 - c . length ) + c , this . backgroundColorString = "#" + c } , a . Stage . prototype . getMousePosition = function ( ) { return this . interactionManager . mouse . global } , a . EventTarget = function ( ) { var a = { } ; this . addEventListener = this . on = function ( b , c ) { void 0 === a [ b ] && ( a [ b ] = [ ] ) , - 1 === a [ b ] . indexOf ( c ) && a [ b ] . push ( c ) } , this . dispatchEvent = this . emit = function ( b ) { if ( a [ b . type ] && a [ b . type ] . length ) for ( var c = 0 , d = a [ b . type ] . length ; d > c ; c ++ ) a [ b . type ] [ c ] ( b ) } , this . removeEventListener = this . off = function ( b , c ) { var d = a [ b ] . indexOf ( c ) ; - 1 !== d && a [ b ] . splice ( d , 1 ) } , this . removeAllEventListeners = function ( b ) { var c = a [ b ] ; c && ( c . length = 0 ) } } , a . PolyK = { } , a . PolyK . Triangulate = function ( b ) { var c = ! 0 , d = b . length >> 1 ; if ( 3 > d ) return [ ] ; for ( var e = [ ] , f = [ ] , g = 0 ; d > g ; g ++ ) f . push ( g ) ; g = 0 ; for ( var h = d ; h > 3 ; ) { var i = f [ ( g + 0 ) % h ] , j = f [ ( g + 1 ) % h ] , k = f [ ( g + 2 ) % h ] , l = b [ 2 * i ] , m = b [ 2 * i + 1 ] , n = b [ 2 * j ] , o = b [ 2 * j + 1 ] , p = b [ 2 * k ] , q = b [ 2 * k + 1 ] , r = ! 1 ; if ( a . PolyK . _convex ( l , m , n , o , p , q , c ) ) { r = ! 0 ; for ( var s = 0 ; h > s ; s ++ ) { var t = f [ s ] ; if ( t !== i && t !== j && t !== k && a . PolyK . _PointInTriangle ( b [ 2 * t ] , b [ 2 * t + 1 ] , l , m , n , o , p , q ) ) { r = ! 1 ; break } } } if ( r ) e . push ( i , j , k ) , f . splice ( ( g + 1 ) % h , 1 ) , h -- , g = 0 ; else if ( g ++ > 3 * h ) { if ( ! c ) return window . console . log ( "PIXI Warning: shape too complex to fill" ) , [ ] ; for ( e = [ ] , f = [ ] , g = 0 ; d > g ; g ++ ) f . push ( g ) ; g = 0 , h = d , c = ! 1 } } return e . push ( f [ 0 ] , f [ 1 ] , f [ 2 ] ) , e } , a . PolyK . _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 } , a . PolyK . _convex = function ( a , b , c , d , e , f , g ) { return ( b - d ) * ( e - c ) + ( c - a ) * ( f - d ) >= 0 === g } , a . initDefaultShaders = function ( ) { } , a . CompileVertexShader = function ( b , c ) { return a . _CompileShader ( b , c , b . VERTEX _SHADER ) } , a . CompileFragmentShader = function ( b , c ) { return a . _CompileShader ( b , c , b . FRAGMENT _SHADER ) } , a . _CompileShader = function ( a , b , c ) { var d = b . join ( "\n" ) , e = a . createShader ( c ) ; return a . shaderSource ( e , d ) , a . compileShader ( e ) , a . getShaderParameter ( e , a . COMPILE _STATUS ) ? e : ( window . console . log ( a . getShaderInfoLog ( e ) ) , null ) } , a . compileProgram = function ( b , c , d ) { var e = a . CompileFragmentShader ( b , d ) , f = a . CompileVertexShader ( b , c ) , g = b . createProgram ( ) ; return b . attachShader ( g , f ) , b . attachShader ( g , e ) , b . linkProgram ( g ) , b . getProgramParameter ( g , b . LINK _STATUS ) || window . console . log ( "Could not initialise shaders" ) , g } , a . PixiShader = function ( a ) { this . gl = a , this . program = null , this . fragmentSrc = [ "precision lowp float;" , "varying vec2 vTextureCoord;" , "varying vec4 vColor;" , "uniform sampler2D uSampler;" , "void main(void) {" , " gl_FragColor = texture2D(uSampler, vTextureCoord) * vColor ;" , "}" ] , this . textureCount = 0 , this . attributes = [ ] , this . init ( ) } , 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 ] ;
} , a . WebGLFastSpriteBatch = function ( a ) { this . vertSize = 10 , this . maxSize = 6e3 , this . size = this . maxSize ; var b = 4 * this . size * this . vertSize , c = 6 * this . maxSize ; this . vertices = new Float32Array ( b ) , this . indices = new Uint16Array ( c ) , this . vertexBuffer = null , this . indexBuffer = null , this . lastIndexCount = 0 ; for ( var d = 0 , e = 0 ; c > d ; d += 6 , e += 4 ) this . indices [ d + 0 ] = e + 0 , this . indices [ d + 1 ] = e + 1 , this . indices [ d + 2 ] = e + 2 , this . indices [ d + 3 ] = e + 0 , this . indices [ d + 4 ] = e + 2 , this . indices [ d + 5 ] = e + 3 ; this . drawing = ! 1 , this . currentBatchSize = 0 , this . currentBaseTexture = null , this . currentBlendMode = 0 , this . renderSession = null , this . shader = null , this . matrix = null , this . setContext ( a ) } , a . WebGLFastSpriteBatch . prototype . setContext = function ( a ) { this . gl = a , this . vertexBuffer = a . createBuffer ( ) , this . indexBuffer = a . createBuffer ( ) , a . bindBuffer ( a . ELEMENT _ARRAY _BUFFER , this . indexBuffer ) , a . bufferData ( a . ELEMENT _ARRAY _BUFFER , this . indices , a . STATIC _DRAW ) , a . bindBuffer ( a . ARRAY _BUFFER , this . vertexBuffer ) , a . bufferData ( a . ARRAY _BUFFER , this . vertices , a . DYNAMIC _DRAW ) , this . currentBlendMode = 99999 } , a . WebGLFastSpriteBatch . prototype . begin = function ( a , b ) { this . renderSession = b , this . shader = this . renderSession . shaderManager . fastShader , this . matrix = a . worldTransform . toArray ( ! 0 ) , this . start ( ) } , a . WebGLFastSpriteBatch . prototype . end = function ( ) { this . flush ( ) } , a . WebGLFastSpriteBatch . prototype . render = function ( a ) { var b = a . children , c = b [ 0 ] ; if ( c . texture . _uvs ) { this . currentBaseTexture = c . texture . baseTexture , c . blendMode !== this . currentBlendMode && this . setBlendMode ( c . blendMode ) ; for ( var d = 0 , e = b . length ; e > d ; d ++ ) this . renderSprite ( b [ d ] ) ; this . flush ( ) } } , a . WebGLFastSpriteBatch . prototype . renderSprite = function ( a ) { if ( a . texture . baseTexture === this . currentBaseTexture || ( this . flush ( ) , this . currentBaseTexture = a . texture . baseTexture , a . texture . _uvs ) ) { var b , c , d , e , f , g , h , i , j = this . vertices ; if ( b = a . texture . _uvs , c = a . texture . frame . width , d = a . texture . frame . height , a . texture . trim ) { var k = a . texture . trim ; f = k . x - a . anchor . x * k . width , e = f + a . texture . frame . width , h = k . y - a . anchor . y * k . height , g = h + a . texture . frame . height } else e = a . texture . frame . width * ( 1 - a . anchor . x ) , f = a . texture . frame . width * - a . anchor . x , g = a . texture . frame . height * ( 1 - a . anchor . y ) , h = a . texture . frame . height * - a . anchor . y ; i = 4 * this . currentBatchSize * this . vertSize , j [ i ++ ] = f , j [ i ++ ] = h , j [ i ++ ] = a . position . x , j [ i ++ ] = a . position . y , j [ i ++ ] = a . scale . x , j [ i ++ ] = a . scale . y , j [ i ++ ] = a . rotation , j [ i ++ ] = b . x0 , j [ i ++ ] = b . y1 , j [ i ++ ] = a . alpha , j [ i ++ ] = e , j [ i ++ ] = h , j [ i ++ ] = a . position . x , j [ i ++ ] = a . position . y , j [ i ++ ] = a . scale . x , j [ i ++ ] = a . scale . y , j [ i ++ ] = a . rotation , j [ i ++ ] = b . x1 , j [ i ++ ] = b . y1 , j [ i ++ ] = a . alpha , j [ i ++ ] = e , j [ i ++ ] = g , j [ i ++ ] = a . position . x , j [ i ++ ] = a . position . y , j [ i ++ ] = a . scale . x , j [ i ++ ] = a . scale . y , j [ i ++ ] = a . rotation , j [ i ++ ] = b . x2 , j [ i ++ ] = b . y2 , j [ i ++ ] = a . alpha , j [ i ++ ] = f , j [ i ++ ] = g , j [ i ++ ] = a . position . x , j [ i ++ ] = a . position . y , j [ i ++ ] = a . scale . x , j [ i ++ ] = a . scale . y , j [ i ++ ] = a . rotation , j [ i ++ ] = b . x3 , j [ i ++ ] = b . y3 , j [ i ++ ] = a . alpha , this . currentBatchSize ++ , this . currentBatchSize >= this . size && this . flush ( ) } } , a . WebGLFastSpriteBatch . prototype . flush = function ( ) { if ( 0 !== this . currentBatchSize ) { var b = this . gl ; if ( this . currentBaseTexture . _glTextures [ b . id ] || a . createWebGLTexture ( this . currentBaseTexture , b ) , b . bindTexture ( b . TEXTURE _2D , this . currentBaseTexture . _glTextures [ b . id ] ) , this . currentBatchSize > . 5 * this . size ) b . bufferSubData ( b . ARRAY _BUFFER , 0 , this . vertices ) ; else { var c = this . vertices . subarray ( 0 , 4 * this . currentBatchSize * this . vertSize ) ; b . bufferSubData ( b . ARRAY _BUFFER , 0 , c ) } b . drawElements ( b . TRIANGLES , 6 * this . currentBatchSize , b . UNSIGNED _SHORT , 0 ) , this . currentBatchSize = 0 , this . renderSession . drawCount ++ } } , 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 . vertexAttribPoi
} , a . TilingSprite . prototype . generateTilingTexture = function ( b ) { var c = this . texture ; if ( c . baseTexture . hasLoaded ) { var d , e , f = c . baseTexture , g = c . frame , h = g . width !== f . width || g . height !== f . height , i = ! 1 ; if ( b ? ( d = a . getNextPowerOfTwo ( g . width ) , e = a . getNextPowerOfTwo ( g . height ) , g . width !== d && g . height !== e && ( i = ! 0 ) ) : h && ( c . trim ? ( d = c . trim . width , e = c . trim . height ) : ( d = g . width , e = g . height ) , i = ! 0 ) , i ) { var j ; this . tilingTexture && this . tilingTexture . isTiling ? ( j = this . tilingTexture . canvasBuffer , j . resize ( d , e ) , this . tilingTexture . baseTexture . width = d , this . tilingTexture . baseTexture . height = e , this . tilingTexture . needsUpdate = ! 0 ) : ( j = new a . CanvasBuffer ( d , e ) , this . tilingTexture = a . Texture . fromCanvas ( j . canvas ) , this . tilingTexture . canvasBuffer = j , this . tilingTexture . isTiling = ! 0 ) , j . context . drawImage ( c . baseTexture . source , g . x , g . y , g . width , g . height , 0 , 0 , d , e ) , this . tileScaleOffset . x = g . width / d , this . tileScaleOffset . y = g . height / e } else this . tilingTexture && this . tilingTexture . isTiling && this . tilingTexture . destroy ( ! 0 ) , this . tileScaleOffset . x = 1 , this . tileScaleOffset . y = 1 , this . tilingTexture = c ; this . refreshTexture = ! 1 , this . tilingTexture . baseTexture . _powerOf2 = ! 0 } } , a . BaseTextureCache = { } , a . texturesToUpdate = [ ] , a . texturesToDestroy = [ ] , a . BaseTextureCacheIdGenerator = 0 , a . BaseTexture = function ( b , c ) { if ( a . EventTarget . call ( this ) , this . width = 100 , this . height = 100 , this . scaleMode = c || a . scaleModes . DEFAULT , this . hasLoaded = ! 1 , this . source = b , this . id = a . BaseTextureCacheIdGenerator ++ , this . _glTextures = [ ] , b ) { if ( this . source . complete || this . source . getContext ) this . hasLoaded = ! 0 , this . width = this . source . width , this . height = this . source . height , a . texturesToUpdate . push ( this ) ; else { var d = this ; this . source . onload = function ( ) { d . hasLoaded = ! 0 , d . width = d . source . width , d . height = d . source . height , a . texturesToUpdate . push ( d ) , d . dispatchEvent ( { type : "loaded" , content : d } ) } } this . imageUrl = null , this . _powerOf2 = ! 1 } } , a . BaseTexture . prototype . constructor = a . BaseTexture , a . BaseTexture . prototype . destroy = function ( ) { this . imageUrl && ( delete a . BaseTextureCache [ this . imageUrl ] , this . imageUrl = null , this . source . src = null ) , this . source = null , a . texturesToDestroy . push ( this ) } , a . BaseTexture . prototype . updateSourceImage = function ( a ) { this . hasLoaded = ! 1 , this . source . src = null , this . source . src = a } , a . BaseTexture . fromImage = function ( b , c , d ) { var e = a . BaseTextureCache [ b ] ; if ( c = ! c , ! e ) { var f = new Image ; c && ( f . crossOrigin = "" ) , f . src = b , e = new a . BaseTexture ( f , d ) , e . imageUrl = b , a . BaseTextureCache [ b ] = e } return e } , a . BaseTexture . fromCanvas = function ( b , c ) { b . _pixiId || ( b . _pixiId = "canvas_" + a . TextureCacheIdGenerator ++ ) ; var d = a . BaseTextureCache [ b . _pixiId ] ; return d || ( d = new a . BaseTexture ( b , c ) , a . BaseTextureCache [ b . _pixiId ] = d ) , d } , a . TextureCache = { } , a . FrameCache = { } , a . TextureCacheIdGenerator = 0 , a . Texture = function ( b , c ) { if ( a . EventTarget . call ( this ) , c || ( this . noFrame = ! 0 , c = new a . Rectangle ( 0 , 0 , 1 , 1 ) ) , b instanceof a . Texture && ( b = b . baseTexture ) , this . baseTexture = b , this . frame = c , this . trim = null , this . scope = this , this . _uvs = null , b . hasLoaded ) this . noFrame && ( c = new a . Rectangle ( 0 , 0 , b . width , b . height ) ) , this . setFrame ( c ) ; else { var d = this ; b . addEventListener ( "loaded" , function ( ) { d . onBaseTextureLoaded ( ) } ) } } , a . Texture . prototype . constructor = a . Texture , a . Texture . prototype . onBaseTextureLoaded = function ( ) { var b = this . baseTexture ; b . removeEventListener ( "loaded" , this . onLoaded ) , this . noFrame && ( this . frame = new a . Rectangle ( 0 , 0 , b . width , b . height ) ) , this . setFrame ( this . frame ) , this . scope . dispatchEvent ( { type : "update" , content : this } ) } , a . Texture . prototype . destroy = function ( a ) { a && this . baseTexture . destroy ( ) } , a . Texture . prototype . setFrame = function ( b ) { if ( this . frame = b , this . width = b . width , this . height = b . height , b . x + b . width > this . baseTexture . width || b . y + b . height > this . baseTexture . height ) throw new Error ( "Texture Error: frame does not fit inside the base Texture dimensions " + this ) ; this . updateFrame = ! 0 , a . Texture . frameUpdates . push ( this ) } , a . Texture . prototype . _updateWebGLuvs = function ( ) { this . _uvs || ( this . _uvs = new a . TextureUvs ) ; var b = this . frame , c = this . baseTexture . width , d = this . baseTexture . height ; this . _uvs . x0 = b . x / c , this . _uvs . y0 = b . y / d , this . _uvs . x1 = ( b . x + b . width ) / c , this . _uvs . y1 = b . y / d , this . _uvs . x2 = ( b . x + b . width ) / c , this . _uvs . y2 = ( b . y + b . height ) / d , this . _uvs . x3 = b . x / c , this . _uvs . y3 = ( b . y + b . height ) / d } , a . Texture . fromImage = function ( b , c , d ) { var e = a . Text
for ( var a = this . children . length ; a -- ; ) this . children [ a ] . preUpdate ( ) ; return ! 0 } , b . Group . prototype . update = function ( ) { for ( var a = this . children . length ; a -- ; ) this . children [ a ] . update ( ) } , b . Group . prototype . postUpdate = function ( ) { 1 === this . _cache [ 7 ] && ( this . x = this . game . camera . view . x + this . cameraOffset . x , this . y = this . game . camera . view . y + this . cameraOffset . y ) ; for ( var a = this . children . length ; a -- ; ) this . children [ a ] . postUpdate ( ) } , b . Group . prototype . forEach = function ( a , b , c ) { "undefined" == typeof c && ( c = ! 1 ) ; var d = Array . prototype . splice . call ( arguments , 3 ) ; d . unshift ( null ) ; for ( var e = 0 , f = this . children . length ; f > e ; e ++ ) ( ! c || c && this . children [ e ] . exists ) && ( d [ 0 ] = this . children [ e ] , a . apply ( b , d ) ) } , b . Group . prototype . forEachExists = function ( a , c ) { var d = Array . prototype . splice . call ( arguments , 2 ) ; d . unshift ( null ) , this . iterate ( "exists" , ! 0 , b . Group . RETURN _TOTAL , a , c , d ) } , b . Group . prototype . forEachAlive = function ( a , c ) { var d = Array . prototype . splice . call ( arguments , 2 ) ; d . unshift ( null ) , this . iterate ( "alive" , ! 0 , b . Group . RETURN _TOTAL , a , c , d ) } , b . Group . prototype . forEachDead = function ( a , c ) { var d = Array . prototype . splice . call ( arguments , 2 ) ; d . unshift ( null ) , this . iterate ( "alive" , ! 1 , b . Group . RETURN _TOTAL , a , c , d ) } , b . Group . prototype . sort = function ( a , c ) { "undefined" == typeof a && ( a = "y" ) , "undefined" == typeof c && ( c = b . Group . SORT _ASCENDING ) } , b . Group . prototype . sortHandler = function ( ) { } , b . Group . prototype . iterate = function ( a , c , d , e , f , g ) { if ( d === b . Group . RETURN _TOTAL && 0 === this . children . length ) return 0 ; "undefined" == typeof e && ( e = ! 1 ) ; for ( var h = 0 , i = 0 , j = this . children . length ; j > i ; i ++ ) if ( this . children [ i ] [ a ] === c && ( h ++ , e && ( g [ 0 ] = this . children [ i ] , e . apply ( f , g ) ) , d === b . Group . RETURN _CHILD ) ) return this . children [ i ] ; return d === b . Group . RETURN _TOTAL ? h : d === b . Group . RETURN _CHILD ? null : void 0 } , b . Group . prototype . getFirstExists = function ( a ) { return "boolean" != typeof a && ( a = ! 0 ) , this . iterate ( "exists" , a , b . Group . RETURN _CHILD ) } , b . Group . prototype . getFirstAlive = function ( ) { return this . iterate ( "alive" , ! 0 , b . Group . RETURN _CHILD ) } , b . Group . prototype . getFirstDead = function ( ) { return this . iterate ( "alive" , ! 1 , b . Group . RETURN _CHILD ) } , b . Group . prototype . countLiving = function ( ) { return this . iterate ( "alive" , ! 0 , b . Group . RETURN _TOTAL ) } , b . Group . prototype . countDead = function ( ) { return this . iterate ( "alive" , ! 1 , b . Group . RETURN _TOTAL ) } , b . Group . prototype . getRandom = function ( a , b ) { return 0 === this . children . length ? null : ( a = a || 0 , b = b || this . children . length , this . game . math . getRandom ( this . children , a , b ) ) } , b . Group . prototype . remove = function ( a ) { return 0 !== this . children . length ? ( a . events && a . events . onRemovedFromGroup . dispatch ( a , this ) , this . removeChild ( a ) , this . cursor === a && this . next ( ) , ! 0 ) : void 0 } , b . Group . prototype . removeAll = function ( ) { if ( 0 !== this . children . length ) { do this . children [ 0 ] . events && this . children [ 0 ] . events . onRemovedFromGroup . dispatch ( this . children [ 0 ] , this ) , this . removeChild ( this . children [ 0 ] ) ; while ( this . children . length > 0 ) ; this . cursor = null } } , b . Group . prototype . removeBetween = function ( a , b ) { if ( 0 !== this . children . length ) { if ( a > b || 0 > a || b > this . children . length ) return ! 1 ; for ( var c = a ; b > c ; c ++ ) this . children [ c ] . events && this . children [ c ] . events . onRemovedFromGroup . dispatch ( this . children [ c ] , this ) , this . removeChild ( this . children [ c ] ) , this . cursor === child && ( this . cursor = null ) } } , b . Group . prototype . destroy = function ( a ) { if ( "undefined" == typeof a && ( a = ! 1 ) , a ) { if ( this . children . length > 0 ) do this . children [ 0 ] . group && this . children [ 0 ] . destroy ( ) ; while ( this . children . length > 0 ) } else this . removeAll ( ) ; this . parent . removeChild ( this ) , this . game = null , this . exists = ! 1 , this . cursor = null } , Object . defineProperty ( b . Group . prototype , "total" , { get : function ( ) { return this . iterate ( "exists" , ! 0 , b . Group . RETURN _TOTAL ) } } ) , Object . defineProperty ( b . Group . prototype , "length" , { get : function ( ) { return this . children . length } } ) , Object . defineProperty ( b . Group . prototype , "angle" , { get : function ( ) { return b . Math . radToDeg ( this . rotation ) } , set : function ( a ) { this . rotation = b . Math . degToRad ( a ) } } ) , Object . defineProperty ( b . Group . 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 . World = function ( a ) { b . Group . call ( this , a , null , "__world" , ! 1 ) , this . bounds = new b . Rectangle ( 0 , 0 , a . width , a . height ) , this . camera = null , this . currentRen
} , move : function ( a , c ) { if ( ! this . game . input . pollLocked ) { if ( "undefined" == typeof c && ( c = ! 1 ) , "undefined" != typeof a . button && ( this . button = a . button ) , this . clientX = a . clientX , this . clientY = a . clientY , this . pageX = a . pageX , this . pageY = a . pageY , this . screenX = a . screenX , this . screenY = a . screenY , this . x = ( this . pageX - this . game . stage . offset . x ) * this . game . input . scale . x , this . y = ( this . pageY - this . game . stage . offset . y ) * this . game . input . scale . y , this . position . setTo ( this . x , this . y ) , this . circle . x = this . x , this . circle . y = this . y , ( this . game . input . multiInputOverride == b . Input . MOUSE _OVERRIDES _TOUCH || this . game . input . multiInputOverride == b . Input . MOUSE _TOUCH _COMBINE || this . game . input . multiInputOverride == b . Input . TOUCH _OVERRIDES _MOUSE && 0 === this . game . input . currentPointers ) && ( this . game . input . activePointer = this , this . game . input . x = this . x , this . game . input . y = this . y , this . game . input . position . setTo ( this . game . input . x , this . game . input . y ) , this . game . input . circle . x = this . game . input . x , this . game . input . circle . y = this . game . input . y ) , this . game . paused ) return this ; if ( this . game . input . moveCallback && this . game . input . moveCallback . call ( this . game . input . moveCallbackContext , this , this . x , this . y ) , null !== this . targetObject && this . targetObject . isDragged === ! 0 ) return this . targetObject . update ( this ) === ! 1 && ( this . targetObject = null ) , this ; if ( this . _highestRenderOrderID = - 1 , this . _highestRenderObject = null , this . _highestInputPriorityID = - 1 , this . game . input . interactiveItems . total > 0 ) { var d = this . game . input . interactiveItems . next ; do ( d . pixelPerfectClick || d . pixelPerfectOver || d . priorityID > this . _highestInputPriorityID || d . priorityID === this . _highestInputPriorityID && d . sprite . renderOrderID > this . _highestRenderOrderID ) && ( ! c && d . checkPointerOver ( this ) || c && d . checkPointerDown ( this ) ) && ( this . _highestRenderOrderID = d . sprite . renderOrderID , this . _highestInputPriorityID = d . priorityID , this . _highestRenderObject = d ) , d = d . next ; while ( null != d ) } return null === this . _highestRenderObject ? this . targetObject && ( this . targetObject . _pointerOutHandler ( this ) , this . targetObject = null ) : null === this . targetObject ? ( this . targetObject = this . _highestRenderObject , this . _highestRenderObject . _pointerOverHandler ( this ) ) : this . targetObject === this . _highestRenderObject ? this . _highestRenderObject . update ( this ) === ! 1 && ( this . targetObject = null ) : ( this . targetObject . _pointerOutHandler ( this ) , this . targetObject = this . _highestRenderObject , this . targetObject . _pointerOverHandler ( this ) ) , this } } , leave : function ( a ) { this . withinGame = ! 1 , this . move ( a , ! 1 ) } , stop : function ( a ) { if ( this . _stateReset ) return a . preventDefault ( ) , void 0 ; if ( this . timeUp = this . game . time . now , ( this . game . input . multiInputOverride == b . Input . MOUSE _OVERRIDES _TOUCH || this . game . input . multiInputOverride == b . Input . MOUSE _TOUCH _COMBINE || this . game . input . multiInputOverride == b . Input . TOUCH _OVERRIDES _MOUSE && 0 === this . game . input . currentPointers ) && ( this . game . input . onUp . dispatch ( this , a ) , this . duration >= 0 && this . duration <= this . game . input . tapRate && ( this . timeUp - this . previousTapTime < this . game . input . doubleTapRate ? this . game . input . onTap . dispatch ( this , ! 0 ) : this . game . input . onTap . dispatch ( this , ! 1 ) , this . previousTapTime = this . timeUp ) ) , this . id > 0 && ( this . active = ! 1 ) , this . withinGame = ! 1 , this . isDown = ! 1 , this . isUp = ! 0 , this . isMouse === ! 1 && this . game . input . currentPointers -- , this . game . input . interactiveItems . total > 0 ) { var c = this . game . input . interactiveItems . next ; do c && c . _releasedHandler ( this ) , c = c . next ; while ( null != c ) } return this . targetObject && this . targetObject . _releasedHandler ( this ) , this . targetObject = null , this } , justPressed : function ( a ) { return a = a || this . game . input . justPressedRate , this . isDown === ! 0 && this . timeDown + a > this . game . time . now } , justReleased : function ( a ) { return a = a || this . game . input . justReleasedRate , this . isUp === ! 0 && this . timeUp + a > this . game . time . now } , reset : function ( ) { this . isMouse === ! 1 && ( this . active = ! 1 ) , this . identifier = null , this . isDown = ! 1 , this . isUp = ! 0 , this . totalTouches = 0 , this . _holdSent = ! 1 , this . _history . length = 0 , this . _stateReset = ! 0 , this . targetObject && this . targetObject . _releasedHandler ( this ) , this . targetObject = null } } , b . Pointer . prototype . constructor = b . Pointer , Object . defineProperty ( b . Pointer . prototype , "duration" , { get : function ( ) { return this . isUp ? - 1 : this . game . time . now - this . timeDown } } ) , Object . defineProperty ( b . Pointer . prototype , "worldX" , { ge
} } , b . InputHandler . prototype . constructor = b . InputHandler , b . Events = function ( a ) { this . parent = a , this . onAddedToGroup = new b . Signal , this . onRemovedFromGroup = new b . Signal , this . onKilled = new b . Signal , this . onRevived = new b . Signal , this . onOutOfBounds = new b . Signal , this . onInputOver = null , this . onInputOut = null , this . onInputDown = null , this . onInputUp = null , this . onDragStart = null , this . onDragStop = null , this . onAnimationStart = null , this . onAnimationComplete = null , this . onAnimationLoop = null } , b . Events . prototype = { destroy : function ( ) { this . parent = null , this . onAddedToGroup . dispose ( ) , this . onRemovedFromGroup . dispose ( ) , this . onKilled . dispose ( ) , this . onRevived . dispose ( ) , this . onOutOfBounds . dispose ( ) , this . onInputOver && ( this . onInputOver . dispose ( ) , this . onInputOut . dispose ( ) , this . onInputDown . dispose ( ) , this . onInputUp . dispose ( ) , this . onDragStart . dispose ( ) , this . onDragStop . dispose ( ) ) , this . onAnimationStart && ( this . onAnimationStart . dispose ( ) , this . onAnimationComplete . dispose ( ) , this . onAnimationLoop . dispose ( ) ) } } , b . Events . prototype . constructor = b . Events , b . GameObjectFactory = function ( a ) { this . game = a , this . world = this . game . world } , b . GameObjectFactory . prototype = { existing : function ( a ) { return this . world . add ( a ) } , image : function ( a , c , d , e , f ) { return "undefined" == typeof f && ( f = this . world ) , f . add ( new b . Image ( this . game , a , c , d , e ) ) } , sprite : function ( a , b , c , d , e ) { return "undefined" == typeof e && ( e = this . world ) , e . create ( a , b , c , d ) } , tween : function ( a ) { return this . game . tweens . create ( a ) } , group : function ( a , c , d ) { return "undefined" == typeof c && ( c = "group" ) , "undefined" == typeof d && ( d = ! 1 ) , new b . Group ( this . game , a , c , d ) } , spriteBatch : function ( a , c , d ) { return "undefined" == typeof c && ( c = "group" ) , "undefined" == typeof d && ( d = ! 1 ) , new b . SpriteBatch ( this . game , a , c , d ) } , audio : function ( a , b , c , d ) { return this . game . sound . add ( a , b , c , d ) } , sound : function ( a , b , c , d ) { return this . game . sound . add ( a , b , c , d ) } , tileSprite : function ( a , c , d , e , f , g , h ) { return "undefined" == typeof h && ( h = this . world ) , h . add ( new b . TileSprite ( this . game , a , c , d , e , f , g ) ) } , text : function ( a , c , d , e , f ) { return "undefined" == typeof f && ( f = this . world ) , f . add ( new b . Text ( this . game , a , c , d , e ) ) } , button : function ( a , c , d , e , f , g , h , i , j , k ) { return "undefined" == typeof k && ( k = this . world ) , k . add ( new b . Button ( this . game , a , c , d , e , f , g , h , i , j ) ) } , graphics : function ( a , c , d ) { return "undefined" == typeof d && ( d = this . world ) , d . add ( new b . Graphics ( this . game , a , c ) ) } , emitter : function ( a , c , d ) { return this . game . particles . add ( new b . Particles . Arcade . Emitter ( this . game , a , c , d ) ) } , bitmapFont : function ( a , c , d , e , f , g , h , i , j ) { return new b . BitmapFont ( this . game , a , c , d , e , f , g , h , i , j ) } , bitmapText : function ( a , c , d , e , f , g ) { return "undefined" == typeof g && ( g = this . world ) , g . add ( new b . BitmapText ( this . game , a , c , d , e , f ) ) } , tilemap : function ( a , c ) { return new b . Tilemap ( this . game , a , c ) } , renderTexture : function ( a , c , d , e ) { ( "undefined" == typeof d || "" === d ) && ( d = this . game . rnd . uuid ( ) ) , "undefined" == typeof e && ( e = ! 1 ) ; var f = new b . RenderTexture ( this . game , a , c , d ) ; return e && this . game . cache . addRenderTexture ( d , f ) , f } , bitmapData : function ( a , c , d ) { "undefined" == typeof d && ( d = ! 1 ) , ( "undefined" == typeof key || "" === key ) && ( key = this . game . rnd . uuid ( ) ) ; var e = new b . BitmapData ( this . game , key , a , c ) ; return d && this . game . cache . addBitmapData ( key , e ) , e } , filter : function ( a ) { var c = Array . prototype . splice . call ( arguments , 1 ) , a = new b . Filter [ a ] ( this . game ) ; return a . init . apply ( a , c ) , a } } , b . GameObjectFactory . prototype . constructor = b . GameObjectFactory , b . BitmapData = function ( c , d , e , f ) { "undefined" == typeof e && ( e = 100 ) , "undefined" == typeof f && ( f = 100 ) , this . game = c , this . key = d , this . width = e , this . height = f , this . canvas = b . Canvas . create ( e , f ) , this . context = this . canvas . getContext ( "2d" ) , this . ctx = this . context , this . imageData = this . context . getImageData ( 0 , 0 , e , f ) , this . pixels = this . imageData . data . buffer ? this . imageData . data . buffer : this . imageData . data , this . baseTexture = new a . BaseTexture ( this . canvas ) , this . texture = new a . Texture ( this . baseTexture ) , this . textureFrame = new b . Frame ( 0 , 0 , 0 , e , f , "bitmapData" , c . rnd . uuid ( ) ) , this . type = b . BITMAPDATA , this . _dirty = ! 1 } , b . BitmapData . prototype = { add : function ( a ) { if ( Array . isArray ( a ) ) for ( var b = 0 ; b < a . length ; b ++ ) a [ b ] . loadTexture && a [ b ] . loadTexture ( this ) ; else a . loadTexture ( this ) } , clear : function ( ) { this . context . clearRect ( 0 , 0 , this . width , this . height ) , this . _dirty = ! 0 } , resize : function ( a , b ) { ( a !== this . widt
} , b . Button . prototype = Object . create ( b . Image . prototype ) , b . Button . prototype . constructor = b . Button , b . Button . prototype . clearFrames = function ( ) { this . _onOverFrameName = null , this . _onOverFrameID = null , this . _onOutFrameName = null , this . _onOutFrameID = null , this . _onDownFrameName = null , this . _onDownFrameID = null , this . _onUpFrameName = null , this . _onUpFrameID = null } , b . Button . prototype . setFrames = function ( a , b , c , d ) { this . clearFrames ( ) , null !== a && ( "string" == typeof a ? ( this . _onOverFrameName = a , this . input . pointerOver ( ) && ( this . frameName = a ) ) : ( this . _onOverFrameID = a , this . input . pointerOver ( ) && ( this . frame = a ) ) ) , null !== b && ( "string" == typeof b ? ( this . _onOutFrameName = b , this . input . pointerOver ( ) === ! 1 && ( this . frameName = b ) ) : ( this . _onOutFrameID = b , this . input . pointerOver ( ) === ! 1 && ( this . frame = b ) ) ) , null !== c && ( "string" == typeof c ? ( this . _onDownFrameName = c , this . input . pointerDown ( ) && ( this . frameName = c ) ) : ( this . _onDownFrameID = c , this . input . pointerDown ( ) && ( this . frame = c ) ) ) , null !== d && ( "string" == typeof d ? ( this . _onUpFrameName = d , this . input . pointerUp ( ) && ( this . frameName = d ) ) : ( this . _onUpFrameID = d , this . input . pointerUp ( ) && ( this . frame = d ) ) ) } , b . Button . prototype . setSounds = function ( a , b , c , d , e , f , g , h ) { this . setOverSound ( a , b ) , this . setOutSound ( e , f ) , this . setDownSound ( c , d ) , this . setUpSound ( g , h ) } , b . Button . prototype . setOverSound = function ( a , c ) { this . onOverSound = null , this . onOverSoundMarker = "" , a instanceof b . Sound && ( this . onOverSound = a ) , "string" == typeof c && ( this . onOverSoundMarker = c ) } , b . Button . prototype . setOutSound = function ( a , c ) { this . onOutSound = null , this . onOutSoundMarker = "" , a instanceof b . Sound && ( this . onOutSound = a ) , "string" == typeof c && ( this . onOutSoundMarker = c ) } , b . Button . prototype . setDownSound = function ( a , c ) { this . onDownSound = null , this . onDownSoundMarker = "" , a instanceof b . Sound && ( this . onDownSound = a ) , "string" == typeof c && ( this . onDownSoundMarker = c ) } , b . Button . prototype . setUpSound = function ( a , c ) { this . onUpSound = null , this . onUpSoundMarker = "" , a instanceof b . Sound && ( this . onUpSound = a ) , "string" == typeof c && ( this . onUpSoundMarker = c ) } , b . Button . prototype . onInputOverHandler = function ( a , b ) { this . freezeFrames === ! 1 && this . setState ( 1 ) , this . onOverSound && this . onOverSound . play ( this . onOverSoundMarker ) , this . onInputOver && this . onInputOver . dispatch ( this , b ) } , b . Button . prototype . onInputOutHandler = function ( a , b ) { this . freezeFrames === ! 1 && this . setState ( 2 ) , this . onOutSound && this . onOutSound . play ( this . onOutSoundMarker ) , this . onInputOut && this . onInputOut . dispatch ( this , b ) } , b . Button . prototype . onInputDownHandler = function ( a , b ) { this . freezeFrames === ! 1 && this . setState ( 3 ) , this . onDownSound && this . onDownSound . play ( this . onDownSoundMarker ) , this . onInputDown && this . onInputDown . dispatch ( this , b ) } , b . Button . prototype . onInputUpHandler = function ( a , b , c ) { this . onUpSound && this . onUpSound . play ( this . onUpSoundMarker ) , this . onInputUp && this . onInputUp . dispatch ( this , b , c ) , this . freezeFrames || ( this . forceOut ? this . setState ( 2 ) : this . _onUpFrameName || this . _onUpFrameID ? this . setState ( 4 ) : c ? this . setState ( 1 ) : this . setState ( 2 ) ) } , b . Button . prototype . setState = function ( a ) { 1 === a ? null != this . _onOverFrameName ? this . frameName = this . _onOverFrameName : null != this . _onOverFrameID && ( this . frame = this . _onOverFrameID ) : 2 === a ? null != this . _onOutFrameName ? this . frameName = this . _onOutFrameName : null != this . _onOutFrameID && ( this . frame = this . _onOutFrameID ) : 3 === a ? null != this . _onDownFrameName ? this . frameName = this . _onDownFrameName : null != this . _onDownFrameID && ( this . frame = this . _onDownFrameID ) : 4 === a && ( null != this . _onUpFrameName ? this . frameName = this . _onUpFrameName : null != this . _onUpFrameID && ( this . frame = this . _onUpFrameID ) ) } , b . Graphics = function ( c , d , e ) { d = d || 0 , e = e || 0 , this . game = c , this . exists = ! 0 , this . name = "" , this . type = b . GRAPHICS , this . world = new b . Point ( d , e ) , this . cameraOffset = new b . Point , a . Graphics . call ( this ) , this . position . set ( d , e ) , this . _cache = new Int16Array ( [ 0 , 0 , 0 , 0 , 1 , 0 , 1 , 0 ] ) } , b . Graphics . prototype = Object . create ( a . 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 . worldTran
} , bezierInterpolation : function ( a , b ) { for ( var c = 0 , d = a . length - 1 , e = 0 ; d >= e ; e ++ ) c += Math . pow ( 1 - b , d - e ) * Math . pow ( b , e ) * a [ e ] * this . bernstein ( d , e ) ; return c } , catmullRomInterpolation : function ( a , b ) { var c = a . length - 1 , d = c * b , e = Math . floor ( d ) ; return a [ 0 ] === a [ c ] ? ( 0 > b && ( e = Math . floor ( d = c * ( 1 + b ) ) ) , this . catmullRom ( a [ ( e - 1 + c ) % c ] , a [ e ] , a [ ( e + 1 ) % c ] , a [ ( e + 2 ) % c ] , d - e ) ) : 0 > b ? a [ 0 ] - ( this . catmullRom ( a [ 0 ] , a [ 0 ] , a [ 1 ] , a [ 1 ] , - d ) - a [ 0 ] ) : b > 1 ? a [ c ] - ( this . catmullRom ( a [ c ] , a [ c ] , a [ c - 1 ] , a [ c - 1 ] , d - c ) - a [ c ] ) : this . catmullRom ( a [ e ? e - 1 : 0 ] , a [ e ] , a [ e + 1 > c ? c : e + 1 ] , a [ e + 2 > c ? c : e + 2 ] , d - e ) } , linear : function ( a , b , c ) { return ( b - a ) * c + a } , bernstein : function ( a , b ) { return this . factorial ( a ) / this . factorial ( b ) / this . factorial ( a - b ) } , catmullRom : function ( a , b , c , d , e ) { var f = . 5 * ( c - a ) , g = . 5 * ( d - b ) , h = e * e , i = e * h ; return ( 2 * b - 2 * c + f + g ) * i + ( - 3 * b + 3 * c - 2 * f - g ) * h + f * e + b } , difference : function ( a , b ) { return Math . abs ( a - b ) } , getRandom : function ( a , b , c ) { if ( "undefined" == typeof b && ( b = 0 ) , "undefined" == typeof c && ( c = 0 ) , null != a ) { var d = c ; if ( ( 0 === d || d > a . length - b ) && ( d = a . length - b ) , d > 0 ) return a [ b + Math . floor ( Math . random ( ) * d ) ] } return null } , floor : function ( a ) { var b = 0 | a ; return a > 0 ? b : b != a ? b - 1 : b } , ceil : function ( a ) { var b = 0 | a ; return a > 0 ? b != a ? b + 1 : b : b } , sinCosGenerator : function ( a , b , c , d ) { "undefined" == typeof b && ( b = 1 ) , "undefined" == typeof c && ( c = 1 ) , "undefined" == typeof d && ( d = 1 ) ; for ( var e = b , f = c , g = d * Math . PI / a , h = [ ] , i = [ ] , j = 0 ; a > j ; j ++ ) f -= e * g , e += f * g , h [ j ] = f , i [ j ] = e ; return { sin : i , cos : h , length : a } } , shift : function ( a ) { var b = a . shift ( ) ; return a . push ( b ) , b } , shuffleArray : function ( a ) { for ( var b = a . length - 1 ; b > 0 ; b -- ) { var c = Math . floor ( Math . random ( ) * ( b + 1 ) ) , d = a [ b ] ; a [ b ] = a [ c ] , a [ c ] = d } return a } , distance : function ( a , b , c , d ) { var e = a - c , f = b - d ; return Math . sqrt ( e * e + f * f ) } , distancePow : function ( a , b , c , d , e ) { return "undefined" == typeof e && ( e = 2 ) , Math . sqrt ( Math . pow ( c - a , e ) + Math . pow ( d - b , e ) ) } , distanceRounded : function ( a , c , d , e ) { return Math . round ( b . Math . distance ( a , c , d , e ) ) } , clamp : function ( a , b , c ) { return b > a ? b : a > c ? c : a } , clampBottom : function ( a , b ) { return b > a ? b : a } , within : function ( a , b , c ) { return Math . abs ( a - b ) <= c } , mapLinear : function ( a , b , c , d , e ) { return d + ( a - b ) * ( e - d ) / ( c - b ) } , smoothstep : function ( a , b , c ) { return b >= a ? 0 : a >= c ? 1 : ( a = ( a - b ) / ( c - b ) , a * a * ( 3 - 2 * a ) ) } , smootherstep : function ( a , b , c ) { return b >= a ? 0 : a >= c ? 1 : ( a = ( a - b ) / ( c - b ) , a * a * a * ( a * ( 6 * a - 15 ) + 10 ) ) } , sign : function ( a ) { return 0 > a ? - 1 : a > 0 ? 1 : 0 } , p2px : function ( a ) { return a *= - 20 } , px2p : function ( a ) { return a * - . 05 } , degToRad : function ( ) { var a = Math . PI / 180 ; return function ( b ) { return b * a } } ( ) , radToDeg : function ( ) { var a = 180 / Math . PI ; return function ( b ) { return b * a } } ( ) } , b . RandomDataGenerator = function ( a ) { "undefined" == typeof a && ( a = [ ] ) , this . c = 1 , this . s0 = 0 , this . s1 = 0 , this . s2 = 0 , this . sow ( a ) } , b . RandomDataGenerator . prototype = { rnd : function ( ) { var a = 2091639 * this . s0 + 2.3283064365386963 e - 10 * this . c ; return this . c = 0 | a , this . s0 = this . s1 , this . s1 = this . s2 , this . s2 = a - this . c , this . s2 } , sow : function ( a ) { "undefined" == typeof a && ( a = [ ] ) , this . s0 = this . hash ( " " ) , this . s1 = this . hash ( this . s0 ) , this . s2 = this . hash ( this . s1 ) , this . c = 1 ; for ( var b , c = 0 ; b = a [ c ++ ] ; ) this . s0 -= this . hash ( b ) , this . s0 += ~ ~ ( this . s0 < 0 ) , this . s1 -= this . hash ( b ) , this . s1 += ~ ~ ( this . s1 < 0 ) , this . s2 -= this . hash ( b ) , this . s2 += ~ ~ ( this . s2 < 0 ) } , hash : function ( a ) { var b , c , d ; for ( d = 4022871197 , a = a . toString ( ) , c = 0 ; c < a . length ; c ++ ) d += a . charCodeAt ( c ) , b = . 02519603282416938 * d , d = b >>> 0 , b -= d , b *= d , d = b >>> 0 , b -= d , d += 4294967296 * b ; return 2.3283064365386963 e - 10 * ( d >>> 0 ) } , integer : function ( ) { return 4294967296 * this . rnd . apply ( this ) } , frac : function ( ) { return this . rnd . apply ( this ) + 1.1102230246251565 e - 16 * ( 0 | 2097152 * this . rnd . apply ( this ) ) } , real : function ( ) { return this . integer ( ) + this . frac ( ) } , integerInRange : function ( a , b ) { return Math . floor ( this . realInRange ( a , b ) ) } , realInRange : function ( a , b ) { return this . frac ( ) * ( b - a ) + a } , normal : function ( ) { return 1 - 2 * this . frac ( ) } , uuid : function ( ) { var a = "" , b = "" ; for ( b = a = "" ; a ++ < 36 ; b += ~ a % 5 | 4 & 3 * a ? ( 15 ^ a ? 8 ^ this . frac ( ) * ( 20 ^ a ? 16 : 4 ) : 4 ) . toString ( 16 ) : "-" ) ; return b } , pick : function ( a ) { return a [ this . integerInRange ( 0 , a . length ) ] } , weightedPick : function ( a ) { return a [ ~ ~ ( Math . pow ( this . frac ( ) , 2 ) * a . length ) ] } , timestamp : function ( a , b ) { return this . realInRange ( a || 9466848e5 , b || 1577862e6 ) } , angle : function ( ) { return this . integerInRange ( - 180 , 180 ) } } , b . RandomDataGenerator . prototype . constructor = b . RandomDataGenerator , b . QuadTree = function ( a , b , c , d , e , f , g ) { this . maxObjects = e || 10 , this . maxLevels = f |
} return g } , XMLData : function ( c , d , e ) { if ( ! d . getElementsByTagName ( "TextureAtlas" ) ) return console . warn ( "Phaser.AnimationParser.XMLData: Invalid Texture Atlas XML given, missing <TextureAtlas> tag" ) , void 0 ; for ( var f , g , h , i , j , k , l , m , n , o , p , q , r = new b . FrameData , s = d . getElementsByTagName ( "SubTexture" ) , t = 0 ; t < s . length ; t ++ ) g = c . rnd . uuid ( ) , i = s [ t ] . attributes , h = i . name . nodeValue , j = parseInt ( i . x . nodeValue , 10 ) , k = parseInt ( i . y . nodeValue , 10 ) , l = parseInt ( i . width . nodeValue , 10 ) , m = parseInt ( i . height . nodeValue , 10 ) , n = null , o = null , i . frameX && ( n = Math . abs ( parseInt ( i . frameX . nodeValue , 10 ) ) , o = Math . abs ( parseInt ( i . frameY . nodeValue , 10 ) ) , p = parseInt ( i . frameWidth . nodeValue , 10 ) , q = parseInt ( i . frameHeight . nodeValue , 10 ) ) , f = r . addFrame ( new b . Frame ( t , j , k , l , m , h , g ) ) , a . TextureCache [ g ] = new a . Texture ( a . BaseTextureCache [ e ] , { x : j , y : k , width : l , height : m } ) , ( null !== n || null !== o ) && ( f . setTrim ( ! 0 , l , m , n , o , p , q ) , a . TextureCache [ g ] . trim = new b . Rectangle ( n , o , l , m ) ) ; return r } } , b . Cache = function ( a ) { this . game = a , this . _canvases = { } , this . _images = { } , this . _textures = { } , this . _sounds = { } , this . _text = { } , this . _physics = { } , this . _tilemaps = { } , this . _binary = { } , this . _bitmapDatas = { } , this . _bitmapFont = { } , this . addDefaultImage ( ) , this . addMissingImage ( ) , this . onSoundUnlock = new b . Signal } , b . Cache . CANVAS = 1 , b . Cache . IMAGE = 2 , b . Cache . TEXTURE = 3 , b . Cache . SOUND = 4 , b . Cache . TEXT = 5 , b . Cache . PHYSICS = 6 , b . Cache . TILEMAP = 7 , b . Cache . BINARY = 8 , b . Cache . BITMAPDATA = 9 , b . Cache . BITMAPFONT = 10 , b . Cache . prototype = { addCanvas : function ( a , b , c ) { this . _canvases [ a ] = { canvas : b , context : c } } , addBinary : function ( a , b ) { this . _binary [ a ] = b } , addBitmapData : function ( a , b ) { return this . _bitmapDatas [ a ] = b , b } , addRenderTexture : function ( a , c ) { var d = new b . Frame ( 0 , 0 , 0 , c . width , c . height , "" , "" ) ; this . _textures [ a ] = { texture : c , frame : d } } , addBitmapFont : function ( a , b ) { this . _bitmapFont [ a ] = b } , addSpriteSheet : function ( c , d , e , f , g , h , i , j ) { this . _images [ c ] = { url : d , data : e , spriteSheet : ! 0 , frameWidth : f , frameHeight : g , margin : i , spacing : j } , a . BaseTextureCache [ c ] = new a . BaseTexture ( e ) , a . TextureCache [ c ] = new a . Texture ( a . BaseTextureCache [ c ] ) , this . _images [ c ] . frameData = b . AnimationParser . spriteSheet ( this . game , c , f , g , h , i , j ) } , addTilemap : function ( a , b , c , d ) { this . _tilemaps [ a ] = { url : b , data : c , format : d } } , addTextureAtlas : function ( c , d , e , f , g ) { this . _images [ c ] = { url : d , data : e , spriteSheet : ! 0 } , a . BaseTextureCache [ c ] = new a . BaseTexture ( e ) , a . TextureCache [ c ] = new a . Texture ( a . BaseTextureCache [ c ] ) , g == b . Loader . TEXTURE _ATLAS _JSON _ARRAY ? this . _images [ c ] . frameData = b . AnimationParser . JSONData ( this . game , f , c ) : g == b . Loader . TEXTURE _ATLAS _JSON _HASH ? this . _images [ c ] . frameData = b . AnimationParser . JSONDataHash ( this . game , f , c ) : g == b . Loader . TEXTURE _ATLAS _XML _STARLING && ( this . _images [ c ] . frameData = b . AnimationParser . XMLData ( this . game , f , c ) ) } , addBitmapFont : function ( c , d , e , f , g , h ) { this . _images [ c ] = { url : d , data : e , spriteSheet : ! 0 } , a . BaseTextureCache [ c ] = new a . BaseTexture ( e ) , a . TextureCache [ c ] = new a . Texture ( a . BaseTextureCache [ c ] ) , b . LoaderParser . bitmapFont ( this . game , f , c , g , h ) } , addPhysicsData : function ( a , b , c , d ) { this . _physics [ a ] = { url : b , data : c , format : d } } , addDefaultImage : function ( ) { var c = new Image ; c . src = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgAQMAAABJtOi3AAAAA1BMVEX///+nxBvIAAAAAXRSTlMAQObYZgAAABVJREFUeF7NwIEAAAAAgKD9qdeocAMAoAABm3DkcAAAAABJRU5ErkJggg==" , this . _images . _ _default = { url : null , data : c , spriteSheet : ! 1 } , this . _images . _ _default . frame = new b . Frame ( 0 , 0 , 0 , 32 , 32 , "" , "" ) , a . BaseTextureCache . _ _default = new a . BaseTexture ( c ) , a . TextureCache . _ _default = new a . Texture ( a . BaseTextureCache . _ _default ) } , addMissingImage : function ( ) { var c = new Image ; c . src = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAIAAAD8GO2jAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJ9JREFUeNq01ssOwyAMRFG46v//Mt1ESmgh+DFmE2GPOBARKb2NVjo+17PXLD8a1+pl5+A+wSgFygymWYHBb0FtsKhJDdZlncG2IzJ4ayoMDv20wTmSMzClEgbWYNTAkQ0Z+OJ+A/eWnAaR9+oxCF4Os0H8htsMUp+pwcgBBiMNnAwF8GqIgL2hAzaGFFgZauDPKABmowZ4GL369/0rwACp2yA/ttmvsQAAAABJRU5ErkJggg==" , this . _images . _ _missing = { url : null , data : c , spriteSheet : ! 1 } , this . _images . _ _missing . frame = new b . Frame ( 0 , 0 , 0 , 32 , 32 , "" , "" ) , a . BaseTextureCache . _ _missing = new a . BaseTexture ( c ) , a . TextureCache . _ _missing = new a . Texture ( a . BaseTextureCache . _ _missing ) } , addText : function ( a , b , c ) { this . _text [ a ] = { url : b , data : c } } , addImage : function ( c , d
} , unlock : function ( ) { if ( this . touchLocked !== ! 1 ) if ( this . game . device . webAudio === ! 1 || window . PhaserGlobal && window . PhaserGlobal . disableWebAudio === ! 0 ) this . touchLocked = ! 1 , this . _unlockSource = null , this . game . input . touch . callbackContext = null , this . game . input . touch . touchStartCallback = null , this . game . input . mouse . callbackContext = null , this . game . input . mouse . mouseDownCallback = null ; else { var a = this . context . createBuffer ( 1 , 1 , 22050 ) ; this . _unlockSource = this . context . createBufferSource ( ) , this . _unlockSource . buffer = a , this . _unlockSource . connect ( this . context . destination ) , this . _unlockSource . noteOn ( 0 ) } } , stopAll : function ( ) { for ( var a = 0 ; a < this . _sounds . length ; a ++ ) this . _sounds [ a ] && this . _sounds [ a ] . stop ( ) } , pauseAll : function ( ) { for ( var a = 0 ; a < this . _sounds . length ; a ++ ) this . _sounds [ a ] && this . _sounds [ a ] . pause ( ) } , resumeAll : function ( ) { for ( var a = 0 ; a < this . _sounds . length ; a ++ ) this . _sounds [ a ] && this . _sounds [ a ] . resume ( ) } , decode : function ( a , b ) { b = b || null ; var c = this . game . cache . getSoundData ( a ) ; if ( c && this . game . cache . isSoundDecoded ( a ) === ! 1 ) { this . game . cache . updateSound ( a , "isDecoding" , ! 0 ) ; var d = this ; this . context . decodeAudioData ( c , function ( c ) { d . game . cache . decodedSound ( a , c ) , b && d . onSoundDecode . dispatch ( a , b ) } ) } } , update : function ( ) { this . touchLocked && this . game . device . webAudio && null !== this . _unlockSource && ( this . _unlockSource . playbackState === this . _unlockSource . PLAYING _STATE || this . _unlockSource . playbackState === this . _unlockSource . FINISHED _STATE ) && ( this . touchLocked = ! 1 , this . _unlockSource = null , this . game . input . touch . callbackContext = null , this . game . input . touch . touchStartCallback = null ) ; for ( var a = 0 ; a < this . _sounds . length ; a ++ ) this . _sounds [ a ] . update ( ) } , add : function ( a , c , d , e ) { "undefined" == typeof c && ( c = 1 ) , "undefined" == typeof d && ( d = ! 1 ) , "undefined" == typeof e && ( e = this . connectToMaster ) ; var f = new b . Sound ( this . game , a , c , d , e ) ; return this . _sounds . push ( f ) , f } , play : function ( a , b , c , d ) { "undefined" == typeof d && ( d = ! 1 ) ; var e = this . add ( a , b , c ) ; return e . play ( ) , e } } , b . SoundManager . prototype . constructor = b . SoundManager , Object . defineProperty ( b . SoundManager . prototype , "mute" , { get : function ( ) { return this . _muted } , set : function ( a ) { if ( a = a || null ) { if ( this . _muted ) return ; this . _muted = ! 0 , this . usingWebAudio && ( this . _muteVolume = this . masterGain . gain . value , this . masterGain . gain . value = 0 ) ; for ( var b = 0 ; b < this . _sounds . length ; b ++ ) this . _sounds [ b ] . usingAudioTag && ( this . _sounds [ b ] . mute = ! 0 ) } else { if ( this . _muted === ! 1 ) return ; this . _muted = ! 1 , this . usingWebAudio && ( this . masterGain . gain . value = this . _muteVolume ) ; for ( var b = 0 ; b < this . _sounds . length ; b ++ ) this . _sounds [ b ] . usingAudioTag && ( this . _sounds [ b ] . mute = ! 1 ) } } } ) , Object . defineProperty ( b . SoundManager . prototype , "volume" , { get : function ( ) { return this . usingWebAudio ? this . masterGain . gain . value : this . _volume } , set : function ( a ) { a = this . game . math . clamp ( a , 1 , 0 ) , this . _volume = a , this . usingWebAudio && ( this . masterGain . gain . value = a ) ; for ( var b = 0 ; b < this . _sounds . length ; b ++ ) this . _sounds [ b ] . usingAudioTag && ( this . _sounds [ b ] . volume = this . _sounds [ b ] . volume * a ) } } ) , b . Utils . Debug = function ( a ) { this . game = a , this . context = a . context , this . font = "14px Courier" , this . columnWidth = 100 , this . lineHeight = 16 , this . renderShadow = ! 0 , this . currentX = 0 , this . currentY = 0 , this . currentAlpha = 1 } , b . Utils . Debug . prototype = { start : function ( a , b , c , d ) { null != this . context && ( "number" != typeof a && ( a = 0 ) , "number" != typeof b && ( b = 0 ) , c = c || "rgb(255,255,255)" , "undefined" == typeof d && ( d = 0 ) , this . currentX = a , this . currentY = b , this . currentColor = c , this . currentAlpha = this . context . globalAlpha , this . columnWidth = d , this . context . save ( ) , this . context . setTransform ( 1 , 0 , 0 , 1 , 0 , 0 ) , this . context . strokeStyle = c , this . context . fillStyle = c , this . context . font = this . font , this . context . globalAlpha = 1 ) } , stop : function ( ) { this . context . restore ( ) , this . context . globalAlpha = this . currentAlpha } , line : function ( a , b , c ) { null != this . context && ( "undefined" != typeof b && ( this . currentX = b ) , "undefined" != typeof c && ( this . currentY = c ) , this . renderShadow && ( this . context . fillStyle = "rgb(0,0,0)" , this . context . fillText ( a , this . currentX + 1 , this . currentY + 1 ) , this . context . fillStyle = this . currentColor ) , this . context . fillText ( a , this . currentX , this . currentY ) , this . currentY += this . lineHeight ) } , splitline : function ( ) { if ( null != this . context ) { for ( var a = this . currentX , b = 0 ; b < arguments . length ; b ++ ) this . renderShadow && ( this . cont
} , 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 , this . collideNone = a || b || c || d ? ! 1 : ! 0 } , resetCollision : function ( ) { this . collideNone = ! 0 , this . collideLeft = ! 1 , this . collideRight = ! 1 , this . collideUp = ! 1 , this . collideDown = ! 1 } , copy : function ( a ) { this . index = a . index , this . alpha = a . alpha , this . properties = a . properties , this . collides = a . collides , this . collideNone = a . collideNone , 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 , "canCollide" , { get : function ( ) { return this . collides || this . collisionCallback || this . layer . callbacks [ this . index ] } } ) , Object . defineProperty ( b . Tile . prototype , "left" , { get : function ( ) { return this . x } } ) , Object . defineProperty ( b . Tile . prototype , "right" , { get : function ( ) { return this . x + this . width } } ) , Object . defineProperty ( b . Tile . prototype , "top" , { get : function ( ) { return this . y } } ) , Object . defineProperty ( b . Tile . prototype , "bottom" , { get : function ( ) { return this . y + this . height } } ) , b . Tilemap = function ( a , c ) { this . game = a , this . key = c ; var d = b . TilemapParser . parse ( this . game , c ) ; null !== d && ( this . width = d . width , this . height = d . height , this . tileWidth = d . tileWidth , this . tileHeight = d . tileHeight , this . orientation = d . orientation , this . version = d . version , this . properties = d . properties , this . widthInPixels = d . widthInPixels , this . heightInPixels = d . heightInPixels , this . layers = d . layers , this . tilesets = d . tilesets , this . tiles = d . tiles , this . objects = d . objects , this . collision = d . collision , this . images = d . images , this . currentLayer = 0 , this . debugMap = [ ] , this . _results = [ ] , this . _tempA = 0 , this . _tempB = 0 ) } , b . Tilemap . CSV = 0 , b . Tilemap . TILED _JSON = 1 , b . Tilemap . prototype = { create : function ( a , c , d ) { for ( var e = [ ] , f = 0 ; d > f ; f ++ ) { e [ f ] = [ ] ; for ( var g = 0 ; c > g ; g ++ ) e [ f ] [ g ] = 0 } this . layers . push ( { name : a , width : c , height : d , alpha : 1 , visible : ! 0 , tileMargin : 0 , tileSpacing : 0 , format : b . Tilemap . CSV , data : e , indexes : [ ] , dirty : ! 0 } ) , this . currentLayer = this . layers . length - 1 } , addTilesetImage : function ( a , b ) { if ( "undefined" == typeof b ) { if ( "string" != typeof a ) return ! 1 ; b = a } return "string" == typeof a && ( a = this . getTilesetIndex ( a ) ) , this . tilesets [ a ] ? ( this . tilesets [ a ] . image = this . game . cache . getImage ( b ) , ! 0 ) : ! 1 } , createFromObjects : function ( a , b , c , d , e , f , g ) { if ( "undefined" == typeof e && ( e = ! 0 ) , "undefined" == typeof f && ( f = ! 0 ) , "undefined" == typeof g && ( g = this . game . world ) , ! this . objects [ a ] ) return console . warn ( "Tilemap.createFromObjects: Invalid objectgroup name given: " + a ) , void 0 ; for ( var h , i = 0 , j = this . objects [ a ] . length ; j > i ; i ++ ) if ( this . objects [ a ] [ i ] . gid === b ) { h = g . create ( this . objects [ a ] [ i ] . x , this . objects [ a ] [ i ] . y , c , d , e ) , h . anchor . setTo ( 0 , 1 ) , h . name = this . objects [ a ] [ i ] . name , h . visible = this . objects [ a ] [ i ] . visible , h . autoCull = f ; for ( property in this . objects [ a ] [ i ] . properties ) g . set ( h , property , this . objects [ a ] [ i ] . properties [ property ] , ! 1 , ! 1 , 0 ) } } , clearPhysicsBodies : function ( a ) { a = this . getLayer ( a ) ; for ( var b = this . layers [ a ] . bodies . length ; b -- ; ) this . layers [ a ] . bodies [ b ] . destroy ( ) } , generateCollisionData : function ( a , b ) { a = this . getLayer ( a ) , "undefined" == typeof b && ( b = ! 0 ) , this . layers [ a ] . bodies . length > 0 && this . clearPhysicsBodies ( a ) , this . layers [ a ] . bodies . length = [ ] ; for ( var c = 0 , d = 0 , e = 0 , f = 0 , g = this . layers [ a ] . height ; g > f ; f ++ ) { c = 0 ; for ( var h = 0 , i = this . layers [ a ] . width ; i > h ; h ++ ) { var j = this . layers [ a ] . data [ f ] [ h ] ; if ( j ) if ( right = this . getTileRight ( a , h , f ) , 0 === c && ( d = j . x * j . width , e = j . y * j . height , c = j . width ) , right && right . collides ) c += j . width ; else { var k = this . game . physics . createBody ( d , e , 0 , ! 1 ) ; k . addRectangle ( c , j . height , c / 2 , j . height / 2 , 0 ) , b && this . game . physics . addBody ( k . data ) , this . layers [ a ] . bodies . push ( k ) , c = 0 } } } return this . layers [ a ] . bodies } , createCollisionObjects : function ( a , b ) { "undefined" == typeof b && ( b = ! 0 ) ; for ( var c = [ ] , d = 0 , e = this . collision [ a ] . length ; e > d ; d ++ ) { var f = this . collision [ a ] [ d ] , g = this . game . physics . createBody ( f . x , f . y , 0 , b , { } , f . polyline ) ; g && c . push ( g ) } return c } , createLayer : function ( a , c , d , e ) { "undefined" == typeof c && ( c = this . game . width ) , "undefined" == typeof d && ( d = this . game . height )