2014-02-28 09:30:53 +00:00
/* Phaser (no libs) v2.0.0 - http://phaser.io - @photonstorm - (c) 2014 Photon Storm Ltd. */
( function ( ) { var a = this , b = b || { VERSION : "<%= version %>" , DEV _VERSION : "2.0" , GAMES : [ ] , AUTO : 0 , CANVAS : 1 , WEBGL : 2 , HEADLESS : 3 , SPRITE : 0 , BUTTON : 1 , IMAGE : 2 , GRAPHICS : 3 , TEXT : 4 , TILESPRITE : 5 , BITMAPTEXT : 6 , GROUP : 7 , RENDERTEXTURE : 8 , TILEMAP : 9 , TILEMAPLAYER : 10 , EMITTER : 11 , POLYGON : 12 , BITMAPDATA : 13 , CANVAS _FILTER : 14 , WEBGL _FILTER : 15 , ELLIPSE : 16 , SPRITEBATCH : 17 , BITMAPFONT : 18 , NONE : 0 , LEFT : 1 , RIGHT : 2 , UP : 3 , DOWN : 4 , DYNAMIC : 1 , STATIC : 2 , KINEMATIC : 4 , blendModes : { NORMAL : 0 , ADD : 1 , MULTIPLY : 2 , SCREEN : 3 , OVERLAY : 4 , DARKEN : 5 , LIGHTEN : 6 , COLOR _DODGE : 7 , COLOR _BURN : 8 , HARD _LIGHT : 9 , SOFT _LIGHT : 10 , DIFFERENCE : 11 , EXCLUSION : 12 , HUE : 13 , SATURATION : 14 , COLOR : 15 , LUMINOSITY : 16 } , scaleModes : { DEFAULT : 0 , LINEAR : 0 , NEAREST : 1 } } ; PIXI . InteractionManager = function ( ) { } , b . Utils = { 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 } , shuffle : 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 } , pad : function ( a , b , c , d ) { if ( "undefined" == typeof b ) var b = 0 ; if ( "undefined" == typeof c ) var c = " " ; if ( "undefined" == typeof d ) var d = 3 ; var e = 0 ; if ( b + 1 >= a . length ) switch ( d ) { case 1 : a = Array ( b + 1 - a . length ) . join ( c ) + a ; break ; case 3 : var f = Math . ceil ( ( e = b - a . length ) / 2 ) , g = e - f ; a = Array ( g + 1 ) . join ( c ) + a + Array ( f + 1 ) . join ( c ) ; break ; default : a += Array ( b + 1 - a . length ) . join ( c ) } return a } , isPlainObject : function ( a ) { if ( "object" != typeof a || a . nodeType || a === a . window ) return ! 1 ; try { if ( a . constructor && ! hasOwn . call ( a . constructor . prototype , "isPrototypeOf" ) ) return ! 1 } catch ( b ) { return ! 1 } return ! 0 } , extend : function ( ) { var a , c , d , e , f , g , h = arguments [ 0 ] || { } , i = 1 , j = arguments . length , k = ! 1 ; for ( "boolean" == typeof h && ( k = h , h = arguments [ 1 ] || { } , i = 2 ) , j === i && ( h = this , -- i ) ; j > i ; i ++ ) if ( null != ( a = arguments [ i ] ) ) for ( c in a ) d = h [ c ] , e = a [ c ] , h !== e && ( k && e && ( b . Utils . isPlainObject ( e ) || ( f = Array . isArray ( e ) ) ) ? ( f ? ( f = ! 1 , g = d && Array . isArray ( d ) ? d : [ ] ) : g = d && b . Utils . isPlainObject ( d ) ? d : { } , h [ c ] = b . Utils . extend ( k , g , e ) ) : void 0 !== e && ( h [ c ] = e ) ) ; return h } } , "function" != typeof Function . prototype . bind && ( Function . prototype . bind = function ( ) { var a = Array . prototype . slice ; return function ( b ) { function c ( ) { var f = e . concat ( a . call ( arguments ) ) ; d . apply ( this instanceof c ? this : b , f ) } var d = this , e = a . call ( arguments , 1 ) ; if ( "function" != typeof d ) throw new TypeError ; return c . prototype = function f ( a ) { return a && ( f . prototype = a ) , this instanceof f ? void 0 : new f } ( d . prototype ) , c } } ( ) ) , Array . isArray || ( Array . isArray = function ( a ) { return "[object Array]" == Object . prototype . toString . call ( a ) } ) , b . Circle = function ( a , b , c ) { a = a || 0 , b = b || 0 , c = c || 0 , this . x = a , this . y = b , this . _diameter = c , this . _radius = c > 0 ? . 5 * c : 0 } , b . Circle . prototype = { circumference : function ( ) { return 2 * Math . PI * this . _radius } , setTo : function ( a , b , c ) { return this . x = a , this . y = b , this . _diameter = c , this . _radius = . 5 * c , this } , copyFrom : function ( a ) { return this . setTo ( a . x , a . y , a . diameter ) } , copyTo : function ( a ) { return a . x = this . x , a . y = this . y , a . diameter = this . _diameter , a } , distance : function ( a , c ) { return "undefined" == typeof c && ( c = ! 1 ) , c ? b . Math . distanceRound ( this . x , this . y , a . x , a . y ) : b . Math . distance ( this . x , this . y , a . x , a . y ) } , clone : function ( a ) { return "undefined" == typeof a ? a = new b . Circle ( this . x , this . y , this . diameter ) : a . setTo ( this . x , this . y , this . diameter ) , a } , contains : function ( a , c ) { return b . Circle . contains ( this , a , c ) } , circumferencePoint : function ( a , c , d ) { return b . Circle . circumferencePoint ( this , a , c , d ) } , offset : function ( a , b ) { return this . x += a , this . y += b , this } , offsetPoint : function ( a ) { return this . offset ( a . x , a . y ) } , toString : function ( ) { return "[{Phaser.Circle (x=" + this . x + " y=" + this . y + " diameter=" + this . diameter + " radius=" + this . radius + ")}]" } } , b . Circle . prototype . constructor = b . Circle , Object . defineProperty ( b . Circle . prototype , "diameter" , { get : function ( ) { return this . _diameter } , set : function ( a ) { a > 0 && ( this . _diameter = a , this . _radius = . 5 * a ) } } ) , Object . defineProperty ( b . Circle . prototype , "radius" , { get : function ( ) { return this . _radius } , set : function ( a ) { a > 0 && ( this . _radius = a , this . _diameter = 2 * a ) } } ) , Object . defineProperty ( b . Circle . prototype , "left" , { get : function ( ) { return this . x - this . _radius } , set : function ( a ) { a > this . x ? ( this . _radius = 0 , this . _diameter = 0 ) : this . radius = this . x - a } } ) , Object . defineProperty ( b . Circle . prototype , "right" , { get : function ( ) { re
2014-02-28 19:45:15 +00:00
} , remove : function ( a ) { if ( 0 !== this . _pluginsLength ) for ( this . _p = 0 ; this . _p < this . _pluginsLength ; this . _p ++ ) if ( this . plugins [ this . _p ] === a ) return a . destroy ( ) , this . plugins . splice ( this . _p , 1 ) , void this . _pluginsLength -- } , removeAll : function ( ) { for ( this . _p = 0 ; this . _p < this . _pluginsLength ; this . _p ++ ) this . plugins [ this . _p ] . destroy ( ) ; this . plugins . length = 0 , this . _pluginsLength = 0 } , preUpdate : function ( ) { if ( 0 !== this . _pluginsLength ) for ( this . _p = 0 ; this . _p < this . _pluginsLength ; this . _p ++ ) this . plugins [ this . _p ] . active && this . plugins [ this . _p ] . hasPreUpdate && this . plugins [ this . _p ] . preUpdate ( ) } , update : function ( ) { if ( 0 !== this . _pluginsLength ) for ( this . _p = 0 ; this . _p < this . _pluginsLength ; this . _p ++ ) this . plugins [ this . _p ] . active && this . plugins [ this . _p ] . hasUpdate && this . plugins [ this . _p ] . update ( ) } , postUpdate : function ( ) { if ( 0 !== this . _pluginsLength ) for ( this . _p = 0 ; this . _p < this . _pluginsLength ; this . _p ++ ) this . plugins [ this . _p ] . active && this . plugins [ this . _p ] . hasPostUpdate && this . plugins [ this . _p ] . postUpdate ( ) } , render : function ( ) { if ( 0 !== this . _pluginsLength ) for ( this . _p = 0 ; this . _p < this . _pluginsLength ; this . _p ++ ) this . plugins [ this . _p ] . visible && this . plugins [ this . _p ] . hasRender && this . plugins [ this . _p ] . render ( ) } , postRender : function ( ) { if ( 0 !== this . _pluginsLength ) for ( this . _p = 0 ; this . _p < this . _pluginsLength ; this . _p ++ ) this . plugins [ this . _p ] . visible && this . plugins [ this . _p ] . hasPostRender && this . plugins [ this . _p ] . postRender ( ) } , destroy : function ( ) { this . plugins . length = 0 , this . _pluginsLength = 0 , this . game = null , this . _parent = null } } , b . PluginManager . prototype . constructor = b . PluginManager , b . Stage = function ( a , c , d ) { this . game = a , this . offset = new b . Point , PIXI . Stage . call ( this , 0 , ! 1 ) , this . name = "_stage_root" , this . interactive = ! 1 , this . disableVisibilityChange = ! 1 , this . checkOffsetInterval = 2500 , this . exists = ! 0 , this . currentRenderOrderID = 0 , this . _hiddenVar = "hidden" , this . _nextOffsetCheck = 0 , this . _backgroundColor , a . config ? this . parseConfig ( a . config ) : ( this . game . canvas = b . Canvas . create ( c , d ) , this . game . canvas . style [ "-webkit-full-screen" ] = "width: 100%; height: 100%" ) } , b . Stage . prototype = Object . create ( PIXI . Stage . prototype ) , b . Stage . prototype . constructor = b . Stage , b . Stage . prototype . preUpdate = function ( ) { this . currentRenderOrderID = 0 ; for ( var a = this . children . length , b = 0 ; a > b ; b ++ ) this . children [ b ] . preUpdate ( ) } , b . Stage . prototype . update = function ( ) { for ( var a = this . children . length ; a -- ; ) this . children [ a ] . update ( ) } , b . Stage . prototype . postUpdate = function ( ) { if ( this . game . world . camera . target ) { this . game . world . camera . target . postUpdate ( ) , this . game . world . camera . update ( ) ; for ( var a = this . children . length ; a -- ; ) this . children [ a ] !== this . game . world . camera . target && this . children [ a ] . postUpdate ( ) } else { this . game . world . camera . update ( ) ; for ( var a = this . children . length ; a -- ; ) this . children [ a ] . postUpdate ( ) } this . checkOffsetInterval !== ! 1 && this . game . time . now > this . _nextOffsetCheck && ( b . Canvas . getOffset ( this . game . canvas , this . offset ) , this . _nextOffsetCheck = this . game . time . now + this . checkOffsetInterval ) } , b . Stage . prototype . parseConfig = function ( a ) { this . game . canvas = a . canvasID ? b . Canvas . create ( this . game . width , this . game . height , a . canvasID ) : b . Canvas . create ( this . game . width , this . game . height ) , a . canvasStyle ? this . game . canvas . stlye = a . canvasStyle : this . game . canvas . style [ "-webkit-full-screen" ] = "width: 100%; height: 100%" , a . checkOffsetInterval && ( this . checkOffsetInterval = a . checkOffsetInterval ) , a . disableVisibilityChange && ( this . disableVisibilityChange = a . disableVisibilityChange ) , a . fullScreenScaleMode && ( this . fullScreenScaleMode = a . fullScreenScaleMode ) , a . scaleMode && ( this . scaleMode = a . scaleMode ) , a . backgroundColor && ( this . backgroundColor = a . backgroundColor ) } , b . Stage . prototype . boot = function ( ) { b . Canvas . getOffset ( this . game . canvas , this . offset ) , this . bounds = new b . Rectangle ( this . offset . x , this . offset . y , this . game . width , this . game . height ) ; var a = this ; this . _onChange = function ( b ) { return a . visibilityChange ( b ) } , b . Canvas . setUserSelect ( this . game . canvas , "none" ) , b . Canvas . setTouchAction ( this . game . canvas , "none" ) , this . checkVisibility ( ) } , b . Stage . prototype . checkVisibility = function ( ) { this . _hiddenVar = void 0 != document . webkitHidden ? "webkitvisibilitychange" : void 0 != document . mozHidden ? "mozvisibilitychange" : void 0 != document . msHidden ? "msvisibilitychange" : void 0 != document . hidden ? " visibil
} , b . Input . MOUSE _OVERRIDES _TOUCH = 0 , b . Input . TOUCH _OVERRIDES _MOUSE = 1 , b . Input . MOUSE _TOUCH _COMBINE = 2 , b . Input . prototype = { boot : function ( ) { this . mousePointer = new b . Pointer ( this . game , 0 ) , this . pointer1 = new b . Pointer ( this . game , 1 ) , this . pointer2 = new b . Pointer ( this . game , 2 ) , this . mouse = new b . Mouse ( this . game ) , this . keyboard = new b . Keyboard ( this . game ) , this . touch = new b . Touch ( this . game ) , this . mspointer = new b . MSPointer ( this . game ) , this . gamepad = new b . Gamepad ( this . game ) , this . onDown = new b . Signal , this . onUp = new b . Signal , this . onTap = new b . Signal , this . onHold = new b . Signal , this . scale = new b . Point ( 1 , 1 ) , this . speed = new b . Point , this . position = new b . Point , this . _oldPosition = new b . Point , this . circle = new b . Circle ( 0 , 0 , 44 ) , this . activePointer = this . mousePointer , this . currentPointers = 0 , this . hitCanvas = document . createElement ( "canvas" ) , this . hitCanvas . width = 1 , this . hitCanvas . height = 1 , this . hitContext = this . hitCanvas . getContext ( "2d" ) , this . mouse . start ( ) , this . keyboard . start ( ) , this . touch . start ( ) , this . mspointer . start ( ) , this . mousePointer . active = ! 0 } , destroy : function ( ) { this . mouse . stop ( ) , this . keyboard . stop ( ) , this . touch . stop ( ) , this . mspointer . stop ( ) , this . gamepad . stop ( ) , this . moveCallback = null } , setMoveCallback : function ( a , b ) { this . moveCallback = a , this . moveCallbackContext = b } , addPointer : function ( ) { for ( var a = 0 , c = 10 ; c > 0 ; c -- ) null === this [ "pointer" + c ] && ( a = c ) ; return 0 === a ? ( console . warn ( "You can only have 10 Pointer objects" ) , null ) : ( this [ "pointer" + a ] = new b . Pointer ( this . game , a ) , this [ "pointer" + a ] ) } , update : function ( ) { return this . keyboard . update ( ) , this . pollRate > 0 && this . _pollCounter < this . pollRate ? void this . _pollCounter ++ : ( this . speed . x = this . position . x - this . _oldPosition . x , this . speed . y = this . position . y - this . _oldPosition . y , this . _oldPosition . copyFrom ( this . position ) , this . mousePointer . update ( ) , this . gamepad . active && this . gamepad . update ( ) , this . pointer1 . update ( ) , this . pointer2 . update ( ) , this . pointer3 && this . pointer3 . update ( ) , this . pointer4 && this . pointer4 . update ( ) , this . pointer5 && this . pointer5 . update ( ) , this . pointer6 && this . pointer6 . update ( ) , this . pointer7 && this . pointer7 . update ( ) , this . pointer8 && this . pointer8 . update ( ) , this . pointer9 && this . pointer9 . update ( ) , this . pointer10 && this . pointer10 . update ( ) , void ( this . _pollCounter = 0 ) ) } , reset : function ( a ) { if ( this . game . isBooted !== ! 1 ) { "undefined" == typeof a && ( a = ! 1 ) , this . keyboard . reset ( ) , this . mousePointer . reset ( ) , this . gamepad . reset ( ) ; for ( var c = 1 ; 10 >= c ; c ++ ) this [ "pointer" + c ] && this [ "pointer" + c ] . reset ( ) ; this . currentPointers = 0 , "none" !== this . game . canvas . style . cursor && ( this . game . canvas . style . cursor = "inherit" ) , a === ! 0 && ( this . onDown . dispose ( ) , this . onUp . dispose ( ) , this . onTap . dispose ( ) , this . onHold . dispose ( ) , this . onDown = new b . Signal , this . onUp = new b . Signal , this . onTap = new b . Signal , this . onHold = new b . Signal , this . interactiveItems . callAll ( "reset" ) ) , this . _pollCounter = 0 } } , resetSpeed : function ( a , b ) { this . _oldPosition . setTo ( a , b ) , this . speed . setTo ( 0 , 0 ) } , startPointer : function ( a ) { if ( this . maxPointers < 10 && this . totalActivePointers == this . maxPointers ) return null ; if ( this . pointer1 . active === ! 1 ) return this . pointer1 . start ( a ) ; if ( this . pointer2 . active === ! 1 ) return this . pointer2 . start ( a ) ; for ( var b = 3 ; 10 >= b ; b ++ ) if ( this [ "pointer" + b ] && this [ "pointer" + b ] . active === ! 1 ) return this [ "pointer" + b ] . start ( a ) ; return null } , updatePointer : function ( a ) { if ( this . pointer1 . active && this . pointer1 . identifier == a . identifier ) return this . pointer1 . move ( a ) ; if ( this . pointer2 . active && this . pointer2 . identifier == a . identifier ) return this . pointer2 . move ( a ) ; for ( var b = 3 ; 10 >= b ; b ++ ) if ( this [ "pointer" + b ] && this [ "pointer" + b ] . active && this [ "pointer" + b ] . identifier == a . identifier ) return this [ "pointer" + b ] . move ( a ) ; return null } , stopPointer : function ( a ) { if ( this . pointer1 . active && this . pointer1 . identifier == a . identifier ) return this . pointer1 . stop ( a ) ; if ( this . pointer2 . active && this . pointer2 . identifier == a . identifier ) return this . pointer2 . stop ( a ) ; for ( var b = 3 ; 10 >= b ; b ++ ) if ( this [ "pointer" + b ] && this [ "pointer" + b ] . active && this [ "pointer" + b ] . identifier == a . identifier ) return this [ "pointer" + b ] . stop ( a ) ; return null } , getPointer : function ( a ) { if ( a = a || ! 1 , this . pointer1 . active == a ) return this . pointer1 ; if ( this . pointer2 . active == a ) return this . pointer2 ; for ( var b = 3 ; 10 >= b ; b ++ ) if ( this [ "pointer" + b ] && this [ "pointer" + b ] . active == a ) return this [ " poin
} , b . SinglePad . prototype = { addCallbacks : function ( a , b ) { "undefined" != typeof b && ( this . onConnectCallback = "function" == typeof b . onConnect ? b . onConnect : this . onConnectCallback , this . onDisconnectCallback = "function" == typeof b . onDisconnect ? b . onDisconnect : this . onDisconnectCallback , this . onDownCallback = "function" == typeof b . onDown ? b . onDown : this . onDownCallback , this . onUpCallback = "function" == typeof b . onUp ? b . onUp : this . onUpCallback , this . onAxisCallback = "function" == typeof b . onAxis ? b . onAxis : this . onAxisCallback , this . onFloatCallback = "function" == typeof b . onFloat ? b . onFloat : this . onFloatCallback ) } , addButton : function ( a ) { return this . _hotkeys [ a ] = new b . GamepadButton ( this . game , a ) , this . _hotkeys [ a ] } , pollStatus : function ( ) { if ( ! this . _rawPad . timestamp || this . _rawPad . timestamp != this . _prevTimestamp ) { for ( var a = 0 ; a < this . _rawPad . buttons . length ; a += 1 ) { var b = this . _rawPad . buttons [ a ] ; this . _rawButtons [ a ] !== b && ( 1 === b ? this . processButtonDown ( a , b ) : 0 === b ? this . processButtonUp ( a , b ) : this . processButtonFloat ( a , b ) , this . _rawButtons [ a ] = b ) } for ( var c = this . _rawPad . axes , d = 0 ; d < c . length ; d += 1 ) { var e = c [ d ] ; this . processAxisChange ( e > 0 && e > this . deadZone || 0 > e && e < - this . deadZone ? { axis : d , value : e } : { axis : d , value : 0 } ) } this . _prevTimestamp = this . _rawPad . timestamp } } , connect : function ( a ) { var b = ! this . _connected ; this . _index = a . index , this . _connected = ! 0 , this . _rawPad = a , this . _rawButtons = a . buttons , this . _axes = a . axes , b && this . _padParent . onConnectCallback && this . _padParent . onConnectCallback . call ( this . _padParent . callbackContext , this . _index ) , b && this . onConnectCallback && this . onConnectCallback . call ( this . callbackContext ) } , disconnect : function ( ) { var a = this . _connected ; this . _connected = ! 1 , this . _rawPad = void 0 , this . _rawButtons = [ ] , this . _buttons = [ ] ; var b = this . _index ; this . _index = null , a && this . _padParent . onDisconnectCallback && this . _padParent . onDisconnectCallback . call ( this . _padParent . callbackContext , b ) , a && this . onDisconnectCallback && this . onDisconnectCallback . call ( this . callbackContext ) } , processAxisChange : function ( a ) { this . game . input . disabled || this . game . input . gamepad . disabled || this . _axes [ a . axis ] !== a . value && ( this . _axes [ a . axis ] = a . value , this . _padParent . onAxisCallback && this . _padParent . onAxisCallback . call ( this . _padParent . callbackContext , a , this . _index ) , this . onAxisCallback && this . onAxisCallback . call ( this . callbackContext , a ) ) } , processButtonDown : function ( a , b ) { this . game . input . disabled || this . game . input . gamepad . disabled || ( this . _padParent . onDownCallback && this . _padParent . onDownCallback . call ( this . _padParent . callbackContext , a , b , this . _index ) , this . onDownCallback && this . onDownCallback . call ( this . callbackContext , a , b ) , this . _buttons [ a ] && this . _buttons [ a ] . isDown ? this . _buttons [ a ] . duration = this . game . time . now - this . _buttons [ a ] . timeDown : this . _buttons [ a ] ? ( this . _buttons [ a ] . isDown = ! 0 , this . _buttons [ a ] . timeDown = this . game . time . now , this . _buttons [ a ] . duration = 0 , this . _buttons [ a ] . value = b ) : this . _buttons [ a ] = { isDown : ! 0 , timeDown : this . game . time . now , timeUp : 0 , duration : 0 , value : b } , this . _hotkeys [ a ] && this . _hotkeys [ a ] . processButtonDown ( b ) ) } , processButtonUp : function ( a , b ) { this . game . input . disabled || this . game . input . gamepad . disabled || ( this . _padParent . onUpCallback && this . _padParent . onUpCallback . call ( this . _padParent . callbackContext , a , b , this . _index ) , this . onUpCallback && this . onUpCallback . call ( this . callbackContext , a , b ) , this . _hotkeys [ a ] && this . _hotkeys [ a ] . processButtonUp ( b ) , this . _buttons [ a ] ? ( this . _buttons [ a ] . isDown = ! 1 , this . _buttons [ a ] . timeUp = this . game . time . now , this . _buttons [ a ] . value = b ) : this . _buttons [ a ] = { isDown : ! 1 , timeDown : this . game . time . now , timeUp : this . game . time . now , duration : 0 , value : b } ) } , processButtonFloat : function ( a , b ) { this . game . input . disabled || this . game . input . gamepad . disabled || ( this . _padParent . onFloatCallback && this . _padParent . onFloatCallback . call ( this . _padParent . callbackContext , a , b , this . _index ) , this . onFloatCallback && this . onFloatCallback . call ( this . callbackContext , a , b ) , this . _buttons [ a ] ? this . _buttons [ a ] . value = b : this . _buttons [ a ] = { value : b } , this . _hotkeys [ a ] && this . _hotkeys [ a ] . processButtonFloat ( b ) ) } , axis : function ( a ) { return this . _axes [ a ] ? this . _axes [ a ] : ! 1 } , isDown : function ( a ) { return this . _buttons [ a ] ? this . _buttons [ a ] . isDown : ! 1 } , justReleased : function ( a , b ) { return "undefined" == typeof b && ( b = 250 ) , this . _buttons [ a ] && this . _buttons [ a ] . i
} } ) , Object . defineProperty ( b . Sprite . prototype , "inCamera" , { get : function ( ) { return this . game . world . camera . screenView . intersects ( this . getBounds ( ) ) } } ) , Object . defineProperty ( b . Sprite . prototype , "frame" , { get : function ( ) { return this . animations . frame } , set : function ( a ) { this . animations . frame = a } } ) , Object . defineProperty ( b . Sprite . prototype , "frameName" , { get : function ( ) { return this . animations . frameName } , set : function ( a ) { this . animations . frameName = a } } ) , Object . defineProperty ( b . Sprite . prototype , "renderOrderID" , { get : function ( ) { return this . _cache [ 3 ] } } ) , Object . defineProperty ( b . Sprite . prototype , "inputEnabled" , { get : function ( ) { return this . input && this . input . enabled } , set : function ( a ) { a ? null === this . input && ( this . input = new b . InputHandler ( this ) , this . input . start ( ) ) : this . input && this . input . enabled && this . input . stop ( ) } } ) , Object . defineProperty ( b . Sprite . prototype , "physicsEnabled" , { get : function ( ) { return null !== this . body } , set : function ( a ) { a ? null === this . body && ( this . body = new b . Physics . Body ( this . game , this , this . x , this . y , 1 ) , this . anchor . set ( . 5 ) ) : this . body && this . body . destroy ( ) } } ) , Object . defineProperty ( b . Sprite . prototype , "exists" , { get : function ( ) { return ! ! this . _cache [ 6 ] } , set : function ( a ) { a ? ( this . _cache [ 6 ] = 1 , this . body && this . body . addToWorld ( ) , this . visible = ! 0 ) : ( this . _cache [ 6 ] = 0 , this . body && this . body . removeFromWorld ( ) , this . visible = ! 1 ) } } ) , Object . defineProperty ( b . Sprite . 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 } } ) , Object . defineProperty ( b . Sprite . prototype , "smoothed" , { get : function ( ) { return ! this . texture . baseTexture . scaleMode } , set : function ( a ) { a ? this . texture && ( this . texture . baseTexture . scaleMode = 0 ) : this . texture && ( this . texture . baseTexture . scaleMode = 1 ) } } ) , b . Image = function ( a , c , d , e , f ) { c = c || 0 , d = d || 0 , e = e || null , f = f || null , this . game = a , this . exists = ! 0 , this . name = "" , this . type = b . IMAGE , this . events = new b . Events ( this ) , this . key = e , this . _frame = 0 , this . _frameName = "" , PIXI . Sprite . call ( this , PIXI . TextureCache . _ _default ) , this . loadTexture ( e , f ) , this . position . set ( c , d ) , this . world = new b . Point ( c , d ) , this . autoCull = ! 1 , this . input = null , this . cameraOffset = new b . Point , this . _cache = new Int16Array ( [ 0 , 0 , 0 , 0 , 1 , 0 , 1 , 0 ] ) } , b . Image . prototype = Object . create ( PIXI . Sprite . prototype ) , b . Image . prototype . constructor = b . Image , b . Image . prototype . preUpdate = function ( ) { 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 ; this . autoCull && ( this . renderable = this . game . world . camera . screenView . intersects ( this . getBounds ( ) ) ) , this . world . setTo ( this . game . camera . x + this . worldTransform [ 2 ] , this . game . camera . y + this . worldTransform [ 5 ] ) , this . visible && ( this . _cache [ 3 ] = this . game . stage . currentRenderOrderID ++ ) ; for ( var a = 0 , b = this . children . length ; b > a ; a ++ ) this . children [ a ] . preUpdate ( ) ; return ! 0 } , b . Image . prototype . update = function ( ) { } , b . Image . prototype . postUpdate = function ( ) { this . key instanceof b . BitmapData && this . key . _dirty && this . key . render ( ) , 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 ) ; for ( var a = 0 , c = this . children . length ; c > a ; a ++ ) this . children [ a ] . postUpdate ( ) } , b . Image . prototype . loadTexture = function ( a , c ) { if ( c = c || 0 , a instanceof b . RenderTexture ) return this . key = a . key , void this . setTexture ( a ) ; if ( a instanceof b . BitmapData ) return this . key = a . key , void this . setTexture ( a . texture ) ; if ( a instanceof PIXI . Texture ) return this . key = a , void this . setTexture ( a ) ; if ( null === a || "undefined" == typeof a ) return this . key = "__default" , void this . setTexture ( PIXI . TextureCache [ this . key ] ) ; if ( "string" == typeof a && ! this . game . cache . checkImageKey ( a ) ) return this . key = "__missing" , void this . setTexture ( PIXI . TextureCache [ this . key ] ) ; if ( this . game . cache . isSpriteSheet ( a ) ) { this . key = a ; var d = this . game . cache . getFrameData ( a ) ; return "string" == typeof c ? ( this . _frame = 0 , this . _frameName = c , void this . setTexture ( PIXI . TextureCache [ d . getFrameByName ( c ) . uuid ] ) ) : ( this . _frame = c , this . _frameName = "" , void this . setTexture ( PIXI . TextureCache [ d . getFrame ( c ) . uuid ] ) ) } return this . key = a , void this . setTexture ( PIXI . TextureCache [ a ] ) } , b . Image . prototype . crop = function ( a ) { if ( " undefined
} , b . BitmapFont . prototype . resize = function ( a , b ) { if ( this . width = a , this . height = b , this . frame . width = this . width , this . frame . height = this . height , this . baseTexture . width = this . width , this . baseTexture . height = this . height , this . renderer . type === PIXI . WEBGL _RENDERER ) { this . projection . x = this . width / 2 , this . projection . y = - this . height / 2 ; var c = this . renderer . gl ; c . bindTexture ( c . TEXTURE _2D , this . baseTexture . _glTextures [ c . id ] ) , c . texImage2D ( c . TEXTURE _2D , 0 , c . RGBA , this . width , this . height , 0 , c . RGBA , c . UNSIGNED _BYTE , null ) } else this . textureBuffer . resize ( this . width , this . height ) ; PIXI . 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 ] . length * ( this . characterWidth + this . customSpacingX ) / 2 , a += this . customSpacingX / 2 } 0 > a && ( a = 0 ) , this . pasteLine ( d [ e ] , a , c , this . customSpacingX ) , c += this . characterHeight + this . customSpacingY } } else { switch ( this . fixedWidth > 0 ? this . resize ( fixedWidth , this . characterHeight ) : this . resize ( this . _text . length * ( this . characterWidth + this . customSpacingX ) , this . characterHeight ) , this . textureBuffer . clear ( ) , this . align ) { case b . BitmapFont . ALIGN _LEFT : a = 0 ; break ; case b . BitmapFont . ALIGN _RIGHT : a = this . width - this . _text . length * ( this . characterWidth + this . customSpacingX ) ; break ; case b . BitmapFont . ALIGN _CENTER : a = this . width / 2 - this . _text . length * ( this . characterWidth + this . customSpacingX ) / 2 , a += this . customSpacingX / 2 } this . pasteLine ( this . _text , a , 0 , this . customSpacingX ) } } , b . BitmapFont . prototype . pasteLine = function ( a , c , d ) { for ( var e = new b . Point , f = 0 ; f < a . length ; f ++ ) if ( " " == a . charAt ( f ) ) c += this . characterWidth + this . customSpacingX ; else if ( this . grabData [ a . charCodeAt ( f ) ] >= 0 && ( this . stamp . frame = this . grabData [ a . charCodeAt ( f ) ] , e . set ( c , d ) , this . render ( this . stamp , e , ! 1 ) , c += this . characterWidth + this . customSpacingX , c > this . width ) ) break } , b . BitmapFont . prototype . getLongestLine = function ( ) { var a = 0 ; if ( this . _text . length > 0 ) for ( var b = this . _text . split ( "\n" ) , c = 0 ; c < b . length ; c ++ ) b [ c ] . length > a && ( a = b [ c ] . length ) ; return a } , b . BitmapFont . prototype . removeUnsupportedCharacters = function ( a ) { for ( var b = "" , c = 0 ; c < this . _text . length ; c ++ ) { var d = this . _text [ c ] , e = d . charCodeAt ( 0 ) ; ( this . grabData [ e ] >= 0 || ! a && "\n" === d ) && ( b = b . concat ( d ) ) } return b } , Object . defineProperty ( b . BitmapFont . prototype , "text" , { get : function ( ) { return this . _text } , set : function ( a ) { var b ; b = this . autoUpperCase ? a . toUpperCase ( ) : a , b !== this . _text && ( this . _text = b , this . removeUnsupportedCharacters ( this . multiLine ) , this . buildBitmapFontText ( ) ) } } ) , b . Canvas = { create : function ( a , b , c , d ) { if ( "undefined" == typeof d && ( d = ! 1 ) , a = a || 256 , b = b || 256 , d ) var e = document . createElement ( "canvas" ) ; else var e = document . createElement ( navigator . isCocoonJS ? "screencanvas" : "canvas" ) ; return "string" == typeof c && "" !== c && ( e . id = c ) , e . width = a , e . height = b , e . style . display = "block" , e } , getOffset : function ( a , c ) { c = c || new b . Point ; var d = a . getBoundingClientRect ( ) , e = a . clientTop || document . body . clientTop || 0 , f = a . clientLeft || document . body . clientLeft || 0 , g = 0 , h = 0 ; return "CSS1Compat" === document . compatMode ? ( g = window . pageYOffset || document . documentElement . scrollTop || a . scrollTop || 0 , h = window . pageXOffset || document . documentElement . scrollLeft || a . scrollLeft || 0 ) : ( g = window . pageYOffset || document . body . scrollTop || a . scrollTop || 0 , h = window . pageXOffset || document . body . scrollLeft || a . scrollLeft || 0 ) , c . x = d . left + h - f , c . y = d . top + g - e , c } , getAspectRatio : function ( a ) { return a . width / a . height } , setBackgroundColor : function ( a , b ) { return b = b || "rgb(0,0,0)" , a . style . backgroundColor = b , a } , setTouchAction : function ( a , b ) { return b = b || "none" , a . style . msTouchAction = b , a . style [ "ms-touch-action" ] = b , a . style [ "touch-action" ] = b , a } , setUserSelect : function ( a , b ) { return b = b || "none" , a . style [ "-webkit-touch-callout" ] = b , a
} , repeat : function ( a , b , c , d ) { return this . create ( a , ! 1 , b , c , d , Array . prototype . splice . call ( arguments , 4 ) ) } , loop : function ( a , b , c ) { return this . create ( a , ! 0 , 0 , b , c , Array . prototype . splice . call ( arguments , 3 ) ) } , start : function ( ) { this . _started = this . game . time . now , this . running = ! 0 } , stop : function ( a ) { this . running = ! 1 , "undefined" == typeof a && ( a = ! 0 ) , a && ( this . events . length = 0 ) } , remove : function ( a ) { for ( var b = 0 ; b < this . events . length ; b ++ ) if ( this . events [ b ] === a ) return this . events [ b ] . pendingDelete = ! 0 , ! 0 ; return ! 1 } , order : function ( ) { this . events . length > 0 && ( this . events . sort ( this . sortHandler ) , this . nextTick = this . events [ 0 ] . tick ) } , sortHandler : function ( a , b ) { return a . tick < b . tick ? - 1 : a . tick > b . tick ? 1 : 0 } , update : function ( a ) { if ( this . paused ) return ! 0 ; for ( this . _now = a , this . _len = this . events . length , this . _i = 0 ; this . _i < this . _len ; ) this . events [ this . _i ] . pendingDelete && ( this . events . splice ( this . _i , 1 ) , this . _len -- ) , this . _i ++ ; if ( this . _len = this . events . length , this . running && this . _now >= this . nextTick && this . _len > 0 ) { for ( this . _i = 0 ; this . _i < this . _len && this . running && this . _now >= this . events [ this . _i ] . tick ; ) { var b = this . _now - this . events [ this . _i ] . tick , c = this . _now + this . events [ this . _i ] . delay - b ; 0 > c && ( c = this . _now + this . events [ this . _i ] . delay ) , this . events [ this . _i ] . loop === ! 0 ? ( this . events [ this . _i ] . tick = c , this . events [ this . _i ] . callback . apply ( this . events [ this . _i ] . callbackContext , this . events [ this . _i ] . args ) ) : this . events [ this . _i ] . repeatCount > 0 ? ( this . events [ this . _i ] . repeatCount -- , this . events [ this . _i ] . tick = c , this . events [ this . _i ] . callback . apply ( this . events [ this . _i ] . callbackContext , this . events [ this . _i ] . args ) ) : ( this . events [ this . _i ] . callback . apply ( this . events [ this . _i ] . callbackContext , this . events [ this . _i ] . args ) , this . events . splice ( this . _i , 1 ) , this . _len -- ) , this . _i ++ } this . events . length > 0 ? this . order ( ) : ( this . expired = ! 0 , this . onComplete . dispatch ( this ) ) } return this . expired && this . autoDestroy ? ! 1 : ! 0 } , pause : function ( ) { this . running && ! this . expired && ( this . _pauseStarted = this . game . time . now , this . paused = ! 0 , this . _codePaused = ! 0 ) } , _pause : function ( ) { this . running && ! this . expired && ( this . _pauseStarted = this . game . time . now , this . paused = ! 0 ) } , resume : function ( ) { if ( this . running && ! this . expired ) { for ( var a = this . game . time . now - this . _pauseStarted , b = 0 ; b < this . events . length ; b ++ ) this . events [ b ] . tick += a ; this . nextTick += a , this . paused = ! 1 , this . _codePaused = ! 1 } } , _resume : function ( ) { this . _codePaused || this . resume ( ) } , destroy : function ( ) { this . onComplete . removeAll ( ) , this . running = ! 1 , this . events = [ ] , this . _i = this . _len } } , Object . defineProperty ( b . Timer . prototype , "next" , { get : function ( ) { return this . nextTick } } ) , Object . defineProperty ( b . Timer . prototype , "duration" , { get : function ( ) { return this . running && this . nextTick > this . _now ? this . nextTick - this . _now : 0 } } ) , Object . defineProperty ( b . Timer . prototype , "length" , { get : function ( ) { return this . events . length } } ) , Object . defineProperty ( b . Timer . prototype , "ms" , { get : function ( ) { return this . _now - this . _started } } ) , Object . defineProperty ( b . Timer . prototype , "seconds" , { get : function ( ) { return . 001 * this . ms } } ) , b . Timer . prototype . constructor = b . Timer , b . TimerEvent = function ( a , b , c , d , e , f , g , h ) { this . timer = a , this . delay = b , this . tick = c , this . repeatCount = d - 1 , this . loop = e , this . callback = f , this . callbackContext = g , this . args = h , this . pendingDelete = ! 1 } , b . TimerEvent . prototype . constructor = b . TimerEvent , b . AnimationManager = function ( a ) { this . sprite = a , this . game = a . game , this . currentFrame = null , this . updateIfVisible = ! 0 , this . isLoaded = ! 1 , this . _frameData = null , this . _anims = { } , this . _outputFrames = [ ] } , b . AnimationManager . prototype = { loadFrameData : function ( a ) { this . _frameData = a , this . frame = 0 , this . isLoaded = ! 0 } , add : function ( a , c , d , e , f ) { return null == this . _frameData ? void console . warn ( "No FrameData available for Phaser.Animation " + a ) : ( c = c || [ ] , d = d || 60 , "undefined" == typeof e && ( e = ! 1 ) , "undefined" == typeof f && ( f = c && "number" == typeof c [ 0 ] ? ! 0 : ! 1 ) , null == this . sprite . events . onAnimationStart && ( this . sprite . events . onAnimationStart = new b . Signal , this . sprite . events . onAnimationComplete = new b . Signal , this . sprite . events . onAnimationLoop = new b . Signal ) , this . _outputFrames . length = 0 , this . _frameData . getFrameIndexes ( c , f , this . _outputFrames ) , this . _anims [ a ] = new b . Animation ( this . game , this . sprite , a , this . _frameData , this . _outputFrames , d , e ) , this . currentAnim = this . _anims [ a ] , this . curr
} , a . data . onerror = function ( ) { return c . fileError ( c . _fileIndex ) } , this . crossOrigin && ( a . data . crossOrigin = this . crossOrigin ) , a . data . src = this . baseURL + a . url ; break ; case "audio" : a . url = this . getAudioURL ( a . url ) , null !== a . url ? this . game . sound . usingWebAudio ? ( this . _xhr . open ( "GET" , this . baseURL + a . url , ! 0 ) , this . _xhr . responseType = "arraybuffer" , this . _xhr . onload = function ( ) { return c . fileComplete ( c . _fileIndex ) } , this . _xhr . onerror = function ( ) { return c . fileError ( c . _fileIndex ) } , this . _xhr . send ( ) ) : this . game . sound . usingAudioTag && ( this . game . sound . touchLocked ? ( a . data = new Audio , a . data . name = a . key , a . data . preload = "auto" , a . data . src = this . baseURL + a . url , this . fileComplete ( this . _fileIndex ) ) : ( a . data = new Audio , a . data . name = a . key , a . data . onerror = function ( ) { return c . fileError ( c . _fileIndex ) } , a . data . preload = "auto" , a . data . src = this . baseURL + a . url , a . data . addEventListener ( "canplaythrough" , b . GAMES [ this . game . id ] . load . fileComplete ( this . _fileIndex ) , ! 1 ) , a . data . load ( ) ) ) : this . fileError ( this . _fileIndex ) ; break ; case "json" : this . _xhr . open ( "GET" , this . baseURL + a . url , ! 0 ) , this . _xhr . responseType = "text" , this . _xhr . onload = function ( ) { return c . jsonLoadComplete ( c . _fileIndex ) } , this . _xhr . send ( ) ; break ; case "tilemap" : if ( this . _xhr . open ( "GET" , this . baseURL + a . url , ! 0 ) , this . _xhr . responseType = "text" , a . format === b . Tilemap . TILED _JSON ) this . _xhr . onload = function ( ) { return c . jsonLoadComplete ( c . _fileIndex ) } ; else { if ( a . format !== b . Tilemap . CSV ) throw new Error ( "Phaser.Loader. Invalid Tilemap format: " + a . format ) ; this . _xhr . onload = function ( ) { return c . csvLoadComplete ( c . _fileIndex ) } } this . _xhr . onerror = function ( ) { return c . dataLoadError ( c . _fileIndex ) } , this . _xhr . send ( ) ; break ; case "text" : case "script" : case "physics" : this . _xhr . open ( "GET" , this . baseURL + a . url , ! 0 ) , this . _xhr . responseType = "text" , this . _xhr . onload = function ( ) { return c . fileComplete ( c . _fileIndex ) } , this . _xhr . onerror = function ( ) { return c . fileError ( c . _fileIndex ) } , this . _xhr . send ( ) ; break ; case "binary" : this . _xhr . open ( "GET" , this . baseURL + a . url , ! 0 ) , this . _xhr . responseType = "arraybuffer" , this . _xhr . onload = function ( ) { return c . fileComplete ( c . _fileIndex ) } , this . _xhr . onerror = function ( ) { return c . fileError ( c . _fileIndex ) } , this . _xhr . send ( ) } } , getAudioURL : function ( a ) { var b ; "string" == typeof a && ( a = [ a ] ) ; for ( var c = 0 ; c < a . length ; c ++ ) if ( b = a [ c ] . toLowerCase ( ) , b = b . substr ( ( Math . max ( 0 , b . lastIndexOf ( "." ) ) || 1 / 0 ) + 1 ) , this . game . device . canPlayAudio ( b ) ) return a [ c ] ; return null } , fileError : function ( a ) { this . _fileList [ a ] . loaded = ! 0 , this . _fileList [ a ] . error = ! 0 , this . onFileError . dispatch ( this . _fileList [ a ] . key , this . _fileList [ a ] ) , console . warn ( "Phaser.Loader error loading file: " + this . _fileList [ a ] . key + " from URL " + this . _fileList [ a ] . url ) , this . nextFile ( a , ! 1 ) } , fileComplete : function ( a ) { if ( ! this . _fileList [ a ] ) return void console . warn ( "Phaser.Loader fileComplete invalid index " + a ) ; var c = this . _fileList [ a ] ; c . loaded = ! 0 ; var d = ! 0 , e = this ; switch ( c . type ) { case "image" : this . game . cache . addImage ( c . key , c . url , c . data ) ; break ; case "spritesheet" : this . game . cache . addSpriteSheet ( c . key , c . url , c . data , c . frameWidth , c . frameHeight , c . frameMax , c . margin , c . spacing ) ; break ; case "textureatlas" : if ( null == c . atlasURL ) this . game . cache . addTextureAtlas ( c . key , c . url , c . data , c . atlasData , c . format ) ; else { if ( d = ! 1 , this . _xhr . open ( "GET" , this . baseURL + c . atlasURL , ! 0 ) , this . _xhr . responseType = "text" , c . format == b . Loader . TEXTURE _ATLAS _JSON _ARRAY || c . format == b . Loader . TEXTURE _ATLAS _JSON _HASH ) this . _xhr . onload = function ( ) { return e . jsonLoadComplete ( a ) } ; else { if ( c . format != b . Loader . TEXTURE _ATLAS _XML _STARLING ) throw new Error ( "Phaser.Loader. Invalid Texture Atlas format: " + c . format ) ; this . _xhr . onload = function ( ) { return e . xmlLoadComplete ( a ) } } this . _xhr . onerror = function ( ) { return e . dataLoadError ( a ) } , this . _xhr . send ( ) } break ; case "bitmapfont" : null == c . xmlURL ? this . game . cache . addBitmapFont ( c . key , c . url , c . data , c . xmlData , c . xSpacing , c . ySpacing ) : ( d = ! 1 , this . _xhr . open ( "GET" , this . baseURL + c . xmlURL , ! 0 ) , this . _xhr . responseType = "text" , this . _xhr . onload = function ( ) { return e . xmlLoadComplete ( a ) } , this . _xhr . onerror = function ( ) { return e . dataLoadError ( a ) } , this . _xhr . send ( ) ) ; break ; case "audio" : if ( this . game . sound . usingWebAudio ) { if ( c . data = this . _xhr . response , this . game . cache . addSound ( c . key , c . url , c . data , ! 0 , ! 1 ) , c . autoDecode ) { this . game . cache . updateSound ( g , "isDecoding" , ! 0 ) ;
if ( a > c ) return b . Color . getColor ( 255 , 255 , 255 ) ; var e = a + Math . round ( Math . random ( ) * ( c - a ) ) , f = a + Math . round ( Math . random ( ) * ( c - a ) ) , g = a + Math . round ( Math . random ( ) * ( c - a ) ) ; return b . Color . getColor32 ( d , e , f , g ) } , getRGB : function ( a ) { return { alpha : a >>> 24 , red : a >> 16 & 255 , green : a >> 8 & 255 , blue : 255 & a } } , getWebRGB : function ( a ) { var b = ( a >>> 24 ) / 255 , c = a >> 16 & 255 , d = a >> 8 & 255 , e = 255 & a ; return "rgba(" + c . toString ( ) + "," + d . toString ( ) + "," + e . toString ( ) + "," + b . toString ( ) + ")" } , getAlpha : function ( a ) { return a >>> 24 } , getAlphaFloat : function ( a ) { return ( a >>> 24 ) / 255 } , getRed : function ( a ) { return a >> 16 & 255 } , getGreen : function ( a ) { return a >> 8 & 255 } , getBlue : function ( a ) { return 255 & a } } , b . Physics = { } , b . Physics . LIME _CORONA _JSON = 0 , p2 . Body . prototype . parent = null , p2 . Spring . prototype . parent = null , b . Physics . World = function ( a , c ) { this . game = a , "undefined" == typeof c && ( c = { gravity : [ 0 , 0 ] , broadphase : new p2 . SAPBroadphase } ) , this . world = new p2 . World ( c ) , this . materials = [ ] , this . gravity = new b . Physics . InversePointProxy ( a , this . world . gravity ) , this . bounds = null , this . _wallShapes = [ null , null , null , null ] , this . onBodyAdded = new b . Signal , this . onBodyRemoved = new b . Signal , this . onSpringAdded = new b . Signal , this . onSpringRemoved = new b . Signal , this . onConstraintAdded = new b . Signal , this . onConstraintRemoved = new b . Signal , this . onContactMaterialAdded = new b . Signal , this . onContactMaterialRemoved = new b . Signal , this . onPostStep = new b . Signal , this . onPostBroadphase = new b . Signal , this . onImpact = new b . Signal , this . onBeginContact = new b . Signal , this . onEndContact = new b . Signal , this . world . on ( "postStep" , this . postStepHandler , this ) , this . world . on ( "postBroadphase" , this . postBroadphaseHandler , this ) , this . world . on ( "impact" , this . impactHandler , this ) , this . world . on ( "beginContact" , this . beginContactHandler , this ) , this . world . on ( "endContact" , this . endContactHandler , this ) , this . collisionGroups = [ ] , this . _collisionGroupID = 2 , this . nothingCollisionGroup = new b . Physics . CollisionGroup ( 1 ) , this . boundsCollisionGroup = new b . Physics . CollisionGroup ( 2 ) , this . everythingCollisionGroup = new b . Physics . CollisionGroup ( 2147483648 ) , this . boundsCollidesWith = [ ] , this . setBoundsToWorld ( ! 0 , ! 0 , ! 0 , ! 0 , ! 1 ) } , b . Physics . World . prototype = { postStepHandler : function ( ) { } , postBroadphaseHandler : function ( a ) { for ( var b = 0 ; b < a . pairs . length ; b += 2 ) { var c = a . pairs [ b ] , d = a . pairs [ b + 1 ] ; 1 !== c . id && 1 !== d . id } } , impactHandler : function ( a ) { if ( a . bodyA . parent && a . bodyB . parent ) { var b = a . bodyA . parent , c = a . bodyB . parent ; b . _bodyCallbacks [ a . bodyB . id ] && b . _bodyCallbacks [ a . bodyB . id ] . call ( b . _bodyCallbackContext [ a . bodyB . id ] , b , c , a . shapeA , a . shapeB ) , c . _bodyCallbacks [ a . bodyA . id ] && c . _bodyCallbacks [ a . bodyA . id ] . call ( c . _bodyCallbackContext [ a . bodyA . id ] , c , b , a . shapeB , a . shapeA ) , b . _groupCallbacks [ a . shapeB . collisionGroup ] && b . _groupCallbacks [ a . shapeB . collisionGroup ] . call ( b . _groupCallbackContext [ a . shapeB . collisionGroup ] , b , c , a . shapeA , a . shapeB ) , c . _groupCallbacks [ a . shapeA . collisionGroup ] && c . _groupCallbacks [ a . shapeA . collisionGroup ] . call ( c . _groupCallbackContext [ a . shapeA . collisionGroup ] , c , b , a . shapeB , a . shapeA ) } } , beginContactHandler : function ( a ) { a . bodyA . id > 1 && a . bodyB . id > 1 } , endContactHandler : function ( a ) { a . bodyA . id > 1 && a . bodyB . id > 1 } , setBoundsToWorld : function ( a , b , c , d , e ) { this . setBounds ( this . game . world . bounds . x , this . game . world . bounds . y , this . game . world . bounds . width , this . game . world . bounds . height , a , b , c , d , e ) } , setWorldMaterial : function ( a , b , c , d , e ) { "undefined" == typeof b && ( b = ! 0 ) , "undefined" == typeof c && ( c = ! 0 ) , "undefined" == typeof d && ( d = ! 0 ) , "undefined" == typeof e && ( e = ! 0 ) , b && this . _wallShapes [ 0 ] && ( this . _wallShapes [ 0 ] . material = a ) , c && this . _wallShapes [ 1 ] && ( this . _wallShapes [ 1 ] . material = a ) , d && this . _wallShapes [ 2 ] && ( this . _wallShapes [ 2 ] . material = a ) , e && this . _wallShapes [ 3 ] && ( this . _wallShapes [ 3 ] . material = a ) } , setBounds : function ( a , b , c , d , e , f , g , h , i ) { "undefined" == typeof e && ( e = ! 0 ) , "undefined" == typeof f && ( f = ! 0 ) , "undefined" == typeof g && ( g = ! 0 ) , "undefined" == typeof h && ( h = ! 0 ) , "undefined" == typeof i && ( i = ! 0 ) ; var j = c / 2 , k = d / 2 , l = j + a , m = k + b ; if ( null !== this . bounds ) { this . world . removeBody ( this . bounds ) ; for ( var n = this . bounds . shapes . length ; n -- ; ) { var o = this . bounds . shapes [ n ] ; this . bounds . removeShape ( o ) } this . bounds . position [ 0 ] = this . game . math . px2pi ( l ) , this . bounds . position [ 1 ] = this . game . math . px2pi ( m ) } else this . bounds = new p2 . Body ( { mass : 0 , position : [ this . game . math . px2pi
} , setTileLocationCallback : function ( a , b , c , d , e , f , g ) { if ( g = this . getLayer ( g ) , this . copy ( a , b , c , d , g ) , ! ( this . _results . length < 2 ) ) for ( var h = 1 ; h < this . _results . length ; h ++ ) this . _results [ h ] . setCollisionCallback ( e , f ) } , setCollision : function ( a , b , c ) { if ( "undefined" == typeof b && ( b = ! 0 ) , c = this . getLayer ( c ) , "number" == typeof a ) return this . setCollisionByIndex ( a , b , c , ! 0 ) ; for ( var d = 0 , e = a . length ; e > d ; d ++ ) this . setCollisionByIndex ( a [ d ] , b , c , ! 1 ) ; this . calculateFaces ( c ) } , setCollisionBetween : function ( a , b , c , d ) { if ( "undefined" == typeof c && ( c = ! 0 ) , d = this . getLayer ( d ) , ! ( a > b ) ) { for ( var e = a ; b >= e ; e ++ ) this . setCollisionByIndex ( e , c , d , ! 1 ) ; this . calculateFaces ( d ) } } , setCollisionByExclusion : function ( a , b , c ) { "undefined" == typeof b && ( b = ! 0 ) , c = this . getLayer ( c ) ; for ( var d = 0 , e = this . tiles . length ; e > d ; d ++ ) - 1 === a . indexOf ( d ) && this . setCollisionByIndex ( d , b , c , ! 1 ) ; this . calculateFaces ( c ) } , setCollisionByIndex : function ( a , b , c , d ) { "undefined" == typeof b && ( b = ! 0 ) , "undefined" == typeof c && ( c = this . currentLayer ) , "undefined" == typeof d && ( d = ! 0 ) ; for ( var e = 0 ; e < this . layers [ c ] . height ; e ++ ) for ( var f = 0 ; f < this . layers [ c ] . width ; f ++ ) { var g = this . layers [ c ] . data [ e ] [ f ] ; g && g . index === a && ( g . collides = b , g . faceTop = b , g . faceBottom = b , g . faceLeft = b , g . faceRight = b ) } return d && this . calculateFaces ( c ) , c } , getLayer : function ( a ) { return "undefined" == typeof a ? a = this . currentLayer : "string" == typeof a ? a = this . getLayerIndex ( a ) : a instanceof b . TilemapLayer && ( a = a . index ) , a } , calculateFaces : function ( a ) { for ( var b = null , c = null , d = null , e = null , f = 0 , g = this . layers [ a ] . height ; g > f ; f ++ ) for ( var h = 0 , i = this . layers [ a ] . width ; i > h ; h ++ ) { var j = this . layers [ a ] . data [ f ] [ h ] ; j && ( b = this . getTileAbove ( a , h , f ) , c = this . getTileBelow ( a , h , f ) , d = this . getTileLeft ( a , h , f ) , e = this . getTileRight ( a , h , f ) , b && b . collides && ( j . faceTop = ! 1 ) , c && c . collides && ( j . faceBottom = ! 1 ) , d && d . collides && ( j . faceLeft = ! 1 ) , e && e . collides && ( j . faceRight = ! 1 ) ) } } , getTileAbove : function ( a , b , c ) { return c > 0 ? this . layers [ a ] . data [ c - 1 ] [ b ] : null } , getTileBelow : function ( a , b , c ) { return c < this . layers [ a ] . height - 1 ? this . layers [ a ] . data [ c + 1 ] [ b ] : null } , getTileLeft : function ( a , b , c ) { return b > 0 ? this . layers [ a ] . data [ c ] [ b - 1 ] : null } , getTileRight : function ( a , b , c ) { return b < this . layers [ a ] . width - 1 ? this . layers [ a ] . data [ c ] [ b + 1 ] : null } , setLayer : function ( a ) { a = this . getLayer ( a ) , this . layers [ a ] && ( this . currentLayer = a ) } , putTile : function ( a , c , d , e ) { e = this . getLayer ( e ) , c >= 0 && c < this . layers [ e ] . width && d >= 0 && d < this . layers [ e ] . height && ( a instanceof b . Tile ? this . layers [ e ] . data [ d ] [ c ] . copy ( a ) : this . layers [ e ] . data [ d ] [ c ] . index = a , this . layers [ e ] . dirty = ! 0 , this . calculateFaces ( e ) ) } , putTileWorldXY : function ( a , b , c , d , e , f ) { f = this . getLayer ( f ) , b = this . game . math . snapToFloor ( b , d ) / d , c = this . game . math . snapToFloor ( c , e ) / e , this . putTile ( a , b , c , f ) } , getTile : function ( a , b , c ) { return c = this . getLayer ( c ) , a >= 0 && a < this . layers [ c ] . width && b >= 0 && b < this . layers [ c ] . height ? this . layers [ c ] . data [ b ] [ a ] : void 0 } , getTileWorldXY : function ( a , b , c , d , e ) { return "undefined" == typeof c && ( c = this . tileWidth ) , "undefined" == typeof d && ( d = this . tileHeight ) , e = this . getLayer ( e ) , a = this . game . math . snapToFloor ( a , c ) / c , b = this . game . math . snapToFloor ( b , d ) / d , this . getTile ( a , b , e ) } , copy : function ( a , b , c , d , e ) { if ( e = this . getLayer ( e ) , ! this . layers [ e ] ) return void ( this . _results . length = 0 ) ; "undefined" == typeof a && ( a = 0 ) , "undefined" == typeof b && ( b = 0 ) , "undefined" == typeof c && ( c = this . layers [ e ] . width ) , "undefined" == typeof d && ( d = this . layers [ e ] . height ) , 0 > a && ( a = 0 ) , 0 > b && ( b = 0 ) , c > this . layers [ e ] . width && ( c = this . layers [ e ] . width ) , d > this . layers [ e ] . height && ( d = this . layers [ e ] . height ) , this . _results . length = 0 , this . _results . push ( { x : a , y : b , width : c , height : d , layer : e } ) ; for ( var f = b ; b + d > f ; f ++ ) for ( var g = a ; a + c > g ; g ++ ) this . _results . push ( this . layers [ e ] . data [ f ] [ g ] ) ; return this . _results } , paste : function ( a , b , c , d ) { if ( "undefined" == typeof a && ( a = 0 ) , "undefined" == typeof b && ( b = 0 ) , d = this . getLayer ( d ) , c && ! ( c . length < 2 ) ) { for ( var e = 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 ===