2014-10-09 15:16:41 +00:00
/* Phaser (no libs) v2.1.2 - http://phaser.io - @photonstorm - (c) 2014 Photon Storm Ltd. */
( function ( ) { var a = this , b = b || { VERSION : "2.1.2" , GAMES : [ ] , AUTO : 0 , CANVAS : 1 , WEBGL : 2 , HEADLESS : 3 , NONE : 0 , LEFT : 1 , RIGHT : 2 , UP : 3 , DOWN : 4 , 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 , RETROFONT : 18 , POINTER : 19 , ROPE : 20 , 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 } } ; if ( PIXI . InteractionManager = PIXI . InteractionManager || function ( ) { } , PIXI . dontSayHello = ! 0 , b . Utils = { getProperty : function ( a , b ) { for ( var c = b . split ( "." ) , d = c . pop ( ) , e = c . length , f = 1 , g = c [ 0 ] ; e > f && ( a = a [ g ] ) ; ) g = c [ f ] , f ++ ; return a ? a [ d ] : null } , setProperty : function ( a , b , c ) { for ( var d = b . split ( "." ) , e = d . pop ( ) , f = d . length , g = 1 , h = d [ 0 ] ; f > g && ( a = a [ h ] ) ; ) h = d [ g ] , g ++ ; return a && ( a [ e ] = c ) , a } , transposeArray : function ( a ) { for ( var b = new Array ( a [ 0 ] . length ) , c = 0 ; c < a [ 0 ] . length ; c ++ ) { b [ c ] = new Array ( a . length - 1 ) ; for ( var d = a . length - 1 ; d > - 1 ; d -- ) b [ c ] [ d ] = a [ d ] [ c ] } return b } , rotateArray : function ( a , c ) { if ( "string" != typeof c && ( c = ( c % 360 + 360 ) % 360 ) , 90 === c || - 270 === c || "rotateLeft" === c ) a = b . Utils . transposeArray ( a ) , a = a . reverse ( ) ; else if ( - 90 === c || 270 === c || "rotateRight" === c ) a = a . reverse ( ) , a = b . Utils . transposeArray ( a ) ; else if ( 180 === Math . abs ( c ) || "rotate180" === c ) { for ( var d = 0 ; d < a . length ; d ++ ) a [ d ] . reverse ( ) ; a = a . reverse ( ) } return a } , 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 = new Array ( b + 1 - a . length ) . join ( c ) + a ; break ; case 3 : var f = Math . ceil ( ( e = b - a . length ) / 2 ) , g = e - f ; a = new Array ( g + 1 ) . join ( c ) + a + new Array ( f + 1 ) . join ( c ) ; break ; default : a += new Array ( b + 1 - a . length ) . join ( c ) } return a } , isPlainObject : function ( a ) { if ( "object" != typeof a || a . nodeType || a === a . window ) return ! 1 ; try { if ( a . constructor && ! { } . hasOwnProperty . call ( a . constructor . prototype , "isPrototypeOf" ) ) return ! 1 } catch ( b ) { return ! 1 } return ! 0 } , extend : function ( ) { var a , c , d , e , f , g , h = arguments [ 0 ] || { } , i = 1 , j = arguments . length , k = ! 1 ; for ( "boolean" == typeof h && ( k = h , h = arguments [ 1 ] || { } , i = 2 ) , j === i && ( h = this , -- i ) ; j > i ; i ++ ) if ( null != ( a = arguments [ i ] ) ) for ( c in a ) d = h [ c ] , e = a [ c ] , h !== e && ( k && e && ( b . Utils . isPlainObject ( e ) || ( f = Array . isArray ( e ) ) ) ? ( f ? ( f = ! 1 , g = d && Array . isArray ( d ) ? d : [ ] ) : g = d && b . Utils . isPlainObject ( d ) ? d : { } , h [ c ] = b . Utils . extend ( k , g , e ) ) : void 0 !== e && ( h [ c ] = e ) ) ; return h } , mixin : function ( a , c ) { if ( ! a || "object" != typeof a ) return c ; for ( var d in a ) { var e = a [ d ] ; if ( ! e . childNodes && ! e . cloneNode ) { var f = typeof a [ d ] ; c [ d ] = a [ d ] && "object" === f ? typeof c [ d ] === f ? b . Utils . mixin ( a [ d ] , c [ d ] ) : b . Utils . mixin ( a [ d ] , new e . constructor ) : a [ d ] } } return c } } , "function" != typeof Function . prototype . bind && ( Function . prototype . bind = function ( ) { var a = Array . prototype . slice ; return function ( b ) { function c ( ) { var f = e . concat ( a . call ( arguments ) ) ; d . apply ( this instanceof c ? this : b , f ) } var d = this , e = a . call ( arguments , 1 ) ; if ( "function" != typeof d ) throw new TypeError ; return c . prototype = function f ( a ) { return a && ( f . prototype = a ) , this instanceof f ? void 0 : new f } ( d . prototype ) , c } } ( ) ) , Array . isArray || ( Array . isArray = function ( a ) { return "[object Array]" == Object . prototype . toString . call ( a ) } ) , Array . prototype . forEach || ( Array . prototype . forEach = function ( a ) { "use strict" ; if ( void 0 === this || null === this ) throw new TypeError ; var b = Object ( this ) , c = b . length >>> 0 ; if ( "function" != typeof a ) throw new TypeError ; for ( var d = arguments . length >= 2 ? arguments [ 1 ] : void 0 , e = 0 ; c > e ; e ++ ) e in b && a . call ( d , b [ e ] , e , b ) } ) , "function" != typeof window . Uint32Array && "object" != typeof window . Uint32Array ) { var c = function ( a ) { var b = new Array ; window [ a ] = function ( a ) { if ( "number" == typeof a ) { Array . call ( this , a ) , this . length = a ; for ( var b = 0 ; b < this . length ; b ++ ) this [ b ] = 0 } else { Array . call ( this , a . length ) , this . length = a . length ; for ( var b = 0
} return console . warn ( "Phaser.StateManager - No state found with the key: " + a ) , ! 1 } , link : function ( a ) { this . states [ a ] . game = this . game , this . states [ a ] . add = this . game . add , this . states [ a ] . make = this . game . make , this . states [ a ] . camera = this . game . camera , this . states [ a ] . cache = this . game . cache , this . states [ a ] . input = this . game . input , this . states [ a ] . load = this . game . load , this . states [ a ] . math = this . game . math , this . states [ a ] . sound = this . game . sound , this . states [ a ] . scale = this . game . scale , this . states [ a ] . state = this , this . states [ a ] . stage = this . game . stage , this . states [ a ] . time = this . game . time , this . states [ a ] . tweens = this . game . tweens , this . states [ a ] . world = this . game . world , this . states [ a ] . particles = this . game . particles , this . states [ a ] . rnd = this . game . rnd , this . states [ a ] . physics = this . game . physics } , unlink : function ( a ) { this . states [ a ] && ( this . states [ a ] . game = null , this . states [ a ] . add = null , this . states [ a ] . make = null , this . states [ a ] . camera = null , this . states [ a ] . cache = null , this . states [ a ] . input = null , this . states [ a ] . load = null , this . states [ a ] . math = null , this . states [ a ] . sound = null , this . states [ a ] . scale = null , this . states [ a ] . state = null , this . states [ a ] . stage = null , this . states [ a ] . time = null , this . states [ a ] . tweens = null , this . states [ a ] . world = null , this . states [ a ] . particles = null , this . states [ a ] . rnd = null , this . states [ a ] . physics = null ) } , setCurrentState : function ( a ) { this . callbackContext = this . states [ a ] , this . link ( a ) , this . onInitCallback = this . states [ a ] . init || this . dummy , this . onPreloadCallback = this . states [ a ] . preload || null , this . onLoadRenderCallback = this . states [ a ] . loadRender || null , this . onLoadUpdateCallback = this . states [ a ] . loadUpdate || null , this . onCreateCallback = this . states [ a ] . create || null , this . onUpdateCallback = this . states [ a ] . update || null , this . onPreRenderCallback = this . states [ a ] . preRender || null , this . onRenderCallback = this . states [ a ] . render || null , this . onResizeCallback = this . states [ a ] . resize || null , this . onPausedCallback = this . states [ a ] . paused || null , this . onResumedCallback = this . states [ a ] . resumed || null , this . onPauseUpdateCallback = this . states [ a ] . pauseUpdate || null , this . onShutDownCallback = this . states [ a ] . shutdown || this . dummy , this . current = a , this . _created = ! 1 , this . onInitCallback . apply ( this . callbackContext , this . _args ) , a === this . _pendingState && ( this . _args = [ ] ) } , getCurrentState : function ( ) { return this . states [ this . current ] } , loadComplete : function ( ) { this . _created === ! 1 && this . onCreateCallback ? ( this . _created = ! 0 , this . onCreateCallback . call ( this . callbackContext , this . game ) ) : this . _created = ! 0 } , pause : function ( ) { this . _created && this . onPausedCallback && this . onPausedCallback . call ( this . callbackContext , this . game ) } , resume : function ( ) { this . _created && this . onResumedCallback && this . onResumedCallback . call ( this . callbackContext , this . game ) } , update : function ( ) { this . _created && this . onUpdateCallback ? this . onUpdateCallback . call ( this . callbackContext , this . game ) : this . onLoadUpdateCallback && this . onLoadUpdateCallback . call ( this . callbackContext , this . game ) } , pauseUpdate : function ( ) { this . _created && this . onPauseUpdateCallback ? this . onPauseUpdateCallback . call ( this . callbackContext , this . game ) : this . onLoadUpdateCallback && this . onLoadUpdateCallback . call ( this . callbackContext , this . game ) } , preRender : function ( ) { this . onPreRenderCallback && this . onPreRenderCallback . call ( this . callbackContext , this . game ) } , resize : function ( a , b ) { this . onResizeCallback && this . onResizeCallback . call ( this . callbackContext , a , b ) } , render : function ( ) { this . _created && this . onRenderCallback ? ( this . game . renderType === b . CANVAS && ( this . game . context . save ( ) , this . game . context . setTransform ( 1 , 0 , 0 , 1 , 0 , 0 ) ) , this . onRenderCallback . call ( this . callbackContext , this . game ) , this . game . renderType === b . CANVAS && this . game . context . restore ( ) ) : this . onLoadRenderCallback && this . onLoadRenderCallback . call ( this . callbackContext , this . game ) } , destroy : function ( ) { this . clearCurrentState ( ) , this . callbackContext = null , this . onInitCallback = null , this . onShutDownCallback = null , this . onPreloadCallback = null , this . onLoadRenderCallback = null , this . onLoadUpdateCallback = null , this . onCreateCallback = null , this . onUpdateCallback = null , this . onRenderCallback = null , this . onPausedCallback = null , this . onResumedCallback = null , this . onPauseUpdateCallback = null , this . game = null , this . states = { } , this . _pendingState = null } } , b . StateManager . prototype . constructor
} , b . FlexGrid . prototype = { setSize : function ( a , c ) { this . width = a , this . height = c , this . ratioH = a / c , this . ratioV = c / a , this . scaleNone = new b . Point ( 1 , 1 ) , this . boundsNone . width = this . width , this . boundsNone . height = this . height , this . refresh ( ) } , createCustomLayer : function ( a , c , d , e ) { "undefined" == typeof e && ( e = ! 0 ) , this . customWidth = a , this . customHeight = c , this . boundsCustom . width = a , this . boundsCustom . height = c ; var f = new b . FlexLayer ( this , this . positionCustom , this . boundsCustom , this . scaleCustom ) ; return e && this . game . world . add ( f ) , this . layers . push ( f ) , "undefined" != typeof d && null !== typeof d && f . addMultiple ( d ) , f } , createFluidLayer : function ( a , c ) { "undefined" == typeof c && ( c = ! 0 ) ; var d = new b . FlexLayer ( this , this . positionFluid , this . boundsFluid , this . scaleFluid ) ; return c && this . game . world . add ( d ) , this . layers . push ( d ) , "undefined" != typeof a && null !== typeof a && d . addMultiple ( a ) , d } , createFullLayer : function ( a ) { var c = new b . FlexLayer ( this , this . positionFull , this . boundsFull , this . scaleFluid ) ; return this . game . world . add ( c ) , this . layers . push ( c ) , "undefined" != typeof a && c . addMultiple ( a ) , c } , createFixedLayer : function ( a ) { var c = new b . FlexLayer ( this , this . positionNone , this . boundsNone , this . scaleNone ) ; return this . game . world . add ( c ) , this . layers . push ( c ) , "undefined" != typeof a && c . addMultiple ( a ) , c } , reset : function ( ) { for ( var a = this . layers . length ; a -- ; ) this . layers [ a ] . persist || ( this . layers [ a ] . position = null , this . layers [ a ] . scale = null , this . layers . slice ( a , 1 ) ) } , onResize : function ( a , b ) { this . refresh ( a , b ) } , refresh : function ( ) { this . multiplier = Math . min ( this . manager . height / this . height , this . manager . width / this . width ) , this . boundsFluid . width = Math . round ( this . width * this . multiplier ) , this . boundsFluid . height = Math . round ( this . height * this . multiplier ) , this . scaleFluid . set ( this . boundsFluid . width / this . width , this . boundsFluid . height / this . height ) , this . scaleFluidInversed . set ( this . width / this . boundsFluid . width , this . height / this . boundsFluid . height ) , this . scaleFull . set ( this . boundsFull . width / this . width , this . boundsFull . height / this . height ) , this . boundsFull . width = this . manager . width * this . scaleFluidInversed . x , this . boundsFull . height = this . manager . height * this . scaleFluidInversed . y , this . boundsFluid . centerOn ( this . manager . bounds . centerX , this . manager . bounds . centerY ) , this . boundsNone . centerOn ( this . manager . bounds . centerX , this . manager . bounds . centerY ) , this . positionFluid . set ( this . boundsFluid . x , this . boundsFluid . y ) , this . positionNone . set ( this . boundsNone . x , this . boundsNone . y ) } , debug : function ( ) { this . game . debug . text ( this . boundsFluid . width + " x " + this . boundsFluid . height , this . boundsFluid . x + 4 , this . boundsFluid . y + 16 ) , this . game . debug . geom ( this . boundsFluid , "rgba(255,0,0,0.9" , ! 1 ) } } , b . FlexGrid . prototype . constructor = b . FlexGrid , b . FlexLayer = function ( a , c , d , e ) { b . Group . call ( this , a . game , null , "__flexLayer" + a . game . rnd . uuid ( ) , ! 1 ) , this . manager = a . manager , this . grid = a , this . persist = ! 1 , this . position = c , this . bounds = d , this . scale = e , this . topLeft = d . topLeft , this . topMiddle = new b . Point ( d . halfWidth , 0 ) , this . topRight = d . topRight , this . bottomLeft = d . bottomLeft , this . bottomMiddle = new b . Point ( d . halfWidth , d . bottom ) , this . bottomRight = d . bottomRight } , b . FlexLayer . prototype = Object . create ( b . Group . prototype ) , b . FlexLayer . prototype . constructor = b . FlexLayer , b . FlexLayer . prototype . resize = function ( ) { } , b . FlexLayer . prototype . debug = function ( ) { this . game . debug . text ( this . bounds . width + " x " + this . bounds . height , this . bounds . x + 4 , this . bounds . y + 16 ) , this . game . debug . geom ( this . bounds , "rgba(0,0,255,0.9" , ! 1 ) , this . game . debug . geom ( this . topLeft , "rgba(255,255,255,0.9" ) , this . game . debug . geom ( this . topMiddle , "rgba(255,255,255,0.9" ) , this . game . debug . geom ( this . topRight , "rgba(255,255,255,0.9" ) } , b . ScaleManager = function ( a , c , d ) { this . game = a , this . grid = null , this . width = 0 , this . height = 0 , this . minWidth = null , this . maxWidth = null , this . minHeight = null , this . maxHeight = null , this . offset = new b . Point , this . forceLandscape = ! 1 , this . forcePortrait = ! 1 , this . incorrectOrientation = ! 1 , this . pageAlignHorizontally = ! 1 , this . pageAlignVertically = ! 1 , this . maxIterations = 5 , this . enterLandscape = new b . Signal , this . enterPortrait = new b . Signal , this . enterIncorrectOrientation = new b . Signal , this . leaveIncorrectOrientation = new b . Signal , this . fullScreenTarget = null , this . enterFullScreen = new b . Signal , this . leaveFullScreen = new b . Signal
} , reset : function ( a ) { "undefined" == typeof a && ( a = ! 0 ) , this . isDown = ! 1 , this . isUp = ! 0 , this . timeUp = this . game . time . now , this . duration = 0 , this . enabled = ! 0 , a && ( this . onDown . removeAll ( ) , this . onUp . removeAll ( ) , this . onHoldCallback = null , this . onHoldContext = null ) } , justPressed : function ( a ) { return "undefined" == typeof a && ( a = 50 ) , this . isDown && this . duration < a } , justReleased : function ( a ) { return "undefined" == typeof a && ( a = 50 ) , ! this . isDown && this . game . time . now - this . timeUp < a } } , b . Key . prototype . constructor = b . Key , b . Keyboard = function ( a ) { this . game = a , this . disabled = ! 1 , this . event = null , this . pressEvent = null , this . callbackContext = this , this . onDownCallback = null , this . onPressCallback = null , this . onUpCallback = null , this . _keys = [ ] , this . _capture = [ ] , this . _onKeyDown = null , this . _onKeyPress = null , this . _onKeyUp = null , this . _i = 0 , this . _k = 0 } , b . Keyboard . prototype = { addCallbacks : function ( a , b , c , d ) { this . callbackContext = a , "undefined" != typeof b && ( this . onDownCallback = b ) , "undefined" != typeof c && ( this . onUpCallback = c ) , "undefined" != typeof d && ( this . onPressCallback = d ) } , addKey : function ( a ) { return this . _keys [ a ] || ( this . _keys [ a ] = new b . Key ( this . game , a ) , this . addKeyCapture ( a ) ) , this . _keys [ a ] } , removeKey : function ( a ) { this . _keys [ a ] && ( this . _keys [ a ] = null , this . removeKeyCapture ( a ) ) } , createCursorKeys : function ( ) { return { up : this . addKey ( b . Keyboard . UP ) , down : this . addKey ( b . Keyboard . DOWN ) , left : this . addKey ( b . Keyboard . LEFT ) , right : this . addKey ( b . Keyboard . RIGHT ) } } , start : function ( ) { if ( ! this . game . device . cocoonJS && null === this . _onKeyDown ) { var a = this ; this . _onKeyDown = function ( b ) { return a . processKeyDown ( b ) } , this . _onKeyUp = function ( b ) { return a . processKeyUp ( b ) } , this . _onKeyPress = function ( b ) { return a . processKeyPress ( b ) } , window . addEventListener ( "keydown" , this . _onKeyDown , ! 1 ) , window . addEventListener ( "keyup" , this . _onKeyUp , ! 1 ) , window . addEventListener ( "keypress" , this . _onKeyPress , ! 1 ) } } , stop : function ( ) { window . removeEventListener ( "keydown" , this . _onKeyDown ) , window . removeEventListener ( "keyup" , this . _onKeyUp ) , window . removeEventListener ( "keypress" , this . _onKeyPress ) , this . _onKeyDown = null , this . _onKeyUp = null , this . _onKeyPress = null } , destroy : function ( ) { this . stop ( ) , this . clearCaptures ( ) , this . _keys . length = 0 , this . _i = 0 } , addKeyCapture : function ( a ) { if ( "object" == typeof a ) for ( var b in a ) this . _capture [ a [ b ] ] = ! 0 ; else this . _capture [ a ] = ! 0 } , removeKeyCapture : function ( a ) { delete this . _capture [ a ] } , clearCaptures : function ( ) { this . _capture = { } } , update : function ( ) { for ( this . _i = this . _keys . length ; this . _i -- ; ) this . _keys [ this . _i ] && this . _keys [ this . _i ] . update ( ) } , processKeyDown : function ( a ) { this . event = a , this . game . input . disabled || this . disabled || ( this . _capture [ a . keyCode ] && a . preventDefault ( ) , this . _keys [ a . keyCode ] || ( this . _keys [ a . keyCode ] = new b . Key ( this . game , a . keyCode ) ) , this . _keys [ a . keyCode ] . processKeyDown ( a ) , this . _k = a . keyCode , this . onDownCallback && this . onDownCallback . call ( this . callbackContext , a ) ) } , processKeyPress : function ( a ) { this . pressEvent = a , this . game . input . disabled || this . disabled || this . onPressCallback && this . onPressCallback . call ( this . callbackContext , String . fromCharCode ( a . charCode ) , a ) } , processKeyUp : function ( a ) { this . event = a , this . game . input . disabled || this . disabled || ( this . _capture [ a . keyCode ] && a . preventDefault ( ) , this . _keys [ a . keyCode ] || ( this . _keys [ a . keyCode ] = new b . Key ( this . game , a . keyCode ) ) , this . _keys [ a . keyCode ] . processKeyUp ( a ) , this . onUpCallback && this . onUpCallback . call ( this . callbackContext , a ) ) } , reset : function ( a ) { "undefined" == typeof a && ( a = ! 0 ) , this . event = null ; for ( var b = this . _keys . length ; b -- ; ) this . _keys [ b ] && this . _keys [ b ] . reset ( a ) } , justPressed : function ( a , b ) { return "undefined" == typeof b && ( b = 50 ) , this . _keys [ a ] ? this . _keys [ a ] . justPressed ( b ) : ! 1 } , justReleased : function ( a , b ) { return "undefined" == typeof b && ( b = 50 ) , this . _keys [ a ] ? this . _keys [ a ] . justReleased ( b ) : ! 1 } , isDown : function ( a ) { return this . _keys [ a ] ? this . _keys [ a ] . isDown : ! 1 } } , Object . defineProperty ( b . Keyboard . prototype , "lastChar" , { get : function ( ) { return 32 === this . event . charCode ? "" : String . fromCharCode ( this . pressEvent . charCode ) } } ) , Object . defineProperty ( b . Keyboard . prototype , "lastKey" , { get : function ( ) { return this . _keys [ this . _k ] } } ) , b . Keyboard . prototype . constructor = b . Keyboard , b . Keyboard . A = "A" . charCodeAt ( 0 ) , b . Keyboard . B = "B" . charCodeAt ( 0 ) , b . Keyboard . C = "C" . charCodeAt ( 0 ) , b . Keyboard . D = "D" . charCodeAt
} , getButton : function ( a ) { return this . _buttons [ a ] ? this . _buttons [ a ] : null } , pollStatus : function ( ) { if ( ! ( ! this . connected || this . game . input . disabled || this . game . input . gamepad . disabled || this . _rawPad . timestamp && this . _rawPad . timestamp === this . _prevTimestamp ) ) { for ( var a = 0 ; a < this . _buttonsLen ; a ++ ) { var b = isNaN ( this . _rawPad . buttons [ a ] ) ? this . _rawPad . buttons [ a ] . value : this . _rawPad . buttons [ a ] ; b !== this . _buttons [ a ] . value && ( 1 === b ? this . processButtonDown ( a , b ) : 0 === b ? this . processButtonUp ( a , b ) : this . processButtonFloat ( a , b ) ) } for ( var c = 0 ; c < this . _axesLen ; c ++ ) { var d = this . _rawPad . axes [ c ] ; d > 0 && d > this . deadZone || 0 > d && d < - this . deadZone ? this . processAxisChange ( c , d ) : this . processAxisChange ( c , 0 ) } this . _prevTimestamp = this . _rawPad . timestamp } } , connect : function ( a ) { var c = ! this . connected ; this . connected = ! 0 , this . index = a . index , this . _rawPad = a , this . _buttons = [ ] , this . _buttonsLen = a . buttons . length , this . _axes = [ ] , this . _axesLen = a . axes . length ; for ( var d = 0 ; d < this . _axesLen ; d ++ ) this . _axes [ d ] = a . axes [ d ] ; for ( var e in a . buttons ) e = parseInt ( e , 10 ) , this . _buttons [ e ] = new b . GamepadButton ( this , e ) ; c && this . _padParent . onConnectCallback && this . _padParent . onConnectCallback . call ( this . _padParent . callbackContext , this . index ) , c && this . onConnectCallback && this . onConnectCallback . call ( this . callbackContext ) } , disconnect : function ( ) { var a = this . connected , b = this . index ; this . connected = ! 1 , this . index = null , this . _rawPad = void 0 ; for ( var c = 0 ; c < this . _buttonsLen ; c ++ ) this . _buttons [ c ] . destroy ( ) ; this . _buttons = [ ] , this . _buttonsLen = 0 , this . _axes = [ ] , this . _axesLen = 0 , a && this . _padParent . onDisconnectCallback && this . _padParent . onDisconnectCallback . call ( this . _padParent . callbackContext , b ) , a && this . onDisconnectCallback && this . onDisconnectCallback . call ( this . callbackContext ) } , destroy : function ( ) { this . _rawPad = void 0 ; for ( var a = 0 ; a < this . _buttonsLen ; a ++ ) this . _buttons [ a ] . destroy ( ) ; this . _buttons = [ ] , this . _buttonsLen = 0 , this . _axes = [ ] , this . _axesLen = 0 , this . onConnectCallback = null , this . onDisconnectCallback = null , this . onDownCallback = null , this . onUpCallback = null , this . onAxisCallback = null , this . onFloatCallback = null } , processAxisChange : function ( a , b ) { this . _axes [ a ] !== b && ( this . _axes [ a ] = b , this . _padParent . onAxisCallback && this . _padParent . onAxisCallback . call ( this . _padParent . callbackContext , this , a , b ) , this . onAxisCallback && this . onAxisCallback . call ( this . callbackContext , this , a , b ) ) } , processButtonDown : function ( a , b ) { 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 ] . processButtonDown ( b ) } , processButtonUp : function ( a , b ) { this . _padParent . onUpCallback && this . _padParent . onUpCallback . call ( this . _padParent . callbackContext , a , b , this . index ) , this . onUpCallback && this . onUpCallback . call ( this . callbackContext , a , b ) , this . _buttons [ a ] && this . _buttons [ a ] . processButtonUp ( b ) } , processButtonFloat : function ( a , b ) { 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 ] . 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 } , isUp : function ( a ) { return this . _buttons [ a ] ? this . _buttons [ a ] . isUp : ! 1 } , justReleased : function ( a , b ) { return this . _buttons [ a ] ? this . _buttons [ a ] . justReleased ( b ) : void 0 } , justPressed : function ( a , b ) { return this . _buttons [ a ] ? this . _buttons [ a ] . justPressed ( b ) : void 0 } , buttonValue : function ( a ) { return this . _buttons [ a ] ? this . _buttons [ a ] . value : null } , reset : function ( ) { for ( var a = 0 ; a < this . _axes . length ; a ++ ) this . _axes [ a ] = 0 } } , b . SinglePad . prototype . constructor = b . SinglePad , b . GamepadButton = function ( a , c ) { this . pad = a , this . game = a . game , this . isDown = ! 1 , this . isUp = ! 0 , this . timeDown = 0 , this . duration = 0 , this . timeUp = 0 , this . repeats = 0 , this . value = 0 , this . buttonCode = c , this . onDown = new b . Signal , this . onUp = new b . Signal , this . onFloat = new b . Signal } , b . GamepadButton . prototype = { processButtonDown : function ( a ) { this . isDown = ! 0 , this . isUp = ! 1 , this . timeDown = this . game . time . now , this . duration = 0 , this . repeats = 0 , this . value = a , this . onDown . dispatch ( this , a ) } , pr
this . _image = a } this . _size . set ( this . _image . width , this . _image . height ) } return ( "undefined" == typeof c || null === c ) && ( c = 0 ) , ( "undefined" == typeof d || null === d ) && ( d = 0 ) , e && ( this . _size . x = e ) , f && ( this . _size . y = f ) , ( "undefined" == typeof g || null === g ) && ( g = c ) , ( "undefined" == typeof h || null === h ) && ( h = d ) , ( "undefined" == typeof i || null === i ) && ( i = this . _size . x ) , ( "undefined" == typeof j || null === j ) && ( j = this . _size . y ) , "number" == typeof k && ( this . _rotate = k ) , "number" == typeof l && ( this . _anchor . x = l ) , "number" == typeof m && ( this . _anchor . y = m ) , "number" == typeof n && ( this . _scale . x = n ) , "number" == typeof o && ( this . _scale . y = o ) , "number" == typeof p && ( this . _alpha . current = p ) , "undefined" == typeof q && ( q = null ) , "undefined" == typeof r && ( r = ! 1 ) , this . _alpha . current <= 0 || 0 === this . _scale . x || 0 === this . _scale . y || 0 === this . _size . x || 0 === this . _size . y ? void 0 : ( this . _alpha . prev = this . context . globalAlpha , this . context . save ( ) , this . context . globalAlpha = this . _alpha . current , q && ( this . context . globalCompositeOperation = q ) , r && ( g |= 0 , h |= 0 ) , this . context . translate ( g , h ) , this . context . scale ( this . _scale . x , this . _scale . y ) , this . context . rotate ( this . _rotate ) , this . context . drawImage ( this . _image , this . _pos . x + c , this . _pos . y + d , this . _size . x , this . _size . y , - i * this . _anchor . x , - j * this . _anchor . y , i , j ) , this . context . restore ( ) , this . context . globalAlpha = this . _alpha . prev , this . dirty = ! 0 , this ) } , copyRect : function ( a , b , c , d , e , f , g ) { return this . copy ( a , b . x , b . y , b . width , b . height , c , d , b . width , b . height , 0 , 0 , 0 , 1 , 1 , e , f , g ) } , draw : function ( a , b , c , d , e , f , g ) { return this . copy ( a , null , null , null , null , b , c , d , e , null , null , null , null , null , null , f , g ) } , shadow : function ( a , b , c , d ) { "undefined" == typeof a || null === a ? this . context . shadowColor = "rgba(0,0,0,0)" : ( this . context . shadowColor = a , this . context . shadowBlur = b || 5 , this . context . shadowOffsetX = c || 10 , this . context . shadowOffsetY = d || 10 ) } , alphaMask : function ( a , b , c , d ) { return "undefined" == typeof d || null === d ? this . draw ( b ) . blendSourceAtop ( ) : this . draw ( b , d . x , d . y , d . width , d . height ) . blendSourceAtop ( ) , "undefined" == typeof c || null === c ? this . draw ( a ) . blendReset ( ) : this . draw ( a , c . x , c . y , c . width , c . height ) . blendReset ( ) , this } , extract : function ( a , b , c , d , e , f , g , h , i ) { return "undefined" == typeof e && ( e = 255 ) , "undefined" == typeof f && ( f = ! 1 ) , "undefined" == typeof g && ( g = b ) , "undefined" == typeof h && ( h = c ) , "undefined" == typeof i && ( i = d ) , f && a . resize ( this . width , this . height ) , this . processPixelRGB ( function ( f , j , k ) { return f . r === b && f . g === c && f . b === d && a . setPixel32 ( j , k , g , h , i , e , ! 1 ) , ! 1 } , this ) , a . context . putImageData ( a . imageData , 0 , 0 ) , a . dirty = ! 0 , a } , rect : function ( a , b , c , d , e ) { return "undefined" != typeof e && ( this . context . fillStyle = e ) , this . context . fillRect ( a , b , c , d ) , this } , circle : function ( a , b , c , d ) { return "undefined" != typeof d && ( this . context . fillStyle = d ) , this . context . beginPath ( ) , this . context . arc ( a , b , c , 0 , 2 * Math . PI , ! 1 ) , this . context . closePath ( ) , this . context . fill ( ) , this } , textureLine : function ( a , c , d ) { if ( "undefined" == typeof d && ( d = "repeat-x" ) , "string" != typeof c || ( c = this . game . cache . getImage ( c ) ) ) { var e = a . length ; return "no-repeat" === d && e > c . width && ( e = c . width ) , this . context . fillStyle = this . context . createPattern ( c , d ) , this . _circle = new b . Circle ( a . start . x , a . start . y , c . height ) , this . _circle . circumferencePoint ( a . angle - 1.5707963267948966 , ! 1 , this . _pos ) , this . context . save ( ) , this . context . translate ( this . _pos . x , this . _pos . y ) , this . context . rotate ( a . angle ) , this . context . fillRect ( 0 , 0 , e , c . height ) , this . context . restore ( ) , this . dirty = ! 0 , this } } , render : function ( ) { return ! this . disableTextureUpload && this . game . renderType === b . WEBGL && this . dirty && ( PIXI . updateWebGLTexture ( this . baseTexture , this . game . renderer . gl ) , this . dirty = ! 1 ) , this } , blendReset : function ( ) { return this . context . globalCompositeOperation = "source-over" , this } , blendSourceOver : function ( ) { return this . context . globalCompositeOperation = "source-over" , this } , blendSourceIn : function ( ) { return this . context . globalCompositeOperation = "source-in" , this } , blendSourceOut : function ( ) { return this . context . globalCompositeOperation = "source-out" , this } , blendSourceAtop : function ( ) { return this . context . globalCompositeOperation = "source-atop" , this } , blendDestinationOver : function ( ) { return this . context . globalCompositeOperation = "destination-over" , this } , blendDestinationIn : function ( ) { return this . context . globalCompositeOperation = "destination-in" , this } , blendDestinationOut
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 . checkWorldBounds ) && this . _bounds . copyFrom ( this . getBounds ( ) ) , this . autoCull && ( this . renderable = this . game . world . camera . screenView . intersects ( this . _bounds ) ) , this . checkWorldBounds && ( 1 === this . _cache [ 5 ] && this . game . world . bounds . intersects ( this . _bounds ) ? ( this . _cache [ 5 ] = 0 , this . events . onEnterBounds . dispatch ( this ) ) : 0 !== this . _cache [ 5 ] || this . game . world . bounds . intersects ( this . _bounds ) || ( this . _cache [ 5 ] = 1 , this . events . onOutOfBounds . dispatch ( this ) ) ) , this . world . setTo ( this . game . camera . x + this . worldTransform . tx , this . game . camera . y + this . worldTransform . ty ) , this . visible && ( this . _cache [ 3 ] = this . game . stage . currentRenderOrderID ++ ) , this . animations . update ( ) , 0 !== this . _scroll . x && ( this . tilePosition . x += this . _scroll . x * this . game . time . physicsElapsed ) , 0 !== this . _scroll . y && ( this . tilePosition . y += this . _scroll . y * this . game . time . physicsElapsed ) , this . body && this . body . preUpdate ( ) ; for ( var a = 0 , b = this . children . length ; b > a ; a ++ ) this . children [ a ] . preUpdate ( ) ; return ! 0 } , b . Rope . prototype . update = function ( ) { this . _hasUpdateAnimation && this . updateAnimation . call ( this ) } , b . Rope . prototype . postUpdate = function ( ) { this . exists && this . body && this . body . postUpdate ( ) , 1 === this . _cache [ 7 ] && ( this . position . x = this . game . camera . view . x + this . cameraOffset . x , this . position . y = this . game . camera . view . y + this . cameraOffset . y ) ; for ( var a = 0 , b = this . children . length ; b > a ; a ++ ) this . children [ a ] . postUpdate ( ) } , b . Rope . prototype . loadTexture = function ( a , c ) { c = c || 0 , this . key = a , a instanceof b . RenderTexture ? ( this . key = a . key , this . setTexture ( a ) ) : a instanceof b . BitmapData ? this . setTexture ( a . texture ) : a instanceof PIXI . Texture ? this . setTexture ( a ) : null === a || "undefined" == typeof a ? ( this . key = "__default" , this . setTexture ( PIXI . TextureCache [ this . key ] ) ) : "string" != typeof a || this . game . cache . checkImageKey ( a ) ? ( this . setTexture ( new PIXI . Texture ( PIXI . BaseTextureCache [ a ] ) ) , this . animations . loadFrameData ( this . game . cache . getFrameData ( a ) , c ) ) : ( console . warn ( "Texture with key '" + a + "' not found." ) , this . key = "__missing" , this . setTexture ( PIXI . TextureCache [ this . key ] ) ) } , b . Rope . prototype . setFrame = function ( a ) { this . texture . frame . x = a . x , this . texture . frame . y = a . y , this . texture . frame . width = a . width , this . texture . frame . height = a . height , this . texture . crop . x = a . x , this . texture . crop . y = a . y , this . texture . crop . width = a . width , this . texture . crop . height = a . height , a . trimmed ? ( this . texture . trim ? ( this . texture . trim . x = a . spriteSourceSizeX , this . texture . trim . y = a . spriteSourceSizeY , this . texture . trim . width = a . sourceSizeW , this . texture . trim . height = a . sourceSizeH ) : this . texture . trim = { x : a . spriteSourceSizeX , y : a . spriteSourceSizeY , width : a . sourceSizeW , height : a . sourceSizeH } , this . texture . width = a . sourceSizeW , this . texture . height = a . sourceSizeH , this . texture . frame . width = a . sourceSizeW , this . texture . frame . height = a . sourceSizeH ) : ! a . trimmed && this . texture . trim && ( this . texture . trim = null ) , this . game . renderType === b . WEBGL && PIXI . WebGLRenderer . updateTextureFrame ( this . texture ) } , b . Rope . prototype . destroy = function ( a ) { if ( null !== this . game && ! this . destroyPhase ) { "undefined" == typeof a && ( a = ! 0 ) , this . _cache [ 8 ] = 1 , this . events && this . events . onDestroy . dispatch ( this ) , this . filters && ( this . filters = null ) , this . parent && ( this . parent instanceof b . Group ? this . parent . remove ( this ) : this . parent . removeChild ( this ) ) , this . animations . destroy ( ) , this . events . destroy ( ) ; var c = this . children . length ; if ( a ) for ( ; c -- ; ) this . children [ c ] . destroy ( a ) ; else for ( ; c -- ; ) this . removeChild ( this . children [ c ] ) ; this . exists = ! 1 , this . visible = ! 1 , this . filters = null , this . mask = null , this . game = null , this . _cache [ 8 ] = 0 } } , b . Rope . prototype . play = function ( a , b , c , d ) { return this . animations . play ( a , b , c , d ) } , b . Rope . prototype . reset = function ( a , b ) { return this . world . setTo ( a , b ) , this . position . x = a , this . position . y = b , this . alive = ! 0 , this . exists = ! 0 , this . visible = ! 0 , this . renderable = ! 0 , this . _outOfBoundsFired = ! 1 , this . tilePosition . x = 0 , this . tilePosition . y = 0 , this . body && this . body . reset ( a , b , ! 1 , ! 1 ) , this . _cache [ 4 ] = 1 , this } , Object . defineProperty ( b . Rope . prototype , "angle" , { get : function ( ) { return b . Math . wrapAngle ( b . Math . radToDeg ( this . rotation ) ) } , set : function ( a ) { this . rotation = b . Math . degToRad ( b . Math . wrapAng
this . buildRetroFontText ( ) } } , Object . defineProperty ( b . RetroFont . 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 . buildRetroFontText ( ) ) } } ) , Object . defineProperty ( b . RetroFont . prototype , "smoothed" , { get : function ( ) { return this . stamp . smoothed } , set : function ( a ) { this . stamp . smoothed = a , this . buildRetroFontText ( ) } } ) , b . Particle = function ( a , c , d , e , f ) { b . Sprite . call ( this , a , c , d , e , f ) , this . autoScale = ! 1 , this . scaleData = null , this . _s = 0 , this . autoAlpha = ! 1 , this . alphaData = null , this . _a = 0 } , b . Particle . prototype = Object . create ( b . Sprite . prototype ) , b . Particle . prototype . constructor = b . Particle , b . Particle . prototype . update = function ( ) { this . autoScale && ( this . _s -- , this . _s ? this . scale . set ( this . scaleData [ this . _s ] . x , this . scaleData [ this . _s ] . y ) : this . autoScale = ! 1 ) , this . autoAlpha && ( this . _a -- , this . _a ? this . alpha = this . alphaData [ this . _a ] . v : this . autoAlpha = ! 1 ) } , b . Particle . prototype . onEmit = function ( ) { } , b . Particle . prototype . setAlphaData = function ( a ) { this . alphaData = a , this . _a = a . length - 1 , this . alpha = this . alphaData [ this . _a ] . v , this . autoAlpha = ! 0 } , b . Particle . prototype . setScaleData = function ( a ) { this . scaleData = a , this . _s = a . length - 1 , this . scale . set ( this . scaleData [ this . _s ] . x , this . scaleData [ this . _s ] . y ) , this . autoScale = ! 0 } , b . Particle . prototype . reset = function ( a , b , c ) { return "undefined" == typeof c && ( c = 1 ) , this . world . setTo ( a , b ) , this . position . x = a , this . position . y = b , this . alive = ! 0 , this . exists = ! 0 , this . visible = ! 0 , this . renderable = ! 0 , this . _outOfBoundsFired = ! 1 , this . health = c , this . body && this . body . reset ( a , b , ! 1 , ! 1 ) , this . _cache [ 4 ] = 1 , this . alpha = 1 , this . scale . set ( 1 ) , this . autoScale = ! 1 , this . autoAlpha = ! 1 , this } , b . Canvas = { create : function ( a , b , c ) { a = a || 256 , b = b || 256 ; var d = document . createElement ( "canvas" ) ; return "string" == typeof c && "" !== c && ( d . id = c ) , d . width = a , d . height = b , d . style . display = "block" , d } , 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 . style [ "-webkit-user-select" ] = b , a . style [ "-khtml-user-select" ] = b , a . style [ "-moz-user-select" ] = b , a . style [ "-ms-user-select" ] = b , a . style [ "user-select" ] = b , a . style [ "-webkit-tap-highlight-color" ] = "rgba(0, 0, 0, 0)" , a } , addToDOM : function ( a , b , c ) { var d ; return "undefined" == typeof c && ( c = ! 0 ) , b && ( "string" == typeof b ? d = document . getElementById ( b ) : "object" == typeof b && 1 === b . nodeType && ( d = b ) ) , d || ( d = document . body ) , c && d . style && ( d . style . overflow = "hidden" ) , d . appendChild ( a ) , a } , removeFromDOM : function ( a ) { a . parentNode && a . parentNode . removeChild ( a ) } , setTransform : function ( a , b , c , d , e , f , g ) { return a . setTransform ( d , f , g , e , b , c ) , a } , setSmoothingEnabled : function ( a , b ) { return a . imageSmoothingEnabled = b , a . mozImageSmoothingEnabled = b , a . oImageSmoothingEnabled = b , a . webkitImageSmoothingEnabled = b , a . msImageSmoothingEnabled = b , a } , getSmoothingEnabled : function ( a ) { return a . imageSmoothingEnabled || a . mozImageSmoothingEnabled || a . oImageSmoothingEnabled || a . webkitImageSmoothingEnabled || a . msImageSmoothingEnabled } , setImageRenderingCrisp : function ( a ) { return a . style [ "image-rendering" ] = "optimizeSpeed" , a . style [ "image-rendering" ] = "crisp-edges" , a . style [ "image-rendering" ] = "-moz-crisp-edges" , a . style [ "image-rendering" ] = "-webkit-optimize-contrast" , a . style [ "image-rendering" ] = "optimize-contrast" , a . style [ "image-rendering" ] = "pixelated" , a . style . msInterpolationMode = "nearest-neighbor" , a } , setImageRenderingBicubic : function ( a ) { return a . s
} } , Quintic : { In : function ( a ) { return a * a * a * a * a } , Out : function ( a ) { return -- a * a * a * a * a + 1 } , InOut : function ( a ) { return ( a *= 2 ) < 1 ? . 5 * a * a * a * a * a : . 5 * ( ( a -= 2 ) * a * a * a * a + 2 ) } } , Sinusoidal : { In : function ( a ) { return 1 - Math . cos ( a * Math . PI / 2 ) } , Out : function ( a ) { return Math . sin ( a * Math . PI / 2 ) } , InOut : function ( a ) { return . 5 * ( 1 - Math . cos ( Math . PI * a ) ) } } , Exponential : { In : function ( a ) { return 0 === a ? 0 : Math . pow ( 1024 , a - 1 ) } , Out : function ( a ) { return 1 === a ? 1 : 1 - Math . pow ( 2 , - 10 * a ) } , InOut : function ( a ) { return 0 === a ? 0 : 1 === a ? 1 : ( a *= 2 ) < 1 ? . 5 * Math . pow ( 1024 , a - 1 ) : . 5 * ( - Math . pow ( 2 , - 10 * ( a - 1 ) ) + 2 ) } } , Circular : { In : function ( a ) { return 1 - Math . sqrt ( 1 - a * a ) } , Out : function ( a ) { return Math . sqrt ( 1 - -- a * a ) } , InOut : function ( a ) { return ( a *= 2 ) < 1 ? - . 5 * ( Math . sqrt ( 1 - a * a ) - 1 ) : . 5 * ( Math . sqrt ( 1 - ( a -= 2 ) * a ) + 1 ) } } , Elastic : { In : function ( a ) { var b , c = . 1 , d = . 4 ; return 0 === a ? 0 : 1 === a ? 1 : ( ! c || 1 > c ? ( c = 1 , b = d / 4 ) : b = d * Math . asin ( 1 / c ) / ( 2 * Math . PI ) , - ( c * Math . pow ( 2 , 10 * ( a -= 1 ) ) * Math . sin ( 2 * ( a - b ) * Math . PI / d ) ) ) } , Out : function ( a ) { var b , c = . 1 , d = . 4 ; return 0 === a ? 0 : 1 === a ? 1 : ( ! c || 1 > c ? ( c = 1 , b = d / 4 ) : b = d * Math . asin ( 1 / c ) / ( 2 * Math . PI ) , c * Math . pow ( 2 , - 10 * a ) * Math . sin ( 2 * ( a - b ) * Math . PI / d ) + 1 ) } , InOut : function ( a ) { var b , c = . 1 , d = . 4 ; return 0 === a ? 0 : 1 === a ? 1 : ( ! c || 1 > c ? ( c = 1 , b = d / 4 ) : b = d * Math . asin ( 1 / c ) / ( 2 * Math . PI ) , ( a *= 2 ) < 1 ? - . 5 * c * Math . pow ( 2 , 10 * ( a -= 1 ) ) * Math . sin ( 2 * ( a - b ) * Math . PI / d ) : c * Math . pow ( 2 , - 10 * ( a -= 1 ) ) * Math . sin ( 2 * ( a - b ) * Math . PI / d ) * . 5 + 1 ) } } , Back : { In : function ( a ) { var b = 1.70158 ; return a * a * ( ( b + 1 ) * a - b ) } , Out : function ( a ) { var b = 1.70158 ; return -- a * a * ( ( b + 1 ) * a + b ) + 1 } , InOut : function ( a ) { var b = 2.5949095 ; return ( a *= 2 ) < 1 ? . 5 * a * a * ( ( b + 1 ) * a - b ) : . 5 * ( ( a -= 2 ) * a * ( ( b + 1 ) * a + b ) + 2 ) } } , Bounce : { In : function ( a ) { return 1 - b . Easing . Bounce . Out ( 1 - a ) } , Out : function ( a ) { return 1 / 2.75 > a ? 7.5625 * a * a : 2 / 2.75 > a ? 7.5625 * ( a -= 1.5 / 2.75 ) * a + . 75 : 2.5 / 2.75 > a ? 7.5625 * ( a -= 2.25 / 2.75 ) * a + . 9375 : 7.5625 * ( a -= 2.625 / 2.75 ) * a + . 984375 } , InOut : function ( a ) { return . 5 > a ? . 5 * b . Easing . Bounce . In ( 2 * a ) : . 5 * b . Easing . Bounce . Out ( 2 * a - 1 ) + . 5 } } } , b . Easing . Default = b . Easing . Linear . None , b . Time = function ( a ) { this . game = a , this . time = 0 , this . now = 0 , this . elapsed = 0 , this . pausedTime = 0 , this . advancedTiming = ! 1 , this . fps = 0 , this . fpsMin = 1e3 , this . fpsMax = 0 , this . msMin = 1e3 , this . msMax = 0 , this . physicsElapsed = 0 , this . deltaCap = 0 , this . timeCap = 1 / 60 * 1e3 , this . frames = 0 , this . pauseDuration = 0 , this . timeToCall = 0 , this . lastTime = 0 , this . events = new b . Timer ( this . game , ! 1 ) , this . _started = 0 , this . _timeLastSecond = 0 , this . _pauseStarted = 0 , this . _justResumed = ! 1 , this . _timers = [ ] , this . _len = 0 , this . _i = 0 } , b . Time . prototype = { boot : function ( ) { this . _started = Date . now ( ) , this . events . start ( ) } , add : function ( a ) { return this . _timers . push ( a ) , a } , create : function ( a ) { "undefined" == typeof a && ( a = ! 0 ) ; var c = new b . Timer ( this . game , a ) ; return this . _timers . push ( c ) , c } , removeAll : function ( ) { for ( var a = 0 ; a < this . _timers . length ; a ++ ) this . _timers [ a ] . destroy ( ) ; this . _timers = [ ] , this . events . removeAll ( ) } , update : function ( a ) { if ( this . now = a , this . timeToCall = this . game . math . max ( 0 , 16 - ( a - this . lastTime ) ) , this . elapsed = this . now - this . time , this . elapsed > this . timeCap && ( this . elapsed = this . timeCap ) , this . physicsElapsed = this . elapsed / 1e3 || 1 / 60 , this . deltaCap > 0 && this . physicsElapsed > this . deltaCap && ( this . physicsElapsed = this . deltaCap ) , this . advancedTiming && ( this . msMin = this . game . math . min ( this . msMin , this . elapsed ) , this . msMax = this . game . math . max ( this . msMax , this . elapsed ) , this . frames ++ , this . now > this . _timeLastSecond + 1e3 && ( this . fps = Math . round ( 1e3 * this . frames / ( this . now - this . _timeLastSecond ) ) , this . fpsMin = this . game . math . min ( this . fpsMin , this . fps ) , this . fpsMax = this . game . math . max ( this . fpsMax , this . fps ) , this . _timeLastSecond = this . now , this . frames = 0 ) ) , this . time = this . now , this . lastTime = a + this . timeToCall , ! this . game . paused ) for ( this . events . update ( this . now ) , this . _i = 0 , this . _len = this . _timers . length ; this . _i < this . _len ; ) this . _timers [ this . _i ] . update ( this . now ) ? this . _i ++ : ( this . _timers . splice ( this . _i , 1 ) , this . _len -- ) } , gamePaused : function ( ) { this . _pauseStarted = this . now , this . events . pause ( ) ; for ( var a = this . _timers . length ; a -- ; ) this . _timers [ a ] . _pause ( ) } , gameResumed : function ( ) { this . time = this . now = Date . now ( ) , this . pauseDuration = this . time - this . _pauseStarted , this . events . resume ( ) ; for ( var a = this . _timers . length ; a -- ; ) this . _timers [ a ] . _resume ( ) } , totalElapsedSeconds : function ( ) { return . 001 * ( this . now - this . _started ) } , elapsedSince : function ( a ) { return this . now - a } , elapsedSecondsSince : function ( a ) { r
if ( ! d || ! c ) return d ; for ( var e in d ) if ( e = d [ e ] , e . fixtureKey === c ) return e ; console . warn ( 'Phaser.Cache.getPhysicsData: Could not find given fixtureKey: "' + c + " in " + a + '"' ) } else console . warn ( 'Phaser.Cache.getPhysicsData: Invalid key/object: "' + a + " / " + b + '"' ) ; return null } , checkKey : function ( a , b ) { return this . _cacheMap [ a ] [ b ] ? ! 0 : ! 1 } , checkCanvasKey : function ( a ) { return this . checkKey ( b . Cache . CANVAS , a ) } , checkImageKey : function ( a ) { return this . checkKey ( b . Cache . IMAGE , a ) } , checkTextureKey : function ( a ) { return this . checkKey ( b . Cache . TEXTURE , a ) } , checkSoundKey : function ( a ) { return this . checkKey ( b . Cache . SOUND , a ) } , checkTextKey : function ( a ) { return this . checkKey ( b . Cache . TEXT , a ) } , checkPhysicsKey : function ( a ) { return this . checkKey ( b . Cache . PHYSICS , a ) } , checkTilemapKey : function ( a ) { return this . checkKey ( b . Cache . TILEMAP , a ) } , checkBinaryKey : function ( a ) { return this . checkKey ( b . Cache . BINARY , a ) } , checkBitmapDataKey : function ( a ) { return this . checkKey ( b . Cache . BITMAPDATA , a ) } , checkBitmapFontKey : function ( a ) { return this . checkKey ( b . Cache . BITMAPFONT , a ) } , checkJSONKey : function ( a ) { return this . checkKey ( b . Cache . JSON , a ) } , checkXMLKey : function ( a ) { return this . checkKey ( b . Cache . XML , a ) } , checkUrl : function ( a ) { return this . _urlMap [ this . _resolveUrl ( a ) ] ? ! 0 : ! 1 } , getImage : function ( a ) { return this . _images [ a ] ? this . _images [ a ] . data : ( console . warn ( 'Phaser.Cache.getImage: Invalid key: "' + a + '"' ) , null ) } , getTilemapData : function ( a ) { return this . _tilemaps [ a ] ? this . _tilemaps [ a ] : void console . warn ( 'Phaser.Cache.getTilemapData: Invalid key: "' + a + '"' ) } , getFrameData : function ( a , c ) { return "undefined" == typeof c && ( c = b . Cache . IMAGE ) , this . _cacheMap [ c ] [ a ] ? this . _cacheMap [ c ] [ a ] . frameData : null } , updateFrameData : function ( a , b ) { this . _images [ a ] && ( this . _images [ a ] . frameData = b ) } , getFrameByIndex : function ( a , b ) { return this . _images [ a ] ? this . _images [ a ] . frameData . getFrame ( b ) : null } , getFrameByName : function ( a , b ) { return this . _images [ a ] ? this . _images [ a ] . frameData . getFrameByName ( b ) : null } , getFrame : function ( a ) { return this . _images [ a ] ? this . _images [ a ] . frame : null } , getTextureFrame : function ( a ) { return this . _textures [ a ] ? this . _textures [ a ] . frame : null } , getTexture : function ( a ) { return this . _textures [ a ] ? this . _textures [ a ] : void console . warn ( 'Phaser.Cache.getTexture: Invalid key: "' + a + '"' ) } , getSound : function ( a ) { return this . _sounds [ a ] ? this . _sounds [ a ] : void console . warn ( 'Phaser.Cache.getSound: Invalid key: "' + a + '"' ) } , getSoundData : function ( a ) { return this . _sounds [ a ] ? this . _sounds [ a ] . data : void console . warn ( 'Phaser.Cache.getSoundData: Invalid key: "' + a + '"' ) } , isSoundDecoded : function ( a ) { return this . _sounds [ a ] ? this . _sounds [ a ] . decoded : void 0 } , isSoundReady : function ( a ) { return this . _sounds [ a ] && this . _sounds [ a ] . decoded && this . game . sound . touchLocked === ! 1 } , getFrameCount : function ( a ) { return this . _images [ a ] ? this . _images [ a ] . frameData . total : 0 } , getText : function ( a ) { return this . _text [ a ] ? this . _text [ a ] . data : void console . warn ( 'Phaser.Cache.getText: Invalid key: "' + a + '"' ) } , getJSON : function ( a ) { return this . _json [ a ] ? this . _json [ a ] . data : void console . warn ( 'Phaser.Cache.getJSON: Invalid key: "' + a + '"' ) } , getXML : function ( a ) { return this . _xml [ a ] ? this . _xml [ a ] . data : void console . warn ( 'Phaser.Cache.getXML: Invalid key: "' + a + '"' ) } , getBinary : function ( a ) { return this . _binary [ a ] ? this . _binary [ a ] : void console . warn ( 'Phaser.Cache.getBinary: Invalid key: "' + a + '"' ) } , getUrl : function ( a ) { return this . _urlMap [ this . _resolveUrl ( a ) ] ? this . _urlMap [ this . _resolveUrl ( a ) ] : void console . warn ( 'Phaser.Cache.getUrl: Invalid url: "' + a + '"' ) } , getKeys : function ( a ) { var c = null ; switch ( a ) { case b . Cache . CANVAS : c = this . _canvases ; break ; case b . Cache . IMAGE : c = this . _images ; break ; case b . Cache . TEXTURE : c = this . _textures ; break ; case b . Cache . SOUND : c = this . _sounds ; break ; case b . Cache . TEXT : c = this . _text ; break ; case b . Cache . PHYSICS : c = this . _physics ; break ; case b . Cache . TILEMAP : c = this . _tilemaps ; break ; case b . Cache . BINARY : c = this . _binary ; break ; case b . Cache . BITMAPDATA : c = this . _bitmapDatas ; break ; case b . Cache . BITMAPFONT : c = this . _bitmapFont ; break ; case b . Cache . JSON : c = this . _json ; break ; case b . Cache . XML : c = this . _xml } if ( c ) { var d = [ ] ; for ( var e in c ) "__default" !== e && "__missing" !== e && d . push ( e ) ; return d } } , removeCanvas : function ( a ) { delete this . _canvases [ a ] } , removeImage : function ( a , b ) { "undefined" == typeof b && ( b = !
} } , fadeOut : function ( a ) { if ( "undefined" == typeof a && ( a = 1e3 ) , ! ( ! this . isPlaying || this . paused || this . volume <= 0 ) ) { var c = this . game . add . tween ( this ) . to ( { volume : 0 } , a , b . Easing . Linear . None , ! 0 ) ; c . onComplete . add ( this . fadeComplete , this ) } } , fadeComplete : function ( ) { this . onFadeComplete . dispatch ( this , this . volume ) , 0 === this . volume && this . stop ( ) } , destroy : function ( a ) { "undefined" == typeof a && ( a = ! 0 ) , this . stop ( ) , a ? this . game . sound . remove ( this ) : ( this . markers = { } , this . context = null , this . _buffer = null , this . externalNode = null , this . onDecoded . dispose ( ) , this . onPlay . dispose ( ) , this . onPause . dispose ( ) , this . onResume . dispose ( ) , this . onLoop . dispose ( ) , this . onStop . dispose ( ) , this . onMute . dispose ( ) , this . onMarkerComplete . dispose ( ) ) } } , b . Sound . prototype . constructor = b . Sound , Object . defineProperty ( b . Sound . prototype , "isDecoding" , { get : function ( ) { return this . game . cache . getSound ( this . key ) . isDecoding } } ) , Object . defineProperty ( b . Sound . prototype , "isDecoded" , { get : function ( ) { return this . game . cache . isSoundDecoded ( this . key ) } } ) , Object . defineProperty ( b . Sound . prototype , "mute" , { get : function ( ) { return this . _muted || this . game . sound . mute } , set : function ( a ) { a = a || null , a ? ( this . _muted = ! 0 , this . usingWebAudio ? ( this . _muteVolume = this . gainNode . gain . value , this . gainNode . gain . value = 0 ) : this . usingAudioTag && this . _sound && ( this . _muteVolume = this . _sound . volume , this . _sound . volume = 0 ) ) : ( this . _muted = ! 1 , this . usingWebAudio ? this . gainNode . gain . value = this . _muteVolume : this . usingAudioTag && this . _sound && ( this . _sound . volume = this . _muteVolume ) ) , this . onMute . dispatch ( this ) } } ) , Object . defineProperty ( b . Sound . prototype , "volume" , { get : function ( ) { return this . _volume } , set : function ( a ) { this . usingWebAudio ? ( this . _volume = a , this . gainNode . gain . value = a ) : this . usingAudioTag && this . _sound && a >= 0 && 1 >= a && ( this . _volume = a , this . _sound . volume = a ) } } ) , b . SoundManager = function ( a ) { this . game = a , this . onSoundDecode = new b . Signal , this . _codeMuted = ! 1 , this . _muted = ! 1 , this . _unlockSource = null , this . _volume = 1 , this . _sounds = [ ] , this . context = null , this . usingWebAudio = ! 0 , this . usingAudioTag = ! 1 , this . noAudio = ! 1 , this . connectToMaster = ! 0 , this . touchLocked = ! 1 , this . channels = 32 } , b . SoundManager . prototype = { boot : function ( ) { if ( this . game . device . iOS && this . game . device . webAudio === ! 1 && ( this . channels = 1 ) , ! this . game . device . cocoonJS && this . game . device . iOS || window . PhaserGlobal && window . PhaserGlobal . fakeiOSTouchLock ? ( this . game . input . touch . callbackContext = this , this . game . input . touch . touchStartCallback = this . unlock , this . game . input . mouse . callbackContext = this , this . game . input . mouse . mouseDownCallback = this . unlock , this . touchLocked = ! 0 ) : this . touchLocked = ! 1 , window . PhaserGlobal ) { if ( window . PhaserGlobal . disableAudio === ! 0 ) return this . usingWebAudio = ! 1 , void ( this . noAudio = ! 0 ) ; if ( window . PhaserGlobal . disableWebAudio === ! 0 ) return this . usingWebAudio = ! 1 , this . usingAudioTag = ! 0 , void ( this . noAudio = ! 1 ) } if ( window . AudioContext ) try { this . context = new window . AudioContext } catch ( a ) { this . context = null , this . usingWebAudio = ! 1 , this . noAudio = ! 0 } else if ( window . webkitAudioContext ) try { this . context = new window . webkitAudioContext } catch ( a ) { this . context = null , this . usingWebAudio = ! 1 , this . noAudio = ! 0 } window . Audio && null === this . context && ( this . usingWebAudio = ! 1 , this . usingAudioTag = ! 0 , this . noAudio = ! 1 ) , null !== this . context && ( this . masterGain = "undefined" == typeof this . context . createGain ? this . context . createGainNode ( ) : this . context . createGain ( ) , this . masterGain . gain . value = 1 , this . masterGain . connect ( this . context . destination ) ) } , unlock : function ( ) { if ( this . touchLocked !== ! 1 ) if ( this . game . device . webAudio === ! 1 || window . PhaserGlobal && window . PhaserGlobal . disableWebAudio === ! 0 ) this . touchLocked = ! 1 , this . _unlockSource = null , this . game . input . touch . callbackContext = null , this . game . input . touch . touchStartCallback = null , this . game . input . mouse . callbackContext = null , this . game . input . mouse . mouseDownCallback = null ; else { var a = this . context . createBuffer ( 1 , 1 , 22050 ) ; this . _unlockSource = this . context . createBufferSource ( ) , this . _unlockSource . buffer = a , this . _unlockSource . connect ( this . context . destination ) , this . _unlockSource . noteOn ( 0 ) } } , stopAll : function ( ) { for ( var a = 0 ; a < this . _sounds . length ; a ++ ) this . _sounds [ a ] && this . _sounds [ a ] . stop ( ) } , pauseAll : function ( ) { for ( var a = 0 ; a < this . _sounds . length ; a ++ ) this . _sounds [ a ] && this . _sounds [ a ] . pause ( ) } , resumeAll : fun
} , separateY : function ( a , b , c ) { return a . immovable && b . immovable ? ! 1 : ( this . _overlap = 0 , this . intersects ( a , b ) && ( this . _maxOverlap = a . deltaAbsY ( ) + b . deltaAbsY ( ) + this . OVERLAP _BIAS , 0 === a . deltaY ( ) && 0 === b . deltaY ( ) ? ( a . embedded = ! 0 , b . embedded = ! 0 ) : a . deltaY ( ) > b . deltaY ( ) ? ( this . _overlap = a . bottom - b . y , this . _overlap > this . _maxOverlap || a . checkCollision . down === ! 1 || b . checkCollision . up === ! 1 ? this . _overlap = 0 : ( a . touching . none = ! 1 , a . touching . down = ! 0 , b . touching . none = ! 1 , b . touching . up = ! 0 ) ) : a . deltaY ( ) < b . deltaY ( ) && ( this . _overlap = a . y - b . bottom , - this . _overlap > this . _maxOverlap || a . checkCollision . up === ! 1 || b . checkCollision . down === ! 1 ? this . _overlap = 0 : ( a . touching . none = ! 1 , a . touching . up = ! 0 , b . touching . none = ! 1 , b . touching . down = ! 0 ) ) , a . overlapY = this . _overlap , b . overlapY = this . _overlap , 0 !== this . _overlap ) ? c || a . customSeparateY || b . customSeparateY ? ! 0 : ( this . _velocity1 = a . velocity . y , this . _velocity2 = b . velocity . y , a . immovable || b . immovable ? a . immovable ? b . immovable || ( b . y += this . _overlap , b . velocity . y = this . _velocity1 - this . _velocity2 * b . bounce . y , a . moves && ( b . x += a . x - a . prev . x ) ) : ( a . y = a . y - this . _overlap , a . velocity . y = this . _velocity2 - this . _velocity1 * a . bounce . y , b . moves && ( a . x += b . x - b . prev . x ) ) : ( this . _overlap *= . 5 , a . y = a . y - this . _overlap , b . y += this . _overlap , this . _newVelocity1 = Math . sqrt ( this . _velocity2 * this . _velocity2 * b . mass / a . mass ) * ( this . _velocity2 > 0 ? 1 : - 1 ) , this . _newVelocity2 = Math . sqrt ( this . _velocity1 * this . _velocity1 * a . mass / b . mass ) * ( this . _velocity1 > 0 ? 1 : - 1 ) , this . _average = . 5 * ( this . _newVelocity1 + this . _newVelocity2 ) , this . _newVelocity1 -= this . _average , this . _newVelocity2 -= this . _average , a . velocity . y = this . _average + this . _newVelocity1 * a . bounce . y , b . velocity . y = this . _average + this . _newVelocity2 * b . bounce . y ) , ! 0 ) : ! 1 ) } , separateTile : function ( a , b , c ) { if ( ! b . enable || ! c . intersects ( b . position . x , b . position . y , b . right , b . bottom ) ) return ! 1 ; if ( c . collisionCallback && ! c . collisionCallback . call ( c . collisionCallbackContext , b . sprite , c ) ) return ! 1 ; if ( c . layer . callbacks [ c . index ] && ! c . layer . callbacks [ c . index ] . callback . call ( c . layer . callbacks [ c . index ] . callbackContext , b . sprite , c ) ) return ! 1 ; if ( ! ( c . faceLeft || c . faceRight || c . faceTop || c . faceBottom ) ) return ! 1 ; var d = 0 , e = 0 , f = 0 , g = 1 ; if ( b . deltaAbsX ( ) > b . deltaAbsY ( ) ? f = - 1 : b . deltaAbsX ( ) < b . deltaAbsY ( ) && ( g = - 1 ) , 0 !== b . deltaX ( ) && 0 !== b . deltaY ( ) && ( c . faceLeft || c . faceRight ) && ( c . faceTop || c . faceBottom ) && ( f = Math . min ( Math . abs ( b . position . x - c . right ) , Math . abs ( b . right - c . left ) ) , g = Math . min ( Math . abs ( b . position . y - c . bottom ) , Math . abs ( b . bottom - c . top ) ) ) , g > f ) { if ( ( c . faceLeft || c . faceRight ) && ( d = this . tileCheckX ( b , c ) , 0 !== d && ! c . intersects ( b . position . x , b . position . y , b . right , b . bottom ) ) ) return ! 0 ; ( c . faceTop || c . faceBottom ) && ( e = this . tileCheckY ( b , c ) ) } else { if ( ( c . faceTop || c . faceBottom ) && ( e = this . tileCheckY ( b , c ) , 0 !== e && ! c . intersects ( b . position . x , b . position . y , b . right , b . bottom ) ) ) return ! 0 ; ( c . faceLeft || c . faceRight ) && ( d = this . tileCheckX ( b , c ) ) } return 0 !== d || 0 !== e } , tileCheckX : function ( a , b ) { var c = 0 ; return a . deltaX ( ) < 0 && ! a . blocked . left && b . collideRight && a . checkCollision . left ? b . faceRight && a . x < b . right && ( c = a . x - b . right , c < - this . TILE _BIAS && ( c = 0 ) ) : a . deltaX ( ) > 0 && ! a . blocked . right && b . collideLeft && a . checkCollision . right && b . faceLeft && a . right > b . left && ( c = a . right - b . left , c > this . TILE _BIAS && ( c = 0 ) ) , 0 !== c && this . processTileSeparationX ( a , c ) , c } , tileCheckY : function ( a , b ) { var c = 0 ; return a . deltaY ( ) < 0 && ! a . blocked . up && b . collideDown && a . checkCollision . up ? b . faceBottom && a . y < b . bottom && ( c = a . y - b . bottom , c < - this . TILE _BIAS && ( c = 0 ) ) : a . deltaY ( ) > 0 && ! a . blocked . down && b . collideUp && a . checkCollision . down && b . faceTop && a . bottom > b . top && ( c = a . bottom - b . top , c > this . TILE _BIAS && ( c = 0 ) ) , 0 !== c && this . processTileSeparationY ( a , c ) , c } , processTileSeparationX : function ( a , b ) { 0 > b ? a . blocked . left = ! 0 : b > 0 && ( a . blocked . right = ! 0 ) , a . position . x -= b , a . velocity . x = 0 === a . bounce . x ? 0 : - a . velocity . x * a . bounce . x } , processTileSeparationY : function ( a , b ) { 0 > b ? a . blocked . up = ! 0 : b > 0 && ( a . blocked . down = ! 0 ) , a . position . y -= b , a . velocity . y = 0 === a . bounce . y ? 0 : - a . velocity . y * a . bounce . y } , getObjectsUnderPointer : function ( a , c , d , e ) { if ( 0 !== c . length && a . exists ) { this . quadTree . clear ( ) , this . quadTree . reset ( this . game . world . bounds . x , this . game . world . bounds . y , this . game . world . bounds . width , this . game . world . bounds . height , this . maxObjects , this . maxLevels ) , this . quadTree . populate ( c ) ; var f = new b . Rectangle ( a . x , a . y , 1 , 1 ) , g = [ ] ; t
} } , calculateFaces : function ( a ) { if ( this . preventingRecalculate ) return void ( this . needToRecalculate [ a ] = ! 0 ) ; 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 ) , j . collides && ( j . faceTop = ! 0 , j . faceBottom = ! 0 , j . faceLeft = ! 0 , j . faceRight = ! 0 ) , 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 ) } , hasTile : function ( a , b , c ) { return c = this . getLayer ( c ) , this . layers [ c ] . data [ b ] [ a ] . index > - 1 } , removeTile : function ( a , c , d ) { if ( d = this . getLayer ( d ) , a >= 0 && a < this . layers [ d ] . width && c >= 0 && c < this . layers [ d ] . height && this . hasTile ( a , c , d ) ) { var e = this . layers [ d ] . data [ c ] [ a ] ; return this . layers [ d ] . data [ c ] [ a ] = new b . Tile ( this . layers [ d ] , - 1 , a , c , this . tileWidth , this . tileHeight ) , this . layers [ d ] . dirty = ! 0 , this . calculateFaces ( d ) , e } } , removeTileWorldXY : function ( a , b , c , d , e ) { return e = this . getLayer ( e ) , a = this . game . math . snapToFloor ( a , c ) / c , b = this . game . math . snapToFloor ( b , d ) / d , this . removeTile ( a , b , e ) } , putTile : function ( a , c , d , e ) { if ( null === a ) return this . removeTile ( c , d , e ) ; if ( e = this . getLayer ( e ) , c >= 0 && c < this . layers [ e ] . width && d >= 0 && d < this . layers [ e ] . height ) { var f ; return a instanceof b . Tile ? ( f = a . index , this . hasTile ( c , d , e ) ? this . layers [ e ] . data [ d ] [ c ] . copy ( a ) : this . layers [ e ] . data [ d ] [ c ] = new b . Tile ( e , f , c , d , a . width , a . height ) ) : ( f = a , this . hasTile ( c , d , e ) ? this . layers [ e ] . data [ d ] [ c ] . index = f : this . layers [ e ] . data [ d ] [ c ] = new b . Tile ( this . layers [ e ] , f , c , d , this . tileWidth , this . tileHeight ) ) , this . collideIndexes . indexOf ( f ) > - 1 ? this . layers [ e ] . data [ d ] [ c ] . setCollision ( ! 0 , ! 0 , ! 0 , ! 0 ) : this . layers [ e ] . data [ d ] [ c ] . resetCollision ( ) , this . layers [ e ] . dirty = ! 0 , this . calculateFaces ( e ) , this . layers [ e ] . data [ d ] [ c ] } return null } , putTileWorldXY : function ( a , b , c , d , e , f ) { return 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 ) } , searchTileIndex : function ( a , b , c , d ) { "undefined" == typeof b && ( b = 0 ) , "undefined" == typeof c && ( c = ! 1 ) , d = this . getLayer ( d ) ; var e = 0 ; if ( c ) { for ( var f = this . layers [ d ] . height - 1 ; f >= 0 ; f -- ) for ( var g = this . layers [ d ] . width - 1 ; g >= 0 ; g -- ) if ( this . layers [ d ] . data [ f ] [ g ] . index === a ) { if ( e === b ) return this . layers [ d ] . data [ f ] [ g ] ; e ++ } } else for ( var f = 0 ; f < this . layers [ d ] . height ; f ++ ) for ( var g = 0 ; g < this . layers [ d ] . width ; g ++ ) if ( this . layers [ d ] . data [ f ] [ g ] . index === a ) { if ( e === b ) return this . layers [ d ] . data [ f ] [ g ] ; e ++ } return null } , getTile : function ( a , b , c , d ) { return "undefined" == typeof d && ( d = ! 1 ) , c = this . getLayer ( c ) , a >= 0 && a < this . layers [ c ] . width && b >= 0 && b < this . layers [ c ] . height ? - 1 === this . layers [ c ] . data [ b ] [ a ] . index ? d ? this . layers [ c ] . data [ b ] [ a ] : null : this . layers [ c ] . data [ b ] [ a ] : null } , 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