diff --git a/batu.html b/batu.html index 8526e8c0..b322923e 100644 --- a/batu.html +++ b/batu.html @@ -19,7 +19,7 @@ fun windos Monkey Mart 8-bit -spaceinvaders +spaceinvaders

miles is not outing for 2 days this will get updated every day

\ No newline at end of file diff --git a/space/SpaceInvaders-master/SpaceInvaders-master/LICENSE b/space/SpaceInvaders-master/SpaceInvaders-master/LICENSE new file mode 100644 index 00000000..0d24d0a0 --- /dev/null +++ b/space/SpaceInvaders-master/SpaceInvaders-master/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 Tóth Róbert + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/space/SpaceInvaders-master/SpaceInvaders-master/README.md b/space/SpaceInvaders-master/SpaceInvaders-master/README.md new file mode 100644 index 00000000..d67ed5d0 --- /dev/null +++ b/space/SpaceInvaders-master/SpaceInvaders-master/README.md @@ -0,0 +1,22 @@ +SpaceInvaders +============= +This is a remake of the space invader phaser example, which you can find here: +http://examples.phaser.io/ + +This remake is made with require.js, which breaks up the code into modules. +Modules are in assets/javascript/module + +Code is more organized thanks to State and Statemanager class from Phaser. +You can find the states in assets/javascript/state + +I used Phaser 2.0.1(no Physics) from the Dev branch. +The dev branch has a lot of bug fixes so it's recommended to use it. + +Thanks to require.js, i made an optimized version of my game, +which can be viewed with indexOpt.html. This use the "compiled" code, which can be found in assets/javascript/built + +Known issue: In every new play state(after the end state) the game makes new DOM nodes. +The cause: in every cycle i make a new text to show the score. +I tried to destroy the texts but i never succeed. + +You can play with it here: http://strykerkkd.github.io/SpaceInvaders/ diff --git a/space/SpaceInvaders-master/SpaceInvaders-master/assets/css/skulls.png b/space/SpaceInvaders-master/SpaceInvaders-master/assets/css/skulls.png new file mode 100644 index 00000000..ef0988f4 Binary files /dev/null and b/space/SpaceInvaders-master/SpaceInvaders-master/assets/css/skulls.png differ diff --git a/space/SpaceInvaders-master/SpaceInvaders-master/assets/css/style.css b/space/SpaceInvaders-master/SpaceInvaders-master/assets/css/style.css new file mode 100644 index 00000000..c3485dab --- /dev/null +++ b/space/SpaceInvaders-master/SpaceInvaders-master/assets/css/style.css @@ -0,0 +1,12 @@ +body{ + background-color: #000205; + background-image: url("skulls.png"); +} + +#game { + position: fixed; + top: 50%; + left: 50%; + margin-top: -300px; + margin-left: -400px; +} \ No newline at end of file diff --git a/space/SpaceInvaders-master/SpaceInvaders-master/assets/img/bullet.png b/space/SpaceInvaders-master/SpaceInvaders-master/assets/img/bullet.png new file mode 100644 index 00000000..cd5cd70e Binary files /dev/null and b/space/SpaceInvaders-master/SpaceInvaders-master/assets/img/bullet.png differ diff --git a/space/SpaceInvaders-master/SpaceInvaders-master/assets/img/enemy-bullet.png b/space/SpaceInvaders-master/SpaceInvaders-master/assets/img/enemy-bullet.png new file mode 100644 index 00000000..3a404045 Binary files /dev/null and b/space/SpaceInvaders-master/SpaceInvaders-master/assets/img/enemy-bullet.png differ diff --git a/space/SpaceInvaders-master/SpaceInvaders-master/assets/img/explode.png b/space/SpaceInvaders-master/SpaceInvaders-master/assets/img/explode.png new file mode 100644 index 00000000..5743585b Binary files /dev/null and b/space/SpaceInvaders-master/SpaceInvaders-master/assets/img/explode.png differ diff --git a/space/SpaceInvaders-master/SpaceInvaders-master/assets/img/invader.png b/space/SpaceInvaders-master/SpaceInvaders-master/assets/img/invader.png new file mode 100644 index 00000000..58edb0b4 Binary files /dev/null and b/space/SpaceInvaders-master/SpaceInvaders-master/assets/img/invader.png differ diff --git a/space/SpaceInvaders-master/SpaceInvaders-master/assets/img/invader32x32x4.png b/space/SpaceInvaders-master/SpaceInvaders-master/assets/img/invader32x32x4.png new file mode 100644 index 00000000..9445254a Binary files /dev/null and b/space/SpaceInvaders-master/SpaceInvaders-master/assets/img/invader32x32x4.png differ diff --git a/space/SpaceInvaders-master/SpaceInvaders-master/assets/img/player.png b/space/SpaceInvaders-master/SpaceInvaders-master/assets/img/player.png new file mode 100644 index 00000000..e4db3a22 Binary files /dev/null and b/space/SpaceInvaders-master/SpaceInvaders-master/assets/img/player.png differ diff --git a/space/SpaceInvaders-master/SpaceInvaders-master/assets/img/starfield.png b/space/SpaceInvaders-master/SpaceInvaders-master/assets/img/starfield.png new file mode 100644 index 00000000..9427d739 Binary files /dev/null and b/space/SpaceInvaders-master/SpaceInvaders-master/assets/img/starfield.png differ diff --git a/space/SpaceInvaders-master/SpaceInvaders-master/assets/javascript/built.js b/space/SpaceInvaders-master/SpaceInvaders-master/assets/javascript/built.js new file mode 100644 index 00000000..97c7c403 --- /dev/null +++ b/space/SpaceInvaders-master/SpaceInvaders-master/assets/javascript/built.js @@ -0,0 +1,14 @@ +/** + * Created by stryker on 2014.03.23.. + */ +/* + * Build script + * To use: npm install -g require.js + * r.js -o built.js + * */ + +({ + baseUrl: ".", + name: "main", + out: "built/main-built.js" +}) \ No newline at end of file diff --git a/space/SpaceInvaders-master/SpaceInvaders-master/assets/javascript/built/main-built.js b/space/SpaceInvaders-master/SpaceInvaders-master/assets/javascript/built/main-built.js new file mode 100644 index 00000000..375e3f5b --- /dev/null +++ b/space/SpaceInvaders-master/SpaceInvaders-master/assets/javascript/built/main-built.js @@ -0,0 +1,3 @@ +/* Phaser (no physics) v2.0.2 - http://phaser.io - @photonstorm - (c) 2014 Photon Storm Ltd. */ + +define("module/Background",[],function(){var e=null,t=null;return{init:function(t,n,r){e=t},preload:function(){e.load.image("starfield","assets/img/starfield.png")},create:function(){t=e.add.tileSprite(0,0,800,600,"starfield")},update:function(){t.tilePosition.y+=2}}}),define("module/HUD",[],function(){var e=null,t=null,n=null,r=null,i=null,s=null,o=null,u=null;return{init:function(t){e=t},preload:function(){},createStat:function(u,a,f){s=u,o=e.add.text(10,10,"Score: "+u,{fontSize:"34px",fill:"#fff"}),t=a,n=e.add.text(10,50,"Health: "+a,{fontSize:"34px",fill:"#fff"}),r=f,i=e.add.text(10,90,"Lives: "+f,{fontSize:"34px",fill:"#fff"})},updateHealthText:function(e){n.text="Health: "+e},updateLivesText:function(e){i.text="Lives: "+e},updateScoreText:function(e){o.text="Score: "+(s+=e)},createTitle:function(t){u=e.add.text(e.world.centerX,e.world.centerY,t,{font:"84px Arial",fill:"#fff"}),u.anchor.setTo(.5,.5)}}}),define("module/Player",["module/HUD"],function(e){var t=null,n=null,r=null,i=null,s=null,o=null,u=null,a=null,f=null,l=null,c=null,h=null,p=null,d=null,v=null,m=function(){f=a.getFirstExists(!1),f&&(f.checkWorldBounds=!0,f.reset(o.x,o.y+8),f.body.velocity.y=-v)},g=function(i,s){i.damage(s.bulletDamage),s.kill(),e.updateHealthText(i.health),i.health==0&&(this.stopShooting(),c=l.getFirstExists(!1),c.reset(o.body.x,o.body.y),c.play("kaboom",30,!1,!0),r--,e.updateLivesText(r),r>0?(i.revive(n),this.startShooting()):t.state.start("End"))};return{init:function(e){t=e},preload:function(){t.load.image("ship","assets/img/player.png")},create:function(e){o=t.add.sprite(400,500,"ship"),o.anchor.setTo(.5,.5),t.physics.enable(o,Phaser.Physics.ARCADE),o.body.collideWorldBounds=!0,o.health=e.health,n=e.health,r=e.lives,i=e.score,s=e.firingTime,v=e.bulletSpeed,u=t.input.keyboard.createCursorKeys()},update:function(){o.body.velocity.setTo(0,0),u.left.isDown?o.body.velocity.x=-200:u.right.isDown&&(o.body.velocity.x=200)},setBulletGroup:function(e){a=e.getBulletGroup()},getBulletGroup:function(){return a},setExplosionGroup:function(e){l=e.getExplosionGroup()},startShooting:function(){d=t.time.events.loop(s,m,this)},stopShooting:function(){t.time.events.remove(d)},getPlayerShip:function(){return o},createOverLap:function(e){t.physics.arcade.overlap(o,e,g,null,this)},setAliensAndAlienGroup:function(e){p=e,h=e.getAlienGroup()}}}),define("module/Aliens",["module/HUD"],function(e){var t=null,n=null,r=function(r){function S(){for(var e=0;e0?(v.checkWorldBounds=!0,b=t.rnd.integerInRange(0,y.length),w=y[b],w&&(v.reset(w.body.x,w.body.y),t.physics.arcade.moveToObject(v,n,f))):y.length==0&&t.state.start("End")},T=function(t,n){n.damage(t.bulletDamage),t.kill(),n.health==0&&(g=m.getFirstExists(!1),g.reset(n.body.x,n.body.y),g.play("kaboom",30,!1,!0)),e.updateScoreText(n.myScore)};return{setBulletGroup:function(e){d=e.getBulletGroup()},getBulletGroup:function(){return d},setExplosionGroup:function(e){m=e.getExplosionGroup()},startShooting:function(){E=t.time.events.loop(a,x,this)},stopShooting:function(){t.time.events.remove(E)},createOverLap:function(e){t.physics.arcade.overlap(e,i,T,null,this)},getAlienGroup:function(){return i}}};return{init:function(e){t=e},preload:function(){t.load.spritesheet("invader","assets/img/invader32x32x4.png",32,32)},create:function(e){return new r(e)},setPlayerShip:function(e){n=e}}}),define("module/Bullets",[],function(){var e=null,t=function(t,n,r){var i=e.add.group();return i.enableBody=!0,i.physicsBodyType=Phaser.Physics.ARCADE,i.createMultiple(t,n),i.setAll("anchor.x",.5),i.setAll("anchor.y",1),i.setAll("outOfBoundsKill",!0),i.setAll("bulletDamage",r),{getBulletGroup:function(){return i}}};return{init:function(t){e=t},preload:function(){e.load.image("bullet","assets/img/bullet.png"),e.load.image("enemyBullet","assets/img/enemy-bullet.png")},create:function(e,n,r){return new t(e,n,r)}}}),define("module/Explosions",[],function(){var e=null,t=function(t,n){function s(e){e.anchor.x=.5,e.anchor.y=.5,e.animations.add(n)}var r=e.add.group();r.createMultiple(t,n),r.forEach(s,this);var i=n;return{getExplosionGroup:function(){return r}}};return{init:function(t){e=t},preload:function(){e.load.spritesheet("kaboom","assets/img/explode.png",128,128)},create:function(e,n){return new t(e,n)}}}),define("state/Load",["module/Background","module/Player","module/Aliens","module/Bullets","module/Explosions","module/HUD"],function(e,t,n,r,i,s){var o=null,u=null,a={preload:function(){e.init(o,0,"easy"),e.preload(),s.init(o),t.init(o),t.preload(),n.init(o),n.preload(),r.init(o),r.preload(),i.init(o),i.preload()},create:function(){o.state.start(u)}};return{init:function(e,t){o=e,u=t},getLoadState:function(){return a}}}),define("state/Start",["module/HUD"],function(e){var t=null,n=null,r=null,i={create:function(){e.createTitle(" Space Invader \n Press Spacebar"),t.physics.startSystem(Phaser.Physics.ARCADE),t.input.keyboard.addKey(Phaser.Keyboard.SPACEBAR).onDown.addOnce(function(){t.state.start(n)})}};return{init:function(e,r){t=e,n=r},getStartState:function(){return i}}}),define("state/Play",["module/Background","module/Player","module/Aliens","module/Bullets","module/Explosions","module/HUD"],function(e,t,n,r,i,s){var o=null,u=null,a=null,f={create:function(){e.create(),s.createStat(0,100,3);var o={health:100,lives:3,score:0,firingTime:300,bulletSpeed:500};t.create(o),t.setBulletGroup(r.create(10,"bullet",100)),t.setExplosionGroup(i.create(1,"kaboom"));var u={rows:4,cols:10,scoreValue:10,firingTime:200,bulletSpeed:200,health:100,easing:Phaser.Easing.Linear.None};a=n.create(u),a.setBulletGroup(r.create(30,"enemyBullet",10)),a.setExplosionGroup(i.create(5,"kaboom")),n.setPlayerShip(t.getPlayerShip()),t.setAliensAndAlienGroup(a),t.startShooting(),a.startShooting()},update:function(){e.update(),t.update(),a.createOverLap(t.getBulletGroup()),t.createOverLap(a.getBulletGroup())}};return{init:function(e,t){o=e,u=t},getPlayState:function(){return f}}}),define("state/End",["module/HUD"],function(e){var t=null,n=null,r={create:function(){e.createTitle(" Game Over \n Press Spacebar"),t.input.keyboard.addKey(Phaser.Keyboard.SPACEBAR).onDown.addOnce(function(){t.state.start(n)})}};return{init:function(e,r){t=e,n=r},getEndState:function(){return r}}}),function(){var e=this,t=t||{};t.WEBGL_RENDERER=0,t.CANVAS_RENDERER=1,t.VERSION="v1.5.0",t.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},t.scaleModes={DEFAULT:0,LINEAR:0,NEAREST:1},t.INTERACTION_FREQUENCY=30,t.AUTO_PREVENT_DEFAULT=!0,t.RAD_TO_DEG=180/Math.PI,t.DEG_TO_RAD=Math.PI/180,t.Point=function(e,t){this.x=e||0,this.y=t||0},t.Point.prototype.clone=function(){return new t.Point(this.x,this.y)},t.Point.prototype.constructor=t.Point,t.Point.prototype.set=function(e,t){this.x=e||0,this.y=t||(0!==t?this.x:0)},t.Rectangle=function(e,t,n,r){this.x=e||0,this.y=t||0,this.width=n||0,this.height=r||0},t.Rectangle.prototype.clone=function(){return new t.Rectangle(this.x,this.y,this.width,this.height)},t.Rectangle.prototype.contains=function(e,t){if(this.width<=0||this.height<=0)return!1;var n=this.x;if(e>=n&&e<=n+this.width){var r=this.y;if(t>=r&&t<=r+this.height)return!0}return!1},t.Rectangle.prototype.constructor=t.Rectangle,t.EmptyRectangle=new t.Rectangle(0,0,0,0),t.Polygon=function(e){if(e instanceof Array||(e=Array.prototype.slice.call(arguments)),"number"==typeof e[0]){for(var n=[],r=0,i=e.length;i>r;r+=2)n.push(new t.Point(e[r],e[r+1]));e=n}this.points=e},t.Polygon.prototype.clone=function(){for(var e=[],n=0;nt!=a>t&&(u-s)*(t-o)/(a-o)+s>e;f&&(n=!n)}return n},t.Polygon.prototype.constructor=t.Polygon,t.Circle=function(e,t,n){this.x=e||0,this.y=t||0,this.radius=n||0},t.Circle.prototype.clone=function(){return new t.Circle(this.x,this.y,this.radius)},t.Circle.prototype.contains=function(e,t){if(this.radius<=0)return!1;var n=this.x-e,r=this.y-t,i=this.radius*this.radius;return n*=n,r*=r,i>=n+r},t.Circle.prototype.constructor=t.Circle,t.Ellipse=function(e,t,n,r){this.x=e||0,this.y=t||0,this.width=n||0,this.height=r||0},t.Ellipse.prototype.clone=function(){return new t.Ellipse(this.x,this.y,this.width,this.height)},t.Ellipse.prototype.contains=function(e,t){if(this.width<=0||this.height<=0)return!1;var n=(e-this.x)/this.width,r=(t-this.y)/this.height;return n*=n,r*=r,1>=n+r},t.Ellipse.prototype.getBounds=function(){return new t.Rectangle(this.x,this.y,this.width,this.height)},t.Ellipse.prototype.constructor=t.Ellipse,t.determineMatrixArrayType=function(){return"undefined"!=typeof Float32Array?Float32Array:Array},t.Matrix2=t.determineMatrixArrayType(),t.Matrix=function(){this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0},t.Matrix.prototype.fromArray=function(e){this.a=e[0],this.b=e[1],this.c=e[3],this.d=e[4],this.tx=e[2],this.ty=e[5]},t.Matrix.prototype.toArray=function(e){this.array||(this.array=new Float32Array(9));var t=this.array;return e?(this.array[0]=this.a,this.array[1]=this.c,this.array[2]=0,this.array[3]=this.b,this.array[4]=this.d,this.array[5]=0,this.array[6]=this.tx,this.array[7]=this.ty,this.array[8]=1):(this.array[0]=this.a,this.array[1]=this.b,this.array[2]=this.tx,this.array[3]=this.c,this.array[4]=this.d,this.array[5]=this.ty,this.array[6]=0,this.array[7]=0,this.array[8]=1),t},t.identityMatrix=new t.Matrix,t.DisplayObject=function(){this.position=new t.Point,this.scale=new t.Point(1,1),this.pivot=new t.Point(0,0),this.rotation=0,this.alpha=1,this.visible=!0,this.hitArea=null,this.buttonMode=!1,this.renderable=!1,this.parent=null,this.stage=null,this.worldAlpha=1,this._interactive=!1,this.defaultCursor="pointer",this.worldTransform=new t.Matrix,this.color=[],this.dynamic=!0,this._sr=0,this._cr=1,this.filterArea=new t.Rectangle(0,0,1,1),this._bounds=new t.Rectangle(0,0,1,1),this._currentBounds=null,this._mask=null,this._cacheAsBitmap=!1,this._cacheIsDirty=!1},t.DisplayObject.prototype.constructor=t.DisplayObject,t.DisplayObject.prototype.setInteractive=function(e){this.interactive=e},Object.defineProperty(t.DisplayObject.prototype,"interactive",{get:function(){return this._interactive},set:function(e){this._interactive=e,this.stage&&(this.stage.dirty=!0)}}),Object.defineProperty(t.DisplayObject.prototype,"worldVisible",{get:function(){var e=this;do{if(!e.visible)return!1;e=e.parent}while(e);return!0}}),Object.defineProperty(t.DisplayObject.prototype,"mask",{get:function(){return this._mask},set:function(e){this._mask&&(this._mask.isMask=!1),this._mask=e,this._mask&&(this._mask.isMask=!0)}}),Object.defineProperty(t.DisplayObject.prototype,"filters",{get:function(){return this._filters},set:function(e){if(e){for(var t=[],n=0;n=0&&t<=this.children.length))throw new Error(e+" The index "+t+" supplied is out of bounds "+this.children.length);e.parent&&e.parent.removeChild(e),e.parent=this,this.children.splice(t,0,e),this.stage&&e.setStageReference(this.stage)},t.DisplayObjectContainer.prototype.swapChildren=function(e,t){if(e!==t){var n=this.children.indexOf(e),r=this.children.indexOf(t);if(0>n||0>r)throw new Error("swapChildren: Both the supplied DisplayObjects must be a child of the caller.");this.children[n]=t,this.children[r]=e}},t.DisplayObjectContainer.prototype.getChildAt=function(e){if(e>=0&&ee;e++)this.children[e].updateTransform()},t.DisplayObjectContainer.prototype.getBounds=function(e){if(0===this.children.length)return t.EmptyRectangle;if(e){var n=this.worldTransform;this.worldTransform=e,this.updateTransform(),this.worldTransform=n}for(var r,i,s,o=1/0,u=1/0,a=-1/0,f=-1/0,l=!1,c=0,h=this.children.length;h>c;c++){var p=this.children[c];p.visible&&(l=!0,r=this.children[c].getBounds(e),o=oi?a:i,f=f>s?f:s)}if(!l)return t.EmptyRectangle;var d=this._bounds;return d.x=o,d.y=u,d.width=a-o,d.height=f-u,d},t.DisplayObjectContainer.prototype.getLocalBounds=function(){var e=this.worldTransform;this.worldTransform=t.identityMatrix;for(var n=0,r=this.children.length;r>n;n++)this.children[n].updateTransform();var i=this.getBounds();return this.worldTransform=e,i},t.DisplayObjectContainer.prototype.setStageReference=function(e){this.stage=e,this._interactive&&(this.stage.dirty=!0);for(var t=0,n=this.children.length;n>t;t++){var r=this.children[t];r.setStageReference(e)}},t.DisplayObjectContainer.prototype.removeStageReference=function(){for(var e=0,t=this.children.length;t>e;e++){var n=this.children[e];n.removeStageReference()}this._interactive&&(this.stage.dirty=!0),this.stage=null},t.DisplayObjectContainer.prototype._renderWebGL=function(e){if(this.visible&&!(this.alpha<=0)){if(this._cacheAsBitmap)return void this._renderCachedSprite(e);var t,n;if(this._mask||this._filters){for(this._mask&&(e.spriteBatch.stop(),e.maskManager.pushMask(this.mask,e),e.spriteBatch.start()),this._filters&&(e.spriteBatch.flush(),e.filterManager.pushFilter(this._filterBlock)),t=0,n=this.children.length;n>t;t++)this.children[t]._renderWebGL(e);e.spriteBatch.stop(),this._filters&&e.filterManager.popFilter(),this._mask&&e.maskManager.popMask(e),e.spriteBatch.start()}else for(t=0,n=this.children.length;n>t;t++)this.children[t]._renderWebGL(e)}},t.DisplayObjectContainer.prototype._renderCanvas=function(e){if(this.visible!==!1&&0!==this.alpha){if(this._cacheAsBitmap)return void this._renderCachedSprite(e);this._mask&&e.maskManager.pushMask(this._mask,e.context);for(var t=0,n=this.children.length;n>t;t++){var r=this.children[t];r._renderCanvas(e)}this._mask&&e.maskManager.popMask(e.context)}},t.Sprite=function(e){t.DisplayObjectContainer.call(this),this.anchor=new t.Point,this.texture=e,this._width=0,this._height=0,this.tint=16777215,this.blendMode=t.blendModes.NORMAL,e.baseTexture.hasLoaded?this.onTextureUpdate():(this.onTextureUpdateBind=this.onTextureUpdate.bind(this),this.texture.addEventListener("update",this.onTextureUpdateBind)),this.renderable=!0},t.Sprite.prototype=Object.create(t.DisplayObjectContainer.prototype),t.Sprite.prototype.constructor=t.Sprite,Object.defineProperty(t.Sprite.prototype,"width",{get:function(){return this.scale.x*this.texture.frame.width},set:function(e){this.scale.x=e/this.texture.frame.width,this._width=e}}),Object.defineProperty(t.Sprite.prototype,"height",{get:function(){return this.scale.y*this.texture.frame.height},set:function(e){this.scale.y=e/this.texture.frame.height,this._height=e}}),t.Sprite.prototype.setTexture=function(e){this.texture.baseTexture!==e.baseTexture?(this.textureChange=!0,this.texture=e):this.texture=e,this.cachedTint=16777215,this.updateFrame=!0},t.Sprite.prototype.onTextureUpdate=function(){this._width&&(this.scale.x=this._width/this.texture.frame.width),this._height&&(this.scale.y=this._height/this.texture.frame.height),this.updateFrame=!0},t.Sprite.prototype.getBounds=function(e){var t=this.texture.frame.width,n=this.texture.frame.height,r=t*(1-this.anchor.x),i=t*-this.anchor.x,s=n*(1-this.anchor.y),o=n*-this.anchor.y,u=e||this.worldTransform,a=u.a,f=u.c,l=u.b,c=u.d,h=u.tx,p=u.ty,d=a*i+l*o+h,v=c*o+f*i+p,m=a*r+l*o+h,g=c*o+f*r+p,y=a*r+l*s+h,b=c*s+f*r+p,w=a*i+l*s+h,E=c*s+f*i+p,S=-1/0,x=-1/0,T=1/0,N=1/0;T=T>d?d:T,T=T>m?m:T,T=T>y?y:T,T=T>w?w:T,N=N>v?v:N,N=N>g?g:N,N=N>b?b:N,N=N>E?E:N,S=d>S?d:S,S=m>S?m:S,S=y>S?y:S,S=w>S?w:S,x=v>x?v:x,x=g>x?g:x,x=b>x?b:x,x=E>x?E:x;var C=this._bounds;return C.x=T,C.width=S-T,C.y=N,C.height=x-N,this._currentBounds=C,C},t.Sprite.prototype._renderWebGL=function(e){if(this.visible&&!(this.alpha<=0)){var t,n;if(this._mask||this._filters){var r=e.spriteBatch;for(this._mask&&(r.stop(),e.maskManager.pushMask(this.mask,e),r.start()),this._filters&&(r.flush(),e.filterManager.pushFilter(this._filterBlock)),r.render(this),t=0,n=this.children.length;n>t;t++)this.children[t]._renderWebGL(e);r.stop(),this._filters&&e.filterManager.popFilter(),this._mask&&e.maskManager.popMask(e),r.start()}else for(e.spriteBatch.render(this),t=0,n=this.children.length;n>t;t++)this.children[t]._renderWebGL(e)}},t.Sprite.prototype._renderCanvas=function(e){if(this.visible!==!1&&0!==this.alpha){var n=this.texture.frame,r=e.context,i=this.texture;if(this.blendMode!==e.currentBlendMode&&(e.currentBlendMode=this.blendMode,r.globalCompositeOperation=t.blendModesCanvas[e.currentBlendMode]),this._mask&&e.maskManager.pushMask(this._mask,e.context),n&&n.width&&n.height&&i.baseTexture.source){r.globalAlpha=this.worldAlpha;var s=this.worldTransform;if(e.roundPixels?r.setTransform(s.a,s.c,s.b,s.d,0|s.tx,0|s.ty):r.setTransform(s.a,s.c,s.b,s.d,s.tx,s.ty),e.smoothProperty&&e.scaleMode!==this.texture.baseTexture.scaleMode&&(e.scaleMode=this.texture.baseTexture.scaleMode,r[e.smoothProperty]=e.scaleMode===t.scaleModes.LINEAR),16777215!==this.tint){if(this.cachedTint!==this.tint){if(!i.baseTexture.hasLoaded)return;this.cachedTint=this.tint,this.tintedTexture=t.CanvasTinter.getTintedTexture(this,this.tint)}r.drawImage(this.tintedTexture,0,0,n.width,n.height,this.anchor.x*-n.width,this.anchor.y*-n.height,n.width,n.height)}else if(i.trim){var o=i.trim;r.drawImage(this.texture.baseTexture.source,n.x,n.y,n.width,n.height,o.x-this.anchor.x*o.width,o.y-this.anchor.y*o.height,n.width,n.height)}else r.drawImage(this.texture.baseTexture.source,n.x,n.y,n.width,n.height,this.anchor.x*-n.width,this.anchor.y*-n.height,n.width,n.height)}for(var u=0,a=this.children.length;a>u;u++){var f=this.children[u];f._renderCanvas(e)}this._mask&&e.maskManager.popMask(e.context)}},t.Sprite.fromFrame=function(e){var n=t.TextureCache[e];if(!n)throw new Error('The frameId "'+e+'" does not exist in the texture cache'+this);return new t.Sprite(n)},t.Sprite.fromImage=function(e,n,r){var i=t.Texture.fromImage(e,n,r);return new t.Sprite(i)},t.SpriteBatch=function(e){t.DisplayObjectContainer.call(this),this.textureThing=e,this.ready=!1},t.SpriteBatch.prototype=Object.create(t.DisplayObjectContainer.prototype),t.SpriteBatch.constructor=t.SpriteBatch,t.SpriteBatch.prototype.initWebGL=function(e){this.fastSpriteBatch=new t.WebGLFastSpriteBatch(e),this.ready=!0},t.SpriteBatch.prototype.updateTransform=function(){t.DisplayObject.prototype.updateTransform.call(this)},t.SpriteBatch.prototype._renderWebGL=function(e){!this.visible||this.alpha<=0||!this.children.length||(this.ready||this.initWebGL(e.gl),e.spriteBatch.stop(),e.shaderManager.activateShader(e.shaderManager.fastShader),this.fastSpriteBatch.begin(this,e),this.fastSpriteBatch.render(this),e.shaderManager.activateShader(e.shaderManager.defaultShader),e.spriteBatch.start())},t.SpriteBatch.prototype._renderCanvas=function(e){var n=e.context;n.globalAlpha=this.worldAlpha,t.DisplayObject.prototype.updateTransform.call(this);for(var r=this.worldTransform,i=!0,s=0;si?(o>0&&(t+="\n"),t+=s[o]+" ",i=this.style.wordWrapWidth-u):(i-=a,t+=s[o]+" ")}r=2?parseInt(n[n.length-2],10):t.BitmapText.fonts[this.fontName].size,this.dirty=!0,this.tint=e.tint},t.BitmapText.prototype.updateText=function(){for(var e=t.BitmapText.fonts[this.fontName],n=new t.Point,r=null,i=[],s=0,o=[],u=0,a=this.fontSize/e.size,f=0;f=f;f++){var p=0;"right"===this.style.align?p=s-o[f]:"center"===this.style.align&&(p=(s-o[f])/2),h.push(p)}var d=this.children.length,v=i.length,m=this.tint||16777215;for(f=0;v>f;f++){var g=d>f?this.children[f]:this._pool.pop();g?g.setTexture(i[f].texture):g=new t.Sprite(i[f].texture),g.position.x=(i[f].position.x+h[i[f].line])*a,g.position.y=i[f].position.y*a,g.scale.x=g.scale.y=a,g.tint=m,g.parent||this.addChild(g)}for(;this.children.length>v;){var y=this.getChildAt(this.children.length-1);this._pool.push(y),this.removeChild(y)}this.textWidth=s*a,this.textHeight=(n.y+e.lineHeight)*a},t.BitmapText.prototype.updateTransform=function(){this.dirty&&(this.updateText(),this.dirty=!1),t.DisplayObjectContainer.prototype.updateTransform.call(this)},t.BitmapText.fonts={},t.Stage=function(e){t.DisplayObjectContainer.call(this),this.worldTransform=new t.Matrix,this.interactive=!0,this.interactionManager=new t.InteractionManager(this),this.dirty=!0,this.stage=this,this.stage.hitArea=new t.Rectangle(0,0,1e5,1e5),this.setBackgroundColor(e)},t.Stage.prototype=Object.create(t.DisplayObjectContainer.prototype),t.Stage.prototype.constructor=t.Stage,t.Stage.prototype.setInteractionDelegate=function(e){this.interactionManager.setTargetDomElement(e)},t.Stage.prototype.updateTransform=function(){this.worldAlpha=1;for(var e=0,t=this.children.length;t>e;e++)this.children[e].updateTransform();this.dirty&&(this.dirty=!1,this.interactionManager.dirty=!0),this.interactive&&this.interactionManager.update()},t.Stage.prototype.setBackgroundColor=function(e){this.backgroundColor=e||0,this.backgroundColorSplit=t.hex2rgb(this.backgroundColor);var n=this.backgroundColor.toString(16);n="000000".substr(0,6-n.length)+n,this.backgroundColorString="#"+n},t.Stage.prototype.getMousePosition=function(){return this.interactionManager.mouse.global};for(var n=0,r=["ms","moz","webkit","o"],i=0;i>16&255)/255,(e>>8&255)/255,(255&e)/255]},t.rgb2hex=function(e){return(255*e[0]<<16)+(255*e[1]<<8)+255*e[2]},"function"!=typeof Function.prototype.bind&&(Function.prototype.bind=function(){var e=Array.prototype.slice;return function(t){function n(){var s=i.concat(e.call(arguments));r.apply(this instanceof n?this:t,s)}var r=this,i=e.call(arguments,1);if("function"!=typeof r)throw new TypeError;return n.prototype=function s(e){return e&&(s.prototype=e),this instanceof s?void 0:new s}(r.prototype),n}}()),t.AjaxRequest=function(){var e=["Msxml2.XMLHTTP.6.0","Msxml2.XMLHTTP.3.0","Microsoft.XMLHTTP"];if(!window.ActiveXObject)return window.XMLHttpRequest?new window.XMLHttpRequest:!1;for(var t=0;t0&&0===(e&e-1))return e;for(var t=1;e>t;)t<<=1;return t},t.EventTarget=function(){var e={};this.addEventListener=this.on=function(t,n){void 0===e[t]&&(e[t]=[]),-1===e[t].indexOf(n)&&e[t].push(n)},this.dispatchEvent=this.emit=function(t){if(e[t.type]&&e[t.type].length)for(var n=0,r=e[t.type].length;r>n;n++)e[t.type][n](t)},this.removeEventListener=this.off=function(t,n){var r=e[t].indexOf(n);-1!==r&&e[t].splice(r,1)},this.removeAllEventListeners=function(t){var n=e[t];n&&(n.length=0)}},t.PolyK={},t.PolyK.Triangulate=function(e){var n=!0,r=e.length>>1;if(3>r)return[];for(var i=[],s=[],o=0;r>o;o++)s.push(o);o=0;for(var u=r;u>3;){var a=s[(o+0)%u],f=s[(o+1)%u],l=s[(o+2)%u],c=e[2*a],h=e[2*a+1],p=e[2*f],d=e[2*f+1],v=e[2*l],m=e[2*l+1],g=!1;if(t.PolyK._convex(c,h,p,d,v,m,n)){g=!0;for(var y=0;u>y;y++){var w=s[y];if(w!==a&&w!==f&&w!==l&&t.PolyK._PointInTriangle(e[2*w],e[2*w+1],c,h,p,d,v,m)){g=!1;break}}}if(g)i.push(a,f,l),s.splice((o+1)%u,1),u--,o=0;else if(o++>3*u){if(!n)return window.console.log("PIXI Warning: shape too complex to fill"),[];for(i=[],s=[],o=0;r>o;o++)s.push(o);o=0,u=r,n=!1}}return i.push(s[0],s[1],s[2]),i},t.PolyK._PointInTriangle=function(e,t,n,r,i,s,o,u){var a=o-n,f=u-r,l=i-n,c=s-r,h=e-n,p=t-r,d=a*a+f*f,v=a*l+f*c,m=a*h+f*p,g=l*l+c*c,y=l*h+c*p,b=1/(d*g-v*v),w=(g*m-v*y)*b,E=(d*y-v*m)*b;return w>=0&&E>=0&&1>w+E},t.PolyK._convex=function(e,t,n,r,i,s,o){return(t-r)*(i-n)+(n-e)*(s-r)>=0===o},t.initDefaultShaders=function(){},t.CompileVertexShader=function(e,n){return t._CompileShader(e,n,e.VERTEX_SHADER)},t.CompileFragmentShader=function(e,n){return t._CompileShader(e,n,e.FRAGMENT_SHADER)},t._CompileShader=function(e,t,n){var r=t.join("\n"),i=e.createShader(n);return e.shaderSource(i,r),e.compileShader(i),e.getShaderParameter(i,e.COMPILE_STATUS)?i:(window.console.log(e.getShaderInfoLog(i)),null)},t.compileProgram=function(e,n,r){var i=t.CompileFragmentShader(e,r),s=t.CompileVertexShader(e,n),o=e.createProgram();return e.attachShader(o,s),e.attachShader(o,i),e.linkProgram(o),e.getProgramParameter(o,e.LINK_STATUS)||window.console.log("Could not initialise shaders"),o},t.PixiShader=function(e){this.gl=e,this.program=null,this.fragmentSrc=["precision lowp float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform sampler2D uSampler;","void main(void) {"," gl_FragColor = texture2D(uSampler, vTextureCoord) * vColor ;","}"],this.textureCount=0,this.attributes=[],this.init()},t.PixiShader.prototype.init=function(){var e=this.gl,n=t.compileProgram(e,this.vertexSrc||t.PixiShader.defaultVertexSrc,this.fragmentSrc);e.useProgram(n),this.uSampler=e.getUniformLocation(n,"uSampler"),this.projectionVector=e.getUniformLocation(n,"projectionVector"),this.offsetVector=e.getUniformLocation(n,"offsetVector"),this.dimensions=e.getUniformLocation(n,"dimensions"),this.aVertexPosition=e.getAttribLocation(n,"aVertexPosition"),this.aTextureCoord=e.getAttribLocation(n,"aTextureCoord"),this.colorAttribute=e.getAttribLocation(n,"aColor"),-1===this.colorAttribute&&(this.colorAttribute=2),this.attributes=[this.aVertexPosition,this.aTextureCoord,this.colorAttribute];for(var r in this.uniforms)this.uniforms[r].uniformLocation=e.getUniformLocation(n,r);this.initUniforms(),this.program=n},t.PixiShader.prototype.initUniforms=function(){this.textureCount=1;var e,t=this.gl;for(var n in this.uniforms){e=this.uniforms[n];var r=e.type;"sampler2D"===r?(e._init=!1,null!==e.value&&this.initSampler2D(e)):"mat2"===r||"mat3"===r||"mat4"===r?(e.glMatrix=!0,e.glValueLength=1,"mat2"===r?e.glFunc=t.uniformMatrix2fv:"mat3"===r?e.glFunc=t.uniformMatrix3fv:"mat4"===r&&(e.glFunc=t.uniformMatrix4fv)):(e.glFunc=t["uniform"+r],e.glValueLength="2f"===r||"2i"===r?2:"3f"===r||"3i"===r?3:"4f"===r||"4i"===r?4:1)}},t.PixiShader.prototype.initSampler2D=function(e){if(e.value&&e.value.baseTexture&&e.value.baseTexture.hasLoaded){var t=this.gl;if(t.activeTexture(t["TEXTURE"+this.textureCount]),t.bindTexture(t.TEXTURE_2D,e.value.baseTexture._glTextures[t.id]),e.textureData){var n=e.textureData,r=n.magFilter?n.magFilter:t.LINEAR,i=n.minFilter?n.minFilter:t.LINEAR,s=n.wrapS?n.wrapS:t.CLAMP_TO_EDGE,o=n.wrapT?n.wrapT:t.CLAMP_TO_EDGE,u=n.luminance?t.LUMINANCE:t.RGBA;if(n.repeat&&(s=t.REPEAT,o=t.REPEAT),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,!!n.flipY),n.width){var a=n.width?n.width:512,f=n.height?n.height:2,l=n.border?n.border:0;t.texImage2D(t.TEXTURE_2D,0,u,a,f,l,u,t.UNSIGNED_BYTE,null)}else t.texImage2D(t.TEXTURE_2D,0,u,t.RGBA,t.UNSIGNED_BYTE,e.value.baseTexture.source);t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,r),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,i),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,s),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,o)}t.uniform1i(e.uniformLocation,this.textureCount),e._init=!0,this.textureCount++}},t.PixiShader.prototype.syncUniforms=function(){this.textureCount=1;var e,n=this.gl;for(var r in this.uniforms)e=this.uniforms[r],1===e.glValueLength?e.glMatrix===!0?e.glFunc.call(n,e.uniformLocation,e.transpose,e.value):e.glFunc.call(n,e.uniformLocation,e.value):2===e.glValueLength?e.glFunc.call(n,e.uniformLocation,e.value.x,e.value.y):3===e.glValueLength?e.glFunc.call(n,e.uniformLocation,e.value.x,e.value.y,e.value.z):4===e.glValueLength?e.glFunc.call(n,e.uniformLocation,e.value.x,e.value.y,e.value.z,e.value.w):"sampler2D"===e.type&&(e._init?(n.activeTexture(n["TEXTURE"+this.textureCount]),n.bindTexture(n.TEXTURE_2D,e.value.baseTexture._glTextures[n.id]||t.createWebGLTexture(e.value.baseTexture,n)),n.uniform1i(e.uniformLocation,this.textureCount),this.textureCount++):this.initSampler2D(e))},t.PixiShader.prototype.destroy=function(){this.gl.deleteProgram(this.program),this.uniforms=null,this.gl=null,this.attributes=null},t.PixiShader.defaultVertexSrc=["attribute vec2 aVertexPosition;","attribute vec2 aTextureCoord;","attribute vec2 aColor;","uniform vec2 projectionVector;","uniform vec2 offsetVector;","varying vec2 vTextureCoord;","varying vec4 vColor;","const vec2 center = vec2(-1.0, 1.0);","void main(void) {"," gl_Position = vec4( ((aVertexPosition + offsetVector) / projectionVector) + center , 0.0, 1.0);"," vTextureCoord = aTextureCoord;"," vec3 color = mod(vec3(aColor.y/65536.0, aColor.y/256.0, aColor.y), 256.0) / 256.0;"," vColor = vec4(color * aColor.x, aColor.x);","}"],t.PixiFastShader=function(e){this.gl=e,this.program=null,this.fragmentSrc=["precision lowp float;","varying vec2 vTextureCoord;","varying float vColor;","uniform sampler2D uSampler;","void main(void) {"," gl_FragColor = texture2D(uSampler, vTextureCoord) * vColor ;","}"],this.vertexSrc=["attribute vec2 aVertexPosition;","attribute vec2 aPositionCoord;","attribute vec2 aScale;","attribute float aRotation;","attribute vec2 aTextureCoord;","attribute float aColor;","uniform vec2 projectionVector;","uniform vec2 offsetVector;","uniform mat3 uMatrix;","varying vec2 vTextureCoord;","varying float vColor;","const vec2 center = vec2(-1.0, 1.0);","void main(void) {"," vec2 v;"," vec2 sv = aVertexPosition * aScale;"," v.x = (sv.x) * cos(aRotation) - (sv.y) * sin(aRotation);"," v.y = (sv.x) * sin(aRotation) + (sv.y) * cos(aRotation);"," v = ( uMatrix * vec3(v + aPositionCoord , 1.0) ).xy ;"," gl_Position = vec4( ( v / projectionVector) + center , 0.0, 1.0);"," vTextureCoord = aTextureCoord;"," vColor = aColor;","}"],this.textureCount=0,this.init()},t.PixiFastShader.prototype.init=function(){var e=this.gl,n=t.compileProgram(e,this.vertexSrc,this.fragmentSrc);e.useProgram(n),this.uSampler=e.getUniformLocation(n,"uSampler"),this.projectionVector=e.getUniformLocation(n,"projectionVector"),this.offsetVector=e.getUniformLocation(n,"offsetVector"),this.dimensions=e.getUniformLocation(n,"dimensions"),this.uMatrix=e.getUniformLocation(n,"uMatrix"),this.aVertexPosition=e.getAttribLocation(n,"aVertexPosition"),this.aPositionCoord=e.getAttribLocation(n,"aPositionCoord"),this.aScale=e.getAttribLocation(n,"aScale"),this.aRotation=e.getAttribLocation(n,"aRotation"),this.aTextureCoord=e.getAttribLocation(n,"aTextureCoord"),this.colorAttribute=e.getAttribLocation(n,"aColor"),-1===this.colorAttribute&&(this.colorAttribute=2),this.attributes=[this.aVertexPosition,this.aPositionCoord,this.aScale,this.aRotation,this.aTextureCoord,this.colorAttribute],this.program=n},t.PixiFastShader.prototype.destroy=function(){this.gl.deleteProgram(this.program),this.uniforms=null,this.gl=null,this.attributes=null},t.StripShader=function(){this.program=null,this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying float vColor;","uniform float alpha;","uniform sampler2D uSampler;","void main(void) {"," gl_FragColor = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y));"," gl_FragColor = gl_FragColor * alpha;","}"],this.vertexSrc=["attribute vec2 aVertexPosition;","attribute vec2 aTextureCoord;","attribute float aColor;","uniform mat3 translationMatrix;","uniform vec2 projectionVector;","varying vec2 vTextureCoord;","uniform vec2 offsetVector;","varying float vColor;","void main(void) {"," vec3 v = translationMatrix * vec3(aVertexPosition, 1.0);"," v -= offsetVector.xyx;"," gl_Position = vec4( v.x / projectionVector.x -1.0, v.y / projectionVector.y + 1.0 , 0.0, 1.0);"," vTextureCoord = aTextureCoord;"," vColor = aColor;","}"]},t.StripShader.prototype.init=function(){var e=t.gl,n=t.compileProgram(e,this.vertexSrc,this.fragmentSrc);e.useProgram(n),this.uSampler=e.getUniformLocation(n,"uSampler"),this.projectionVector=e.getUniformLocation(n,"projectionVector"),this.offsetVector=e.getUniformLocation(n,"offsetVector"),this.colorAttribute=e.getAttribLocation(n,"aColor"),this.aVertexPosition=e.getAttribLocation(n,"aVertexPosition"),this.aTextureCoord=e.getAttribLocation(n,"aTextureCoord"),this.translationMatrix=e.getUniformLocation(n,"translationMatrix"),this.alpha=e.getUniformLocation(n,"alpha"),this.program=n},t.PrimitiveShader=function(e){this.gl=e,this.program=null,this.fragmentSrc=["precision mediump float;","varying vec4 vColor;","void main(void) {"," gl_FragColor = vColor;","}"],this.vertexSrc=["attribute vec2 aVertexPosition;","attribute vec4 aColor;","uniform mat3 translationMatrix;","uniform vec2 projectionVector;","uniform vec2 offsetVector;","uniform float alpha;","uniform vec3 tint;","varying vec4 vColor;","void main(void) {"," vec3 v = translationMatrix * vec3(aVertexPosition , 1.0);"," v -= offsetVector.xyx;"," gl_Position = vec4( v.x / projectionVector.x -1.0, v.y / -projectionVector.y + 1.0 , 0.0, 1.0);"," vColor = aColor * vec4(tint * alpha, alpha);","}"],this.init()},t.PrimitiveShader.prototype.init=function(){var e=this.gl,n=t.compileProgram(e,this.vertexSrc,this.fragmentSrc);e.useProgram(n),this.projectionVector=e.getUniformLocation(n,"projectionVector"),this.offsetVector=e.getUniformLocation(n,"offsetVector"),this.tintColor=e.getUniformLocation(n,"tint"),this.aVertexPosition=e.getAttribLocation(n,"aVertexPosition"),this.colorAttribute=e.getAttribLocation(n,"aColor"),this.attributes=[this.aVertexPosition,this.colorAttribute],this.translationMatrix=e.getUniformLocation(n,"translationMatrix"),this.alpha=e.getUniformLocation(n,"alpha"),this.program=n},t.PrimitiveShader.prototype.destroy=function(){this.gl.deleteProgram(this.program),this.uniforms=null,this.gl=null,this.attribute=null},t.WebGLGraphics=function(){},t.WebGLGraphics.renderGraphics=function(e,n){var r=n.gl,i=n.projection,s=n.offset,o=n.shaderManager.primitiveShader;e._webGL[r.id]||(e._webGL[r.id]={points:[],indices:[],lastIndex:0,buffer:r.createBuffer(),indexBuffer:r.createBuffer()});var u=e._webGL[r.id];e.dirty&&(e.dirty=!1,e.clearDirty&&(e.clearDirty=!1,u.lastIndex=0,u.points=[],u.indices=[]),t.WebGLGraphics.updateGraphics(e,r)),n.shaderManager.activatePrimitiveShader(),r.blendFunc(r.ONE,r.ONE_MINUS_SRC_ALPHA),r.uniformMatrix3fv(o.translationMatrix,!1,e.worldTransform.toArray(!0)),r.uniform2f(o.projectionVector,i.x,-i.y),r.uniform2f(o.offsetVector,-s.x,-s.y),r.uniform3fv(o.tintColor,t.hex2rgb(e.tint)),r.uniform1f(o.alpha,e.worldAlpha),r.bindBuffer(r.ARRAY_BUFFER,u.buffer),r.vertexAttribPointer(o.aVertexPosition,2,r.FLOAT,!1,24,0),r.vertexAttribPointer(o.colorAttribute,4,r.FLOAT,!1,24,8),r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,u.indexBuffer),r.drawElements(r.TRIANGLE_STRIP,u.indices.length,r.UNSIGNED_SHORT,0),n.shaderManager.deactivatePrimitiveShader()},t.WebGLGraphics.updateGraphics=function(e,n){for(var r=e._webGL[n.id],i=r.lastIndex;i3&&t.WebGLGraphics.buildPoly(s,r),s.lineWidth>0&&t.WebGLGraphics.buildLine(s,r)):s.type===t.Graphics.RECT?t.WebGLGraphics.buildRectangle(s,r):(s.type===t.Graphics.CIRC||s.type===t.Graphics.ELIP)&&t.WebGLGraphics.buildCircle(s,r)}r.lastIndex=e.graphicsData.length,r.glPoints=new Float32Array(r.points),n.bindBuffer(n.ARRAY_BUFFER,r.buffer),n.bufferData(n.ARRAY_BUFFER,r.glPoints,n.STATIC_DRAW),r.glIndicies=new Uint16Array(r.indices),n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,r.indexBuffer),n.bufferData(n.ELEMENT_ARRAY_BUFFER,r.glIndicies,n.STATIC_DRAW)},t.WebGLGraphics.buildRectangle=function(e,n){var r=e.points,i=r[0],s=r[1],o=r[2],u=r[3];if(e.fill){var a=t.hex2rgb(e.fillColor),f=e.fillAlpha,l=a[0]*f,c=a[1]*f,h=a[2]*f,p=n.points,d=n.indices,v=p.length/6;p.push(i,s),p.push(l,c,h,f),p.push(i+o,s),p.push(l,c,h,f),p.push(i,s+u),p.push(l,c,h,f),p.push(i+o,s+u),p.push(l,c,h,f),d.push(v,v,v+1,v+2,v+3,v+3)}if(e.lineWidth){var m=e.points;e.points=[i,s,i+o,s,i+o,s+u,i,s+u,i,s],t.WebGLGraphics.buildLine(e,n),e.points=m}},t.WebGLGraphics.buildCircle=function(e,n){var r=e.points,i=r[0],s=r[1],o=r[2],u=r[3],a=40,f=2*Math.PI/a,l=0;if(e.fill){var c=t.hex2rgb(e.fillColor),h=e.fillAlpha,p=c[0]*h,d=c[1]*h,v=c[2]*h,m=n.points,g=n.indices,y=m.length/6;for(g.push(y),l=0;a+1>l;l++)m.push(i,s,p,d,v,h),m.push(i+Math.sin(f*l)*o,s+Math.cos(f*l)*u,p,d,v,h),g.push(y++,y++);g.push(y-1)}if(e.lineWidth){var w=e.points;for(e.points=[],l=0;a+1>l;l++)e.points.push(i+Math.sin(f*l)*o,s+Math.cos(f*l)*u);t.WebGLGraphics.buildLine(e,n),e.points=w}},t.WebGLGraphics.buildLine=function(e,n){var r=0,i=e.points;if(0!==i.length){if(e.lineWidth%2)for(r=0;rr;r++)c=i[2*(r-1)],h=i[2*(r-1)+1],p=i[2*r],d=i[2*r+1],v=i[2*(r+1)],m=i[2*(r+1)+1],g=-(h-d),y=c-p,_=Math.sqrt(g*g+y*y),g/=_,y/=_,g*=F,y*=F,w=-(d-m),E=p-v,_=Math.sqrt(w*w+E*E),w/=_,E/=_,w*=F,E*=F,T=-y+h-(-y+d),N=-g+p-(-g+c),C=(-g+c)*(-y+d)-(-g+p)*(-y+h),k=-E+m-(-E+d),L=-w+p-(-w+v),A=(-w+v)*(-E+d)-(-w+p)*(-E+m),O=T*L-k*N,Math.abs(O)<.1?(O+=10.1,D.push(p-g,d-y,R,U,z,q),D.push(p+g,d+y,R,U,z,q)):(f=(N*A-L*C)/O,l=(k*C-T*A)/O,M=(f-p)*(f-p)+(l-d)+(l-d),M>19600?(S=g-w,x=y-E,_=Math.sqrt(S*S+x*x),S/=_,x/=_,S*=F,x*=F,D.push(p-S,d-x),D.push(R,U,z,q),D.push(p+S,d+x),D.push(R,U,z,q),D.push(p-S,d-x),D.push(R,U,z,q),B++):(D.push(f,l),D.push(R,U,z,q),D.push(p-(f-p),d-(l-d)),D.push(R,U,z,q)));for(c=i[2*(H-2)],h=i[2*(H-2)+1],p=i[2*(H-1)],d=i[2*(H-1)+1],g=-(h-d),y=c-p,_=Math.sqrt(g*g+y*y),g/=_,y/=_,g*=F,y*=F,D.push(p-g,d-y),D.push(R,U,z,q),D.push(p+g,d+y),D.push(R,U,z,q),P.push(j),r=0;B>r;r++)P.push(j++);P.push(j-1)}},t.WebGLGraphics.buildPoly=function(e,n){var r=e.points;if(!(r.length<6)){var i=n.points,s=n.indices,o=r.length/2,u=t.hex2rgb(e.fillColor),a=e.fillAlpha,f=u[0]*a,l=u[1]*a,c=u[2]*a,h=t.PolyK.Triangulate(r),p=i.length/6,d=0;for(d=0;dd;d++)i.push(r[2*d],r[2*d+1],f,l,c,a)}},t.glContexts=[],t.WebGLRenderer=function(e,n,r,i,s){t.defaultRenderer||(t.defaultRenderer=this),this.type=t.WEBGL_RENDERER,this.transparent=!!i,this.width=e||800,this.height=n||600,this.view=r||document.createElement("canvas"),this.view.width=this.width,this.view.height=this.height,this.contextLost=this.handleContextLost.bind(this),this.contextRestoredLost=this.handleContextRestored.bind(this),this.view.addEventListener("webglcontextlost",this.contextLost,!1),this.view.addEventListener("webglcontextrestored",this.contextRestoredLost,!1),this.options={alpha:this.transparent,antialias:!!s,premultipliedAlpha:!!i,stencil:!0};try{this.gl=this.view.getContext("experimental-webgl",this.options)}catch(o){try{this.gl=this.view.getContext("webgl",this.options)}catch(u){throw new Error(" This browser does not support webGL. Try using the canvas renderer"+this)}}var a=this.gl;this.glContextId=a.id=t.WebGLRenderer.glContextId++,t.glContexts[this.glContextId]=a,t.blendModesWebGL||(t.blendModesWebGL=[],t.blendModesWebGL[t.blendModes.NORMAL]=[a.ONE,a.ONE_MINUS_SRC_ALPHA],t.blendModesWebGL[t.blendModes.ADD]=[a.SRC_ALPHA,a.DST_ALPHA],t.blendModesWebGL[t.blendModes.MULTIPLY]=[a.DST_COLOR,a.ONE_MINUS_SRC_ALPHA],t.blendModesWebGL[t.blendModes.SCREEN]=[a.SRC_ALPHA,a.ONE],t.blendModesWebGL[t.blendModes.OVERLAY]=[a.ONE,a.ONE_MINUS_SRC_ALPHA],t.blendModesWebGL[t.blendModes.DARKEN]=[a.ONE,a.ONE_MINUS_SRC_ALPHA],t.blendModesWebGL[t.blendModes.LIGHTEN]=[a.ONE,a.ONE_MINUS_SRC_ALPHA],t.blendModesWebGL[t.blendModes.COLOR_DODGE]=[a.ONE,a.ONE_MINUS_SRC_ALPHA],t.blendModesWebGL[t.blendModes.COLOR_BURN]=[a.ONE,a.ONE_MINUS_SRC_ALPHA],t.blendModesWebGL[t.blendModes.HARD_LIGHT]=[a.ONE,a.ONE_MINUS_SRC_ALPHA],t.blendModesWebGL[t.blendModes.SOFT_LIGHT]=[a.ONE,a.ONE_MINUS_SRC_ALPHA],t.blendModesWebGL[t.blendModes.DIFFERENCE]=[a.ONE,a.ONE_MINUS_SRC_ALPHA],t.blendModesWebGL[t.blendModes.EXCLUSION]=[a.ONE,a.ONE_MINUS_SRC_ALPHA],t.blendModesWebGL[t.blendModes.HUE]=[a.ONE,a.ONE_MINUS_SRC_ALPHA],t.blendModesWebGL[t.blendModes.SATURATION]=[a.ONE,a.ONE_MINUS_SRC_ALPHA],t.blendModesWebGL[t.blendModes.COLOR]=[a.ONE,a.ONE_MINUS_SRC_ALPHA],t.blendModesWebGL[t.blendModes.LUMINOSITY]=[a.ONE,a.ONE_MINUS_SRC_ALPHA]),this.projection=new t.Point,this.projection.x=this.width/2,this.projection.y=-this.height/2,this.offset=new t.Point(0,0),this.resize(this.width,this.height),this.contextLost=!1,this.shaderManager=new t.WebGLShaderManager(a),this.spriteBatch=new t.WebGLSpriteBatch(a),this.maskManager=new t.WebGLMaskManager(a),this.filterManager=new t.WebGLFilterManager(a,this.transparent),this.renderSession={},this.renderSession.gl=this.gl,this.renderSession.drawCount=0,this.renderSession.shaderManager=this.shaderManager,this.renderSession.maskManager=this.maskManager,this.renderSession.filterManager=this.filterManager,this.renderSession.spriteBatch=this.spriteBatch,this.renderSession.renderer=this,a.useProgram(this.shaderManager.defaultShader.program),a.disable(a.DEPTH_TEST),a.disable(a.CULL_FACE),a.enable(a.BLEND),a.colorMask(!0,!0,!0,this.transparent)},t.WebGLRenderer.prototype.constructor=t.WebGLRenderer,t.WebGLRenderer.prototype.render=function(e){if(!this.contextLost){this.__stage!==e&&(e.interactive&&e.interactionManager.removeEvents(),this.__stage=e),t.WebGLRenderer.updateTextures(),e.updateTransform(),e._interactive&&(e._interactiveEventsAdded||(e._interactiveEventsAdded=!0,e.interactionManager.setTarget(this)));var n=this.gl;n.viewport(0,0,this.width,this.height),n.bindFramebuffer(n.FRAMEBUFFER,null),this.transparent?n.clearColor(0,0,0,0):n.clearColor(e.backgroundColorSplit[0],e.backgroundColorSplit[1],e.backgroundColorSplit[2],1),n.clear(n.COLOR_BUFFER_BIT),this.renderDisplayObject(e,this.projection),e.interactive?e._interactiveEventsAdded||(e._interactiveEventsAdded=!0,e.interactionManager.setTarget(this)):e._interactiveEventsAdded&&(e._interactiveEventsAdded=!1,e.interactionManager.setTarget(this))}},t.WebGLRenderer.prototype.renderDisplayObject=function(e,t,n){this.renderSession.drawCount=0,this.renderSession.currentBlendMode=9999,this.renderSession.projection=t,this.renderSession.offset=this.offset,this.spriteBatch.begin(this.renderSession),this.filterManager.begin(this.renderSession,n),e._renderWebGL(this.renderSession),this.spriteBatch.end()},t.WebGLRenderer.updateTextures=function(){var e=0;for(e=0;e=0;n--){var r=e._glTextures[n],i=t.glContexts[n];i&&r&&i.deleteTexture(r)}e._glTextures.length=0},t.WebGLRenderer.updateTextureFrame=function(e){e.updateFrame=!1,e._updateWebGLuvs()},t.WebGLRenderer.prototype.resize=function(e,t){this.width=e,this.height=t,this.view.width=e,this.view.height=t,this.gl.viewport(0,0,this.width,this.height),this.projection.x=this.width/2,this.projection.y=-this.height/2},t.createWebGLTexture=function(e,n){return e.hasLoaded&&(e._glTextures[n.id]=n.createTexture(),n.bindTexture(n.TEXTURE_2D,e._glTextures[n.id]),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,e.source),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,e.scaleMode===t.scaleModes.LINEAR?n.LINEAR:n.NEAREST),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,e.scaleMode===t.scaleModes.LINEAR?n.LINEAR:n.NEAREST),e._powerOf2?(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.REPEAT),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.REPEAT)):(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE)),n.bindTexture(n.TEXTURE_2D,null)),e._glTextures[n.id]},t.updateWebGLTexture=function(e,n){e._glTextures[n.id]&&(n.bindTexture(n.TEXTURE_2D,e._glTextures[n.id]),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,e.source),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,e.scaleMode===t.scaleModes.LINEAR?n.LINEAR:n.NEAREST),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,e.scaleMode===t.scaleModes.LINEAR?n.LINEAR:n.NEAREST),e._powerOf2?(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.REPEAT),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.REPEAT)):(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE)),n.bindTexture(n.TEXTURE_2D,null))},t.WebGLRenderer.prototype.handleContextLost=function(e){e.preventDefault(),this.contextLost=!0},t.WebGLRenderer.prototype.handleContextRestored=function(){try{this.gl=this.view.getContext("experimental-webgl",this.options)}catch(e){try{this.gl=this.view.getContext("webgl",this.options)}catch(n){throw new Error(" This browser does not support webGL. Try using the canvas renderer"+this)}}var r=this.gl;r.id=t.WebGLRenderer.glContextId++,this.shaderManager.setContext(r),this.spriteBatch.setContext(r),this.maskManager.setContext(r),this.filterManager.setContext(r),this.renderSession.gl=this.gl,r.disable(r.DEPTH_TEST),r.disable(r.CULL_FACE),r.enable(r.BLEND),r.colorMask(!0,!0,!0,this.transparent),this.gl.viewport(0,0,this.width,this.height);for(var i in t.TextureCache){var s=t.TextureCache[i].baseTexture;s._glTextures=[]}this.contextLost=!1},t.WebGLRenderer.prototype.destroy=function(){this.view.removeEventListener("webglcontextlost",this.contextLost),this.view.removeEventListener("webglcontextrestored",this.contextRestoredLost),t.glContexts[this.glContextId]=null,this.projection=null,this.offset=null,this.shaderManager.destroy(),this.spriteBatch.destroy(),this.maskManager.destroy(),this.filterManager.destroy(),this.shaderManager=null,this.spriteBatch=null,this.maskManager=null,this.filterManager=null,this.gl=null,this.renderSession=null},t.WebGLRenderer.glContextId=0,t.WebGLMaskManager=function(e){this.maskStack=[],this.maskPosition=0,this.setContext(e)},t.WebGLMaskManager.prototype.setContext=function(e){this.gl=e},t.WebGLMaskManager.prototype.pushMask=function(e,n){var r=this.gl;0===this.maskStack.length&&(r.enable(r.STENCIL_TEST),r.stencilFunc(r.ALWAYS,1,1)),this.maskStack.push(e),r.colorMask(!1,!1,!1,!0),r.stencilOp(r.KEEP,r.KEEP,r.INCR),t.WebGLGraphics.renderGraphics(e,n),r.colorMask(!0,!0,!0,!0),r.stencilFunc(r.NOTEQUAL,0,this.maskStack.length),r.stencilOp(r.KEEP,r.KEEP,r.KEEP)},t.WebGLMaskManager.prototype.popMask=function(e){var n=this.gl,r=this.maskStack.pop();r&&(n.colorMask(!1,!1,!1,!1),n.stencilOp(n.KEEP,n.KEEP,n.DECR),t.WebGLGraphics.renderGraphics(r,e),n.colorMask(!0,!0,!0,!0),n.stencilFunc(n.NOTEQUAL,0,this.maskStack.length),n.stencilOp(n.KEEP,n.KEEP,n.KEEP)),0===this.maskStack.length&&n.disable(n.STENCIL_TEST)},t.WebGLMaskManager.prototype.destroy=function(){this.maskStack=null,this.gl=null},t.WebGLShaderManager=function(e){this.maxAttibs=10,this.attribState=[],this.tempAttribState=[];for(var t=0;tr;r+=6,i+=4)this.indices[r+0]=i+0,this.indices[r+1]=i+1,this.indices[r+2]=i+2,this.indices[r+3]=i+0,this.indices[r+4]=i+2,this.indices[r+5]=i+3;this.drawing=!1,this.currentBatchSize=0,this.currentBaseTexture=null,this.setContext(e)},t.WebGLSpriteBatch.prototype.setContext=function(e){this.gl=e,this.vertexBuffer=e.createBuffer(),this.indexBuffer=e.createBuffer(),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,this.indexBuffer),e.bufferData(e.ELEMENT_ARRAY_BUFFER,this.indices,e.STATIC_DRAW),e.bindBuffer(e.ARRAY_BUFFER,this.vertexBuffer),e.bufferData(e.ARRAY_BUFFER,this.vertices,e.DYNAMIC_DRAW),this.currentBlendMode=99999},t.WebGLSpriteBatch.prototype.begin=function(e){this.renderSession=e,this.shader=this.renderSession.shaderManager.defaultShader,this.start()},t.WebGLSpriteBatch.prototype.end=function(){this.flush()},t.WebGLSpriteBatch.prototype.render=function(e){var t=e.texture;(t.baseTexture!==this.currentBaseTexture||this.currentBatchSize>=this.size)&&(this.flush(),this.currentBaseTexture=t.baseTexture),e.blendMode!==this.currentBlendMode&&this.setBlendMode(e.blendMode);var n=e._uvs||e.texture._uvs;if(n){var r,i,s,o,u=e.worldAlpha,a=e.tint,f=this.vertices,l=e.anchor.x,c=e.anchor.y;if(e.texture.trim){var h=e.texture.trim;i=h.x-l*h.width,r=i+t.frame.width,o=h.y-c*h.height,s=o+t.frame.height}else r=t.frame.width*(1-l),i=t.frame.width*-l,s=t.frame.height*(1-c),o=t.frame.height*-c;var p=4*this.currentBatchSize*this.vertSize,d=e.worldTransform,v=d.a,m=d.c,g=d.b,y=d.d,b=d.tx,w=d.ty;f[p++]=v*i+g*o+b,f[p++]=y*o+m*i+w,f[p++]=n.x0,f[p++]=n.y0,f[p++]=u,f[p++]=a,f[p++]=v*r+g*o+b,f[p++]=y*o+m*r+w,f[p++]=n.x1,f[p++]=n.y1,f[p++]=u,f[p++]=a,f[p++]=v*r+g*s+b,f[p++]=y*s+m*r+w,f[p++]=n.x2,f[p++]=n.y2,f[p++]=u,f[p++]=a,f[p++]=v*i+g*s+b,f[p++]=y*s+m*i+w,f[p++]=n.x3,f[p++]=n.y3,f[p++]=u,f[p++]=a,this.currentBatchSize++}},t.WebGLSpriteBatch.prototype.renderTilingSprite=function(e){var n=e.tilingTexture;(n.baseTexture!==this.currentBaseTexture||this.currentBatchSize>=this.size)&&(this.flush(),this.currentBaseTexture=n.baseTexture),e.blendMode!==this.currentBlendMode&&this.setBlendMode(e.blendMode),e._uvs||(e._uvs=new t.TextureUvs);var r=e._uvs;e.tilePosition.x%=n.baseTexture.width*e.tileScaleOffset.x,e.tilePosition.y%=n.baseTexture.height*e.tileScaleOffset.y;var i=e.tilePosition.x/(n.baseTexture.width*e.tileScaleOffset.x),s=e.tilePosition.y/(n.baseTexture.height*e.tileScaleOffset.y),o=e.width/n.baseTexture.width/(e.tileScale.x*e.tileScaleOffset.x),u=e.height/n.baseTexture.height/(e.tileScale.y*e.tileScaleOffset.y);r.x0=0-i,r.y0=0-s,r.x1=1*o-i,r.y1=0-s,r.x2=1*o-i,r.y2=1*u-s,r.x3=0-i,r.y3=1*u-s;var a=e.worldAlpha,f=e.tint,l=this.vertices,c=e.width,h=e.height,p=e.anchor.x,d=e.anchor.y,v=c*(1-p),m=c*-p,g=h*(1-d),y=h*-d,w=4*this.currentBatchSize*this.vertSize,E=e.worldTransform,S=E.a,x=E.c,T=E.b,N=E.d,C=E.tx,k=E.ty;l[w++]=S*m+T*y+C,l[w++]=N*y+x*m+k,l[w++]=r.x0,l[w++]=r.y0,l[w++]=a,l[w++]=f,l[w++]=S*v+T*y+C,l[w++]=N*y+x*v+k,l[w++]=r.x1,l[w++]=r.y1,l[w++]=a,l[w++]=f,l[w++]=S*v+T*g+C,l[w++]=N*g+x*v+k,l[w++]=r.x2,l[w++]=r.y2,l[w++]=a,l[w++]=f,l[w++]=S*m+T*g+C,l[w++]=N*g+x*m+k,l[w++]=r.x3,l[w++]=r.y3,l[w++]=a,l[w++]=f,this.currentBatchSize++},t.WebGLSpriteBatch.prototype.flush=function(){if(0!==this.currentBatchSize){var e=this.gl;if(e.bindTexture(e.TEXTURE_2D,this.currentBaseTexture._glTextures[e.id]||t.createWebGLTexture(this.currentBaseTexture,e)),this.currentBatchSize>.5*this.size)e.bufferSubData(e.ARRAY_BUFFER,0,this.vertices);else{var n=this.vertices.subarray(0,4*this.currentBatchSize*this.vertSize);e.bufferSubData(e.ARRAY_BUFFER,0,n)}e.drawElements(e.TRIANGLES,6*this.currentBatchSize,e.UNSIGNED_SHORT,0),this.currentBatchSize=0,this.renderSession.drawCount++}},t.WebGLSpriteBatch.prototype.stop=function(){this.flush()},t.WebGLSpriteBatch.prototype.start=function(){var e=this.gl;e.activeTexture(e.TEXTURE0),e.bindBuffer(e.ARRAY_BUFFER,this.vertexBuffer),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,this.indexBuffer);var n=this.renderSession.projection;e.uniform2f(this.shader.projectionVector,n.x,n.y);var r=4*this.vertSize;e.vertexAttribPointer(this.shader.aVertexPosition,2,e.FLOAT,!1,r,0),e.vertexAttribPointer(this.shader.aTextureCoord,2,e.FLOAT,!1,r,8),e.vertexAttribPointer(this.shader.colorAttribute,2,e.FLOAT,!1,r,16),this.currentBlendMode!==t.blendModes.NORMAL&&this.setBlendMode(t.blendModes.NORMAL)},t.WebGLSpriteBatch.prototype.setBlendMode=function(e){this.flush(),this.currentBlendMode=e;var n=t.blendModesWebGL[this.currentBlendMode];this.gl.blendFunc(n[0],n[1])},t.WebGLSpriteBatch.prototype.destroy=function(){this.vertices=null,this.indices=null,this.gl.deleteBuffer(this.vertexBuffer),this.gl.deleteBuffer(this.indexBuffer),this.currentBaseTexture=null,this.gl=null},t.WebGLFastSpriteBatch=function(e){this.vertSize=10,this.maxSize=6e3,this.size=this.maxSize;var t=4*this.size*this.vertSize,n=6*this.maxSize;this.vertices=new Float32Array(t),this.indices=new Uint16Array(n),this.vertexBuffer=null,this.indexBuffer=null,this.lastIndexCount=0;for(var r=0,i=0;n>r;r+=6,i+=4)this.indices[r+0]=i+0,this.indices[r+1]=i+1,this.indices[r+2]=i+2,this.indices[r+3]=i+0,this.indices[r+4]=i+2,this.indices[r+5]=i+3;this.drawing=!1,this.currentBatchSize=0,this.currentBaseTexture=null,this.currentBlendMode=0,this.renderSession=null,this.shader=null,this.matrix=null,this.setContext(e)},t.WebGLFastSpriteBatch.prototype.setContext=function(e){this.gl=e,this.vertexBuffer=e.createBuffer(),this.indexBuffer=e.createBuffer(),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,this.indexBuffer),e.bufferData(e.ELEMENT_ARRAY_BUFFER,this.indices,e.STATIC_DRAW),e.bindBuffer(e.ARRAY_BUFFER,this.vertexBuffer),e.bufferData(e.ARRAY_BUFFER,this.vertices,e.DYNAMIC_DRAW),this.currentBlendMode=99999},t.WebGLFastSpriteBatch.prototype.begin=function(e,t){this.renderSession=t,this.shader=this.renderSession.shaderManager.fastShader,this.matrix=e.worldTransform.toArray(!0),this.start()},t.WebGLFastSpriteBatch.prototype.end=function(){this.flush()},t.WebGLFastSpriteBatch.prototype.render=function(e){var t=e.children,n=t[0];if(n.texture._uvs){this.currentBaseTexture=n.texture.baseTexture,n.blendMode!==this.currentBlendMode&&this.setBlendMode(n.blendMode);for(var r=0,i=t.length;i>r;r++)this.renderSprite(t[r]);this.flush()}},t.WebGLFastSpriteBatch.prototype.renderSprite=function(e){if(e.visible&&(e.texture.baseTexture===this.currentBaseTexture||(this.flush(),this.currentBaseTexture=e.texture.baseTexture,e.texture._uvs))){var t,n,r,i,s,o,u,a,f=this.vertices;if(t=e.texture._uvs,n=e.texture.frame.width,r=e.texture.frame.height,e.texture.trim){var l=e.texture.trim;s=l.x-e.anchor.x*l.width,i=s+e.texture.frame.width,u=l.y-e.anchor.y*l.height,o=u+e.texture.frame.height}else i=e.texture.frame.width*(1-e.anchor.x),s=e.texture.frame.width*-e.anchor.x,o=e.texture.frame.height*(1-e.anchor.y),u=e.texture.frame.height*-e.anchor.y;a=4*this.currentBatchSize*this.vertSize,f[a++]=s,f[a++]=u,f[a++]=e.position.x,f[a++]=e.position.y,f[a++]=e.scale.x,f[a++]=e.scale.y,f[a++]=e.rotation,f[a++]=t.x0,f[a++]=t.y1,f[a++]=e.alpha,f[a++]=i,f[a++]=u,f[a++]=e.position.x,f[a++]=e.position.y,f[a++]=e.scale.x,f[a++]=e.scale.y,f[a++]=e.rotation,f[a++]=t.x1,f[a++]=t.y1,f[a++]=e.alpha,f[a++]=i,f[a++]=o,f[a++]=e.position.x,f[a++]=e.position.y,f[a++]=e.scale.x,f[a++]=e.scale.y,f[a++]=e.rotation,f[a++]=t.x2,f[a++]=t.y2,f[a++]=e.alpha,f[a++]=s,f[a++]=o,f[a++]=e.position.x,f[a++]=e.position.y,f[a++]=e.scale.x,f[a++]=e.scale.y,f[a++]=e.rotation,f[a++]=t.x3,f[a++]=t.y3,f[a++]=e.alpha,this.currentBatchSize++,this.currentBatchSize>=this.size&&this.flush()}},t.WebGLFastSpriteBatch.prototype.flush=function(){if(0!==this.currentBatchSize){var e=this.gl;if(this.currentBaseTexture._glTextures[e.id]||t.createWebGLTexture(this.currentBaseTexture,e),e.bindTexture(e.TEXTURE_2D,this.currentBaseTexture._glTextures[e.id]),this.currentBatchSize>.5*this.size)e.bufferSubData(e.ARRAY_BUFFER,0,this.vertices);else{var n=this.vertices.subarray(0,4*this.currentBatchSize*this.vertSize);e.bufferSubData(e.ARRAY_BUFFER,0,n)}e.drawElements(e.TRIANGLES,6*this.currentBatchSize,e.UNSIGNED_SHORT,0),this.currentBatchSize=0,this.renderSession.drawCount++}},t.WebGLFastSpriteBatch.prototype.stop=function(){this.flush()},t.WebGLFastSpriteBatch.prototype.start=function(){var e=this.gl;e.activeTexture(e.TEXTURE0),e.bindBuffer(e.ARRAY_BUFFER,this.vertexBuffer),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,this.indexBuffer);var n=this.renderSession.projection;e.uniform2f(this.shader.projectionVector,n.x,n.y),e.uniformMatrix3fv(this.shader.uMatrix,!1,this.matrix);var r=4*this.vertSize;e.vertexAttribPointer(this.shader.aVertexPosition,2,e.FLOAT,!1,r,0),e.vertexAttribPointer(this.shader.aPositionCoord,2,e.FLOAT,!1,r,8),e.vertexAttribPointer(this.shader.aScale,2,e.FLOAT,!1,r,16),e.vertexAttribPointer(this.shader.aRotation,1,e.FLOAT,!1,r,24),e.vertexAttribPointer(this.shader.aTextureCoord,2,e.FLOAT,!1,r,28),e.vertexAttribPointer(this.shader.colorAttribute,1,e.FLOAT,!1,r,36),this.currentBlendMode!==t.blendModes.NORMAL&&this.setBlendMode(t.blendModes.NORMAL)},t.WebGLFastSpriteBatch.prototype.setBlendMode=function(e){this.flush(),this.currentBlendMode=e;var n=t.blendModesWebGL[this.currentBlendMode];this.gl.blendFunc(n[0],n[1])},t.WebGLFilterManager=function(e,t){this.transparent=t,this.filterStack=[],this.offsetX=0,this.offsetY=0,this.setContext(e)},t.WebGLFilterManager.prototype.setContext=function(e){this.gl=e,this.texturePool=[],this.initShaderBuffers()},t.WebGLFilterManager.prototype.begin=function(e,t){this.renderSession=e,this.defaultShader=e.shaderManager.defaultShader;var n=this.renderSession.projection;this.width=2*n.x,this.height=2*-n.y,this.buffer=t},t.WebGLFilterManager.prototype.pushFilter=function(e){var n=this.gl,r=this.renderSession.projection,i=this.renderSession.offset;this.filterStack.push(e);var s=e.filterPasses[0];this.offsetX+=e.target.filterArea.x,this.offsetY+=e.target.filterArea.y;var o=this.texturePool.pop();o?o.resize(this.width,this.height):o=new t.FilterTexture(this.gl,this.width,this.height),n.bindTexture(n.TEXTURE_2D,o.texture),e.target.filterArea=e.target.getBounds();var u=e.target.filterArea,a=s.padding;u.x-=a,u.y-=a,u.width+=2*a,u.height+=2*a,u.x<0&&(u.x=0),u.width>this.width&&(u.width=this.width),u.y<0&&(u.y=0),u.height>this.height&&(u.height=this.height),n.bindFramebuffer(n.FRAMEBUFFER,o.frameBuffer),n.viewport(0,0,u.width,u.height),r.x=u.width/2,r.y=-u.height/2,i.x=-u.x,i.y=-u.y,n.uniform2f(this.defaultShader.projectionVector,u.width/2,-u.height/2),n.uniform2f(this.defaultShader.offsetVector,-u.x,-u.y),n.colorMask(!0,!0,!0,!0),n.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT),e._glFilterTexture=o},t.WebGLFilterManager.prototype.popFilter=function(){var e=this.gl,n=this.filterStack.pop(),r=n.target.filterArea,i=n._glFilterTexture,s=this.renderSession.projection,o=this.renderSession.offset;if(n.filterPasses.length>1){e.viewport(0,0,r.width,r.height),e.bindBuffer(e.ARRAY_BUFFER,this.vertexBuffer),this.vertexArray[0]=0,this.vertexArray[1]=r.height,this.vertexArray[2]=r.width,this.vertexArray[3]=r.height,this.vertexArray[4]=0,this.vertexArray[5]=0,this.vertexArray[6]=r.width,this.vertexArray[7]=0,e.bufferSubData(e.ARRAY_BUFFER,0,this.vertexArray),e.bindBuffer(e.ARRAY_BUFFER,this.uvBuffer),this.uvArray[2]=r.width/this.width,this.uvArray[5]=r.height/this.height,this.uvArray[6]=r.width/this.width,this.uvArray[7]=r.height/this.height,e.bufferSubData(e.ARRAY_BUFFER,0,this.uvArray);var u=i,a=this.texturePool.pop();a||(a=new t.FilterTexture(this.gl,this.width,this.height)),a.resize(this.width,this.height),e.bindFramebuffer(e.FRAMEBUFFER,a.frameBuffer),e.clear(e.COLOR_BUFFER_BIT),e.disable(e.BLEND);for(var f=0;f0&&(t.Texture.frameUpdates.length=0)},t.CanvasRenderer.prototype.resize=function(e,t){this.width=e,this.height=t,this.view.width=e,this.view.height=t},t.CanvasRenderer.prototype.renderDisplayObject=function(e,t){this.renderSession.context=t||this.context,e._renderCanvas(this.renderSession)},t.CanvasRenderer.prototype.renderStripFlat=function(e){var t=this.context,n=e.verticies,r=n.length/2;this.count++,t.beginPath();for(var i=1;r-2>i;i++){var s=2*i,o=n[s],u=n[s+2],a=n[s+4],f=n[s+1],l=n[s+3],c=n[s+5];t.moveTo(o,f),t.lineTo(u,l),t.lineTo(a,c)}t.fillStyle="#FF0000",t.fill(),t.closePath()},t.CanvasRenderer.prototype.renderStrip=function(e){var t=this.context,n=e.verticies,r=e.uvs,i=n.length/2;this.count++;for(var s=1;i-2>s;s++){var o=2*s,u=n[o],a=n[o+2],f=n[o+4],l=n[o+1],c=n[o+3],h=n[o+5],p=r[o]*e.texture.width,d=r[o+2]*e.texture.width,v=r[o+4]*e.texture.width,m=r[o+1]*e.texture.height,g=r[o+3]*e.texture.height,y=r[o+5]*e.texture.height;t.save(),t.beginPath(),t.moveTo(u,l),t.lineTo(a,c),t.lineTo(f,h),t.closePath(),t.clip();var b=p*g+m*v+d*y-g*v-m*d-p*y,w=u*g+m*f+a*y-g*f-m*a-u*y,E=p*a+u*v+d*f-a*v-u*d-p*f,S=p*g*f+m*a*v+u*d*y-u*g*v-m*d*f-p*a*y,x=l*g+m*h+c*y-g*h-m*c-l*y,T=p*c+l*v+d*h-c*v-l*d-p*h,N=p*g*h+m*c*v+l*d*y-l*g*v-m*d*h-p*c*y;t.transform(w/b,x/b,E/b,T/b,S/b,N/b),t.drawImage(e.texture.baseTexture.source,0,0),t.restore()}},t.CanvasBuffer=function(e,t){this.width=e,this.height=t,this.canvas=document.createElement("canvas"),this.context=this.canvas.getContext("2d"),this.canvas.width=e,this.canvas.height=t},t.CanvasBuffer.prototype.clear=function(){this.context.clearRect(0,0,this.width,this.height)},t.CanvasBuffer.prototype.resize=function(e,t){this.width=this.canvas.width=e,this.height=this.canvas.height=t},t.CanvasGraphics=function(){},t.CanvasGraphics.renderGraphics=function(e,n){for(var r=e.worldAlpha,i="",s=0;s1&&(r=1,window.console.log("Pixi.js warning: masks in canvas can only mask using the first path in the graphics object"));for(var i=0;1>i;i++){var s=e.graphicsData[i],o=s.points;if(s.type===t.Graphics.POLY){n.beginPath(),n.moveTo(o[0],o[1]);for(var u=1;ur;r++)this.children[r]._renderWebGL(e);e.spriteBatch.stop()}this._filters&&e.filterManager.popFilter(),this._mask&&e.maskManager.popMask(e),e.drawCount++,e.spriteBatch.start()}},t.Graphics.prototype._renderCanvas=function(e){if(this.visible!==!1&&0!==this.alpha&&this.isMask!==!0){var n=e.context,r=this.worldTransform;this.blendMode!==e.currentBlendMode&&(e.currentBlendMode=this.blendMode,n.globalCompositeOperation=t.blendModesCanvas[e.currentBlendMode]),n.setTransform(r.a,r.c,r.b,r.d,r.tx,r.ty),t.CanvasGraphics.renderGraphics(this,n);for(var i=0,s=this.children.length;s>i;i++)this.children[i]._renderCanvas(e)}},t.Graphics.prototype.getBounds=function(e){this.bounds||this.updateBounds();var t=this.bounds.x,n=this.bounds.width+this.bounds.x,r=this.bounds.y,i=this.bounds.height+this.bounds.y,s=e||this.worldTransform,o=s.a,u=s.c,a=s.b,f=s.d,l=s.tx,c=s.ty,h=o*n+a*i+l,p=f*i+u*n+c,d=o*t+a*i+l,v=f*i+u*t+c,m=o*t+a*r+l,g=f*r+u*t+c,y=o*n+a*r+l,b=f*r+u*n+c,w=-1/0,E=-1/0,S=1/0,x=1/0;S=S>h?h:S,S=S>d?d:S,S=S>m?m:S,S=S>y?y:S,x=x>p?p:x,x=x>v?v:x,x=x>g?g:x,x=x>b?b:x,w=h>w?h:w,w=d>w?d:w,w=m>w?m:w,w=y>w?y:w,E=p>E?p:E,E=v>E?v:E,E=g>E?g:E,E=b>E?b:E;var T=this._bounds;return T.x=S,T.width=w-S,T.y=x,T.height=E-x,T},t.Graphics.prototype.updateBounds=function(){for(var e,n,r,i,s,o=1/0,u=-1/0,a=1/0,f=-1/0,l=0;ln?n:o,u=n+i>u?n+i:u,a=a>r?n:a,f=r+s>f?r+s:f;else if(h===t.Graphics.CIRC||h===t.Graphics.ELIP)n=e[0],r=e[1],i=e[2]+p/2,s=e[3]+p/2,o=o>n-i?n-i:o,u=n+i>u?n+i:u,a=a>r-s?r-s:a,f=r+s>f?r+s:f;else for(var d=0;dn-p?n-p:o,u=n+p>u?n+p:u,a=a>r-p?r-p:a,f=r+p>f?r+p:f}var v=this.boundsPadding;this.bounds=new t.Rectangle(o-v,a-v,u-o+2*v,f-a+2*v)},t.Graphics.prototype._generateCachedSprite=function(){var e=this.getLocalBounds();if(this._cachedSprite)this._cachedSprite.buffer.resize(e.width,e.height);else{var n=new t.CanvasBuffer(e.width,e.height),r=t.Texture.fromCanvas(n.canvas);this._cachedSprite=new t.Sprite(r),this._cachedSprite.buffer=n,this._cachedSprite.worldTransform=this.worldTransform}this._cachedSprite.anchor.x=-(e.x/e.width),this._cachedSprite.anchor.y=-(e.y/e.height),this._cachedSprite.buffer.context.translate(-e.x,-e.y),t.CanvasGraphics.renderGraphics(this,this._cachedSprite.buffer.context)},t.Graphics.prototype.destroyCachedSprite=function(){this._cachedSprite.texture.destroy(!0),this._cachedSprite=null},t.Graphics.POLY=0,t.Graphics.RECT=1,t.Graphics.CIRC=2,t.Graphics.ELIP=3,t.TilingSprite=function(e,n,r){t.Sprite.call(this,e),this.width=n||100,this.height=r||100,this.tileScale=new t.Point(1,1),this.tileScaleOffset=new t.Point(1,1),this.tilePosition=new t.Point(0,0),this.renderable=!0,this.tint=16777215,this.blendMode=t.blendModes.NORMAL},t.TilingSprite.prototype=Object.create(t.Sprite.prototype),t.TilingSprite.prototype.constructor=t.TilingSprite,Object.defineProperty(t.TilingSprite.prototype,"width",{get:function(){return this._width},set:function(e){this._width=e}}),Object.defineProperty(t.TilingSprite.prototype,"height",{get:function(){return this._height},set:function(e){this._height=e}}),t.TilingSprite.prototype.onTextureUpdate=function(){this.updateFrame=!0},t.TilingSprite.prototype.setTexture=function(e){this.texture!==e&&(this.texture=e,this.refreshTexture=!0,this.cachedTint=16777215)},t.TilingSprite.prototype._renderWebGL=function(e){if(this.visible!==!1&&0!==this.alpha){var n,r;for(this.mask&&(e.spriteBatch.stop(),e.maskManager.pushMask(this.mask,e),e.spriteBatch.start()),this.filters&&(e.spriteBatch.flush(),e.filterManager.pushFilter(this._filterBlock)),!this.tilingTexture||this.refreshTexture?(this.generateTilingTexture(!0),this.tilingTexture&&this.tilingTexture.needsUpdate&&(t.updateWebGLTexture(this.tilingTexture.baseTexture,e.gl),this.tilingTexture.needsUpdate=!1)):e.spriteBatch.renderTilingSprite(this),n=0,r=this.children.length;r>n;n++)this.children[n]._renderWebGL(e);e.spriteBatch.stop(),this.filters&&e.filterManager.popFilter(),this.mask&&e.maskManager.popMask(e),e.spriteBatch.start()}},t.TilingSprite.prototype._renderCanvas=function(e){if(this.visible!==!1&&0!==this.alpha){var n=e.context;this._mask&&e.maskManager.pushMask(this._mask,n),n.globalAlpha=this.worldAlpha;var r=this.worldTransform;n.setTransform(r.a,r.c,r.b,r.d,r.tx,r.ty),(!this.__tilePattern||this.refreshTexture)&&(this.generateTilingTexture(!1),this.tilingTexture&&(this.__tilePattern=n.createPattern(this.tilingTexture.baseTexture.source,"repeat"))),this.blendMode!==e.currentBlendMode&&(e.currentBlendMode=this.blendMode,n.globalCompositeOperation=t.blendModesCanvas[e.currentBlendMode]),n.beginPath();var i=this.tilePosition,s=this.tileScale;i.x%=this.tilingTexture.baseTexture.width,i.y%=this.tilingTexture.baseTexture.height,n.scale(s.x,s.y),n.translate(i.x,i.y),n.fillStyle=this.__tilePattern,n.fillRect(-i.x,-i.y,this.width/s.x,this.height/s.y),n.scale(1/s.x,1/s.y),n.translate(-i.x,-i.y),n.closePath(),this._mask&&e.maskManager.popMask(e.context)}},t.TilingSprite.prototype.getBounds=function(){var e=this._width,t=this._height,n=e*(1-this.anchor.x),r=e*-this.anchor.x,i=t*(1-this.anchor.y),s=t*-this.anchor.y,o=this.worldTransform,u=o.a,a=o.c,f=o.b,l=o.d,c=o.tx,h=o.ty,p=u*r+f*s+c,d=l*s+a*r+h,v=u*n+f*s+c,m=l*s+a*n+h,g=u*n+f*i+c,y=l*i+a*n+h,b=u*r+f*i+c,w=l*i+a*r+h,E=-1/0,S=-1/0,x=1/0,T=1/0;x=x>p?p:x,x=x>v?v:x,x=x>g?g:x,x=x>b?b:x,T=T>d?d:T,T=T>m?m:T,T=T>y?y:T,T=T>w?w:T,E=p>E?p:E,E=v>E?v:E,E=g>E?g:E,E=b>E?b:E,S=d>S?d:S,S=m>S?m:S,S=y>S?y:S,S=w>S?w:S;var N=this._bounds;return N.x=x,N.width=E-x,N.y=T,N.height=S-T,this._currentBounds=N,N},t.TilingSprite.prototype.generateTilingTexture=function(e){var n=this.texture;if(n.baseTexture.hasLoaded){var r,i,s=n.baseTexture,o=n.frame,u=o.width!==s.width||o.height!==s.height,a=!1;if(e?(r=t.getNextPowerOfTwo(o.width),i=t.getNextPowerOfTwo(o.height),o.width!==r&&o.height!==i&&(a=!0)):u&&(r=o.width,i=o.height,a=!0),a){var f;this.tilingTexture&&this.tilingTexture.isTiling?(f=this.tilingTexture.canvasBuffer,f.resize(r,i),this.tilingTexture.baseTexture.width=r,this.tilingTexture.baseTexture.height=i,this.tilingTexture.needsUpdate=!0):(f=new t.CanvasBuffer(r,i),this.tilingTexture=t.Texture.fromCanvas(f.canvas),this.tilingTexture.canvasBuffer=f,this.tilingTexture.isTiling=!0),f.context.drawImage(n.baseTexture.source,o.x,o.y,o.width,o.height,0,0,r,i),this.tileScaleOffset.x=o.width/r,this.tileScaleOffset.y=o.height/i}else this.tilingTexture&&this.tilingTexture.isTiling&&this.tilingTexture.destroy(!0),this.tileScaleOffset.x=1,this.tileScaleOffset.y=1,this.tilingTexture=n;this.refreshTexture=!1,this.tilingTexture.baseTexture._powerOf2=!0}},t.BaseTextureCache={},t.texturesToUpdate=[],t.texturesToDestroy=[],t.BaseTextureCacheIdGenerator=0,t.BaseTexture=function(e,n){if(t.EventTarget.call(this),this.width=100,this.height=100,this.scaleMode=n||t.scaleModes.DEFAULT,this.hasLoaded=!1,this.source=e,this.id=t.BaseTextureCacheIdGenerator++,this._glTextures=[],e){if(this.source.complete||this.source.getContext)this.hasLoaded=!0,this.width=this.source.width,this.height=this.source.height,t.texturesToUpdate.push(this);else{var r=this;this.source.onload=function(){r.hasLoaded=!0,r.width=r.source.width,r.height=r.source.height,t.texturesToUpdate.push(r),r.dispatchEvent({type:"loaded",content:r})}}this.imageUrl=null,this._powerOf2=!1}},t.BaseTexture.prototype.constructor=t.BaseTexture,t.BaseTexture.prototype.destroy=function(){this.imageUrl&&(delete t.BaseTextureCache[this.imageUrl],this.imageUrl=null,this.source.src=null),this.source=null,t.texturesToDestroy.push(this)},t.BaseTexture.prototype.updateSourceImage=function(e){this.hasLoaded=!1,this.source.src=null,this.source.src=e},t.BaseTexture.fromImage=function(e,n,r){var i=t.BaseTextureCache[e];if(!i){var s=new Image;n&&(s.crossOrigin=""),s.src=e,i=new t.BaseTexture(s,r),i.imageUrl=e,t.BaseTextureCache[e]=i}return i},t.BaseTexture.fromCanvas=function(e,n){e._pixiId||(e._pixiId="canvas_"+t.TextureCacheIdGenerator++);var r=t.BaseTextureCache[e._pixiId];return r||(r=new t.BaseTexture(e,n),t.BaseTextureCache[e._pixiId]=r),r},t.TextureCache={},t.FrameCache={},t.TextureCacheIdGenerator=0,t.Texture=function(e,n){if(t.EventTarget.call(this),n||(this.noFrame=!0,n=new t.Rectangle(0,0,1,1)),e instanceof t.Texture&&(e=e.baseTexture),this.baseTexture=e,this.frame=n,this.trim=null,this.scope=this,this._uvs=null,e.hasLoaded)this.noFrame&&(n=new t.Rectangle(0,0,e.width,e.height)),this.setFrame(n);else{var r=this;e.addEventListener("loaded",function(){r.onBaseTextureLoaded()})}},t.Texture.prototype.constructor=t.Texture,t.Texture.prototype.onBaseTextureLoaded=function(){var e=this.baseTexture;e.removeEventListener("loaded",this.onLoaded),this.noFrame&&(this.frame=new t.Rectangle(0,0,e.width,e.height)),this.setFrame(this.frame),this.scope.dispatchEvent({type:"update",content:this})},t.Texture.prototype.destroy=function(e){e&&this.baseTexture.destroy()},t.Texture.prototype.setFrame=function(e){if(this.frame=e,this.width=e.width,this.height=e.height,e.x+e.width>this.baseTexture.width||e.y+e.height>this.baseTexture.height)throw new Error("Texture Error: frame does not fit inside the base Texture dimensions "+this);this.updateFrame=!0,t.Texture.frameUpdates.push(this)},t.Texture.prototype._updateWebGLuvs=function(){this._uvs||(this._uvs=new t.TextureUvs);var e=this.frame,n=this.baseTexture.width,r=this.baseTexture.height;this._uvs.x0=e.x/n,this._uvs.y0=e.y/r,this._uvs.x1=(e.x+e.width)/n,this._uvs.y1=e.y/r,this._uvs.x2=(e.x+e.width)/n,this._uvs.y2=(e.y+e.height)/r,this._uvs.x3=e.x/n,this._uvs.y3=(e.y+e.height)/r},t.Texture.fromImage=function(e,n,r){var i=t.TextureCache[e];return i||(i=new t.Texture(t.BaseTexture.fromImage(e,n,r)),t.TextureCache[e]=i),i},t.Texture.fromFrame=function(e){var n=t.TextureCache[e];if(!n)throw new Error('The frameId "'+e+'" does not exist in the texture cache ');return n},t.Texture.fromCanvas=function(e,n){var r=t.BaseTexture.fromCanvas(e,n);return new t.Texture(r)},t.Texture.addTextureToCache=function(e,n){t.TextureCache[n]=e},t.Texture.removeTextureFromCache=function(e){var n=t.TextureCache[e];return delete t.TextureCache[e],delete t.BaseTextureCache[e],n},t.Texture.frameUpdates=[],t.TextureUvs=function(){this.x0=0,this.y0=0,this.x1=0,this.y1=0,this.x2=0,this.y2=0,this.x3=0,this.y4=0},t.RenderTexture=function(e,n,r){if(t.EventTarget.call(this),this.width=e||100,this.height=n||100,this.frame=new t.Rectangle(0,0,this.width,this.height),this.baseTexture=new t.BaseTexture,this.baseTexture.width=this.width,this.baseTexture.height=this.height,this.baseTexture._glTextures=[],this.baseTexture.hasLoaded=!0,this.renderer=r||t.defaultRenderer,this.renderer.type===t.WEBGL_RENDERER){var i=this.renderer.gl;this.textureBuffer=new t.FilterTexture(i,this.width,this.height),this.baseTexture._glTextures[i.id]=this.textureBuffer.texture,this.render=this.renderWebGL,this.projection=new t.Point(this.width/2,-this.height/2)}else console.log("renderer canvas"),this.render=this.renderCanvas,this.textureBuffer=new t.CanvasBuffer(this.width,this.height),this.baseTexture.source=this.textureBuffer.canvas;t.Texture.frameUpdates.push(this)},t.RenderTexture.prototype=Object.create(t.Texture.prototype),t.RenderTexture.prototype.constructor=t.RenderTexture,t.RenderTexture.prototype.resize=function(e,n){if(this.width=e,this.height=n,this.frame.width=this.width,this.frame.height=this.height,this.renderer.type===t.WEBGL_RENDERER){this.projection.x=this.width/2,this.projection.y=-this.height/2;var r=this.renderer.gl;r.bindTexture(r.TEXTURE_2D,this.baseTexture._glTextures[r.id]),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,this.width,this.height,0,r.RGBA,r.UNSIGNED_BYTE,null)}else this.textureBuffer.resize(this.width,this.height);t.Texture.frameUpdates.push(this)},t.RenderTexture.prototype.renderWebGL=function(e,n,r){var i=this.renderer.gl;i.colorMask(!0,!0,!0,!0),i.viewport(0,0,this.width,this.height),i.bindFramebuffer(i.FRAMEBUFFER,this.textureBuffer.frameBuffer),r&&this.textureBuffer.clear();var s=e.children,o=e.worldTransform;e.worldTransform=t.RenderTexture.tempMatrix,e.worldTransform.d=-1,e.worldTransform.ty=-2*this.projection.y,n&&(e.worldTransform.tx=n.x,e.worldTransform.ty-=n.y);for(var u=0,a=s.length;a>u;u++)s[u].updateTransform();t.WebGLRenderer.updateTextures(),this.renderer.renderDisplayObject(e,this.projection,this.textureBuffer.frameBuffer),e.worldTransform=o},t.RenderTexture.prototype.renderCanvas=function(e,n,r){var i=e.children,s=e.worldTransform;e.worldTransform=t.RenderTexture.tempMatrix,n&&(e.worldTransform.tx=n.x,e.worldTransform.ty=n.y);for(var o=0,u=i.length;u>o;o++)i[o].updateTransform();r&&this.textureBuffer.clear();var a=this.textureBuffer.context;this.renderer.renderDisplayObject(e,a),a.setTransform(1,0,0,1,0,0),e.worldTransform=s},t.RenderTexture.tempMatrix=new t.Matrix,"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=t),exports.PIXI=t):"undefined"!=typeof define&&define.amd?define("PIXI",function(){return e.PIXI=t}()):e.PIXI=t}.call(this),function(){var e=this,t=t||{VERSION:"<%= version %>",DEV_VERSION:"2.0.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,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(){},t.Utils={parseDimension:function(e,t){var n=0,r=0;return"string"==typeof e?"%"===e.substr(-1)?(n=parseInt(e,10)/100,r=0===t?window.innerWidth*n:window.innerHeight*n):r=parseInt(e,10):r=e,r},shuffle:function(e){for(var t=e.length-1;t>0;t--){var n=Math.floor(Math.random()*(t+1)),r=e[t];e[t]=e[n],e[n]=r}return e},pad:function(e,t,n,r){if("undefined"==typeof t)var t=0;if("undefined"==typeof n)var n=" ";if("undefined"==typeof r)var r=3;var i=0;if(t+1>=e.length)switch(r){case 1:e=(new Array(t+1-e.length)).join(n)+e;break;case 3:var s=Math.ceil((i=t-e.length)/2),o=i-s;e=(new Array(o+1)).join(n)+e+(new Array(s+1)).join(n);break;default:e+=(new Array(t+1-e.length)).join(n)}return e},isPlainObject:function(e){if("object"!=typeof e||e.nodeType||e===e.window)return!1;try{if(e.constructor&&!{}.hasOwnProperty.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(t){return!1}return!0},extend:function(){var e,n,r,i,s,o,u=arguments[0]||{},a=1,f=arguments.length,l=!1;for("boolean"==typeof u&&(l=u,u=arguments[1]||{},a=2),f===a&&(u=this,--a);f>a;a++)if(null!=(e=arguments[a]))for(n in e)r=u[n],i=e[n],u!==i&&(l&&i&&(t.Utils.isPlainObject(i)||(s=Array.isArray(i)))?(s?(s=!1,o=r&&Array.isArray(r)?r:[]):o=r&&t.Utils.isPlainObject(r)?r:{},u[n]=t.Utils.extend(l,o,i)):void 0!==i&&(u[n]=i));return u}},"function"!=typeof Function.prototype.bind&&(Function.prototype.bind=function(){var e=Array.prototype.slice;return function(t){function n(){var s=i.concat(e.call(arguments));r.apply(this instanceof n?this:t,s)}var r=this,i=e.call(arguments,1);if("function"!=typeof r)throw new TypeError;return n.prototype=function s(e){return e&&(s.prototype=e),this instanceof s?void 0:new s}(r.prototype),n}}()),Array.isArray||(Array.isArray=function(e){return"[object Array]"==Object.prototype.toString.call(e)}),t.Circle=function(e,t,n){e=e||0,t=t||0,n=n||0,this.x=e,this.y=t,this._diameter=n,this._radius=n>0?.5*n:0},t.Circle.prototype={circumference:function(){return 2*Math.PI*this._radius},setTo:function(e,t,n){return this.x=e,this.y=t,this._diameter=n,this._radius=.5*n,this},copyFrom:function(e){return this.setTo(e.x,e.y,e.diameter)},copyTo:function(e){return e.x=this.x,e.y=this.y,e.diameter=this._diameter,e},distance:function(e,n){return"undefined"==typeof n&&(n=!1),n?t.Math.distanceRound(this.x,this.y,e.x,e.y):t.Math.distance(this.x,this.y,e.x,e.y)},clone:function(e){return"undefined"==typeof e?e=new t.Circle(this.x,this.y,this.diameter):e.setTo(this.x,this.y,this.diameter),e},contains:function(e,n){return t.Circle.contains(this,e,n)},circumferencePoint:function(e,n,r){return t.Circle.circumferencePoint(this,e,n,r)},offset:function(e,t){return this.x+=e,this.y+=t,this},offsetPoint:function(e){return this.offset(e.x,e.y)},toString:function(){return"[{Phaser.Circle (x="+this.x+" y="+this.y+" diameter="+this.diameter+" radius="+this.radius+")}]"}},t.Circle.prototype.constructor=t.Circle,Object.defineProperty(t.Circle.prototype,"diameter",{get:function(){return this._diameter},set:function(e){e>0&&(this._diameter=e,this._radius=.5*e)}}),Object.defineProperty(t.Circle.prototype,"radius",{get:function(){return this._radius},set:function(e){e>0&&(this._radius=e,this._diameter=2*e)}}),Object.defineProperty(t.Circle.prototype,"left",{get:function(){return this.x-this._radius},set:function(e){e>this.x?(this._radius=0,this._diameter=0):this.radius=this.x-e}}),Object.defineProperty(t.Circle.prototype,"right",{get:function(){return this.x+this._radius},set:function(e){ethis.y?(this._radius=0,this._diameter=0):this.radius=this.y-e}}),Object.defineProperty(t.Circle.prototype,"bottom",{get:function(){return this.y+this._radius},set:function(e){e0?Math.PI*this._radius*this._radius:0}}),Object.defineProperty(t.Circle.prototype,"empty",{get:function(){return 0===this._diameter},set:function(e){e===!0&&this.setTo(0,0,0)}}),t.Circle.contains=function(e,t,n){if(e.radius>0&&t>=e.left&&t<=e.right&&n>=e.top&&n<=e.bottom){var r=(e.x-t)*(e.x-t),i=(e.y-n)*(e.y-n);return r+i<=e.radius*e.radius}return!1},t.Circle.equals=function(e,t){return e.x==t.x&&e.y==t.y&&e.diameter==t.diameter},t.Circle.intersects=function(e,n){return t.Math.distance(e.x,e.y,n.x,n.y)<=e.radius+n.radius},t.Circle.circumferencePoint=function(e,n,r,i){return"undefined"==typeof r&&(r=!1),"undefined"==typeof i&&(i=new t.Point),r===!0&&(n=t.Math.degToRad(n)),i.x=e.x+e.radius*Math.cos(n),i.y=e.y+e.radius*Math.sin(n),i},t.Circle.intersectsRectangle=function(e,t){var n=Math.abs(e.x-t.x-t.halfWidth),r=t.halfWidth+e.radius;if(n>r)return!1;var i=Math.abs(e.y-t.y-t.halfHeight),s=t.halfHeight+e.radius;if(i>s)return!1;if(n<=t.halfWidth||i<=t.halfHeight)return!0;var o=n-t.halfWidth,u=i-t.halfHeight,a=o*o,f=u*u,l=e.radius*e.radius;return l>=a+f},PIXI.Circle=t.Circle,t.Point=function(e,t){e=e||0,t=t||0,this.x=e,this.y=t},t.Point.prototype={copyFrom:function(e){return this.setTo(e.x,e.y)},invert:function(){return this.setTo(this.y,this.x)},setTo:function(e,t){return this.x=e||0,this.y=t||(0!==t?this.x:0),this},set:function(e,t){return this.x=e||0,this.y=t||(0!==t?this.x:0),this},add:function(e,t){return this.x+=e,this.y+=t,this},subtract:function(e,t){return this.x-=e,this.y-=t,this},multiply:function(e,t){return this.x*=e,this.y*=t,this},divide:function(e,t){return this.x/=e,this.y/=t,this},clampX:function(e,n){return this.x=t.Math.clamp(this.x,e,n),this},clampY:function(e,n){return this.y=t.Math.clamp(this.y,e,n),this},clamp:function(e,n){return this.x=t.Math.clamp(this.x,e,n),this.y=t.Math.clamp(this.y,e,n),this},clone:function(e){return"undefined"==typeof e?e=new t.Point(this.x,this.y):e.setTo(this.x,this.y),e},copyTo:function(e){return e.x=this.x,e.y=this.y,e},distance:function(e,n){return t.Point.distance(this,e,n)},equals:function(e){return e.x==this.x&&e.y==this.y},rotate:function(e,n,r,i,s){return t.Point.rotate(this,e,n,r,i,s)},getMagnitude:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},setMagnitude:function(e){return this.normalize().multiply(e,e)},normalize:function(){if(!this.isZero()){var e=this.getMagnitude();this.x/=e,this.y/=e}return this},isZero:function(){return 0===this.x&&0===this.y},toString:function(){return"[{Point (x="+this.x+" y="+this.y+")}]"}},t.Point.prototype.constructor=t.Point,t.Point.add=function(e,n,r){return"undefined"==typeof r&&(r=new t.Point),r.x=e.x+n.x,r.y=e.y+n.y,r},t.Point.subtract=function(e,n,r){return"undefined"==typeof r&&(r=new t.Point),r.x=e.x-n.x,r.y=e.y-n.y,r},t.Point.multiply=function(e,n,r){return"undefined"==typeof r&&(r=new t.Point),r.x=e.x*n.x,r.y=e.y*n.y,r},t.Point.divide=function(e,n,r){return"undefined"==typeof r&&(r=new t.Point),r.x=e.x/n.x,r.y=e.y/n.y,r},t.Point.equals=function(e,t){return e.x==t.x&&e.y==t.y},t.Point.distance=function(e,n,r){return"undefined"==typeof r&&(r=!1),r?t.Math.distanceRound(e.x,e.y,n.x,n.y):t.Math.distance(e.x,e.y,n.x,n.y)},t.Point.rotate=function(e,n,r,i,s,o){return s=s||!1,o=o||null,s&&(i=t.Math.degToRad(i)),null===o&&(o=Math.sqrt((n-e.x)*(n-e.x)+(r-e.y)*(r-e.y))),e.setTo(n+o*Math.cos(i),r+o*Math.sin(i))},PIXI.Point=t.Point,t.Rectangle=function(e,t,n,r){e=e||0,t=t||0,n=n||0,r=r||0,this.x=e,this.y=t,this.width=n,this.height=r},t.Rectangle.prototype={offset:function(e,t){return this.x+=e,this.y+=t,this},offsetPoint:function(e){return this.offset(e.x,e.y)},setTo:function(e,t,n,r){return this.x=e,this.y=t,this.width=n,this.height=r,this},floor:function(){this.x=Math.floor(this.x),this.y=Math.floor(this.y)},floorAll:function(){this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.width=Math.floor(this.width),this.height=Math.floor(this.height)},copyFrom:function(e){return this.setTo(e.x,e.y,e.width,e.height)},copyTo:function(e){return e.x=this.x,e.y=this.y,e.width=this.width,e.height=this.height,e},inflate:function(e,n){return t.Rectangle.inflate(this,e,n)},size:function(e){return t.Rectangle.size(this,e)},clone:function(e){return t.Rectangle.clone(this,e)},contains:function(e,n){return t.Rectangle.contains(this,e,n)},containsRect:function(e){return t.Rectangle.containsRect(this,e)},equals:function(e){return t.Rectangle.equals(this,e)},intersection:function(e,n){return t.Rectangle.intersection(this,e,n)},intersects:function(e,n){return t.Rectangle.intersects(this,e,n)},intersectsRaw:function(e,n,r,i,s){return t.Rectangle.intersectsRaw(this,e,n,r,i,s)},union:function(e,n){return t.Rectangle.union(this,e,n)},toString:function(){return"[{Rectangle (x="+this.x+" y="+this.y+" width="+this.width+" height="+this.height+" empty="+this.empty+")}]"}},Object.defineProperty(t.Rectangle.prototype,"halfWidth",{get:function(){return Math.round(this.width/2)}}),Object.defineProperty(t.Rectangle.prototype,"halfHeight",{get:function(){return Math.round(this.height/2)}}),Object.defineProperty(t.Rectangle.prototype,"bottom",{get:function(){return this.y+this.height},set:function(e){this.height=e<=this.y?0:this.y-e}}),Object.defineProperty(t.Rectangle.prototype,"bottomRight",{get:function(){return new t.Point(this.right,this.bottom)},set:function(e){this.right=e.x,this.bottom=e.y}}),Object.defineProperty(t.Rectangle.prototype,"left",{get:function(){return this.x},set:function(e){this.width=e>=this.right?0:this.right-e,this.x=e}}),Object.defineProperty(t.Rectangle.prototype,"right",{get:function(){return this.x+this.width},set:function(e){this.width=e<=this.x?0:this.x+e}}),Object.defineProperty(t.Rectangle.prototype,"volume",{get:function(){return this.width*this.height}}),Object.defineProperty(t.Rectangle.prototype,"perimeter",{get:function(){return 2*this.width+2*this.height}}),Object.defineProperty(t.Rectangle.prototype,"centerX",{get:function(){return this.x+this.halfWidth},set:function(e){this.x=e-this.halfWidth}}),Object.defineProperty(t.Rectangle.prototype,"centerY",{get:function(){return this.y+this.halfHeight},set:function(e){this.y=e-this.halfHeight}}),Object.defineProperty(t.Rectangle.prototype,"top",{get:function(){return this.y},set:function(e){e>=this.bottom?(this.height=0,this.y=e):this.height=this.bottom-e}}),Object.defineProperty(t.Rectangle.prototype,"topLeft",{get:function(){return new t.Point(this.x,this.y)},set:function(e){this.x=e.x,this.y=e.y}}),Object.defineProperty(t.Rectangle.prototype,"empty",{get:function(){return!this.width||!this.height},set:function(e){e===!0&&this.setTo(0,0,0,0)}}),t.Rectangle.prototype.constructor=t.Rectangle,t.Rectangle.inflate=function(e,t,n){return e.x-=t,e.width+=2*t,e.y-=n,e.height+=2*n,e},t.Rectangle.inflatePoint=function(e,n){return t.Rectangle.inflate(e,n.x,n.y)},t.Rectangle.size=function(e,n){return"undefined"==typeof n?n=new t.Point(e.width,e.height):n.setTo(e.width,e.height),n},t.Rectangle.clone=function(e,n){return"undefined"==typeof n?n=new t.Rectangle(e.x,e.y,e.width,e.height):n.setTo(e.x,e.y,e.width,e.height),n},t.Rectangle.contains=function(e,t,n){return e.width<=0||e.height<=0?!1:t>=e.x&&t<=e.right&&n>=e.y&&n<=e.bottom},t.Rectangle.containsRaw=function(e,t,n,r,i,s){return i>=e&&e+n>=i&&s>=t&&t+r>=s},t.Rectangle.containsPoint=function(e,n){return t.Rectangle.contains(e,n.x,n.y)},t.Rectangle.containsRect=function(e,t){return e.volume>t.volume?!1:e.x>=t.x&&e.y>=t.y&&e.right<=t.right&&e.bottom<=t.bottom},t.Rectangle.equals=function(e,t){return e.x==t.x&&e.y==t.y&&e.width==t.width&&e.height==t.height},t.Rectangle.intersection=function(e,n,r){return"undefined"==typeof r&&(r=new t.Rectangle),t.Rectangle.intersects(e,n)&&(r.x=Math.max(e.x,n.x),r.y=Math.max(e.y,n.y),r.width=Math.min(e.right,n.right)-r.x,r.height=Math.min(e.bottom,n.bottom)-r.y),r},t.Rectangle.intersects=function(e,t){return e.width<=0||e.height<=0||t.width<=0||t.height<=0?!1:!(e.rightt.right||e.y>t.bottom)},t.Rectangle.intersectsRaw=function(e,t,n,r,i,s){return"undefined"==typeof s&&(s=0),!(t>e.right+s||ne.bottom+s||i=n&&r>=e&&t>=i&&s>=t},coordinatesOnLine:function(e,t){"undefined"==typeof e&&(e=1),"undefined"==typeof t&&(t=[]);var n=Math.round(this.start.x),r=Math.round(this.start.y),i=Math.round(this.end.x),s=Math.round(this.end.y),o=Math.abs(i-n),u=Math.abs(s-r),a=i>n?1:-1,f=s>r?1:-1,l=o-u;t.push([n,r]);for(var c=1;n!=i||r!=s;){var h=l<<1;h>-u&&(l-=u,n+=a),o>h&&(l+=o,r+=f),c%e===0&&t.push([n,r]),c++}return t}},Object.defineProperty(t.Line.prototype,"length",{get:function(){return Math.sqrt((this.end.x-this.start.x)*(this.end.x-this.start.x)+(this.end.y-this.start.y)*(this.end.y-this.start.y))}}),Object.defineProperty(t.Line.prototype,"angle",{get:function(){return Math.atan2(this.end.x-this.start.x,this.end.y-this.start.y)}}),Object.defineProperty(t.Line.prototype,"slope",{get:function(){return(this.end.y-this.start.y)/(this.end.x-this.start.x)}}),Object.defineProperty(t.Line.prototype,"perpSlope",{get:function(){return-((this.end.x-this.start.x)/(this.end.y-this.start.y))}}),Object.defineProperty(t.Line.prototype,"x",{get:function(){return Math.min(this.start.x,this.end.x)}}),Object.defineProperty(t.Line.prototype,"y",{get:function(){return Math.min(this.start.y,this.end.y)}}),Object.defineProperty(t.Line.prototype,"left",{get:function(){return Math.min(this.start.x,this.end.x)}}),Object.defineProperty(t.Line.prototype,"right",{get:function(){return Math.max(this.start.x,this.end.x)}}),Object.defineProperty(t.Line.prototype,"top",{get:function(){return Math.min(this.start.y,this.end.y)}}),Object.defineProperty(t.Line.prototype,"bottom",{get:function(){return Math.max(this.start.y,this.end.y)}}),Object.defineProperty(t.Line.prototype,"width",{get:function(){return Math.abs(this.start.x-this.end.x)}}),Object.defineProperty(t.Line.prototype,"height",{get:function(){return Math.abs(this.start.y-this.end.y)}}),t.Line.intersectsPoints=function(e,n,r,i,s,o){"undefined"==typeof s&&(s=!0),"undefined"==typeof o&&(o=new t.Point);var u=n.y-e.y,a=i.y-r.y,f=e.x-n.x,l=r.x-i.x,c=n.x*e.y-e.x*n.y,h=i.x*r.y-r.x*i.y,p=u*l-a*f;if(0===p)return null;if(o.x=(f*h-l*c)/p,o.y=(a*c-u*h)/p,s){if(Math.pow(o.x-n.x+(o.y-n.y),2)>Math.pow(e.x-n.x+(e.y-n.y),2))return null;if(Math.pow(o.x-e.x+(o.y-e.y),2)>Math.pow(e.x-n.x+(e.y-n.y),2))return null;if(Math.pow(o.x-i.x+(o.y-i.y),2)>Math.pow(r.x-i.x+(r.y-i.y),2))return null;if(Math.pow(o.x-r.x+(o.y-r.y),2)>Math.pow(r.x-i.x+(r.y-i.y),2))return null}return o},t.Line.intersects=function(e,n,r,i){return t.Line.intersectsPoints(e.start,e.end,n.start,n.end,r,i)},t.Ellipse=function(e,n,r,i){this.type=t.ELLIPSE,e=e||0,n=n||0,r=r||0,i=i||0,this.x=e,this.y=n,this.width=r,this.height=i},t.Ellipse.prototype={setTo:function(e,t,n,r){return this.x=e,this.y=t,this.width=n,this.height=r,this},copyFrom:function(e){return this.setTo(e.x,e.y,e.width,e.height)},copyTo:function(e){return e.x=this.x,e.y=this.y,e.width=this.width,e.height=this.height,e},clone:function(e){return"undefined"==typeof e?e=new t.Ellipse(this.x,this.y,this.width,this.height):e.setTo(this.x,this.y,this.width,this.height),e},contains:function(e,n){return t.Ellipse.contains(this,e,n)},toString:function(){return"[{Phaser.Ellipse (x="+this.x+" y="+this.y+" width="+this.width+" height="+this.height+")}]"}},t.Ellipse.prototype.constructor=t.Ellipse,Object.defineProperty(t.Ellipse.prototype,"left",{get:function(){return this.x},set:function(e){this.x=e}}),Object.defineProperty(t.Ellipse.prototype,"right",{get:function(){return this.x+this.width},set:function(e){this.width=er+i},t.Ellipse.prototype.getBounds=function(){return new t.Rectangle(this.x,this.y,this.width,this.height)},PIXI.Ellipse=t.Ellipse,t.Polygon=function(e){if(this.type=t.POLYGON,e instanceof Array||(e=Array.prototype.slice.call(arguments)),"number"==typeof e[0]){for(var n=[],r=0,i=e.length;i>r;r+=2)n.push(new t.Point(e[r],e[r+1]));e=n}this.points=e},t.Polygon.prototype={clone:function(){for(var e=[],n=0;nt!=a>t&&(u-s)*(t-o)/(a-o)+s>e;f&&(n=!0)}return n}},t.Polygon.prototype.constructor=t.Polygon,PIXI.Polygon=t.Polygon,t.Camera=function(e,n,r,i,s,o){this.game=e,this.world=e.world,this.id=0,this.view=new t.Rectangle(r,i,s,o),this.screenView=new t.Rectangle(r,i,s,o),this.bounds=new t.Rectangle(r,i,s,o),this.deadzone=null,this.visible=!0,this.atLimit={x:!1,y:!1},this.target=null,this._edge=0,this.displayObject=null,this.scale=null},t.Camera.FOLLOW_LOCKON=0,t.Camera.FOLLOW_PLATFORMER=1,t.Camera.FOLLOW_TOPDOWN=2,t.Camera.FOLLOW_TOPDOWN_TIGHT=3,t.Camera.prototype={follow:function(e,n){"undefined"==typeof n&&(n=t.Camera.FOLLOW_LOCKON),this.target=e;var r;switch(n){case t.Camera.FOLLOW_PLATFORMER:var i=this.width/8,s=this.height/3;this.deadzone=new t.Rectangle((this.width-i)/2,(this.height-s)/2-.25*s,i,s);break;case t.Camera.FOLLOW_TOPDOWN:r=Math.max(this.width,this.height)/4,this.deadzone=new t.Rectangle((this.width-r)/2,(this.height-r)/2,r,r);break;case t.Camera.FOLLOW_TOPDOWN_TIGHT:r=Math.max(this.width,this.height)/8,this.deadzone=new t.Rectangle((this.width-r)/2,(this.height-r)/2,r,r);break;case t.Camera.FOLLOW_LOCKON:this.deadzone=null;break;default:this.deadzone=null}},focusOn:function(e){this.setPosition(Math.round(e.x-this.view.halfWidth),Math.round(e.y-this.view.halfHeight))},focusOnXY:function(e,t){this.setPosition(Math.round(e-this.view.halfWidth),Math.round(t-this.view.halfHeight))},update:function(){this.target&&this.updateTarget(),this.bounds&&this.checkBounds(),this.displayObject.position.x=-this.view.x,this.displayObject.position.y=-this.view.y},updateTarget:function(){this.deadzone?(this._edge=this.target.x-this.deadzone.x,this.view.x>this._edge&&(this.view.x=this._edge),this._edge=this.target.x+this.target.width-this.deadzone.x-this.deadzone.width,this.view.xthis._edge&&(this.view.y=this._edge),this._edge=this.target.y+this.target.height-this.deadzone.y-this.deadzone.height,this.view.y=this.bounds.right&&(this.atLimit.x=!0,this.view.x=this.bounds.right-this.width),this.view.y<=this.bounds.top&&(this.atLimit.y=!0,this.view.y=this.bounds.top),this.view.bottom>=this.bounds.bottom&&(this.atLimit.y=!0,this.view.y=this.bounds.bottom-this.height),this.view.floor()},setPosition:function(e,t){this.view.x=e,this.view.y=t,this.bounds&&this.checkBounds()},setSize:function(e,t){this.view.width=e,this.view.height=t},reset:function(){this.target=null,this.view.x=0,this.view.y=0}},t.Camera.prototype.constructor=t.Camera,Object.defineProperty(t.Camera.prototype,"x",{get:function(){return this.view.x},set:function(e){this.view.x=e,this.bounds&&this.checkBounds()}}),Object.defineProperty(t.Camera.prototype,"y",{get:function(){return this.view.y},set:function(e){this.view.y=e,this.bounds&&this.checkBounds()}}),Object.defineProperty(t.Camera.prototype,"width",{get:function(){return this.view.width},set:function(e){this.view.width=e}}),Object.defineProperty(t.Camera.prototype,"height",{get:function(){return this.view.height},set:function(e){this.view.height=e}}),t.State=function(){this.game=null,this.add=null,this.make=null,this.camera=null,this.cache=null,this.input=null,this.load=null,this.math=null,this.sound=null,this.scale=null,this.stage=null,this.time=null,this.tweens=null,this.world=null,this.particles=null,this.physics=null,this.rnd=null},t.State.prototype={preload:function(){},loadUpdate:function(){},loadRender:function(){},create:function(){},update:function(){},render:function(){},paused:function(){},shutdown:function(){}},t.State.prototype.constructor=t.State,t.StateManager=function(e,t){this.game=e,this.states={},this._pendingState=null,"undefined"!=typeof t&&null!==t&&(this._pendingState=t),this._clearWorld=!1,this._clearCache=!1,this._created=!1,this._args=[],this.current="",this.onInitCallback=null,this.onPreloadCallback=null,this.onCreateCallback=null,this.onUpdateCallback=null,this.onRenderCallback=null,this.onPreRenderCallback=null,this.onLoadUpdateCallback=null,this.onLoadRenderCallback=null,this.onPausedCallback=null,this.onResumedCallback=null,this.onShutDownCallback=null},t.StateManager.prototype={boot:function(){this.game.onPause.add(this.pause,this),this.game.onResume.add(this.resume,this),this.game.load.onLoadComplete.add(this.loadComplete,this),null!==this._pendingState&&("string"==typeof this._pendingState?this.start(this._pendingState,!1,!1):this.add("default",this._pendingState,!0))},add:function(e,n,r){"undefined"==typeof r&&(r=!1);var i;return n instanceof t.State?i=n:"object"==typeof n?(i=n,i.game=this.game):"function"==typeof n&&(i=new n(this.game)),this.states[e]=i,r&&(this.game.isBooted?this.start(e):this._pendingState=e),i},remove:function(e){this.current==e&&(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.onDestroyCallback=null),delete this.states[e]},start:function(e,t,n){"undefined"==typeof t&&(t=!0),"undefined"==typeof n&&(n=!1),this.checkState(e)&&(this._pendingState=e,this._clearWorld=t,this._clearCache=n,arguments.length>3&&(this._args=Array.prototype.splice.call(arguments,3)))},dummy:function(){},preUpdate:function(){this._pendingState&&this.game.isBooted&&(this.current&&(this.onShutDownCallback.call(this.callbackContext,this.game),this.game.tweens.removeAll(),this.game.camera.reset(),this.game.input.reset(!0),this.game.physics.clear(),this.game.time.removeAll(),this._clearWorld&&(this.game.world.shutdown(),this._clearCache===!0&&this.game.cache.destroy())),this.setCurrentState(this._pendingState),this.onPreloadCallback?(this.game.load.reset(),this.onPreloadCallback.call(this.callbackContext,this.game),0===this.game.load.totalQueuedFiles()?this.loadComplete():this.game.load.start()):this.loadComplete(),this.current===this._pendingState&&(this._pendingState=null))},checkState:function(e){if(this.states[e]){var t=!1;return this.states[e].preload&&(t=!0),this.states[e].create&&(t=!0),this.states[e].update&&(t=!0),this.states[e].render&&(t=!0),t===!1?(console.warn("Invalid Phaser State object given. Must contain at least a one of the required functions: preload, create, update or render"),!1):!0}return console.warn("Phaser.StateManager - No state found with the key: "+e),!1},link:function(e){this.states[e].game=this.game,this.states[e].add=this.game.add,this.states[e].make=this.game.make,this.states[e].camera=this.game.camera,this.states[e].cache=this.game.cache,this.states[e].input=this.game.input,this.states[e].load=this.game.load,this.states[e].math=this.game.math,this.states[e].sound=this.game.sound,this.states[e].scale=this.game.scale,this.states[e].state=this,this.states[e].stage=this.game.stage,this.states[e].time=this.game.time,this.states[e].tweens=this.game.tweens,this.states[e].world=this.game.world,this.states[e].particles=this.game.particles,this.states[e].rnd=this.game.rnd,this.states[e].physics=this.game.physics},setCurrentState:function(e){this.callbackContext=this.states[e],this.link(e),this.onInitCallback=this.states[e].init||this.dummy,this.onPreloadCallback=this.states[e].preload||null,this.onLoadRenderCallback=this.states[e].loadRender||null,this.onLoadUpdateCallback=this.states[e].loadUpdate||null,this.onCreateCallback=this.states[e].create||null,this.onUpdateCallback=this.states[e].update||null,this.onPreRenderCallback=this.states[e].preRender||null,this.onRenderCallback=this.states[e].render||null,this.onPausedCallback=this.states[e].paused||null,this.onResumedCallback=this.states[e].resumed||null,this.onShutDownCallback=this.states[e].shutdown||this.dummy,this.current=e,this._created=!1,this.onInitCallback.apply(this.callbackContext,this._args),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)},preRender:function(){this.onPreRenderCallback&&this.onPreRenderCallback.call(this.callbackContext,this.game)},render:function(){this._created&&this.onRenderCallback?(this.game.renderType===t.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===t.CANVAS&&this.game.context.restore()):this.onLoadRenderCallback&&this.onLoadRenderCallback.call(this.callbackContext,this.game)},destroy:function(){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.onDestroyCallback=null,this.game=null,this.states={},this._pendingState=null}},t.StateManager.prototype.constructor=t.StateManager,t.LinkedList=function(){this.next=null,this.prev=null,this.first=null,this.last=null,this.total=0},t.LinkedList.prototype={add:function(e){return 0===this.total&&null==this.first&&null==this.last?(this.first=e,this.last=e,this.next=e,e.prev=this,this.total++,e):(this.last.next=e,e.prev=this.last,this.last=e,this.total++,e)},remove:function(e){e==this.first?this.first=this.first.next:e==this.last&&(this.last=this.last.prev),e.prev&&(e.prev.next=e.next),e.next&&(e.next.prev=e.prev),e.next=e.prev=null,null==this.first&&(this.last=null),this.total--},callAll:function(e){if(this.first&&this.last){var t=this.first;do t&&t[e]&&t[e].call(t),t=t.next;while(t!=this.last.next)}}},t.LinkedList.prototype.constructor=t.LinkedList,t.Signal=function(){this._bindings=[],this._prevParams=null;var e=this;this.dispatch=function(){t.Signal.prototype.dispatch.apply(e,arguments)}},t.Signal.prototype={memorize:!1,_shouldPropagate:!0,active:!0,validateListener:function(e,t){if("function"!=typeof e)throw new Error("listener is a required param of {fn}() and should be a Function.".replace("{fn}",t))},_registerListener:function(e,n,r,i){var s,o=this._indexOfListener(e,r);if(-1!==o){if(s=this._bindings[o],s.isOnce()!==n)throw new Error("You cannot add"+(n?"":"Once")+"() then add"+(n?"Once":"")+"() the same listener without removing the relationship first.")}else s=new t.SignalBinding(this,e,n,r,i),this._addBinding(s);return this.memorize&&this._prevParams&&s.execute(this._prevParams),s},_addBinding:function(e){var t=this._bindings.length;do--t;while(this._bindings[t]&&e._priority<=this._bindings[t]._priority);this._bindings.splice(t+1,0,e)},_indexOfListener:function(e,t){for(var n,r=this._bindings.length;r--;)if(n=this._bindings[r],n._listener===e&&n.context===t)return r;return-1},has:function(e,t){return-1!==this._indexOfListener(e,t)},add:function(e,t,n){return this.validateListener(e,"add"),this._registerListener(e,!1,t,n)},addOnce:function(e,t,n){return this.validateListener(e,"addOnce"),this._registerListener(e,!0,t,n)},remove:function(e,t){this.validateListener(e,"remove");var n=this._indexOfListener(e,t);return-1!==n&&(this._bindings[n]._destroy(),this._bindings.splice(n,1)),e},removeAll:function(){for(var e=this._bindings.length;e--;)this._bindings[e]._destroy();this._bindings.length=0},getNumListeners:function(){return this._bindings.length},halt:function(){this._shouldPropagate=!1},dispatch:function(){if(this.active){var e,t=Array.prototype.slice.call(arguments),n=this._bindings.length;if(this.memorize&&(this._prevParams=t),n){e=this._bindings.slice(),this._shouldPropagate=!0;do n--;while(e[n]&&this._shouldPropagate&&e[n].execute(t)!==!1)}}},forget:function(){this._prevParams=null},dispose:function(){this.removeAll(),delete this._bindings,delete this._prevParams},toString:function(){return"[Phaser.Signal active:"+this.active+" numListeners:"+this.getNumListeners()+"]"}},t.Signal.prototype.constructor=t.Signal,t.SignalBinding=function(e,t,n,r,i){this._listener=t,this._isOnce=n,this.context=r,this._signal=e,this._priority=i||0},t.SignalBinding.prototype={active:!0,params:null,execute:function(e){var t,n;return this.active&&this._listener&&(n=this.params?this.params.concat(e):e,t=this._listener.apply(this.context,n),this._isOnce&&this.detach()),t},detach:function(){return this.isBound()?this._signal.remove(this._listener,this.context):null},isBound:function(){return!!this._signal&&!!this._listener},isOnce:function(){return this._isOnce},getListener:function(){return this._listener},getSignal:function(){return this._signal},_destroy:function(){delete this._signal,delete this._listener,delete this.context},toString:function(){return"[Phaser.SignalBinding isOnce:"+this._isOnce+", isBound:"+this.isBound()+", active:"+this.active+"]"}},t.SignalBinding.prototype.constructor=t.SignalBinding,t.Filter=function(e,n,r){this.game=e,this.type=t.WEBGL_FILTER,this.passes=[this],this.shaders=[],this.dirty=!0,this.padding=0,this.uniforms={time:{type:"1f",value:0},resolution:{type:"2f",value:{x:256,y:256}},mouse:{type:"2f",value:{x:0,y:0}}},this.fragmentSrc=r||[]},t.Filter.prototype={init:function(){},setResolution:function(e,t){this.uniforms.resolution.value.x=e,this.uniforms.resolution.value.y=t},update:function(e){"undefined"!=typeof e&&(e.x>0&&(this.uniforms.mouse.x=e.x.toFixed(2)),e.y>0&&(this.uniforms.mouse.y=e.y.toFixed(2))),this.uniforms.time.value=this.game.time.totalElapsedSeconds()},destroy:function(){this.game=null}},t.Filter.prototype.constructor=t.Filter,Object.defineProperty(t.Filter.prototype,"width",{get:function(){return this.uniforms.resolution.value.x},set:function(e){this.uniforms.resolution.value.x=e}}),Object.defineProperty(t.Filter.prototype,"height",{get:function(){return this.uniforms.resolution.value.y},set:function(e){this.uniforms.resolution.value.y=e}}),t.Plugin=function(e,t){"undefined"==typeof t&&(t=null),this.game=e,this.parent=t,this.active=!1,this.visible=!1,this.hasPreUpdate=!1,this.hasUpdate=!1,this.hasPostUpdate=!1,this.hasRender=!1,this.hasPostRender=!1},t.Plugin.prototype={preUpdate:function(){},update:function(){},render:function(){},postRender:function(){},destroy:function(){this.game=null,this.parent=null,this.active=!1,this.visible=!1}},t.Plugin.prototype.constructor=t.Plugin,t.PluginManager=function(e,t){this.game=e,this._parent=t,this.plugins=[],this._pluginsLength=0},t.PluginManager.prototype={add:function(e){var t=!1;return"function"==typeof e?e=new e(this.game,this._parent):(e.game=this.game,e.parent=this._parent),"function"==typeof e.preUpdate&&(e.hasPreUpdate=!0,t=!0),"function"==typeof e.update&&(e.hasUpdate=!0,t=!0),"function"==typeof e.postUpdate&&(e.hasPostUpdate=!0,t=!0),"function"==typeof e.render&&(e.hasRender=!0,t=!0),"function"==typeof e.postRender&&(e.hasPostRender=!0,t=!0),t?((e.hasPreUpdate||e.hasUpdate||e.hasPostUpdate)&&(e.active=!0),(e.hasRender||e.hasPostRender)&&(e.visible=!0),this._pluginsLength=this.plugins.push(e),"function"==typeof e.init&&e.init(),e):null},remove:function(e){if(0!==this._pluginsLength)for(this._p=0;this._pt;t++)this.children[t].preUpdate()},t.Stage.prototype.update=function(){for(var e=this.children.length;e--;)this.children[e].update()},t.Stage.prototype.postUpdate=function(){if(this.game.world.camera.target){this.game.world.camera.target.postUpdate(),this.game.world.camera.update();for(var e=this.children.length;e--;)this.children[e]!==this.game.world.camera.target&&this.children[e].postUpdate()}else{this.game.world.camera.update();for(var e=this.children.length;e--;)this.children[e].postUpdate()}this.checkOffsetInterval!==!1&&this.game.time.now>this._nextOffsetCheck&&(t.Canvas.getOffset(this.game.canvas,this.offset),this._nextOffsetCheck=this.game.time.now+this.checkOffsetInterval)},t.Stage.prototype.parseConfig=function(e){this.game.canvas=e.canvasID?t.Canvas.create(this.game.width,this.game.height,e.canvasID):t.Canvas.create(this.game.width,this.game.height),e.canvasStyle?this.game.canvas.stlye=e.canvasStyle:this.game.canvas.style["-webkit-full-screen"]="width: 100%; height: 100%",e.checkOffsetInterval&&(this.checkOffsetInterval=e.checkOffsetInterval),e.disableVisibilityChange&&(this.disableVisibilityChange=e.disableVisibilityChange),e.fullScreenScaleMode&&(this.fullScreenScaleMode=e.fullScreenScaleMode),e.scaleMode&&(this.scaleMode=e.scaleMode),e.backgroundColor&&(this.backgroundColor=e.backgroundColor)},t.Stage.prototype.boot=function(){t.Canvas.getOffset(this.game.canvas,this.offset),this.bounds=new t.Rectangle(this.offset.x,this.offset.y,this.game.width,this.game.height);var e=this;this._onChange=function(t){return e.visibilityChange(t)},t.Canvas.setUserSelect(this.game.canvas,"none"),t.Canvas.setTouchAction(this.game.canvas,"none"),this.checkVisibility()},t.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?"visibilitychange":null,this._hiddenVar&&document.addEventListener(this._hiddenVar,this._onChange,!1),window.onpagehide=this._onChange,window.onpageshow=this._onChange,window.onblur=this._onChange,window.onfocus=this._onChange},t.Stage.prototype.visibilityChange=function(e){return this.disableVisibilityChange?void 0:"pagehide"===e.type||"blur"===e.type||"pageshow"===e.type||"focus"===e.type?void ("pagehide"===e.type||"blur"===e.type?this.game.focusLoss(e):("pageshow"===e.type||"focus"===e.type)&&this.game.focusGain(e)):void (document.hidden||document.mozHidden||document.msHidden||document.webkitHidden?this.game.gamePaused(e):this.game.gameResumed(e))},t.Stage.prototype.setBackgroundColor=function(e){this._backgroundColor=e||0,this.backgroundColorSplit=PIXI.hex2rgb(this.backgroundColor);var t=this._backgroundColor.toString(16);t="000000".substr(0,6-t.length)+t,this.backgroundColorString="#"+t},Object.defineProperty(t.Stage.prototype,"backgroundColor",{get:function(){return this._backgroundColor},set:function(e){this._backgroundColor=e,this.game.transparent===!1&&("string"==typeof e&&(e=t.Color.hexToRGB(e)),this.setBackgroundColor(e))}}),Object.defineProperty(t.Stage.prototype,"smoothed",{get:function(){return!PIXI.scaleModes.LINEAR},set:function(e){PIXI.scaleModes.LINEAR=e?0:1}}),t.Group=function(e,n,r,i,s,o){"undefined"==typeof i&&(i=!1),"undefined"==typeof s&&(s=!1),"undefined"==typeof o&&(o=t.Physics.ARCADE),this.game=e,"undefined"==typeof n&&(n=e.world),this.name=r||"group",PIXI.DisplayObjectContainer.call(this),i?this.game.stage.addChild(this):n&&n.addChild(this),this.z=0,this.type=t.GROUP,this.alive=!0,this.exists=!0,this.scale=new t.Point(1,1),this.cursor=null,this.cameraOffset=new t.Point,this.enableBody=s,this.enableBodyDebug=!1,this.physicsBodyType=o,this._sortProperty="z",this._cache=[0,0,0,0,1,0,1,0,0,0]},t.Group.prototype=Object.create(PIXI.DisplayObjectContainer.prototype),t.Group.prototype.constructor=t.Group,t.Group.RETURN_NONE=0,t.Group.RETURN_TOTAL=1,t.Group.RETURN_CHILD=2,t.Group.SORT_ASCENDING=-1,t.Group.SORT_DESCENDING=1,t.Group.prototype.add=function(e){return e.parent!==this&&(this.enableBody&&this.game.physics.enable(e,this.physicsBodyType),this.addChild(e),e.z=this.children.length,e.events&&e.events.onAddedToGroup.dispatch(e,this),null===this.cursor&&(this.cursor=e)),e},t.Group.prototype.addAt=function(e,t){return e.parent!==this&&(this.enableBody&&this.game.physics.enable(e,this.physicsBodyType),this.addChildAt(e,t),this.updateZ(),e.events&&e.events.onAddedToGroup.dispatch(e,this),null===this.cursor&&(this.cursor=e)),e},t.Group.prototype.getAt=function(e){return 0>e||e>=this.children.length?-1:this.getChildAt(e)},t.Group.prototype.create=function(e,n,r,i,s){"undefined"==typeof s&&(s=!0);var o=new t.Sprite(this.game,e,n,r,i);return this.enableBody&&this.game.physics.enable(o,this.physicsBodyType),o.exists=s,o.visible=s,o.alive=s,this.addChild(o),o.z=this.children.length,o.events&&o.events.onAddedToGroup.dispatch(o,this),null===this.cursor&&(this.cursor=o),o},t.Group.prototype.createMultiple=function(e,t,n,r){"undefined"==typeof r&&(r=!1);for(var i=0;e>i;i++)this.create(0,0,t,n,r)},t.Group.prototype.updateZ=function(){for(var e=this.children.length;e--;)this.children[e].z=e},t.Group.prototype.next=function(){this.cursor&&(this._cache[8]===this.children.length?this._cache[8]=0:this._cache[8]++,this.cursor=this.children[this._cache[8]])},t.Group.prototype.previous=function(){this.cursor&&(0===this._cache[8]?this._cache[8]=this.children.length-1:this._cache[8]--,this.cursor=this.children[this._cache[8]])},t.Group.prototype.swap=function(e,t){var n=this.swapChildren(e,t);return n&&this.updateZ(),n},t.Group.prototype.bringToTop=function(e){return e.parent===this&&this.getIndex(e)0&&(this.remove(e),this.addAt(e,0)),e},t.Group.prototype.moveUp=function(e){if(e.parent===this&&this.getIndex(e)0){var t=this.getIndex(e),n=this.getAt(t-1);n&&this.swap(t,n)}return e},t.Group.prototype.xy=function(e,t,n){return 0>e||e>this.children.length?-1:(this.getChildAt(e).x=t,void (this.getChildAt(e).y=n))},t.Group.prototype.reverse=function(){this.children.reverse(),this.updateZ()},t.Group.prototype.getIndex=function(e){return this.children.indexOf(e)},t.Group.prototype.replace=function(e,n){var r=this.getIndex(e);if(-1!==r){void 0!==n.parent&&(n.events.onRemovedFromGroup.dispatch(n,this),n.parent.removeChild(n),n.parent instanceof t.Group&&n.parent.updateZ());var i=e;return this.remove(i),this.addAt(n,r),i}},t.Group.prototype.setProperty=function(e,t,n,r){r=r||0;var i=t.length;1==i?0===r?e[t[0]]=n:1==r?e[t[0]]+=n:2==r?e[t[0]]-=n:3==r?e[t[0]]*=n:4==r&&(e[t[0]]/=n):2==i?0===r?e[t[0]][t[1]]=n:1==r?e[t[0]][t[1]]+=n:2==r?e[t[0]][t[1]]-=n:3==r?e[t[0]][t[1]]*=n:4==r&&(e[t[0]][t[1]]/=n):3==i?0===r?e[t[0]][t[1]][t[2]]=n:1==r?e[t[0]][t[1]][t[2]]+=n:2==r?e[t[0]][t[1]][t[2]]-=n:3==r?e[t[0]][t[1]][t[2]]*=n:4==r&&(e[t[0]][t[1]][t[2]]/=n):4==i&&(0===r?e[t[0]][t[1]][t[2]][t[3]]=n:1==r?e[t[0]][t[1]][t[2]][t[3]]+=n:2==r?e[t[0]][t[1]][t[2]][t[3]]-=n:3==r?e[t[0]][t[1]][t[2]][t[3]]*=n:4==r&&(e[t[0]][t[1]][t[2]][t[3]]/=n))},t.Group.prototype.set=function(e,t,n,r,i,s){t=t.split("."),"undefined"==typeof r&&(r=!1),"undefined"==typeof i&&(i=!1),(r===!1||r&&e.alive)&&(i===!1||i&&e.visible)&&this.setProperty(e,t,n,s)},t.Group.prototype.setAll=function(e,t,n,r,i){e=e.split("."),"undefined"==typeof n&&(n=!1),"undefined"==typeof r&&(r=!1),i=i||0;for(var s=0,o=this.children.length;o>s;s++)(!n||n&&this.children[s].alive)&&(!r||r&&this.children[s].visible)&&this.setProperty(this.children[s],e,t,i)},t.Group.prototype.setAllChildren=function(e,n,r,i,s){"undefined"==typeof r&&(r=!1),"undefined"==typeof i&&(i=!1),s=s||0;for(var o=0,u=this.children.length;u>o;o++)(!r||r&&this.children[o].alive)&&(!i||i&&this.children[o].visible)&&(this.children[o]instanceof t.Group?this.children[o].setAllChildren(e,n,r,i,s):this.setProperty(this.children[o],e.split("."),n,s))},t.Group.prototype.addAll=function(e,t,n,r){this.setAll(e,t,n,r,1)},t.Group.prototype.subAll=function(e,t,n,r){this.setAll(e,t,n,r,2)},t.Group.prototype.multiplyAll=function(e,t,n,r){this.setAll(e,t,n,r,3)},t.Group.prototype.divideAll=function(e,t,n,r){this.setAll(e,t,n,r,4)},t.Group.prototype.callAllExists=function(e,t){for(var n=Array.prototype.splice.call(arguments,2),r=0,i=this.children.length;i>r;r++)this.children[r].exists===t&&this.children[r][e]&&this.children[r][e].apply(this.children[r],n)},t.Group.prototype.callbackFromArray=function(e,t,n){if(1==n){if(e[t[0]])return e[t[0]]}else if(2==n){if(e[t[0]][t[1]])return e[t[0]][t[1]]}else if(3==n){if(e[t[0]][t[1]][t[2]])return e[t[0]][t[1]][t[2]]}else if(4==n){if(e[t[0]][t[1]][t[2]][t[3]])return e[t[0]][t[1]][t[2]][t[3]]}else if(e[t])return e[t];return!1},t.Group.prototype.callAll=function(e,t){if("undefined"!=typeof e){e=e.split(".");var n=e.length;if("undefined"==typeof t||null===t||""===t)t=null;else if("string"==typeof t){t=t.split(".");var r=t.length}for(var i=Array.prototype.splice.call(arguments,2),s=null,o=null,u=0,a=this.children.length;a>u;u++)s=this.callbackFromArray(this.children[u],e,n),t&&s?(o=this.callbackFromArray(this.children[u],t,r),s&&s.apply(o,i)):s&&s.apply(this.children[u],i)}},t.Group.prototype.preUpdate=function(){if(!this.exists||!this.parent.exists)return this.renderOrderID=-1,!1;for(var e=this.children.length;e--;)this.children[e].preUpdate();return!0},t.Group.prototype.update=function(){for(var e=this.children.length;e--;)this.children[e].update()},t.Group.prototype.postUpdate=function(){1===this._cache[7]&&(this.x=this.game.camera.view.x+this.cameraOffset.x,this.y=this.game.camera.view.y+this.cameraOffset.y);for(var e=this.children.length;e--;)this.children[e].postUpdate()},t.Group.prototype.forEach=function(e,t,n){"undefined"==typeof n&&(n=!1);var r=Array.prototype.splice.call(arguments,3);r.unshift(null);for(var i=0,s=this.children.length;s>i;i++)(!n||n&&this.children[i].exists)&&(r[0]=this.children[i],e.apply(t,r))},t.Group.prototype.forEachExists=function(e,n){var r=Array.prototype.splice.call(arguments,2);r.unshift(null),this.iterate("exists",!0,t.Group.RETURN_TOTAL,e,n,r)},t.Group.prototype.forEachAlive=function(e,n){var r=Array.prototype.splice.call(arguments,2);r.unshift(null),this.iterate("alive",!0,t.Group.RETURN_TOTAL,e,n,r)},t.Group.prototype.forEachDead=function(e,n){var r=Array.prototype.splice.call(arguments,2);r.unshift(null),this.iterate("alive",!1,t.Group.RETURN_TOTAL,e,n,r)},t.Group.prototype.sort=function(e,n){this.children.length<2||("undefined"==typeof e&&(e="z"),"undefined"==typeof n&&(n=t.Group.SORT_ASCENDING),this._sortProperty=e,this.children.sort(n===t.Group.SORT_ASCENDING?this.ascendingSortHandler.bind(this):this.descendingSortHandler.bind(this)),this.updateZ())},t.Group.prototype.ascendingSortHandler=function(e,t){return e[this._sortProperty]t[this._sortProperty]?1:e.zt[this._sortProperty]?-1:0},t.Group.prototype.iterate=function(e,n,r,i,s,o){if(r===t.Group.RETURN_TOTAL&&0===this.children.length)return 0;"undefined"==typeof i&&(i=!1);for(var u=0,a=0,f=this.children.length;f>a;a++)if(this.children[a][e]===n&&(u++,i&&(o[0]=this.children[a],i.apply(s,o)),r===t.Group.RETURN_CHILD))return this.children[a];return r===t.Group.RETURN_TOTAL?u:r===t.Group.RETURN_CHILD?null:void 0},t.Group.prototype.getFirstExists=function(e){return"boolean"!=typeof e&&(e=!0),this.iterate("exists",e,t.Group.RETURN_CHILD)},t.Group.prototype.getFirstAlive=function(){return this.iterate("alive",!0,t.Group.RETURN_CHILD)},t.Group.prototype.getFirstDead=function(){return this.iterate("alive",!1,t.Group.RETURN_CHILD)},t.Group.prototype.getTop=function(){return this.children.length>0?this.children[this.children.length-1]:void 0},t.Group.prototype.getBottom=function(){return this.children.length>0?this.children[0]:void 0},t.Group.prototype.countLiving=function(){return this.iterate("alive",!0,t.Group.RETURN_TOTAL)},t.Group.prototype.countDead=function(){return this.iterate("alive",!1,t.Group.RETURN_TOTAL)},t.Group.prototype.getRandom=function(e,t){return 0===this.children.length?null:(e=e||0,t=t||this.children.length,this.game.math.getRandom(this.children,e,t))},t.Group.prototype.remove=function(e){return 0!==this.children.length?(e.events&&e.events.onRemovedFromGroup.dispatch(e,this),this.removeChild(e),this.updateZ(),this.cursor===e&&this.next(),!0):void 0},t.Group.prototype.removeAll=function(){if(0!==this.children.length){do this.children[0].events&&this.children[0].events.onRemovedFromGroup.dispatch(this.children[0],this),this.removeChild(this.children[0]);while(this.children.length>0);this.cursor=null}},t.Group.prototype.removeBetween=function(e,t){if(0!==this.children.length){if(e>t||0>e||t>this.children.length)return!1;for(var n=e;t>n;n++)this.children[n].events&&this.children[n].events.onRemovedFromGroup.dispatch(this.children[n],this),this.removeChild(this.children[n]),this.cursor===this.children[n]&&(this.cursor=null);this.updateZ()}},t.Group.prototype.destroy=function(e,t){if(null!==this.game){if("undefined"==typeof e&&(e=!0),"undefined"==typeof t&&(t=!1),e){if(this.children.length>0)do this.children[0].parent&&this.children[0].destroy(e);while(this.children.length>0)}else this.removeAll();this.cursor=null,t||(this.parent.removeChild(this),this.game=null,this.exists=!1)}},Object.defineProperty(t.Group.prototype,"total",{get:function(){return this.iterate("exists",!0,t.Group.RETURN_TOTAL)}}),Object.defineProperty(t.Group.prototype,"length",{get:function(){return this.children.length}}),Object.defineProperty(t.Group.prototype,"angle",{get:function(){return t.Math.radToDeg(this.rotation)},set:function(e){this.rotation=t.Math.degToRad(e)}}),Object.defineProperty(t.Group.prototype,"fixedToCamera",{get:function(){return!!this._cache[7]},set:function(e){e?(this._cache[7]=1,this.cameraOffset.set(this.x,this.y)):this._cache[7]=0}}),t.World=function(e){t.Group.call(this,e,null,"__world",!1),this.bounds=new t.Rectangle(0,0,e.width,e.height),this.camera=null},t.World.prototype=Object.create(t.Group.prototype),t.World.prototype.constructor=t.World,t.World.prototype.boot=function(){this.camera=new t.Camera(this.game,0,0,0,this.game.width,this.game.height),this.camera.displayObject=this,this.camera.scale=this.scale,this.game.camera=this.camera,this.game.stage.addChild(this)},t.World.prototype.setBounds=function(e,t,n,r){nwindow.outerHeight&&(this.orientation=90),this.scaleFactor=new t.Point(1,1),this.scaleFactorInversed=new t.Point(1,1),this.margin=new t.Point(0,0),this.aspectRatio=0,this.sourceAspectRatio=n/r,this.event=null,this.scaleMode=t.ScaleManager.NO_SCALE,this.fullScreenScaleMode=t.ScaleManager.NO_SCALE,this._startHeight=0,this._width=0,this._height=0;var i=this;window.addEventListener("orientationchange",function(e){return i.checkOrientation(e)},!1),window.addEventListener("resize",function(e){return i.checkResize(e)},!1),document.addEventListener("webkitfullscreenchange",function(e){return i.fullScreenChange(e)},!1),document.addEventListener("mozfullscreenchange",function(e){return i.fullScreenChange(e)},!1),document.addEventListener("fullscreenchange",function(e){return i.fullScreenChange(e)},!1)},t.ScaleManager.EXACT_FIT=0,t.ScaleManager.NO_SCALE=1,t.ScaleManager.SHOW_ALL=2,t.ScaleManager.prototype={startFullScreen:function(e){!this.isFullScreen&&this.game.device.fullscreen&&("undefined"!=typeof e&&this.game.renderType===t.CANVAS&&(this.game.stage.smoothed=e),this._width=this.width,this._height=this.height,this.game.device.fullscreenKeyboard?this.fullScreenTarget[this.game.device.requestFullscreen](Element.ALLOW_KEYBOARD_INPUT):this.fullScreenTarget[this.game.device.requestFullscreen]())},stopFullScreen:function(){this.fullScreenTarget[this.game.device.cancelFullscreen]()},fullScreenChange:function(e){this.event=e,this.isFullScreen?(this.fullScreenScaleMode===t.ScaleManager.EXACT_FIT?(this.fullScreenTarget.style.width="100%",this.fullScreenTarget.style.height="100%",this.width=window.outerWidth,this.height=window.outerHeight,this.game.input.scale.setTo(this.game.width/this.width,this.game.height/this.height),this.aspectRatio=this.width/this.height,this.scaleFactor.x=this.game.width/this.width,this.scaleFactor.y=this.game.height/this.height,this.checkResize()):this.fullScreenScaleMode===t.ScaleManager.SHOW_ALL&&(this.setShowAll(),this.refresh()),this.enterFullScreen.dispatch(this.width,this.height)):(this.fullScreenTarget.style.width=this.game.width+"px",this.fullScreenTarget.style.height=this.game.height+"px",this.width=this._width,this.height=this._height,this.game.input.scale.setTo(this.game.width/this.width,this.game.height/this.height),this.aspectRatio=this.width/this.height,this.scaleFactor.x=this.game.width/this.width,this.scaleFactor.y=this.game.height/this.height,this.leaveFullScreen.dispatch(this.width,this.height))},forceOrientation:function(e,n,r){"undefined"==typeof n&&(n=!1),this.forceLandscape=e,this.forcePortrait=n,"undefined"!=typeof r&&((null==r||this.game.cache.checkImageKey(r)===!1)&&(r="__default"),this.orientationSprite=new t.Image(this.game,this.game.width/2,this.game.height/2,PIXI.TextureCache[r]),this.orientationSprite.anchor.set(.5),this.checkOrientationState(),this.incorrectOrientation?(this.orientationSprite.visible=!0,this.game.world.visible=!1):(this.orientationSprite.visible=!1,this.game.world.visible=!0),this.game.stage.addChild(this.orientationSprite))},checkOrientationState:function(){this.incorrectOrientation?(this.forceLandscape&&window.innerWidth>window.innerHeight||this.forcePortrait&&window.innerHeight>window.innerWidth)&&(this.incorrectOrientation=!1,this.leaveIncorrectOrientation.dispatch(),this.orientationSprite&&(this.orientationSprite.visible=!1,this.game.world.visible=!0),this.scaleMode!==t.ScaleManager.NO_SCALE&&this.refresh()):(this.forceLandscape&&window.innerWidthwindow.outerHeight?90:0,this.isLandscape?this.enterLandscape.dispatch(this.orientation,!0,!1):this.enterPortrait.dispatch(this.orientation,!1,!0),this.scaleMode!==t.ScaleManager.NO_SCALE&&this.refresh(),this.checkOrientationState()},refresh:function(){if(this.game.device.iPad===!1&&this.game.device.webApp===!1&&this.game.device.desktop===!1&&(this.game.device.android&&this.game.device.chrome===!1?window.scrollTo(0,1):window.scrollTo(0,0)),null==this._check&&this.maxIterations>0){this._iterations=this.maxIterations;var e=this;this._check=window.setInterval(function(){return e.setScreenSize()},10),this.setScreenSize()}},setScreenSize:function(e){"undefined"==typeof e&&(e=!1),this.game.device.iPad===!1&&this.game.device.webApp===!1&&this.game.device.desktop===!1&&(this.game.device.android&&this.game.device.chrome===!1?window.scrollTo(0,1):window.scrollTo(0,0)),this._iterations--,(e||window.innerHeight>this._startHeight||this._iterations<0)&&(document.documentElement.style.minHeight=window.innerHeight+"px",this.incorrectOrientation===!0?this.setMaximum():this.isFullScreen?this.fullScreenScaleMode==t.ScaleManager.EXACT_FIT?this.setExactFit():this.fullScreenScaleMode==t.ScaleManager.SHOW_ALL&&this.setShowAll():this.scaleMode==t.ScaleManager.EXACT_FIT?this.setExactFit():this.scaleMode==t.ScaleManager.SHOW_ALL&&this.setShowAll(),this.setSize(),clearInterval(this._check),this._check=null)},setSize:function(){this.incorrectOrientation===!1&&(this.maxWidth&&this.width>this.maxWidth&&(this.width=this.maxWidth),this.maxHeight&&this.height>this.maxHeight&&(this.height=this.maxHeight),this.minWidth&&this.widththis.maxWidth?this.maxWidth:e,this.height=this.maxHeight&&t>this.maxHeight?this.maxHeight:t}},t.ScaleManager.prototype.constructor=t.ScaleManager,Object.defineProperty(t.ScaleManager.prototype,"isFullScreen",{get:function(){return document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement}}),Object.defineProperty(t.ScaleManager.prototype,"isPortrait",{get:function(){return 0===this.orientation||180==this.orientation}}),Object.defineProperty(t.ScaleManager.prototype,"isLandscape",{get:function(){return 90===this.orientation||-90===this.orientation}}),t.Game=function(e,n,r,i,s,o,u,a){this.id=t.GAMES.push(this)-1,this.config=null,this.physicsConfig=a,this.parent="",this.width=800,this.height=600,this.transparent=!1,this.antialias=!0,this.renderer=t.AUTO,this.renderType=t.AUTO,this.state=null,this.isBooted=!1,this.isRunning=!1,this.raf=null,this.add=null,this.make=null,this.cache=null,this.input=null,this.load=null,this.math=null,this.net=null,this.scale=null,this.sound=null,this.stage=null,this.time=null,this.tweens=null,this.world=null,this.physics=null,this.rnd=null,this.device=null,this.camera=null,this.canvas=null,this.context=null,this.debug=null,this.particles=null,this.stepping=!1,this.pendingStep=!1,this.stepCount=0,this.onPause=null,this.onResume=null,this.onBlur=null,this.onFocus=null,this._paused=!1,this._codePaused=!1,1===arguments.length&&"object"==typeof arguments[0]?this.parseConfig(arguments[0]):("undefined"!=typeof e&&(this.width=e),"undefined"!=typeof n&&(this.height=n),"undefined"!=typeof r&&(this.renderer=r,this.renderType=r),"undefined"!=typeof i&&(this.parent=i),"undefined"!=typeof o&&(this.transparent=o),"undefined"!=typeof u&&(this.antialias=u),this.rnd=new t.RandomDataGenerator([(Date.now()*Math.random()).toString()]),this.state=new t.StateManager(this,s));var f=this;return this._onBoot=function(){return f.boot()},"complete"===document.readyState||"interactive"===document.readyState?window.setTimeout(this._onBoot,0):(document.addEventListener("DOMContentLoaded",this._onBoot,!1),window.addEventListener("load",this._onBoot,!1)),this},t.Game.prototype={parseConfig:function(e){this.config=e,e.width&&(this.width=t.Utils.parseDimension(e.width,0)),e.height&&(this.height=t.Utils.parseDimension(e.height,1)),e.renderer&&(this.renderer=e.renderer,this.renderType=e.renderer),e.parent&&(this.parent=e.parent),e.transparent&&(this.transparent=e.transparent),e.antialias&&(this.antialias=e.antialias),e.physicsConfig&&(this.physicsConfig=e.physicsConfig);var n=[(Date.now()*Math.random()).toString()];e.seed&&(n=e.seed),this.rnd=new t.RandomDataGenerator(n);var r=null;e.state&&(r=e.state),this.state=new t.StateManager(this,r)},boot:function(){this.isBooted||(document.body?(document.removeEventListener("DOMContentLoaded",this._onBoot),window.removeEventListener("load",this._onBoot),this.onPause=new t.Signal,this.onResume=new t.Signal,this.onBlur=new t.Signal,this.onFocus=new t.Signal,this.isBooted=!0,this.device=new t.Device(this),this.math=t.Math,this.stage=new t.Stage(this,this.width,this.height),this.scale=new t.ScaleManager(this,this.width,this.height),this.setUpRenderer(),this.device.checkFullScreenSupport(),this.world=new t.World(this),this.add=new t.GameObjectFactory(this),this.make=new t.GameObjectCreator(this),this.cache=new t.Cache(this),this.load=new t.Loader(this),this.time=new t.Time(this),this.tweens=new t.TweenManager(this),this.input=new t.Input(this),this.sound=new t.SoundManager(this),this.physics=new t.Physics(this,this.physicsConfig),this.particles=new t.Particles(this),this.plugins=new t.PluginManager(this,this),this.net=new t.Net(this),this.debug=new t.Utils.Debug(this),this.time.boot(),this.stage.boot(),this.world.boot(),this.input.boot(),this.sound.boot(),this.state.boot(),this.debug.boot(),this.showDebugHeader(),this.isRunning=!0,this.raf=this.config&&this.config.forceSetTimeOut?new t.RequestAnimationFrame(this,this.config.forceSetTimeOut):new t.RequestAnimationFrame(this,!1),this.raf.start()):window.setTimeout(this._onBoot,20))},showDebugHeader:function(){var e=t.DEV_VERSION,n="Canvas",r="HTML Audio",i=1;if(this.renderType===t.WEBGL?(n="WebGL",i++):this.renderType==t.HEADLESS&&(n="Headless"),this.device.webAudio&&(r="WebAudio",i++),this.device.chrome){for(var s=["%c %c %c Phaser v"+e+" - "+n+" - "+r+" %c %c http://phaser.io %c %c ♥%c♥%c♥ ","background: #0cf300","background: #00bc17","color: #ffffff; background: #00711f;","background: #00bc17","background: #0cf300","background: #00bc17"],o=0;3>o;o++)s.push(i>o?"color: #ff2424; background: #fff":"color: #959595; background: #fff");console.log.apply(console,s)}else console.log("Phaser v"+e+" - Renderer: "+n+" - Audio: "+r+" - http://phaser.io")},setUpRenderer:function(){if(this.device.trident&&(this.renderType=t.CANVAS),this.renderType===t.HEADLESS||this.renderType===t.CANVAS||this.renderType===t.AUTO&&this.device.webGL===!1){if(!this.device.canvas)throw new Error("Phaser.Game - cannot create Canvas or WebGL context, aborting.");this.renderType===t.AUTO&&(this.renderType=t.CANVAS),this.renderer=new PIXI.CanvasRenderer(this.width,this.height,this.canvas,this.transparent),this.context=this.renderer.context}else this.renderType=t.WEBGL,this.renderer=new PIXI.WebGLRenderer(this.width,this.height,this.canvas,this.transparent,this.antialias),this.context=null;this.renderType!==t.HEADLESS&&(this.stage.smoothed=this.antialias,t.Canvas.addToDOM(this.canvas,this.parent,!0),t.Canvas.setTouchAction(this.canvas))},update:function(e){this.time.update(e),this._paused||this.pendingStep?this.debug.preUpdate():(this.stepping&&(this.pendingStep=!0),this.debug.preUpdate(),this.physics.preUpdate(),this.state.preUpdate(),this.plugins.preUpdate(),this.stage.preUpdate(),this.stage.update(),this.tweens.update(),this.sound.update(),this.input.update(),this.state.update(),this.physics.update(),this.particles.update(),this.plugins.update(),this.stage.postUpdate(),this.plugins.postUpdate()),this.renderType!=t.HEADLESS&&(this.renderer.render(this.stage),this.plugins.render(),this.state.render(),this.plugins.postRender())},enableStep:function(){this.stepping=!0,this.pendingStep=!1,this.stepCount=0},disableStep:function(){this.stepping=!1,this.pendingStep=!1},step:function(){this.pendingStep=!1,this.stepCount++},destroy:function(){this.raf.stop(),this.input.destroy(),this.state.destroy(),this.physics.destroy(),this.state=null,this.cache=null,this.input=null,this.load=null,this.sound=null,this.stage=null,this.time=null,this.world=null,this.isBooted=!1},gamePaused:function(e){this._paused||(this._paused=!0,this.time.gamePaused(),this.sound.setMute(),this.onPause.dispatch(e))},gameResumed:function(e){this._paused&&!this._codePaused&&(this._paused=!1,this.time.gameResumed(),this.input.reset(),this.sound.unsetMute(),this.onResume.dispatch(e))},focusLoss:function(e){this.onBlur.dispatch(e),this.gamePaused(e)},focusGain:function(e){this.onFocus.dispatch(e),this.gameResumed(e)}},t.Game.prototype.constructor=t.Game,Object.defineProperty(t.Game.prototype,"paused",{get:function(){return this._paused},set:function(e){e===!0?this._paused===!1&&(this._paused=!0,this._codePaused=!0,this.sound.mute=!0,this.time.gamePaused(),this.onPause.dispatch(this)):this._paused&&(this._paused=!1,this._codePaused=!1,this.input.reset(),this.sound.mute=!1,this.time.gameResumed(),this.onResume.dispatch(this))}}),t.Input=function(e){this.game=e,this.hitCanvas=null,this.hitContext=null,this.moveCallback=null,this.moveCallbackContext=this,this.pollRate=0,this.disabled=!1,this.multiInputOverride=t.Input.MOUSE_TOUCH_COMBINE,this.position=null,this.speed=null,this.circle=null,this.scale=null,this.maxPointers=10,this.currentPointers=0,this.tapRate=200,this.doubleTapRate=300,this.holdRate=2e3,this.justPressedRate=200,this.justReleasedRate=200,this.recordPointerHistory=!1,this.recordRate=100,this.recordLimit=100,this.pointer1=null,this.pointer2=null,this.pointer3=null,this.pointer4=null,this.pointer5=null,this.pointer6=null,this.pointer7=null,this.pointer8=null,this.pointer9=null,this.pointer10=null,this.activePointer=null,this.mousePointer=null,this.mouse=null,this.keyboard=null,this.touch=null,this.mspointer=null,this.gamepad=null,this.onDown=null,this.onUp=null,this.onTap=null,this.onHold=null,this.interactiveItems=new t.LinkedList,this._localPoint=new t.Point,this._pollCounter=0,this._oldPosition=null,this._x=0,this._y=0},t.Input.MOUSE_OVERRIDES_TOUCH=0,t.Input.TOUCH_OVERRIDES_MOUSE=1,t.Input.MOUSE_TOUCH_COMBINE=2,t.Input.prototype={boot:function(){this.mousePointer=new t.Pointer(this.game,0),this.pointer1=new t.Pointer(this.game,1),this.pointer2=new t.Pointer(this.game,2),this.mouse=new t.Mouse(this.game),this.keyboard=new t.Keyboard(this.game),this.touch=new t.Touch(this.game),this.mspointer=new t.MSPointer(this.game),this.gamepad=new t.Gamepad(this.game),this.onDown=new t.Signal,this.onUp=new t.Signal,this.onTap=new t.Signal,this.onHold=new t.Signal,this.scale=new t.Point(1,1),this.speed=new t.Point,this.position=new t.Point,this._oldPosition=new t.Point,this.circle=new t.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(e,t){this.moveCallback=e,this.moveCallbackContext=t},addPointer:function(){for(var e=0,n=10;n>0;n--)null===this["pointer"+n]&&(e=n);return 0===e?(console.warn("You can only have 10 Pointer objects"),null):(this["pointer"+e]=new t.Pointer(this.game,e),this["pointer"+e])},update:function(){return this.keyboard.update(),this.pollRate>0&&this._pollCounter=n;n++)this["pointer"+n]&&this["pointer"+n].reset();this.currentPointers=0,"none"!==this.game.canvas.style.cursor&&(this.game.canvas.style.cursor="inherit"),e===!0&&(this.onDown.dispose(),this.onUp.dispose(),this.onTap.dispose(),this.onHold.dispose(),this.onDown=new t.Signal,this.onUp=new t.Signal,this.onTap=new t.Signal,this.onHold=new t.Signal,this.interactiveItems.callAll("reset")),this._pollCounter=0}},resetSpeed:function(e,t){this._oldPosition.setTo(e,t),this.speed.setTo(0,0)},startPointer:function(e){if(this.maxPointers<10&&this.totalActivePointers==this.maxPointers)return null;if(this.pointer1.active===!1)return this.pointer1.start(e);if(this.pointer2.active===!1)return this.pointer2.start(e);for(var t=3;10>=t;t++)if(this["pointer"+t]&&this["pointer"+t].active===!1)return this["pointer"+t].start(e);return null},updatePointer:function(e){if(this.pointer1.active&&this.pointer1.identifier==e.identifier)return this.pointer1.move(e);if(this.pointer2.active&&this.pointer2.identifier==e.identifier)return this.pointer2.move(e);for(var t=3;10>=t;t++)if(this["pointer"+t]&&this["pointer"+t].active&&this["pointer"+t].identifier==e.identifier)return this["pointer"+t].move(e);return null},stopPointer:function(e){if(this.pointer1.active&&this.pointer1.identifier==e.identifier)return this.pointer1.stop(e);if(this.pointer2.active&&this.pointer2.identifier==e.identifier)return this.pointer2.stop(e);for(var t=3;10>=t;t++)if(this["pointer"+t]&&this["pointer"+t].active&&this["pointer"+t].identifier==e.identifier)return this["pointer"+t].stop(e);return null},getPointer:function(e){if(e=e||!1,this.pointer1.active==e)return this.pointer1;if(this.pointer2.active==e)return this.pointer2;for(var t=3;10>=t;t++)if(this["pointer"+t]&&this["pointer"+t].active==e)return this["pointer"+t];return null},getPointerFromIdentifier:function(e){if(this.pointer1.identifier==e)return this.pointer1;if(this.pointer2.identifier==e)return this.pointer2;for(var t=3;10>=t;t++)if(this["pointer"+t]&&this["pointer"+t].identifier==e)return this["pointer"+t];return null},getLocalPosition:function(e,n,r){"undefined"==typeof r&&(r=new t.Point);var i=e.worldTransform,s=1/(i.a*i.d+i.b*-i.c);return r.setTo(i.d*s*n.x+ -i.b*s*n.y+(i.ty*i.b-i.tx*i.d)*s,i.a*s*n.y+ -i.c*s*n.x+(-i.ty*i.a+i.tx*i.c)*s)},hitTest:function(e,n,r){if(!e.worldVisible)return!1;if(this.getLocalPosition(e,n,this._localPoint),r.copyFrom(this._localPoint),e.hitArea&&e.hitArea.contains)return e.hitArea.contains(this._localPoint.x,this._localPoint.y)?!0:!1;if(e instanceof t.TileSprite){var i=e.width,s=e.height,o=-i*e.anchor.x;if(this._localPoint.x>o&&this._localPoint.xu&&this._localPoint.yo&&this._localPoint.xu&&this._localPoint.ya;a++)if(this.hitTest(e.children[a],n,r))return!0;return!1}},t.Input.prototype.constructor=t.Input,Object.defineProperty(t.Input.prototype,"x",{get:function(){return this._x},set:function(e){this._x=Math.floor(e)}}),Object.defineProperty(t.Input.prototype,"y",{get:function(){return this._y},set:function(e){this._y=Math.floor(e)}}),Object.defineProperty(t.Input.prototype,"pollLocked",{get:function(){return this.pollRate>0&&this._pollCounter=e;e++)this["pointer"+e]&&this["pointer"+e].active&&this.currentPointers++;return this.currentPointers}}),Object.defineProperty(t.Input.prototype,"worldX",{get:function(){return this.game.camera.view.x+this.x}}),Object.defineProperty(t.Input.prototype,"worldY",{get:function(){return this.game.camera.view.y+this.y}}),t.Key=function(e,n){this.game=e,this.event=null,this.isDown=!1,this.isUp=!0,this.altKey=!1,this.ctrlKey=!1,this.shiftKey=!1,this.timeDown=0,this.duration=0,this.timeUp=-2500,this.repeats=0,this.keyCode=n,this.onDown=new t.Signal,this.onHoldCallback=null,this.onHoldContext=null,this.onUp=new t.Signal},t.Key.prototype={update:function(){this.isDown&&(this.duration=this.game.time.now-this.timeDown,this.repeats++,this.onHoldCallback&&this.onHoldCallback.call(this.onHoldContext,this))},processKeyDown:function(e){this.event=e,this.isDown||(this.altKey=e.altKey,this.ctrlKey=e.ctrlKey,this.shiftKey=e.shiftKey,this.isDown=!0,this.isUp=!1,this.timeDown=this.game.time.now,this.duration=0,this.repeats=0,this.onDown.dispatch(this))},processKeyUp:function(e){this.event=e,this.isUp||(this.isDown=!1,this.isUp=!0,this.timeUp=this.game.time.now,this.duration=this.game.time.now-this.timeDown,this.onUp.dispatch(this))},reset:function(){this.isDown=!1,this.isUp=!0,this.timeUp=this.game.time.now,this.duration=this.game.time.now-this.timeDown},justPressed:function(e){return"undefined"==typeof e&&(e=2500),this.isDown&&this.duration=this.game.input.holdRate&&((this.game.input.multiInputOverride==t.Input.MOUSE_OVERRIDES_TOUCH||this.game.input.multiInputOverride==t.Input.MOUSE_TOUCH_COMBINE||this.game.input.multiInputOverride==t.Input.TOUCH_OVERRIDES_MOUSE&&0===this.game.input.currentPointers)&&this.game.input.onHold.dispatch(this),this._holdSent=!0),this.game.input.recordPointerHistory&&this.game.time.now>=this._nextDrop&&(this._nextDrop=this.game.time.now+this.game.input.recordRate,this._history.push({x:this.position.x,y:this.position.y}),this._history.length>this.game.input.recordLimit&&this._history.shift()))},move:function(e,n){if(!this.game.input.pollLocked){if("undefined"==typeof n&&(n=!1),"undefined"!=typeof e.button&&(this.button=e.button),this.clientX=e.clientX,this.clientY=e.clientY,this.pageX=e.pageX,this.pageY=e.pageY,this.screenX=e.screenX,this.screenY=e.screenY,this.x=(this.pageX-this.game.stage.offset.x)*this.game.input.scale.x,this.y=(this.pageY-this.game.stage.offset.y)*this.game.input.scale.y,this.position.setTo(this.x,this.y),this.circle.x=this.x,this.circle.y=this.y,(this.game.input.multiInputOverride==t.Input.MOUSE_OVERRIDES_TOUCH||this.game.input.multiInputOverride==t.Input.MOUSE_TOUCH_COMBINE||this.game.input.multiInputOverride==t.Input.TOUCH_OVERRIDES_MOUSE&&0===this.game.input.currentPointers)&&(this.game.input.activePointer=this,this.game.input.x=this.x,this.game.input.y=this.y,this.game.input.position.setTo(this.game.input.x,this.game.input.y),this.game.input.circle.x=this.game.input.x,this.game.input.circle.y=this.game.input.y),this.game.paused)return this;if(this.game.input.moveCallback&&this.game.input.moveCallback.call(this.game.input.moveCallbackContext,this,this.x,this.y),null!==this.targetObject&&this.targetObject.isDragged===!0)return this.targetObject.update(this)===!1&&(this.targetObject=null),this;if(this._highestRenderOrderID=Number.MAX_SAFE_INTEGER,this._highestRenderObject=null,this._highestInputPriorityID=-1,this.game.input.interactiveItems.total>0){var r=this.game.input.interactiveItems.next;do r.validForInput(this._highestInputPriorityID,this._highestRenderOrderID)&&(!n&&r.checkPointerOver(this)||n&&r.checkPointerDown(this))&&(this._highestRenderOrderID=r.sprite._cache[3],this._highestInputPriorityID=r.priorityID,this._highestRenderObject=r),r=r.next;while(null!=r)}return null===this._highestRenderObject?this.targetObject&&(this.targetObject._pointerOutHandler(this),this.targetObject=null):null===this.targetObject?(this.targetObject=this._highestRenderObject,this._highestRenderObject._pointerOverHandler(this)):this.targetObject===this._highestRenderObject?this._highestRenderObject.update(this)===!1&&(this.targetObject=null):(this.targetObject._pointerOutHandler(this),this.targetObject=this._highestRenderObject,this.targetObject._pointerOverHandler(this)),this}},leave:function(e){this.withinGame=!1,this.move(e,!1)},stop:function(e){if(this._stateReset)return void e.preventDefault();if(this.timeUp=this.game.time.now,(this.game.input.multiInputOverride==t.Input.MOUSE_OVERRIDES_TOUCH||this.game.input.multiInputOverride==t.Input.MOUSE_TOUCH_COMBINE||this.game.input.multiInputOverride==t.Input.TOUCH_OVERRIDES_MOUSE&&0===this.game.input.currentPointers)&&(this.game.input.onUp.dispatch(this,e),this.duration>=0&&this.duration<=this.game.input.tapRate&&(this.timeUp-this.previousTapTime0&&(this.active=!1),this.withinGame=!1,this.isDown=!1,this.isUp=!0,this.isMouse===!1&&this.game.input.currentPointers--,this.game.input.interactiveItems.total>0){var n=this.game.input.interactiveItems.next;do n&&n._releasedHandler(this),n=n.next;while(null!=n)}return this.targetObject&&this.targetObject._releasedHandler(this),this.targetObject=null,this},justPressed:function(e){return e=e||this.game.input.justPressedRate,this.isDown===!0&&this.timeDown+e>this.game.time.now},justReleased:function(e){return e=e||this.game.input.justReleasedRate,this.isUp===!0&&this.timeUp+e>this.game.time.now},reset:function(){this.isMouse===!1&&(this.active=!1),this.identifier=null,this.isDown=!1,this.isUp=!0,this.totalTouches=0,this._holdSent=!1,this._history.length=0,this._stateReset=!0,this.targetObject&&this.targetObject._releasedHandler(this),this.targetObject=null}},t.Pointer.prototype.constructor=t.Pointer,Object.defineProperty(t.Pointer.prototype,"duration",{get:function(){return this.isUp?-1:this.game.time.now-this.timeDown}}),Object.defineProperty(t.Pointer.prototype,"worldX",{get:function(){return this.game.world.camera.x+this.x}}),Object.defineProperty(t.Pointer.prototype,"worldY",{get:function(){return this.game.world.camera.y+this.y}}),t.Touch=function(e){this.game=e,this.disabled=!1,this.callbackContext=this.game,this.touchStartCallback=null,this.touchMoveCallback=null,this.touchEndCallback=null,this.touchEnterCallback=null,this.touchLeaveCallback=null,this.touchCancelCallback=null,this.preventDefault=!0,this.event=null,this._onTouchStart=null,this._onTouchMove=null,this._onTouchEnd=null,this._onTouchEnter=null,this._onTouchLeave=null,this._onTouchCancel=null,this._onTouchMove=null},t.Touch.prototype={start:function(){if(null===this._onTouchStart){var e=this;this.game.device.touch&&(this._onTouchStart=function(t){return e.onTouchStart(t)},this._onTouchMove=function(t){return e.onTouchMove(t)},this._onTouchEnd=function(t){return e.onTouchEnd(t)},this._onTouchEnter=function(t){return e.onTouchEnter(t)},this._onTouchLeave=function(t){return e.onTouchLeave(t)},this._onTouchCancel=function(t){return e.onTouchCancel(t)},this.game.canvas.addEventListener("touchstart",this._onTouchStart,!1),this.game.canvas.addEventListener("touchmove",this._onTouchMove,!1),this.game.canvas.addEventListener("touchend",this._onTouchEnd,!1),this.game.canvas.addEventListener("touchenter",this._onTouchEnter,!1),this.game.canvas.addEventListener("touchleave",this._onTouchLeave,!1),this.game.canvas.addEventListener("touchcancel",this._onTouchCancel,!1))}},consumeDocumentTouches:function(){this._documentTouchMove=function(e){e.preventDefault()},document.addEventListener("touchmove",this._documentTouchMove,!1)},onTouchStart:function(e){if(this.event=e,this.touchStartCallback&&this.touchStartCallback.call(this.callbackContext,e),!this.game.input.disabled&&!this.disabled){this.preventDefault&&e.preventDefault();for(var t=0;t0&&i>this.deadZone||0>i&&i<-this.deadZone?{axis:r,value:i}:{axis:r,value:0})}this._prevTimestamp=this._rawPad.timestamp}},connect:function(e){var t=!this._connected;this._index=e.index,this._connected=!0,this._rawPad=e,this._rawButtons=e.buttons,this._axes=e.axes,t&&this._padParent.onConnectCallback&&this._padParent.onConnectCallback.call(this._padParent.callbackContext,this._index),t&&this.onConnectCallback&&this.onConnectCallback.call(this.callbackContext)},disconnect:function(){var e=this._connected;this._connected=!1,this._rawPad=void 0,this._rawButtons=[],this._buttons=[];var t=this._index;this._index=null,e&&this._padParent.onDisconnectCallback&&this._padParent.onDisconnectCallback.call(this._padParent.callbackContext,t),e&&this.onDisconnectCallback&&this.onDisconnectCallback.call(this.callbackContext)},processAxisChange:function(e){this.game.input.disabled||this.game.input.gamepad.disabled||this._axes[e.axis]!==e.value&&(this._axes[e.axis]=e.value,this._padParent.onAxisCallback&&this._padParent.onAxisCallback.call(this._padParent.callbackContext,e,this._index),this.onAxisCallback&&this.onAxisCallback.call(this.callbackContext,e))},processButtonDown:function(e,t){this.game.input.disabled||this.game.input.gamepad.disabled||(this._padParent.onDownCallback&&this._padParent.onDownCallback.call(this._padParent.callbackContext,e,t,this._index),this.onDownCallback&&this.onDownCallback.call(this.callbackContext,e,t),this._buttons[e]&&this._buttons[e].isDown?this._buttons[e].duration=this.game.time.now-this._buttons[e].timeDown:this._buttons[e]?(this._buttons[e].isDown=!0,this._buttons[e].timeDown=this.game.time.now,this._buttons[e].duration=0,this._buttons[e].value=t):this._buttons[e]={isDown:!0,timeDown:this.game.time.now,timeUp:0,duration:0,value:t},this._hotkeys[e]&&this._hotkeys[e].processButtonDown(t))},processButtonUp:function(e,t){this.game.input.disabled||this.game.input.gamepad.disabled||(this._padParent.onUpCallback&&this._padParent.onUpCallback.call(this._padParent.callbackContext,e,t,this._index),this.onUpCallback&&this.onUpCallback.call(this.callbackContext,e,t),this._hotkeys[e]&&this._hotkeys[e].processButtonUp(t),this._buttons[e]?(this._buttons[e].isDown=!1,this._buttons[e].timeUp=this.game.time.now,this._buttons[e].value=t):this._buttons[e]={isDown:!1,timeDown:this.game.time.now,timeUp:this.game.time.now,duration:0,value:t})},processButtonFloat:function(e,t){this.game.input.disabled||this.game.input.gamepad.disabled||(this._padParent.onFloatCallback&&this._padParent.onFloatCallback.call(this._padParent.callbackContext,e,t,this._index),this.onFloatCallback&&this.onFloatCallback.call(this.callbackContext,e,t),this._buttons[e]?this._buttons[e].value=t:this._buttons[e]={value:t},this._hotkeys[e]&&this._hotkeys[e].processButtonFloat(t))},axis:function(e){return this._axes[e]?this._axes[e]:!1},isDown:function(e){return this._buttons[e]?this._buttons[e].isDown:!1},justReleased:function(e,t){return"undefined"==typeof t&&(t=250),this._buttons[e]&&this._buttons[e].isDown===!1&&this.game.time.now-this._buttons[e].timeUpr;r++)this._pointerData[r]={id:r,x:0,y:0,isDown:!1,isUp:!1,isOver:!1,isOut:!1,timeOver:0,timeOut:0,timeDown:0,timeUp:0,downDuration:0,isDragged:!1};this.snapOffset=new t.Point,this.enabled=!0,this.sprite.events&&null===this.sprite.events.onInputOver&&(this.sprite.events.onInputOver=new t.Signal,this.sprite.events.onInputOut=new t.Signal,this.sprite.events.onInputDown=new t.Signal,this.sprite.events.onInputUp=new t.Signal,this.sprite.events.onDragStart=new t.Signal,this.sprite.events.onDragStop=new t.Signal)}return this.sprite},reset:function(){this.enabled=!1;for(var e=0;10>e;e++)this._pointerData[e]={id:e,x:0,y:0,isDown:!1,isUp:!1,isOver:!1,isOut:!1,timeOver:0,timeOut:0,timeDown:0,timeUp:0,downDuration:0,isDragged:!1}},stop:function(){this.enabled!==!1&&(this.enabled=!1,this.game.input.interactiveItems.remove(this))},destroy:function(){this.enabled&&(this._setHandCursor&&(this.game.canvas.style.cursor="default",this._setHandCursor=!1),this.enabled=!1,this.game.input.interactiveItems.remove(this),this._pointerData.length=0,this.boundsRect=null,this.boundsSprite=null,this.sprite=null)},validForInput:function(e,t){return 0===this.sprite.scale.x||0===this.sprite.scale.y?!1:this.pixelPerfectClick||this.pixelPerfectOver?!0:this.priorityID>e||this.priorityID===e&&this.sprite._cache[3]t;t++)if(this._pointerData[t].isOver)return!0}return!1},pointerOut:function(e){if(this.enabled){if("undefined"!=typeof e)return this._pointerData[e].isOut;for(var t=0;10>t;t++)if(this._pointerData[t].isOut)return!0}return!1},pointerTimeOver:function(e){return e=e||0,this._pointerData[e].timeOver},pointerTimeOut:function(e){return e=e||0,this._pointerData[e].timeOut},pointerDragged:function(e){return e=e||0,this._pointerData[e].isDragged},checkPointerDown:function(e){return this.enabled===!1||this.sprite.visible===!1||this.sprite.parent.visible===!1?!1:this.game.input.hitTest(this.sprite,e,this._tempPoint)?this.pixelPerfectClick?this.checkPixel(this._tempPoint.x,this._tempPoint.y):!0:!1},checkPointerOver:function(e){return this.enabled===!1||this.sprite.visible===!1||this.sprite.parent.visible===!1?!1:this.game.input.hitTest(this.sprite,e,this._tempPoint)?this.pixelPerfectOver?this.checkPixel(this._tempPoint.x,this._tempPoint.y):!0:!1},checkPixel:function(e,t,n){if(this.sprite.texture.baseTexture.source){if(this.game.input.hitContext.clearRect(0,0,1,1),null===e&&null===t){this.game.input.getLocalPosition(this.sprite,n,this._tempPoint);var e=this._tempPoint.x,t=this._tempPoint.y}0!==this.sprite.anchor.x&&(e-=-this.sprite.texture.frame.width*this.sprite.anchor.x),0!==this.sprite.anchor.y&&(t-=-this.sprite.texture.frame.height*this.sprite.anchor.y),e+=this.sprite.texture.frame.x,t+=this.sprite.texture.frame.y,this.game.input.hitContext.drawImage(this.sprite.texture.baseTexture.source,e,t,1,1,0,0,1,1);var r=this.game.input.hitContext.getImageData(0,0,1,1);if(r.data[3]>=this.pixelPerfectAlpha)return!0}return!1},update:function(e){return null!==this.sprite?this.enabled&&this.sprite.visible&&this.sprite.parent.visible?this.draggable&&this._draggedPointerID==e.id?this.updateDrag(e):this._pointerData[e.id].isOver===!0?this.checkPointerOver(e)?(this._pointerData[e.id].x=e.x-this.sprite.x,this._pointerData[e.id].y=e.y-this.sprite.y,!0):(this._pointerOutHandler(e),!1):void 0:(this._pointerOutHandler(e),!1):void 0},_pointerOverHandler:function(e){null!==this.sprite&&this._pointerData[e.id].isOver===!1&&(this._pointerData[e.id].isOver=!0,this._pointerData[e.id].isOut=!1,this._pointerData[e.id].timeOver=this.game.time.now,this._pointerData[e.id].x=e.x-this.sprite.x,this._pointerData[e.id].y=e.y-this.sprite.y,this.useHandCursor&&this._pointerData[e.id].isDragged===!1&&(this.game.canvas.style.cursor="pointer",this._setHandCursor=!1),this.sprite.events.onInputOver.dispatch(this.sprite,e))},_pointerOutHandler:function(e){null!==this.sprite&&(this._pointerData[e.id].isOver=!1,this._pointerData[e.id].isOut=!0,this._pointerData[e.id].timeOut=this.game.time.now,this.useHandCursor&&this._pointerData[e.id].isDragged===!1&&(this.game.canvas.style.cursor="default",this._setHandCursor=!1),this.sprite&&this.sprite.events&&this.sprite.events.onInputOut.dispatch(this.sprite,e))},_touchedHandler:function(e){if(null!==this.sprite){if(this._pointerData[e.id].isDown===!1&&this._pointerData[e.id].isOver===!0){if(this.pixelPerfectClick&&!this.checkPixel(null,null,e))return;this._pointerData[e.id].isDown=!0,this._pointerData[e.id].isUp=!1,this._pointerData[e.id].timeDown=this.game.time.now,this.sprite.events.onInputDown.dispatch(this.sprite,e),this.draggable&&this.isDragged===!1&&this.startDrag(e),this.bringToTop&&this.sprite.bringToTop()}return this.consumePointerEvent}},_releasedHandler:function(e){null!==this.sprite&&this._pointerData[e.id].isDown&&e.isUp&&(this._pointerData[e.id].isDown=!1,this._pointerData[e.id].isUp=!0,this._pointerData[e.id].timeUp=this.game.time.now,this._pointerData[e.id].downDuration=this._pointerData[e.id].timeUp-this._pointerData[e.id].timeDown,this.checkPointerOver(e)?this.sprite.events.onInputUp.dispatch(this.sprite,e,!0):(this.sprite.events.onInputUp.dispatch(this.sprite,e,!1),this.useHandCursor&&(this.game.canvas.style.cursor="default",this._setHandCursor=!1)),this.draggable&&this.isDragged&&this._draggedPointerID==e.id&&this.stopDrag(e))},updateDrag:function(e){return e.isUp?(this.stopDrag(e),!1):(this.sprite.fixedToCamera?(this.allowHorizontalDrag&&(this.sprite.cameraOffset.x=e.x+this._dragPoint.x+this.dragOffset.x),this.allowVerticalDrag&&(this.sprite.cameraOffset.y=e.y+this._dragPoint.y+this.dragOffset.y),this.boundsRect&&this.checkBoundsRect(),this.boundsSprite&&this.checkBoundsSprite(),this.snapOnDrag&&(this.sprite.cameraOffset.x=Math.round((this.sprite.cameraOffset.x-this.snapOffsetX%this.snapX)/this.snapX)*this.snapX+this.snapOffsetX%this.snapX,this.sprite.cameraOffset.y=Math.round((this.sprite.cameraOffset.y-this.snapOffsetY%this.snapY)/this.snapY)*this.snapY+this.snapOffsetY%this.snapY)):(this.allowHorizontalDrag&&(this.sprite.x=e.x+this._dragPoint.x+this.dragOffset.x),this.allowVerticalDrag&&(this.sprite.y=e.y+this._dragPoint.y+this.dragOffset.y),this.boundsRect&&this.checkBoundsRect(),this.boundsSprite&&this.checkBoundsSprite(),this.snapOnDrag&&(this.sprite.x=Math.round((this.sprite.x-this.snapOffsetX%this.snapX)/this.snapX)*this.snapX+this.snapOffsetX%this.snapX,this.sprite.y=Math.round((this.sprite.y-this.snapOffsetY%this.snapY)/this.snapY)*this.snapY+this.snapOffsetY%this.snapY)),!0)},justOver:function(e,t){return e=e||0,t=t||500,this._pointerData[e].isOver&&this.overDuration(e)e;e++)this._pointerData[e].isDragged=!1;this.draggable=!1,this.isDragged=!1,this._draggedPointerID=-1},startDrag:function(e){if(this.isDragged=!0,this._draggedPointerID=e.id,this._pointerData[e.id].isDragged=!0,this.sprite.fixedToCamera)this.dragFromCenter?(this.sprite.centerOn(e.x,e.y),this._dragPoint.setTo(this.sprite.cameraOffset.x-e.x,this.sprite.cameraOffset.y-e.y)):this._dragPoint.setTo(this.sprite.cameraOffset.x-e.x,this.sprite.cameraOffset.y-e.y);else if(this.dragFromCenter){var t=this.sprite.getBounds();this.sprite.x=e.x+(this.sprite.x-t.centerX),this.sprite.y=e.y+(this.sprite.y-t.centerY),this._dragPoint.setTo(this.sprite.x-e.x,this.sprite.y-e.y)}else this._dragPoint.setTo(this.sprite.x-e.x,this.sprite.y-e.y);this.updateDrag(e),this.bringToTop&&this.sprite.bringToTop(),this.sprite.events.onDragStart.dispatch(this.sprite,e)},stopDrag:function(e){this.isDragged=!1,this._draggedPointerID=-1,this._pointerData[e.id].isDragged=!1,this.snapOnRelease&&(this.sprite.fixedToCamera?(this.sprite.cameraOffset.x=Math.round((this.sprite.cameraOffset.x-this.snapOffsetX%this.snapX)/this.snapX)*this.snapX+this.snapOffsetX%this.snapX,this.sprite.cameraOffset.y=Math.round((this.sprite.cameraOffset.y-this.snapOffsetY%this.snapY)/this.snapY)*this.snapY+this.snapOffsetY%this.snapY):(this.sprite.x=Math.round((this.sprite.x-this.snapOffsetX%this.snapX)/this.snapX)*this.snapX+this.snapOffsetX%this.snapX,this.sprite.y=Math.round((this.sprite.y-this.snapOffsetY%this.snapY)/this.snapY)*this.snapY+this.snapOffsetY%this.snapY)),this.sprite.events.onDragStop.dispatch(this.sprite,e),this.checkPointerOver(e)===!1&&this._pointerOutHandler(e)},setDragLock:function(e,t){"undefined"==typeof e&&(e=!0),"undefined"==typeof t&&(t=!0),this.allowHorizontalDrag=e,this.allowVerticalDrag=t},enableSnap:function(e,t,n,r,i,s){"undefined"==typeof n&&(n=!0),"undefined"==typeof r&&(r=!1),"undefined"==typeof i&&(i=0),"undefined"==typeof s&&(s=0),this.snapX=e,this.snapY=t,this.snapOffsetX=i,this.snapOffsetY=s,this.snapOnDrag=n,this.snapOnRelease=r},disableSnap:function(){this.snapOnDrag=!1,this.snapOnRelease=!1},checkBoundsRect:function(){this.sprite.fixedToCamera?(this.sprite.cameraOffset.xthis.boundsRect.right&&(this.sprite.cameraOffset.x=this.boundsRect.right-this.sprite.width),this.sprite.cameraOffset.ythis.boundsRect.bottom&&(this.sprite.cameraOffset.y=this.boundsRect.bottom-this.sprite.height)):(this.sprite.xthis.boundsRect.right&&(this.sprite.x=this.boundsRect.right-this.sprite.width),this.sprite.ythis.boundsRect.bottom&&(this.sprite.y=this.boundsRect.bottom-this.sprite.height))},checkBoundsSprite:function(){this.sprite.fixedToCamera&&this.boundsSprite.fixedToCamera?(this.sprite.cameraOffset.xthis.boundsSprite.camerOffset.x+this.boundsSprite.width&&(this.sprite.cameraOffset.x=this.boundsSprite.camerOffset.x+this.boundsSprite.width-this.sprite.width),this.sprite.cameraOffset.ythis.boundsSprite.camerOffset.y+this.boundsSprite.height&&(this.sprite.cameraOffset.y=this.boundsSprite.camerOffset.y+this.boundsSprite.height-this.sprite.height)):(this.sprite.xthis.boundsSprite.x+this.boundsSprite.width&&(this.sprite.x=this.boundsSprite.x+this.boundsSprite.width-this.sprite.width),this.sprite.ythis.boundsSprite.y+this.boundsSprite.height&&(this.sprite.y=this.boundsSprite.y+this.boundsSprite.height-this.sprite.height))}},t.InputHandler.prototype.constructor=t.InputHandler,t.Events=function(e){this.parent=e,this.onAddedToGroup=new t.Signal,this.onRemovedFromGroup=new t.Signal,this.onKilled=new t.Signal,this.onRevived=new t.Signal,this.onOutOfBounds=new t.Signal,this.onEnterBounds=new t.Signal,this.onInputOver=null,this.onInputOut=null,this.onInputDown=null,this.onInputUp=null,this.onDragStart=null,this.onDragStop=null,this.onAnimationStart=null,this.onAnimationComplete=null,this.onAnimationLoop=null},t.Events.prototype={destroy:function(){this.parent=null,this.onAddedToGroup.dispose(),this.onRemovedFromGroup.dispose(),this.onKilled.dispose(),this.onRevived.dispose(),this.onOutOfBounds.dispose(),this.onInputOver&&(this.onInputOver.dispose(),this.onInputOut.dispose(),this.onInputDown.dispose(),this.onInputUp.dispose(),this.onDragStart.dispose(),this.onDragStop.dispose()),this.onAnimationStart&&(this.onAnimationStart.dispose(),this.onAnimationComplete.dispose(),this.onAnimationLoop.dispose())}},t.Events.prototype.constructor=t.Events,t.GameObjectFactory=function(e){this.game=e,this.world=this.game.world},t.GameObjectFactory.prototype={existing:function(e){return this.world.add(e)},image:function(e,n,r,i,s){return"undefined"==typeof s&&(s=this.world),s.add(new t.Image(this.game,e,n,r,i))},sprite:function(e,t,n,r,i){return"undefined"==typeof i&&(i=this.world),i.create(e,t,n,r)},tween:function(e){return this.game.tweens.create(e)},group:function(e,n,r,i,s){return new t.Group(this.game,e,n,r,i,s)},physicsGroup:function(e,n,r,i){return new t.Group(this.game,n,r,i,!0,e)},spriteBatch:function(e,n,r){return"undefined"==typeof n&&(n="group"),"undefined"==typeof r&&(r=!1),new t.SpriteBatch(this.game,e,n,r)},audio:function(e,t,n,r){return this.game.sound.add(e,t,n,r)},sound:function(e,t,n,r){return this.game.sound.add(e,t,n,r)},tileSprite:function(e,n,r,i,s,o,u){return"undefined"==typeof u&&(u=this.world),u.add(new t.TileSprite(this.game,e,n,r,i,s,o))},text:function(e,n,r,i,s){return"undefined"==typeof s&&(s=this.world),s.add(new t.Text(this.game,e,n,r,i))},button:function(e,n,r,i,s,o,u,a,f,l){return"undefined"==typeof l&&(l=this.world),l.add(new t.Button(this.game,e,n,r,i,s,o,u,a,f))},graphics:function(e,n,r){return"undefined"==typeof r&&(r=this.world),r.add(new t.Graphics(this.game,e,n))},emitter:function(e,n,r){return this.game.particles.add(new t.Particles.Arcade.Emitter(this.game,e,n,r))},retroFont:function(e,n,r,i,s,o,u,a,f){return new t.RetroFont(this.game,e,n,r,i,s,o,u,a,f)},bitmapText:function(e,n,r,i,s,o){return"undefined"==typeof o&&(o=this.world),o.add(new t.BitmapText(this.game,e,n,r,i,s))},tilemap:function(e,n,r,i,s){return new t.Tilemap(this.game,e,n,r,i,s)},renderTexture:function(e,n,r,i){("undefined"==typeof r||""===r)&&(r=this.game.rnd.uuid()),"undefined"==typeof i&&(i=!1);var s=new t.RenderTexture(this.game,e,n,r);return i&&this.game.cache.addRenderTexture(r,s),s},bitmapData:function(e,n,r,i){"undefined"==typeof i&&(i=!1),("undefined"==typeof r||""===r)&&(r=this.game.rnd.uuid());var s=new t.BitmapData(this.game,r,e,n);return i&&this.game.cache.addBitmapData(r,s),s},filter:function(e){var n=Array.prototype.splice.call(arguments,1),e=new t.Filter[e](this.game);return e.init.apply(e,n),e}},t.GameObjectFactory.prototype.constructor=t.GameObjectFactory,t.GameObjectCreator=function(e){this.game=e,this.world=this.game.world},t.GameObjectCreator.prototype={image:function(e,n,r,i){return new t.Image(this.game,e,n,r,i)},sprite:function(e,n,r,i){return new t.Sprite(this.game,e,n,r,i)},tween:function(e){return new t.Tween(e,this.game)},group:function(e,n,r,i,s){return new t.Group(this.game,null,n,r,i,s)},spriteBatch:function(e,n,r){return"undefined"==typeof n&&(n="group"),"undefined"==typeof r&&(r=!1),new t.SpriteBatch(this.game,e,n,r)},audio:function(e,t,n,r){return this.game.sound.add(e,t,n,r)},sound:function(e,t,n,r){return this.game.sound.add(e,t,n,r)},tileSprite:function(e,n,r,i,s,o){return new t.TileSprite(this.game,e,n,r,i,s,o)},text:function(e,n,r,i){return new t.Text(this.game,e,n,r,i)},button:function(e,n,r,i,s,o,u,a,f){return new t.Button(this.game,e,n,r,i,s,o,u,a,f)},graphics:function(e,n){return new t.Graphics(this.game,e,n)},emitter:function(e,n,r){return new t.Particles.Arcade.Emitter(this.game,e,n,r)},retroFont:function(e,n,r,i,s,o,u,a,f){return new t.RetroFont(this.game,e,n,r,i,s,o,u,a,f)},bitmapText:function(e,n,r,i,s){return new t.BitmapText(this.game,e,n,r,i,s)},tilemap:function(e,n,r,i,s){return new t.Tilemap(this.game,e,n,r,i,s)},renderTexture:function(e,n,r,i){("undefined"==typeof r||""===r)&&(r=this.game.rnd.uuid()),"undefined"==typeof i&&(i=!1);var s=new t.RenderTexture(this.game,e,n,r);return i&&this.game.cache.addRenderTexture(r,s),s},bitmapData:function(e,n,r,i){"undefined"==typeof i&&(i=!1),("undefined"==typeof r||""===r)&&(r=this.game.rnd.uuid());var s=new t.BitmapData(this.game,r,e,n);return i&&this.game.cache.addBitmapData(r,s),s},filter:function(e){var n=Array.prototype.splice.call(arguments,1),e=new t.Filter[e](this.game);return e.init.apply(e,n),e}},t.GameObjectCreator.prototype.constructor=t.GameObjectCreator,t.BitmapData=function(e,n,r,i){"undefined"==typeof r&&(r=100),"undefined"==typeof i&&(i=100),this.game=e,this.key=n,this.width=r,this.height=i,this.canvas=t.Canvas.create(r,i,"",!0),this.context=this.canvas.getContext("2d"),this.ctx=this.context,this.imageData=this.context.getImageData(0,0,r,i),this.pixels=this.imageData.data.buffer?this.imageData.data.buffer:this.imageData.data,this.baseTexture=new PIXI.BaseTexture(this.canvas),this.texture=new PIXI.Texture(this.baseTexture),this.textureFrame=new t.Frame(0,0,0,r,i,"bitmapData",e.rnd.uuid()),this.type=t.BITMAPDATA,this.dirty=!1},t.BitmapData.prototype={add:function(e){if(Array.isArray(e))for(var t=0;t=0&&e<=this.width&&t>=0&&t<=this.height&&(this.pixels[t*this.width+e]=s<<24|i<<16|r<<8|n,this.context.putImageData(this.imageData,0,0),this.dirty=!0)},setPixel:function(e,t,n,r,i){this.setPixel32(e,t,n,r,i,255)},getPixel:function(e,t){return e>=0&&e<=this.width&&t>=0&&t<=this.height?this.data32[t*this.width+e]:void 0},getPixel32:function(e,t){return e>=0&&e<=this.width&&t>=0&&t<=this.height?this.data32[t*this.width+e]:void 0},getPixels:function(e){return this.context.getImageData(e.x,e.y,e.width,e.height)},copyPixels:function(e,t,n,r){"string"==typeof e&&(e=this.game.cache.getImage(e)),e&&this.context.drawImage(e,t.x,t.y,t.width,t.height,n,r,t.width,t.height)},draw:function(e,t,n){"string"==typeof e&&(e=this.game.cache.getImage(e)),e&&this.context.drawImage(e,0,0,e.width,e.height,t,n,e.width,e.height)},alphaMask:function(e,t){var n=this.context.globalCompositeOperation;"string"==typeof t&&(t=this.game.cache.getImage(t)),t&&this.context.drawImage(t,0,0),this.context.globalCompositeOperation="source-atop","string"==typeof e&&(e=this.game.cache.getImage(e)),e&&this.context.drawImage(e,0,0),this.context.globalCompositeOperation=n},render:function(){this.game.renderType===t.WEBGL&&this.dirty&&(PIXI.updateWebGLTexture(this.baseTexture,this.game.renderer.gl),this.dirty=!1)}},t.BitmapData.prototype.constructor=t.BitmapData,t.Sprite=function(e,n,r,i,s){n=n||0,r=r||0,i=i||null,s=s||null,this.game=e,this.name="",this.type=t.SPRITE,this.z=0,this.events=new t.Events(this),this.animations=new t.AnimationManager(this),this.key=i,this._frame=0,this._frameName="",PIXI.Sprite.call(this,PIXI.TextureCache.__default),this.loadTexture(i,s),this.position.set(n,r),this.world=new t.Point(n,r),this.autoCull=!1,this.input=null,this.body=null,this.health=1,this.lifespan=0,this.checkWorldBounds=!1,this.outOfBoundsKill=!1,this.debug=!1,this.cameraOffset=new t.Point,this._cache=[0,0,0,0,1,0,1,0],this._bounds=new t.Rectangle},t.Sprite.prototype=Object.create(PIXI.Sprite.prototype),t.Sprite.prototype.constructor=t.Sprite,t.Sprite.prototype.preUpdate=function(){if(1===this._cache[4]&&this.exists)return this.world.setTo(this.parent.position.x+this.position.x,this.parent.position.y+this.position.y),this.worldTransform.tx=this.world.x,this.worldTransform.ty=this.world.y,this._cache[0]=this.world.x,this._cache[1]=this.world.y,this._cache[2]=this.rotation,this.body&&this.body.preUpdate(),this._cache[4]=0,!1;if(this._cache[0]=this.world.x,this._cache[1]=this.world.y,this._cache[2]=this.rotation,!this.exists||!this.parent.exists)return this._cache[3]=-1,!1;if(this.lifespan>0&&(this.lifespan-=this.game.time.elapsed,this.lifespan<=0))return this.kill(),!1;if((this.autoCull||this.checkWorldBounds)&&this._bounds.copyFrom(this.getBounds()),this.autoCull&&(this.renderable=this.game.world.camera.screenView.intersects(this._bounds)),this.checkWorldBounds)if(1===this._cache[5]&&this.game.world.bounds.intersects(this._bounds))this._cache[5]=0,this.events.onEnterBounds.dispatch(this);else if(0===this._cache[5]&&!this.game.world.bounds.intersects(this._bounds)&&(this._cache[5]=1,this.events.onOutOfBounds.dispatch(this),this.outOfBoundsKill))return this.kill(),!1;this.world.setTo(this.game.camera.x+this.worldTransform.tx,this.game.camera.y+this.worldTransform.ty),this.visible&&(this._cache[3]=this.game.stage.currentRenderOrderID++),this.animations.update(),this.body&&this.body.preUpdate();for(var e=0,t=this.children.length;t>e;e++)this.children[e].preUpdate();return!0},t.Sprite.prototype.update=function(){},t.Sprite.prototype.postUpdate=function(){this.key instanceof t.BitmapData&&this.key.render(),this.exists&&this.body&&this.body.postUpdate(),1===this._cache[7]&&(this.position.x=(this.game.camera.view.x+this.cameraOffset.x)/this.game.camera.scale.x,this.position.y=(this.game.camera.view.y+this.cameraOffset.y)/this.game.camera.scale.y);for(var e=0,n=this.children.length;n>e;e++)this.children[e].postUpdate()},t.Sprite.prototype.loadTexture=function(e,n){return n=n||0,e instanceof t.RenderTexture?(this.key=e.key,void this.setTexture(e)):e instanceof t.BitmapData?(this.key=e,void this.setTexture(e.texture)):e instanceof PIXI.Texture?(this.key=e,void this.setTexture(e)):null===e||"undefined"==typeof e?(this.key="__default",void this.setTexture(PIXI.TextureCache[this.key])):"string"!=typeof e||this.game.cache.checkImageKey(e)?this.game.cache.isSpriteSheet(e)?(this.key=e,this.animations.loadFrameData(this.game.cache.getFrameData(e)),"string"==typeof n?this.frameName=n:this.frame=n,void 0):(this.key=e,void this.setTexture(PIXI.TextureCache[e])):(this.key="__missing",void this.setTexture(PIXI.TextureCache[this.key]))},t.Sprite.prototype.crop=function(e){if("undefined"==typeof e||null===e)this.texture.hasOwnProperty("sourceWidth")&&this.texture.setFrame(new t.Rectangle(0,0,this.texture.sourceWidth,this.texture.sourceHeight));else if(this.texture instanceof PIXI.Texture){var n={};t.Utils.extend(!0,n,this.texture),n.sourceWidth=n.width,n.sourceHeight=n.height,n.frame=e,n.width=e.width,n.height=e.height,this.texture=n,this.texture.updateFrame=!0,PIXI.Texture.frameUpdates.push(this.texture)}else this.texture.setFrame(e)},t.Sprite.prototype.revive=function(e){return"undefined"==typeof e&&(e=1),this.alive=!0,this.exists=!0,this.visible=!0,this.health=e,this.events&&this.events.onRevived.dispatch(this),this},t.Sprite.prototype.kill=function(){return this.alive=!1,this.exists=!1,this.visible=!1,this.events&&this.events.onKilled.dispatch(this),this},t.Sprite.prototype.destroy=function(e){if(null!==this.game){"undefined"==typeof e&&(e=!0),this.parent&&(this.parent instanceof t.Group?this.parent.remove(this):this.parent.removeChild(this)),this.input&&this.input.destroy(),this.animations&&this.animations.destroy(),this.body&&this.body.destroy(),this.events&&this.events.destroy();var n=this.children.length;if(e)for(;n--;)this.children[n].destroy(e);else for(;n--;)this.removeChild(this.children[n]);this.alive=!1,this.exists=!1,this.visible=!1,this.filters=null,this.mask=null,this.game=null}},t.Sprite.prototype.damage=function(e){return this.alive&&(this.health-=e,this.health<=0&&this.kill()),this},t.Sprite.prototype.reset=function(e,t,n){return"undefined"==typeof n&&(n=1),this.world.setTo(e,t),this.position.x=e,this.position.y=t,this.alive=!0,this.exists=!0,this.visible=!0,this.renderable=!0,this._outOfBoundsFired=!1,this.health=n,this.body&&this.body.reset(e,t,!1,!1),this._cache[4]=1,this},t.Sprite.prototype.bringToTop=function(){return this.parent&&this.parent.bringToTop(this),this},t.Sprite.prototype.play=function(e,t,n,r){return this.animations?this.animations.play(e,t,n,r):void 0},t.Sprite.prototype.overlap=function(e){return t.Rectangle.intersects(this.getBounds(),e.getBounds())},Object.defineProperty(t.Sprite.prototype,"angle",{get:function(){return t.Math.wrapAngle(t.Math.radToDeg(this.rotation))},set:function(e){this.rotation=t.Math.degToRad(t.Math.wrapAngle(e))}}),Object.defineProperty(t.Sprite.prototype,"deltaX",{get:function(){return this.world.x-this._cache[0]}}),Object.defineProperty(t.Sprite.prototype,"deltaY",{get:function(){return this.world.y-this._cache[1]}}),Object.defineProperty(t.Sprite.prototype,"deltaZ",{get:function(){return this.rotation-this._cache[2]}}),Object.defineProperty(t.Sprite.prototype,"inWorld",{get:function(){return this.game.world.bounds.intersects(this.getBounds())}}),Object.defineProperty(t.Sprite.prototype,"inCamera",{get:function(){return this.game.world.camera.screenView.intersects(this.getBounds())}}),Object.defineProperty(t.Sprite.prototype,"frame",{get:function(){return this.animations.frame},set:function(e){this.animations.frame=e}}),Object.defineProperty(t.Sprite.prototype,"frameName",{get:function(){return this.animations.frameName},set:function(e){this.animations.frameName=e}}),Object.defineProperty(t.Sprite.prototype,"renderOrderID",{get:function(){return this._cache[3]}}),Object.defineProperty(t.Sprite.prototype,"inputEnabled",{get:function(){return this.input&&this.input.enabled},set:function(e){e?null===this.input&&(this.input=new t.InputHandler(this),this.input.start()):this.input&&this.input.enabled&&this.input.stop()}}),Object.defineProperty(t.Sprite.prototype,"exists",{get:function(){return!!this._cache[6]},set:function(e){e?(this._cache[6]=1,this.body&&this.body.type===t.Physics.P2JS&&this.body.addToWorld(),this.visible=!0):(this._cache[6]=0,this.body&&this.body.type===t.Physics.P2JS&&this.body.removeFromWorld(),this.visible=!1)}}),Object.defineProperty(t.Sprite.prototype,"fixedToCamera",{get:function(){return!!this._cache[7]},set:function(e){e?(this._cache[7]=1,this.cameraOffset.set(this.x,this.y)):this._cache[7]=0}}),Object.defineProperty(t.Sprite.prototype,"smoothed",{get:function(){return!this.texture.baseTexture.scaleMode},set:function(e){e?this.texture&&(this.texture.baseTexture.scaleMode=0):this.texture&&(this.texture.baseTexture.scaleMode=1)}}),Object.defineProperty(t.Sprite.prototype,"x",{get:function(){return this.position.x},set:function(e){this.position.x=e,this.body&&this.body.type===t.Physics.ARCADE&&2===this.body.phase&&(this.body._reset=1)}}),Object.defineProperty(t.Sprite.prototype,"y",{get:function(){return this.position.y},set:function(e){this.position.y=e,this.body&&this.body.type===t.Physics.ARCADE&&2===this.body.phase&&(this.body._reset=1)}}),t.Image=function(e,n,r,i,s){n=n||0,r=r||0,i=i||null,s=s||null,this.game=e,this.exists=!0,this.name="",this.type=t.IMAGE,this.z=0,this.events=new t.Events(this),this.key=i,this._frame=0,this._frameName="",PIXI.Sprite.call(this,PIXI.TextureCache.__default),this.loadTexture(i,s),this.position.set(n,r),this.world=new t.Point(n,r),this.autoCull=!1,this.input=null,this.cameraOffset=new t.Point,this._cache=[0,0,0,0,1,0,1,0]},t.Image.prototype=Object.create(PIXI.Sprite.prototype),t.Image.prototype.constructor=t.Image,t.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 e=0,t=this.children.length;t>e;e++)this.children[e].preUpdate();return!0},t.Image.prototype.update=function(){},t.Image.prototype.postUpdate=function(){this.key instanceof t.BitmapData&&this.key.render(),1===this._cache[7]&&(this.position.x=(this.game.camera.view.x+this.cameraOffset.x)/this.game.camera.scale.x,this.position.y=(this.game.camera.view.y+this.cameraOffset.y)/this.game.camera.scale.y);for(var e=0,n=this.children.length;n>e;e++)this.children[e].postUpdate()},t.Image.prototype.loadTexture=function(e,n){if(n=n||0,e instanceof t.RenderTexture)return this.key=e.key,void this.setTexture(e);if(e instanceof t.BitmapData)return this.key=e,void this.setTexture(e.texture);if(e instanceof PIXI.Texture)return this.key=e,void this.setTexture(e);if(null===e||"undefined"==typeof e)return this.key="__default",void this.setTexture(PIXI.TextureCache[this.key]);if("string"==typeof e&&!this.game.cache.checkImageKey(e))return this.key="__missing",void this.setTexture(PIXI.TextureCache[this.key]);if(this.game.cache.isSpriteSheet(e)){this.key=e;var r=this.game.cache.getFrameData(e);return"string"==typeof n?(this._frame=0,this._frameName=n,void this.setTexture(PIXI.TextureCache[r.getFrameByName(n).uuid])):(this._frame=n,this._frameName="",void this.setTexture(PIXI.TextureCache[r.getFrame(n).uuid]))}return this.key=e,void this.setTexture(PIXI.TextureCache[e])},t.Image.prototype.crop=function(e){if("undefined"==typeof e||null===e)this.texture.hasOwnProperty("sourceWidth")&&this.texture.setFrame(new t.Rectangle(0,0,this.texture.sourceWidth,this.texture.sourceHeight));else if(this.texture instanceof PIXI.Texture){var n={};t.Utils.extend(!0,n,this.texture),n.sourceWidth=n.width,n.sourceHeight=n.height,n.frame=e,n.width=e.width,n.height=e.height,this.texture=n,this.texture.updateFrame=!0,PIXI.Texture.frameUpdates.push(this.texture)}else this.texture.setFrame(e)},t.Image.prototype.revive=function(){return this.alive=!0,this.exists=!0,this.visible=!0,this.events&&this.events.onRevived.dispatch(this),this},t.Image.prototype.kill=function(){return this.alive=!1,this.exists=!1,this.visible=!1,this.events&&this.events.onKilled.dispatch(this),this},t.Image.prototype.destroy=function(e){if(null!==this.game){"undefined"==typeof e&&(e=!0),this.parent&&(this.parent instanceof t.Group?this.parent.remove(this):this.parent.removeChild(this)),this.events&&this.events.destroy(),this.input&&this.input.destroy();var n=this.children.length;if(e)for(;n--;)this.children[n].destroy(e);else for(;n--;)this.removeChild(this.children[n]);this.alive=!1,this.exists=!1,this.visible=!1,this.filters=null,this.mask=null,this.game=null}},t.Image.prototype.reset=function(e,t){return this.world.setTo(e,t),this.position.x=e,this.position.y=t,this.alive=!0,this.exists=!0,this.visible=!0,this.renderable=!0,this},t.Image.prototype.bringToTop=function(){return this.parent&&this.parent.bringToTop(this),this},Object.defineProperty(t.Image.prototype,"angle",{get:function(){return t.Math.wrapAngle(t.Math.radToDeg(this.rotation))},set:function(e){this.rotation=t.Math.degToRad(t.Math.wrapAngle(e))}}),Object.defineProperty(t.Image.prototype,"deltaX",{get:function(){return this.world.x-this._cache[0]}}),Object.defineProperty(t.Image.prototype,"deltaY",{get:function(){return this.world.y-this._cache[1]}}),Object.defineProperty(t.Image.prototype,"deltaZ",{get:function(){return this.rotation-this._cache[2]}}),Object.defineProperty(t.Image.prototype,"inWorld",{get:function(){return this.game.world.bounds.intersects(this.getBounds())}}),Object.defineProperty(t.Image.prototype,"inCamera",{get:function(){return this.game.world.camera.screenView.intersects(this.getBounds())}}),Object.defineProperty(t.Image.prototype,"frame",{get:function(){return this._frame},set:function(e){if(e!==this.frame&&this.game.cache.isSpriteSheet(this.key)){var t=this.game.cache.getFrameData(this.key);t&&ee;e++)this.children[e].preUpdate();return!0},t.TileSprite.prototype.update=function(){},t.TileSprite.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 e=0,t=this.children.length;t>e;e++)this.children[e].postUpdate()},t.TileSprite.prototype.autoScroll=function(e,t){this._scroll.set(e,t)},t.TileSprite.prototype.stopScroll=function(){this._scroll.set(0,0)},t.TileSprite.prototype.loadTexture=function(e,n){return n=n||0,e instanceof t.RenderTexture?(this.key=e.key,void this.setTexture(e)):e instanceof t.BitmapData?(this.key=e,void this.setTexture(e.texture)):e instanceof PIXI.Texture?(this.key=e,void this.setTexture(e)):null===e||"undefined"==typeof e?(this.key="__default",void this.setTexture(PIXI.TextureCache[this.key])):"string"!=typeof e||this.game.cache.checkImageKey(e)?this.game.cache.isSpriteSheet(e)?(this.key=e,this.animations.loadFrameData(this.game.cache.getFrameData(e)),"string"==typeof n?this.frameName=n:this.frame=n,void 0):(this.key=e,void this.setTexture(PIXI.TextureCache[e])):(this.key="__missing",void this.setTexture(PIXI.TextureCache[this.key]))},t.TileSprite.prototype.destroy=function(e){if(null!==this.game){"undefined"==typeof e&&(e=!0),this.filters&&(this.filters=null),this.parent&&(this.parent instanceof t.Group?this.parent.remove(this):this.parent.removeChild(this)),this.animations.destroy(),this.events.destroy();var n=this.children.length;if(e)for(;n--;)this.children[n].destroy(e);else for(;n--;)this.removeChild(this.children[n]);this.exists=!1,this.visible=!1,this.filters=null,this.mask=null,this.game=null}},t.TileSprite.prototype.play=function(e,t,n,r){return this.animations.play(e,t,n,r)},t.TileSprite.prototype.reset=function(e,t){return this.world.setTo(e,t),this.position.x=e,this.position.y=t,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(e,t,!1,!1),this._cache[4]=1,this},Object.defineProperty(t.TileSprite.prototype,"angle",{get:function(){return t.Math.wrapAngle(t.Math.radToDeg(this.rotation))},set:function(e){this.rotation=t.Math.degToRad(t.Math.wrapAngle(e))}}),Object.defineProperty(t.TileSprite.prototype,"frame",{get:function(){return this.animations.frame},set:function(e){e!==this.animations.frame&&(this.animations.frame=e)}}),Object.defineProperty(t.TileSprite.prototype,"frameName",{get:function(){return this.animations.frameName},set:function(e){e!==this.animations.frameName&&(this.animations.frameName=e)}}),Object.defineProperty(t.TileSprite.prototype,"fixedToCamera",{get:function(){return!!this._cache[7]},set:function(e){e?(this._cache[7]=1,this.cameraOffset.set(this.x,this.y)):this._cache[7]=0}}),Object.defineProperty(t.TileSprite.prototype,"exists",{get:function(){return!!this._cache[6]},set:function(e){e?(this._cache[6]=1,this.body&&this.body.type===t.Physics.P2JS&&this.body.addToWorld(),this.visible=!0):(this._cache[6]=0,this.body&&this.body.type===t.Physics.P2JS&&(this.body.safeRemove=!0),this.visible=!1)}}),Object.defineProperty(t.TileSprite.prototype,"inputEnabled",{get:function(){return this.input&&this.input.enabled},set:function(e){e?null===this.input&&(this.input=new t.InputHandler(this),this.input.start()):this.input&&this.input.enabled&&this.input.stop()}}),Object.defineProperty(t.TileSprite.prototype,"x",{get:function(){return this.position.x},set:function(e){this.position.x=e,this.body&&this.body.type===t.Physics.ARCADE&&2===this.body.phase&&(this.body._reset=1)}}),Object.defineProperty(t.TileSprite.prototype,"y",{get:function(){return this.position.y},set:function(e){this.position.y=e,this.body&&this.body.type===t.Physics.ARCADE&&2===this.body.phase&&(this.body._reset=1)}}),t.Text=function(e,n,r,i,s){n=n||0,r=r||0,i=i||" ",s=s||{},i=0===i.length?" ":i.toString(),this.game=e,this.exists=!0,this.name="",this.type=t.TEXT,this.z=0,this.world=new t.Point(n,r),this._text=i,this._font="",this._fontSize=32,this._fontWeight="normal",this._lineSpacing=0,this.events=new t.Events(this),this.input=null,this.cameraOffset=new t.Point,this.setStyle(s),PIXI.Text.call(this,i,this.style),this.position.set(n,r),this._cache=[0,0,0,0,1,0,1,0]},t.Text.prototype=Object.create(PIXI.Text.prototype),t.Text.prototype.constructor=t.Text,t.Text.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.renderOrderID=-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 e=0,t=this.children.length;t>e;e++)this.children[e].preUpdate();return!0},t.Text.prototype.update=function(){},t.Text.prototype.postUpdate=function(){1===this._cache[7]&&(this.position.x=(this.game.camera.view.x+this.cameraOffset.x)/this.game.camera.scale.x,this.position.y=(this.game.camera.view.y+this.cameraOffset.y)/this.game.camera.scale.y);for(var e=0,t=this.children.length;t>e;e++)this.children[e].postUpdate()},t.Text.prototype.destroy=function(e){if(null!==this.game){"undefined"==typeof e&&(e=!0),this.parent&&(this.parent instanceof t.Group?this.parent.remove(this):this.parent.removeChild(this)),this.texture.destroy(),this.canvas.parentNode?this.canvas.parentNode.removeChild(this.canvas):(this.canvas=null,this.context=null);var n=this.children.length;if(e)for(;n--;)this.children[n].destroy(e);else for(;n--;)this.removeChild(this.children[n]);this.exists=!1,this.visible=!1,this.filters=null,this.mask=null,this.game=null}},t.Text.prototype.setShadow=function(e,t,n,r){this.style.shadowOffsetX=e||0,this.style.shadowOffsetY=t||0,this.style.shadowColor=n||"rgba(0,0,0,0)",this.style.shadowBlur=r||0,this.dirty=!0},t.Text.prototype.setStyle=function(e){e=e||{},e.font=e.font||"bold 20pt Arial",e.fill=e.fill||"black",e.align=e.align||"left",e.stroke=e.stroke||"black",e.strokeThickness=e.strokeThickness||0,e.wordWrap=e.wordWrap||!1,e.wordWrapWidth=e.wordWrapWidth||100,e.shadowOffsetX=e.shadowOffsetX||0,e.shadowOffsetY=e.shadowOffsetY||0,e.shadowColor=e.shadowColor||"rgba(0,0,0,0)",e.shadowBlur=e.shadowBlur||0,this.style=e,this.dirty=!0},t.Text.prototype.updateText=function(){this.context.font=this.style.font;var e=this.text;this.style.wordWrap&&(e=this.runWordWrap(this.text));for(var t=e.split(/(?:\r\n|\r|\n)/),n=[],r=0,i=0;ii?(o>0&&(t+="\n"),t+=s[o]+" ",i=this.style.wordWrapWidth-u):(i-=a,t+=s[o]+" ")}r?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~",t.RetroFont.TEXT_SET2=" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ",t.RetroFont.TEXT_SET3="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ",t.RetroFont.TEXT_SET4="ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789",t.RetroFont.TEXT_SET5="ABCDEFGHIJKLMNOPQRSTUVWXYZ.,/() '!?-*:0123456789",t.RetroFont.TEXT_SET6="ABCDEFGHIJKLMNOPQRSTUVWXYZ!?:;0123456789\"(),-.' ",t.RetroFont.TEXT_SET7="AGMSY+:4BHNTZ!;5CIOU.?06DJPV,(17EKQW\")28FLRX-'39",t.RetroFont.TEXT_SET8="0123456789 .ABCDEFGHIJKLMNOPQRSTUVWXYZ",t.RetroFont.TEXT_SET9="ABCDEFGHIJKLMNOPQRSTUVWXYZ()-0123456789.:,'\"?!",t.RetroFont.TEXT_SET10="ABCDEFGHIJKLMNOPQRSTUVWXYZ",t.RetroFont.TEXT_SET11="ABCDEFGHIJKLMNOPQRSTUVWXYZ.,\"-+!?()':;0123456789",t.RetroFont.prototype.setFixedWidth=function(e,t){"undefined"==typeof t&&(t="left"),this.fixedWidth=e,this.align=t},t.RetroFont.prototype.setText=function(e,t,n,r,i,s){this.multiLine=t||!1,this.customSpacingX=n||0,this.customSpacingY=r||0,this.align=i||"left",this.autoUpperCase=s?!1:!0,e.length>0&&(this.text=e)},t.RetroFont.prototype.resize=function(e,t){if(this.width=e,this.height=t,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 n=this.renderer.gl;n.bindTexture(n.TEXTURE_2D,this.baseTexture._glTextures[n.id]),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,this.width,this.height,0,n.RGBA,n.UNSIGNED_BYTE,null)}else this.textureBuffer.resize(this.width,this.height);PIXI.Texture.frameUpdates.push(this)},t.RetroFont.prototype.buildRetroFontText=function(){var e=0,n=0;if(this.multiLine){var r=this._text.split("\n");this.fixedWidth>0?this.resize(this.fixedWidth,r.length*(this.characterHeight+this.customSpacingY)-this.customSpacingY):this.resize(this.getLongestLine()*(this.characterWidth+this.customSpacingX),r.length*(this.characterHeight+this.customSpacingY)-this.customSpacingY),this.textureBuffer.clear();for(var i=0;ie&&(e=0),this.pasteLine(r[i],e,n,this.customSpacingX),n+=this.characterHeight+this.customSpacingY}}else{switch(this.fixedWidth>0?this.resize(this.fixedWidth,this.characterHeight):this.resize(this._text.length*(this.characterWidth+this.customSpacingX),this.characterHeight),this.textureBuffer.clear(),this.align){case t.RetroFont.ALIGN_LEFT:e=0;break;case t.RetroFont.ALIGN_RIGHT:e=this.width-this._text.length*(this.characterWidth+this.customSpacingX);break;case t.RetroFont.ALIGN_CENTER:e=this.width/2-this._text.length*(this.characterWidth+this.customSpacingX)/2,e+=this.customSpacingX/2}this.pasteLine(this._text,e,0,this.customSpacingX)}},t.RetroFont.prototype.pasteLine=function(e,n,r,i){for(var s=new t.Point,o=0;o=0&&(this.stamp.frame=this.grabData[e.charCodeAt(o)],s.set(n,r),this.render(this.stamp,s,!1),n+=this.characterWidth+i,n>this.width))break},t.RetroFont.prototype.getLongestLine=function(){var e=0;if(this._text.length>0)for(var t=this._text.split("\n"),n=0;ne&&(e=t[n].length);return e},t.RetroFont.prototype.removeUnsupportedCharacters=function(e){for(var t="",n=0;n=0||!e&&"\n"===r)&&(t=t.concat(r))}return t},Object.defineProperty(t.RetroFont.prototype,"text",{get:function(){return this._text},set:function(e){var t;t=this.autoUpperCase?e.toUpperCase():e,t!==this._text&&(this._text=t,this.removeUnsupportedCharacters(this.multiLine),this.buildRetroFontText())}}),t.Canvas={create:function(e,t,n,r){if("undefined"==typeof r&&(r=!1),e=e||256,t=t||256,r)var i=document.createElement("canvas");else var i=document.createElement(navigator.isCocoonJS?"screencanvas":"canvas");return"string"==typeof n&&""!==n&&(i.id=n),i.width=e,i.height=t,i.style.display="block",i},getOffset:function(e,n){n=n||new t.Point;var r=e.getBoundingClientRect(),i=e.clientTop||document.body.clientTop||0,s=e.clientLeft||document.body.clientLeft||0,o=0,u=0;return"CSS1Compat"===document.compatMode?(o=window.pageYOffset||document.documentElement.scrollTop||e.scrollTop||0,u=window.pageXOffset||document.documentElement.scrollLeft||e.scrollLeft||0):(o=window.pageYOffset||document.body.scrollTop||e.scrollTop||0,u=window.pageXOffset||document.body.scrollLeft||e.scrollLeft||0),n.x=r.left+u-s,n.y=r.top+o-i,n},getAspectRatio:function(e){return e.width/e.height},setBackgroundColor:function(e,t){return t=t||"rgb(0,0,0)",e.style.backgroundColor=t,e},setTouchAction:function(e,t){return t=t||"none",e.style.msTouchAction=t,e.style["ms-touch-action"]=t,e.style["touch-action"]=t,e},setUserSelect:function(e,t){return t=t||"none",e.style["-webkit-touch-callout"]=t,e.style["-webkit-user-select"]=t,e.style["-khtml-user-select"]=t,e.style["-moz-user-select"]=t,e.style["-ms-user-select"]=t,e.style["user-select"]=t,e.style["-webkit-tap-highlight-color"]="rgba(0, 0, 0, 0)",e},addToDOM:function(e,t,n){var r;return"undefined"==typeof n&&(n=!0),t&&("string"==typeof t?r=document.getElementById(t):"object"==typeof t&&1===t.nodeType&&(r=t)),r||(r=document.body),n&&r.style&&(r.style.overflow="hidden"),r.appendChild(e),e},setTransform:function(e,t,n,r,i,s,o){return e.setTransform(r,s,o,i,t,n),e},setSmoothingEnabled:function(e,t){return e.imageSmoothingEnabled=t,e.mozImageSmoothingEnabled=t,e.oImageSmoothingEnabled=t,e.webkitImageSmoothingEnabled=t,e.msImageSmoothingEnabled=t,e},setImageRenderingCrisp:function(e){return e.style["image-rendering"]="optimizeSpeed",e.style["image-rendering"]="crisp-edges",e.style["image-rendering"]="-moz-crisp-edges",e.style["image-rendering"]="-webkit-optimize-contrast",e.style["image-rendering"]="optimize-contrast",e.style.msInterpolationMode="nearest-neighbor",e},setImageRenderingBicubic:function(e){return e.style["image-rendering"]="auto",e.style.msInterpolationMode="bicubic",e}},t.Device=function(e){this.game=e,this.desktop=!1,this.iOS=!1,this.cocoonJS=!1,this.ejecta=!1,this.android=!1,this.chromeOS=!1,this.linux=!1,this.macOS=!1,this.windows=!1,this.windowsPhone=!1,this.canvas=!1,this.file=!1,this.fileSystem=!1,this.localStorage=!1,this.webGL=!1,this.worker=!1,this.touch=!1,this.mspointer=!1,this.css3D=!1,this.pointerLock=!1,this.typedArray=!1,this.vibration=!1,this.getUserMedia=!1,this.quirksMode=!1,this.arora=!1,this.chrome=!1,this.epiphany=!1,this.firefox=!1,this.ie=!1,this.ieVersion=0,this.trident=!1,this.tridentVersion=0,this.mobileSafari=!1,this.midori=!1,this.opera=!1,this.safari=!1,this.webApp=!1,this.silk=!1,this.audioData=!1,this.webAudio=!1,this.ogg=!1,this.opus=!1,this.mp3=!1,this.wav=!1,this.m4a=!1,this.webm=!1,this.iPhone=!1,this.iPhone4=!1,this.iPad=!1,this.pixelRatio=0,this.littleEndian=!1,this.fullscreen=!1,this.requestFullscreen="",this.cancelFullscreen="",this.fullscreenKeyboard=!1,this._checkAudio(),this._checkBrowser(),this._checkCSS3D(),this._checkDevice(),this._checkFeatures(),this._checkOS()},t.Device.prototype={_checkOS:function(){var e=navigator.userAgent;/Android/.test(e)?this.android=!0:/CrOS/.test(e)?this.chromeOS=!0:/iP[ao]d|iPhone/i.test(e)?this.iOS=!0:/Linux/.test(e)?this.linux=!0:/Mac OS/.test(e)?this.macOS=!0:/Windows/.test(e)&&(this.windows=!0,/Windows Phone/i.test(e)&&(this.windowsPhone=!0)),(this.windows||this.macOS||this.linux&&this.silk===!1)&&(this.desktop=!0),(this.windowsPhone||/Windows NT/i.test(e)&&/Touch/i.test(e))&&(this.desktop=!1)},_checkFeatures:function(){this.canvas=!!window.CanvasRenderingContext2D||this.cocoonJS;try{this.localStorage=!!localStorage.getItem}catch(e){this.localStorage=!1}this.file=!!(window.File&&window.FileReader&&window.FileList&&window.Blob),this.fileSystem=!!window.requestFileSystem,this.webGL=function(){try{var e=document.createElement("canvas");return!!window.WebGLRenderingContext&&(e.getContext("webgl")||e.getContext("experimental-webgl"))}catch(t){return!1}}(),this.webGL=null===this.webGL||this.webGL===!1?!1:!0,this.worker=!!window.Worker,("ontouchstart"in document.documentElement||window.navigator.maxTouchPoints&&window.navigator.maxTouchPoints>1)&&(this.touch=!0),(window.navigator.msPointerEnabled||window.navigator.pointerEnabled)&&(this.mspointer=!0),this.pointerLock="pointerLockElement"in document||"mozPointerLockElement"in document||"webkitPointerLockElement"in document,this.quirksMode="CSS1Compat"===document.compatMode?!1:!0,this.getUserMedia=!!(navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia)},checkFullScreenSupport:function(){for(var e=["requestFullscreen","requestFullScreen","webkitRequestFullscreen","webkitRequestFullScreen","msRequestFullscreen","msRequestFullScreen","mozRequestFullScreen","mozRequestFullscreen"],t=0;t0,this.typedArray=!0):(this.littleEndian=!1,this.typedArray=!1),navigator.vibrate=navigator.vibrate||navigator.webkitVibrate||navigator.mozVibrate||navigator.msVibrate,navigator.vibrate&&(this.vibration=!0)},_checkCSS3D:function(){var e,t=document.createElement("p"),n={webkitTransform:"-webkit-transform",OTransform:"-o-transform",msTransform:"-ms-transform",MozTransform:"-moz-transform",transform:"transform"};document.body.insertBefore(t,null);for(var r in n)void 0!==t.style[r]&&(t.style[r]="translate3d(1px,1px,1px)",e=window.getComputedStyle(t).getPropertyValue(n[r]));document.body.removeChild(t),this.css3D=void 0!==e&&e.length>0&&"none"!==e},canPlayAudio:function(e){return"mp3"==e&&this.mp3?!0:"ogg"==e&&(this.ogg||this.opus)?!0:"m4a"==e&&this.m4a?!0:"wav"==e&&this.wav?!0:"webm"==e&&this.webm?!0:!1},isConsoleOpen:function(){return window.console&&window.console.firebug?!0:window.console&&(console.profile(),console.profileEnd(),console.clear&&console.clear(),console.profiles)?console.profiles.length>0:!1}},t.Device.prototype.constructor=t.Device,t.RequestAnimationFrame=function(e,t){"undefined"==typeof t&&(t=!1),this.game=e,this.isRunning=!1,this.forceSetTimeOut=t;for(var n=["ms","moz","webkit","o"],r=0;re},fuzzyGreaterThan:function(e,t,n){return"undefined"==typeof n&&(n=1e-4),e>t-n},fuzzyCeil:function(e,t){return"undefined"==typeof t&&(t=1e-4),Math.ceil(e-t)},fuzzyFloor:function(e,t){return"undefined"==typeof t&&(t=1e-4),Math.floor(e+t)},average:function(){for(var e=[],t=0;t0?Math.floor(e):Math.ceil(e)},shear:function(e){return e%1},snapTo:function(e,t,n){return"undefined"==typeof n&&(n=0),0===t?e:(e-=n,e=t*Math.round(e/t),n+e)},snapToFloor:function(e,t,n){return"undefined"==typeof n&&(n=0),0===t?e:(e-=n,e=t*Math.floor(e/t),n+e)},snapToCeil:function(e,t,n){return"undefined"==typeof n&&(n=0),0===t?e:(e-=n,e=t*Math.ceil(e/t),n+e)},snapToInArray:function(e,t,n){if("undefined"==typeof n&&(n=!0),n&&t.sort(),e=s-e?s:i},roundTo:function(e,t,n){"undefined"==typeof t&&(t=0),"undefined"==typeof n&&(n=10);var r=Math.pow(n,-t);return Math.round(e*r)/r},floorTo:function(e,t,n){"undefined"==typeof t&&(t=0),"undefined"==typeof n&&(n=10);var r=Math.pow(n,-t);return Math.floor(e*r)/r},ceilTo:function(e,t,n){"undefined"==typeof t&&(t=0),"undefined"==typeof n&&(n=10);var r=Math.pow(n,-t);return Math.ceil(e*r)/r},interpolateFloat:function(e,t,n){return(t-e)*n+e},angleBetween:function(e,t,n,r){return Math.atan2(n-e,r-t)},angleBetweenPoints:function(e,t){return Math.atan2(t.x-e.x,t.y-e.y)},reverseAngle:function(e){return this.normalizeAngle(e+Math.PI,!0)},normalizeAngle:function(e){return e%=2*Math.PI,e>=0?e:e+2*Math.PI},normalizeLatitude:function(e){return Math.max(-90,Math.min(90,e))},normalizeLongitude:function(e){return e%360==180?180:(e%=360,-180>e?e+360:e>180?e-360:e)},nearestAngleBetween:function(e,t,n){"undefined"==typeof n&&(n=!0);var r=n?Math.PI:180;return e=this.normalizeAngle(e,n),t=this.normalizeAngle(t,n),-r/2>e&&t>r/2&&(e+=2*r),-r/2>t&&e>r/2&&(t+=2*r),t-e},interpolateAngles:function(e,t,n,r,i){return"undefined"==typeof r&&(r=!0),"undefined"==typeof i&&(i=null),e=this.normalizeAngle(e,r),t=this.normalizeAngleToAnother(t,e,r),"function"==typeof i?i(n,e,t-e,1):this.interpolateFloat(e,t,n)},chanceRoll:function(e){return"undefined"==typeof e&&(e=50),0>=e?!1:e>=100?!0:100*Math.random()>=e?!1:!0},numberArray:function(e,t){for(var n=[],r=e;t>=r;r++)n.push(r);return n},maxAdd:function(e,t,n){return e+=t,e>n&&(e=n),e},minSub:function(e,t,n){return e-=t,n>e&&(e=n),e},wrap:function(e,t,n){var r=n-t;if(0>=r)return 0;var i=(e-t)%r;return 0>i&&(i+=r),i+t},wrapValue:function(e,t,n){var r;return e=Math.abs(e),t=Math.abs(t),n=Math.abs(n),r=(e+t)%n},randomSign:function(){return Math.random()>.5?1:-1},isOdd:function(e){return 1&e},isEven:function(e){return 1&e?!1:!0},min:function(){if(1===arguments.length&&"object"==typeof arguments[0])var e=arguments[0];else var e=arguments;for(var t=1,n=0,r=e.length;r>t;t++)e[t]t;t++)e[t]>e[n]&&(n=t);return e[n]},minProperty:function(e){if(2===arguments.length&&"object"==typeof arguments[1])var t=arguments[1];else var t=arguments.slice(1);for(var n=1,r=0,i=t.length;i>n;n++)t[n][e]n;n++)t[n][e]>t[r][e]&&(r=n);return t[r][e]},wrapAngle:function(e,t){var n=t?Math.PI/180:1;return this.wrap(e,-180*n,180*n)},angleLimit:function(e,t,n){var r=e;return e>n?r=n:t>e&&(r=t),r},linearInterpolation:function(e,t){var n=e.length-1,r=n*t,i=Math.floor(r);return 0>t?this.linear(e[0],e[1],r):t>1?this.linear(e[n],e[n-1],n-r):this.linear(e[i],e[i+1>n?n:i+1],r-i)},bezierInterpolation:function(e,t){for(var n=0,r=e.length-1,i=0;r>=i;i++)n+=Math.pow(1-t,r-i)*Math.pow(t,i)*e[i]*this.bernstein(r,i);return n},catmullRomInterpolation:function(e,t){var n=e.length-1,r=n*t,i=Math.floor(r);return e[0]===e[n]?(0>t&&(i=Math.floor(r=n*(1+t))),this.catmullRom(e[(i-1+n)%n],e[i],e[(i+1)%n],e[(i+2)%n],r-i)):0>t?e[0]-(this.catmullRom(e[0],e[0],e[1],e[1],-r)-e[0]):t>1?e[n]-(this.catmullRom(e[n],e[n],e[n-1],e[n-1],r-n)-e[n]):this.catmullRom(e[i?i-1:0],e[i],e[i+1>n?n:i+1],e[i+2>n?n:i+2],r-i)},linear:function(e,t,n){return(t-e)*n+e},bernstein:function(e,t){return this.factorial(e)/this.factorial(t)/this.factorial(e-t)},catmullRom:function(e,t,n,r,i){var s=.5*(n-e),o=.5*(r-t),u=i*i,a=i*u;return(2*t-2*n+s+o)*a+(-3*t+3*n-2*s-o)*u+s*i+t},difference:function(e,t){return Math.abs(e-t)},getRandom:function(e,t,n){if("undefined"==typeof t&&(t=0),"undefined"==typeof n&&(n=0),null!=e){var r=n;if((0===r||r>e.length-t)&&(r=e.length-t),r>0)return e[t+Math.floor(Math.random()*r)]}return null},removeRandom:function(e,t,n){if("undefined"==typeof t&&(t=0),"undefined"==typeof n&&(n=0),null!=e){var r=n;if((0===r||r>e.length-t)&&(r=e.length-t),r>0){var i=t+Math.floor(Math.random()*r),s=e.splice(i,1);return s[0]}}return null},floor:function(e){var t=0|e;return e>0?t:t!=e?t-1:t},ceil:function(e){var t=0|e;return e>0&&t!=e?t+1:t},sinCosGenerator:function(e,t,n,r){"undefined"==typeof t&&(t=1),"undefined"==typeof n&&(n=1),"undefined"==typeof r&&(r=1);for(var i=t,s=n,o=r*Math.PI/e,u=[],a=[],f=0;e>f;f++)s-=i*o,i+=s*o,u[f]=s,a[f]=i;return{sin:a,cos:u,length:e}},shift:function(e){var t=e.shift();return e.push(t),t},shuffleArray:function(e){for(var t=e.length-1;t>0;t--){var n=Math.floor(Math.random()*(t+1)),r=e[t];e[t]=e[n],e[n]=r}return e},distance:function(e,t,n,r){var i=e-n,s=t-r;return Math.sqrt(i*i+s*s)},distancePow:function(e,t,n,r,i){return"undefined"==typeof i&&(i=2),Math.sqrt(Math.pow(n-e,i)+Math.pow(r-t,i))},distanceRounded:function(e,n,r,i){return Math.round(t.Math.distance(e,n,r,i))},clamp:function(e,t,n){return t>e?t:e>n?n:e},clampBottom:function(e,t){return t>e?t:e},within:function(e,t,n){return Math.abs(e-t)<=n},mapLinear:function(e,t,n,r,i){return r+(e-t)*(i-r)/(n-t)},smoothstep:function(e,t,n){return t>=e?0:e>=n?1:(e=(e-t)/(n-t),e*e*(3-2*e))},smootherstep:function(e,t,n){return t>=e?0:e>=n?1:(e=(e-t)/(n-t),e*e*e*(e*(6*e-15)+10))},sign:function(e){return 0>e?-1:e>0?1:0},degToRad:function(){var e=Math.PI/180;return function(t){return t*e}}(),radToDeg:function(){var e=180/Math.PI;return function(t){return t*e}}()},t.RandomDataGenerator=function(e){"undefined"==typeof e&&(e=[]),this.c=1,this.s0=0,this.s1=0,this.s2=0,this.sow(e)},t.RandomDataGenerator.prototype={rnd:function(){var e=2091639*this.s0+2.3283064365386963e-10*this.c;return this.c=0|e,this.s0=this.s1,this.s1=this.s2,this.s2=e-this.c,this.s2},sow:function(e){"undefined"==typeof e&&(e=[]),this.s0=this.hash(" "),this.s1=this.hash(this.s0),this.s2=this.hash(this.s1),this.c=1;for(var t,n=0;t=e[n++];)this.s0-=this.hash(t),this.s0+=~~(this.s0<0),this.s1-=this.hash(t),this.s1+=~~(this.s1<0),this.s2-=this.hash(t),this.s2+=~~(this.s2<0)},hash:function(e){var t,n,r;for(r=4022871197,e=e.toString(),n=0;n>>0,t-=r,t*=r,r=t>>>0,t-=r,r+=4294967296*t;return 2.3283064365386963e-10*(r>>>0)},integer:function(){return 4294967296*this.rnd.apply(this)},frac:function(){return this.rnd.apply(this)+1.1102230246251565e-16*(2097152*this.rnd.apply(this)|0)},real:function(){return this.integer()+this.frac()},integerInRange:function(e,t){return Math.round(this.realInRange(e,t))},realInRange:function(e,t){return this.frac()*(t-e)+e},normal:function(){return 1-2*this.frac()},uuid:function(){var e="",t="";for(t=e="";e++<36;t+=~e%5|3*e&4?(15^e?8^this.frac()*(20^e?16:4):4).toString(16):"-");return t},pick:function(e){return e[this.integerInRange(0,e.length-1)]},weightedPick:function(e){return e[~~(Math.pow(this.frac(),2)*(e.length-1))]},timestamp:function(e,t){return this.realInRange(e||9466848e5,t||1577862e6)},angle:function(){return this.integerInRange(-180,180)}},t.RandomDataGenerator.prototype.constructor=t.RandomDataGenerator,t.QuadTree=function(e,t,n,r,i,s,o){this.maxObjects=10,this.maxLevels=4,this.level=0,this.bounds={},this.objects=[],this.nodes=[],this.reset(e,t,n,r,i,s,o)},t.QuadTree.prototype={reset:function(e,t,n,r,i,s,o){this.maxObjects=i||10,this.maxLevels=s||4,this.level=o||0,this.bounds={x:Math.round(e),y:Math.round(t),width:n,height:r,subWidth:Math.floor(n/2),subHeight:Math.floor(r/2),right:Math.round(e)+Math.floor(n/2),bottom:Math.round(t)+Math.floor(r/2)},this.objects.length=0,this.nodes.length=0},populate:function(e){e.forEach(this.populateHandler,this,!0)},populateHandler:function(e){e.body&&e.exists&&this.insert(e.body)},split:function(){this.level++,this.nodes[0]=new t.QuadTree(this.bounds.right,this.bounds.y,this.bounds.subWidth,this.bounds.subHeight,this.maxObjects,this.maxLevels,this.level),this.nodes[1]=new t.QuadTree(this.bounds.x,this.bounds.y,this.bounds.subWidth,this.bounds.subHeight,this.maxObjects,this.maxLevels,this.level),this.nodes[2]=new t.QuadTree(this.bounds.x,this.bounds.bottom,this.bounds.subWidth,this.bounds.subHeight,this.maxObjects,this.maxLevels,this.level),this.nodes[3]=new t.QuadTree(this.bounds.right,this.bounds.bottom,this.bounds.subWidth,this.bounds.subHeight,this.maxObjects,this.maxLevels,this.level)},insert:function(e){var t,n=0;if(null!=this.nodes[0]&&(t=this.getIndex(e),-1!==t))return void this.nodes[t].insert(e);if(this.objects.push(e),this.objects.length>this.maxObjects&&this.levelthis.bounds.bottom&&(t=2):e.x>this.bounds.right&&(e.ythis.bounds.bottom&&(t=3)),t},retrieve:function(e){var t=this.objects,n=this.getIndex(e.body);return this.nodes[0]&&(-1!==n?t=t.concat(this.nodes[n].retrieve(e)):(t=t.concat(this.nodes[0].retrieve(e)),t=t.concat(this.nodes[1].retrieve(e)),t=t.concat(this.nodes[2].retrieve(e)),t=t.concat(this.nodes[3].retrieve(e)))),t},clear:function(){this.objects.length=0;for(var e=this.nodes.length;e--;)this.nodes[e].clear(),this.nodes.splice(e,1);this.nodes.length=0}},t.QuadTree.prototype.constructor=t.QuadTree,t.Net=function(e){this.game=e},t.Net.prototype={getHostName:function(){return window.location&&window.location.hostname?window.location.hostname:null},checkDomainName:function(e){return-1!==window.location.hostname.indexOf(e)},updateQueryString:function(e,t,n,r){"undefined"==typeof n&&(n=!1),("undefined"==typeof r||""===r)&&(r=window.location.href);var i="",s=new RegExp("([?|&])"+e+"=.*?(&|#|$)(.*)","gi");if(s.test(r))i="undefined"!=typeof t&&null!==t?r.replace(s,"$1"+e+"="+t+"$2$3"):r.replace(s,"$1$3").replace(/(&|\?)$/,"");else if("undefined"!=typeof t&&null!==t){var o=-1!==r.indexOf("?")?"&":"?",u=r.split("#");r=u[0]+o+e+"="+t,u[1]&&(r+="#"+u[1]),i=r}else i=r;return n?void (window.location.href=i):i},getQueryString:function(e){"undefined"==typeof e&&(e="");var t={},n=location.search.substring(1).split("&");for(var r in n){var i=n[r].split("=");if(i.length>1){if(e&&e==this.decodeURI(i[0]))return this.decodeURI(i[1]);t[this.decodeURI(i[0])]=this.decodeURI(i[1])}}return t},decodeURI:function(e){return decodeURIComponent(e.replace(/\+/g," "))}},t.Net.prototype.constructor=t.Net,t.TweenManager=function(e){this.game=e,this._tweens=[],this._add=[],this.game.onPause.add(this._pauseAll,this),this.game.onResume.add(this._resumeAll,this)},t.TweenManager.prototype={getAll:function(){return this._tweens},removeAll:function(){for(var e=0;ee;)this._tweens[e].update(this.game.time.now)?e++:(this._tweens.splice(e,1),t--);return this._add.length>0&&(this._tweens=this._tweens.concat(this._add),this._add.length=0),!0},isTweening:function(e){return this._tweens.some(function(t){return t._object===e})},_pauseAll:function(){for(var e=this._tweens.length-1;e>=0;e--)this._tweens[e]._pause()},_resumeAll:function(){for(var e=this._tweens.length-1;e>=0;e--)this._tweens[e]._resume()},pauseAll:function(){for(var e=this._tweens.length-1;e>=0;e--)this._tweens[e].pause()},resumeAll:function(){for(var e=this._tweens.length-1;e>=0;e--)this._tweens[e].resume(!0)}},t.TweenManager.prototype.constructor=t.TweenManager,t.Tween=function(e,n,r){this._object=e,this.game=n,this._manager=r,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._repeat=0,this._yoyo=!1,this._reversed=!1,this._delayTime=0,this._startTime=null,this._easingFunction=t.Easing.Linear.None,this._interpolationFunction=t.Math.linearInterpolation,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onUpdateCallback=null,this._onUpdateCallbackContext=null,this._paused=!1,this._pausedTime=0,this._codePaused=!1,this.pendingDelete=!1,this.onStart=new t.Signal,this.onLoop=new t.Signal,this.onComplete=new t.Signal,this.isRunning=!1},t.Tween.prototype={to:function(e,t,n,r,i,s,o){t=t||1e3,n=n||null,r=r||!1,i=i||0,s=s||0,o=o||!1;var u;return this._parent?(u=this._manager.create(this._object),this._lastChild.chain(u),this._lastChild=u):(u=this,this._parent=this,this._lastChild=this),u._repeat=s,u._duration=t,u._valuesEnd=e,null!==n&&(u._easingFunction=n),i>0&&(u._delayTime=i),u._yoyo=o,r?this.start():this},start:function(){if(null!==this.game&&null!==this._object){this._manager.add(this),this.isRunning=!0,this._onStartCallbackFired=!1,this._startTime=this.game.time.now+this._delayTime;for(var e in this._valuesEnd){if(Array.isArray(this._valuesEnd[e])){if(0===this._valuesEnd[e].length)continue;this._valuesEnd[e]=[this._object[e]].concat(this._valuesEnd[e])}this._valuesStart[e]=this._object[e],Array.isArray(this._valuesStart[e])||(this._valuesStart[e]*=1),this._valuesStartRepeat[e]=this._valuesStart[e]||0}return this}},generateData:function(e,t){if(null===this.game||null===this._object)return null;this._startTime=0;for(var n in this._valuesEnd){if(Array.isArray(this._valuesEnd[n])){if(0===this._valuesEnd[n].length)continue;this._valuesEnd[n]=[this._object[n]].concat(this._valuesEnd[n])}this._valuesStart[n]=this._object[n],Array.isArray(this._valuesStart[n])||(this._valuesStart[n]*=1),this._valuesStartRepeat[n]=this._valuesStart[n]||0}for(var r=0,i=Math.floor(e*(this._duration/1e3)),s=this._duration/i,o=[];i--;){var n,u=(r-this._startTime)/this._duration;u=u>1?1:u;var a=this._easingFunction(u),f={};for(n in this._valuesEnd){var l=this._valuesStart[n]||0,c=this._valuesEnd[n];c instanceof Array?f[n]=this._interpolationFunction(c,a):("string"==typeof c&&(c=l+parseFloat(c,10)),"number"==typeof c&&(f[n]=l+(c-l)*a))}o.push(f),r+=s}if(this._yoyo){var h=o.slice();h.reverse(),o=o.concat(h)}return"undefined"!=typeof t?t=t.concat(o):o},stop:function(){return this.isRunning=!1,this._onUpdateCallback=null,this._manager.remove(this),this},delay:function(e){return this._delayTime=e,this},repeat:function(e){return this._repeat=e,this},yoyo:function(e){return this._yoyo=e,this},easing:function(e){return this._easingFunction=e,this},interpolation:function(e){return this._interpolationFunction=e,this},chain:function(){return this._chainedTweens=arguments,this},loop:function(){return this._lastChild.chain(this),this},onUpdateCallback:function(e,t){return this._onUpdateCallback=e,this._onUpdateCallbackContext=t,this},pause:function(){this._codePaused=!0,this._paused=!0,this._pausedTime=this.game.time.now},_pause:function(){this._codePaused||(this._paused=!0,this._pausedTime=this.game.time.now)},resume:function(){this._paused&&(this._paused=!1,this._codePaused=!1,this._startTime+=this.game.time.now-this._pausedTime)},_resume:function(){this._codePaused||(this._startTime+=this.game.time.pauseDuration,this._paused=!1)},update:function(e){if(this.pendingDelete)return!1;if(this._paused||e1?1:n;var r=this._easingFunction(n);for(t in this._valuesEnd){var i=this._valuesStart[t]||0,s=this._valuesEnd[t];s instanceof Array?this._object[t]=this._interpolationFunction(s,r):("string"==typeof s&&(s=i+parseFloat(s,10)),"number"==typeof s&&(this._object[t]=i+(s-i)*r))}if(null!==this._onUpdateCallback&&this._onUpdateCallback.call(this._onUpdateCallbackContext,this,r),1==n){if(this._repeat>0){isFinite(this._repeat)&&this._repeat--;for(t in this._valuesStartRepeat){if("string"==typeof this._valuesEnd[t]&&(this._valuesStartRepeat[t]=this._valuesStartRepeat[t]+parseFloat(this._valuesEnd[t],10)),this._yoyo){var o=this._valuesStartRepeat[t];this._valuesStartRepeat[t]=this._valuesEnd[t],this._valuesEnd[t]=o,this._reversed=!this._reversed}this._valuesStart[t]=this._valuesStartRepeat[t]}return this._startTime=e+this._delayTime,this.onLoop.dispatch(this._object),!0}this.isRunning=!1,this.onComplete.dispatch(this._object);for(var u=0,a=this._chainedTweens.length;a>u;u++)this._chainedTweens[u].start(e);return!1}return!0}},t.Tween.prototype.constructor=t.Tween,t.Easing={Linear:{None:function(e){return e}},Quadratic:{In:function(e){return e*e},Out:function(e){return e*(2-e)},InOut:function(e){return(e*=2)<1?.5*e*e:-0.5*(--e*(e-2)-1)}},Cubic:{In:function(e){return e*e*e},Out:function(e){return--e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)}},Quartic:{In:function(e){return e*e*e*e},Out:function(e){return 1- --e*e*e*e},InOut:function(e){return(e*=2)<1?.5*e*e*e*e:-0.5*((e-=2)*e*e*e-2)}},Quintic:{In:function(e){return e*e*e*e*e},Out:function(e){return--e*e*e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2)}},Sinusoidal:{In:function(e){return 1-Math.cos(e*Math.PI/2)},Out:function(e){return Math.sin(e*Math.PI/2)},InOut:function(e){return.5*(1-Math.cos(Math.PI*e))}},Exponential:{In:function(e){return 0===e?0:Math.pow(1024,e-1)},Out:function(e){return 1===e?1:1-Math.pow(2,-10*e)},InOut:function(e){return 0===e?0:1===e?1:(e*=2)<1?.5*Math.pow(1024,e-1):.5*(-Math.pow(2,-10*(e-1))+2)}},Circular:{In:function(e){return 1-Math.sqrt(1-e*e)},Out:function(e){return Math.sqrt(1- --e*e)},InOut:function(e){return(e*=2)<1?-0.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)}},Elastic:{In:function(e){var t,n=.1,r=.4;return 0===e?0:1===e?1:(!n||1>n?(n=1,t=r/4):t=r*Math.asin(1/n)/(2*Math.PI),-(n*Math.pow(2,10*(e-=1))*Math.sin(2*(e-t)*Math.PI/r)))},Out:function(e){var t,n=.1,r=.4;return 0===e?0:1===e?1:(!n||1>n?(n=1,t=r/4):t=r*Math.asin(1/n)/(2*Math.PI),n*Math.pow(2,-10*e)*Math.sin(2*(e-t)*Math.PI/r)+1)},InOut:function(e){var t,n=.1,r=.4;return 0===e?0:1===e?1:(!n||1>n?(n=1,t=r/4):t=r*Math.asin(1/n)/(2*Math.PI),(e*=2)<1?-0.5*n*Math.pow(2,10*(e-=1))*Math.sin(2*(e-t)*Math.PI/r):n*Math.pow(2,-10*(e-=1))*Math.sin(2*(e-t)*Math.PI/r)*.5+1)}},Back:{In:function(e){var t=1.70158;return e*e*((t+1)*e-t)},Out:function(e){var t=1.70158;return--e*e*((t+1)*e+t)+1},InOut:function(e){var t=2.5949095;return(e*=2)<1?.5*e*e*((t+1)*e-t):.5*((e-=2)*e*((t+1)*e+t)+2)}},Bounce:{In:function(e){return 1-t.Easing.Bounce.Out(1-e)},Out:function(e){return 1/2.75>e?7.5625*e*e:2/2.75>e?7.5625*(e-=1.5/2.75)*e+.75:2.5/2.75>e?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},InOut:function(e){return.5>e?.5*t.Easing.Bounce.In(2*e):.5*t.Easing.Bounce.Out(2*e-1)+.5}}},t.Time=function(e){this.game=e,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.frames=0,this.pauseDuration=0,this.timeToCall=0,this.lastTime=0,this.events=new t.Timer(this.game,!1),this._started=0,this._timeLastSecond=0,this._pauseStarted=0,this._justResumed=!1,this._timers=[],this._len=0,this._i=0},t.Time.prototype={boot:function(){this._started=Date.now(),this.events.start()},create:function(e){"undefined"==typeof e&&(e=!0);var n=new t.Timer(this.game,e);return this._timers.push(n),n},removeAll:function(){for(var e=0;e0&&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=e+this.timeToCall,!this.game.paused)for(this.events.update(this.now),this._i=0,this._len=this._timers.length;this._i0&&(this.events.sort(this.sortHandler),this.nextTick=this.events[0].tick)},sortHandler:function(e,t){return e.tickt.tick?1:0},update:function(e){if(this.paused)return!0;for(this._now=e,this._len=this.events.length,this._i=0;this._i=this.nextTick&&this._len>0){for(this._i=0;this._i=this.events[this._i].tick;){var t=this._now-this.events[this._i].tick,n=this._now+this.events[this._i].delay-t;0>n&&(n=this._now+this.events[this._i].delay),this.events[this._i].loop===!0?(this.events[this._i].tick=n,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=n,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){var e=this.game.time.now-this._pauseStarted;this._pauseTotal+=e;for(var t=0;tthis._now?this.nextTick-this._now:0}}),Object.defineProperty(t.Timer.prototype,"length",{get:function(){return this.events.length}}),Object.defineProperty(t.Timer.prototype,"ms",{get:function(){return this._now-this._started-this._pauseTotal}}),Object.defineProperty(t.Timer.prototype,"seconds",{get:function(){return.001*this.ms}}),t.Timer.prototype.constructor=t.Timer,t.TimerEvent=function(e,t,n,r,i,s,o,u){this.timer=e,this.delay=t,this.tick=n,this.repeatCount=r-1,this.loop=i,this.callback=s,this.callbackContext=o,this.args=u,this.pendingDelete=!1},t.TimerEvent.prototype.constructor=t.TimerEvent,t.AnimationManager=function(e){this.sprite=e,this.game=e.game,this.currentFrame=null,this.updateIfVisible=!0,this.isLoaded=!1,this._frameData=null,this._anims={},this._outputFrames=[]},t.AnimationManager.prototype={loadFrameData:function(e){this._frameData=e,this.frame=0,this.isLoaded=!0},add:function(e,n,r,i,s){return null==this._frameData?void console.warn("No FrameData available for Phaser.Animation "+e):(n=n||[],r=r||60,"undefined"==typeof i&&(i=!1),"undefined"==typeof s&&(s=n&&"number"==typeof n[0]?!0:!1),null==this.sprite.events.onAnimationStart&&(this.sprite.events.onAnimationStart=new t.Signal,this.sprite.events.onAnimationComplete=new t.Signal,this.sprite.events.onAnimationLoop=new t.Signal),this._outputFrames.length=0,this._frameData.getFrameIndexes(n,s,this._outputFrames),this._anims[e]=new t.Animation(this.game,this.sprite,e,this._frameData,this._outputFrames,r,i),this.currentAnim=this._anims[e],this.currentFrame=this.currentAnim.currentFrame,this.sprite.setTexture(PIXI.TextureCache[this.currentFrame.uuid]),this.sprite.__tilePattern&&(this.__tilePattern=!1,this.tilingTexture=!1),this._anims[e])},validateFrames:function(e,t){"undefined"==typeof t&&(t=!0);for(var n=0;nthis._frameData.total)return!1}else if(this._frameData.checkFrameName(e[n])===!1)return!1;return!0},play:function(e,t,n,r){if(this._anims[e]){if(this.currentAnim!=this._anims[e])return this.currentAnim=this._anims[e],this.currentAnim.paused=!1,this.currentAnim.play(t,n,r);if(this.currentAnim.isPlaying===!1)return this.currentAnim.paused=!1,this.currentAnim.play(t,n,r)}},stop:function(e,t){"undefined"==typeof t&&(t=!1),"string"==typeof e?this._anims[e]&&(this.currentAnim=this._anims[e],this.currentAnim.stop(t)):this.currentAnim&&this.currentAnim.stop(t)},update:function(){return this.updateIfVisible&&!this.sprite.visible?!1:this.currentAnim&&this.currentAnim.update()===!0?(this.currentFrame=this.currentAnim.currentFrame,!0):!1},getAnimation:function(e){return"string"==typeof e&&this._anims[e]?this._anims[e]:null},refreshFrame:function(){this.sprite.setTexture(PIXI.TextureCache[this.currentFrame.uuid]),this.sprite.__tilePattern&&(this.__tilePattern=!1,this.tilingTexture=!1)},destroy:function(){this._anims={},this._frameData=null,this._frameIndex=0,this.currentAnim=null,this.currentFrame=null}},t.AnimationManager.prototype.constructor=t.AnimationManager,Object.defineProperty(t.AnimationManager.prototype,"frameData",{get:function(){return this._frameData}}),Object.defineProperty(t.AnimationManager.prototype,"frameTotal",{get:function(){return this._frameData?this._frameData.total:-1}}),Object.defineProperty(t.AnimationManager.prototype,"paused",{get:function(){return this.currentAnim.isPaused},set:function(e){this.currentAnim.paused=e}}),Object.defineProperty(t.AnimationManager.prototype,"frame",{get:function(){return this.currentFrame?this._frameIndex:void 0},set:function(e){"number"==typeof e&&this._frameData&&null!==this._frameData.getFrame(e)&&(this.currentFrame=this._frameData.getFrame(e),this.currentFrame&&(this._frameIndex=e,this.sprite.setTexture(PIXI.TextureCache[this.currentFrame.uuid]),this.sprite.__tilePattern&&(this.__tilePattern=!1,this.tilingTexture=!1)))}}),Object.defineProperty(t.AnimationManager.prototype,"frameName",{get:function(){return this.currentFrame?this.currentFrame.name:void 0},set:function(e){"string"==typeof e&&this._frameData&&null!==this._frameData.getFrameByName(e)?(this.currentFrame=this._frameData.getFrameByName(e),this.currentFrame&&(this._frameIndex=this.currentFrame.index,this.sprite.setTexture(PIXI.TextureCache[this.currentFrame.uuid]),this.sprite.__tilePattern&&(this.__tilePattern=!1,this.tilingTexture=!1))):console.warn("Cannot set frameName: "+e)}}),t.Animation=function(e,n,r,i,s,o,u){this.game=e,this._parent=n,this._frameData=i,this.name=r,this._frames=[],this._frames=this._frames.concat(s),this.delay=1e3/o,this.loop=u,this.loopCount=0,this.killOnComplete=!1,this.isFinished=!1,this.isPlaying=!1,this.isPaused=!1,this._pauseStartTime=0,this._frameIndex=0,this._frameDiff=0,this._frameSkip=1,this.currentFrame=this._frameData.getFrame(this._frames[this._frameIndex]),this.onStart=new t.Signal,this.onComplete=new t.Signal,this.onLoop=new t.Signal,this.game.onPause.add(this.onPause,this),this.game.onResume.add(this.onResume,this)},t.Animation.prototype={play:function(e,t,n){return"number"==typeof e&&(this.delay=1e3/e),"boolean"==typeof t&&(this.loop=t),"undefined"!=typeof n&&(this.killOnComplete=n),this.isPlaying=!0,this.isFinished=!1,this.paused=!1,this.loopCount=0,this._timeLastFrame=this.game.time.now,this._timeNextFrame=this.game.time.now+this.delay,this._frameIndex=0,this.currentFrame=this._frameData.getFrame(this._frames[this._frameIndex]),this._parent.setTexture(PIXI.TextureCache[this.currentFrame.uuid]),this._parent.__tilePattern&&(this._parent.__tilePattern=!1,this._parent.tilingTexture=!1),this._parent.events.onAnimationStart.dispatch(this._parent,this),this.onStart.dispatch(this._parent,this),this},restart:function(){this.isPlaying=!0,this.isFinished=!1,this.paused=!1,this.loopCount=0,this._timeLastFrame=this.game.time.now,this._timeNextFrame=this.game.time.now+this.delay,this._frameIndex=0,this.currentFrame=this._frameData.getFrame(this._frames[this._frameIndex]),this.onStart.dispatch(this._parent,this)},stop:function(e,t){"undefined"==typeof e&&(e=!1),"undefined"==typeof t&&(t=!1),this.isPlaying=!1,this.isFinished=!0,this.paused=!1,e&&(this.currentFrame=this._frameData.getFrame(this._frames[0])),t&&(this._parent.events.onAnimationComplete.dispatch(this._parent,this),this.onComplete.dispatch(this._parent,this))},onPause:function(){this.isPlaying&&(this._frameDiff=this._timeNextFrame-this.game.time.now)},onResume:function(){this.isPlaying&&(this._timeNextFrame=this.game.time.now+this._frameDiff)},update:function(){return this.isPaused?!1:this.isPlaying===!0&&this.game.time.now>=this._timeNextFrame?(this._frameSkip=1,this._frameDiff=this.game.time.now-this._timeNextFrame,this._timeLastFrame=this.game.time.now,this._frameDiff>this.delay&&(this._frameSkip=Math.floor(this._frameDiff/this.delay),this._frameDiff-=this._frameSkip*this.delay),this._timeNextFrame=this.game.time.now+(this.delay-this._frameDiff),this._frameIndex+=this._frameSkip,this._frameIndex>=this._frames.length?this.loop?(this._frameIndex%=this._frames.length,this.currentFrame=this._frameData.getFrame(this._frames[this._frameIndex]),this.currentFrame&&(this._parent.setTexture(PIXI.TextureCache[this.currentFrame.uuid]),this._parent.__tilePattern&&(this._parent.__tilePattern=!1,this._parent.tilingTexture=!1)),this.loopCount++,this._parent.events.onAnimationLoop.dispatch(this._parent,this),this.onLoop.dispatch(this._parent,this)):this.complete():(this.currentFrame=this._frameData.getFrame(this._frames[this._frameIndex]),this.currentFrame&&(this._parent.setTexture(PIXI.TextureCache[this.currentFrame.uuid]),this._parent.__tilePattern&&(this._parent.__tilePattern=!1,this._parent.tilingTexture=!1))),!0):!1},destroy:function(){this.game=null,this._parent=null,this._frames=null,this._frameData=null,this.currentFrame=null,this.isPlaying=!1,this.onStart.destroy(),this.onLoop.destroy(),this.onComplete.destroy(),this.game.onPause.remove(this.onPause,this),this.game.onResume.remove(this.onResume,this)},complete:function(){this.isPlaying=!1,this.isFinished=!0,this.paused=!1,this._parent.events.onAnimationComplete.dispatch(this._parent,this),this.onComplete.dispatch(this._parent,this),this.killOnComplete&&this._parent.kill()}},t.Animation.prototype.constructor=t.Animation,Object.defineProperty(t.Animation.prototype,"paused",{get:function(){return this.isPaused},set:function(e){this.isPaused=e,e?this._pauseStartTime=this.game.time.now:this.isPlaying&&(this._timeNextFrame=this.game.time.now+this.delay)}}),Object.defineProperty(t.Animation.prototype,"frameTotal",{get:function(){return this._frames.length}}),Object.defineProperty(t.Animation.prototype,"frame",{get:function(){return null!==this.currentFrame?this.currentFrame.index:this._frameIndex},set:function(e){this.currentFrame=this._frameData.getFrame(this._frames[e]),null!==this.currentFrame&&(this._frameIndex=e,this._parent.setTexture(PIXI.TextureCache[this.currentFrame.uuid]))}}),Object.defineProperty(t.Animation.prototype,"speed",{get:function(){return Math.round(1e3/this.delay)},set:function(e){e>=1&&(this.delay=1e3/e)}}),t.Animation.generateFrameNames=function(e,n,r,i,s){"undefined"==typeof i&&(i="");var o=[],u="";if(r>n)for(var a=n;r>=a;a++)u="number"==typeof s?t.Utils.pad(a.toString(),s,"0",1):a.toString(),u=e+u+i,o.push(u);else for(var a=n;a>=r;a--)u="number"==typeof s?t.Utils.pad(a.toString(),s,"0",1):a.toString(),u=e+u+i,o.push(u);return o},t.Frame=function(e,n,r,i,s,o,u){this.index=e,this.x=n,this.y=r,this.width=i,this.height=s,this.name=o,this.uuid=u,this.centerX=Math.floor(i/2),this.centerY=Math.floor(s/2),this.distance=t.Math.distance(0,0,i,s),this.rotated=!1,this.rotationDirection="cw",this.trimmed=!1,this.sourceSizeW=i,this.sourceSizeH=s,this.spriteSourceSizeX=0,this.spriteSourceSizeY=0,this.spriteSourceSizeW=0,this.spriteSourceSizeH=0},t.Frame.prototype={setTrim:function(e,t,n,r,i,s,o){this.trimmed=e,e&&(this.width=t,this.height=n,this.sourceSizeW=t,this.sourceSizeH=n,this.centerX=Math.floor(t/2),this.centerY=Math.floor(n/2),this.spriteSourceSizeX=r,this.spriteSourceSizeY=i,this.spriteSourceSizeW=s,this.spriteSourceSizeH=o)},getRect:function(e){return"undefined"==typeof e?e=new t.Rectangle(this.x,this.y,this.width,this.height):e.setTo(this.x,this.y,this.width,this.height),e}},t.Frame.prototype.constructor=t.Frame,t.FrameData=function(){this._frames=[],this._frameNames=[]},t.FrameData.prototype={addFrame:function(e){return e.index=this._frames.length,this._frames.push(e),""!==e.name&&(this._frameNames[e.name]=e.index),e},getFrame:function(e){return e>this._frames.length&&(e=0),this._frames[e]},getFrameByName:function(e){return"number"==typeof this._frameNames[e]?this._frames[this._frameNames[e]]:null},checkFrameName:function(e){return null==this._frameNames[e]?!1:!0},getFrameRange:function(e,t,n){"undefined"==typeof n&&(n=[]);for(var r=e;t>=r;r++)n.push(this._frames[r]);return n},getFrames:function(e,t,n){if("undefined"==typeof t&&(t=!0),"undefined"==typeof n&&(n=[]),"undefined"==typeof e||0===e.length)for(var r=0;rr;r++)n.push(t?this.getFrame(e[r]):this.getFrameByName(e[r]));return n},getFrameIndexes:function(e,t,n){if("undefined"==typeof t&&(t=!0),"undefined"==typeof n&&(n=[]),"undefined"==typeof e||0===e.length)for(var r=0,i=this._frames.length;i>r;r++)n.push(this._frames[r].index);else for(var r=0,i=e.length;i>r;r++)t?n.push(e[r]):this.getFrameByName(e[r])&&n.push(this.getFrameByName(e[r]).index);return n}},t.FrameData.prototype.constructor=t.FrameData,Object.defineProperty(t.FrameData.prototype,"total",{get:function(){return this._frames.length}}),t.AnimationParser={spriteSheet:function(e,n,r,i,s,o,u){var a=e.cache.getImage(n);if(null==a)return null;var f=a.width,l=a.height;0>=r&&(r=Math.floor(-f/Math.min(-1,r))),0>=i&&(i=Math.floor(-l/Math.min(-1,i)));var c=Math.floor((f-o)/(r+u)),h=Math.floor((l-o)/(i+u)),p=c*h;if(-1!==s&&(p=s),0===f||0===l||r>f||i>l||0===p)return console.warn("Phaser.AnimationParser.spriteSheet: width/height zero or width/height < given frameWidth/frameHeight"),null;for(var d=new t.FrameData,v=o,m=o,g=0;p>g;g++){var y=e.rnd.uuid();d.addFrame(new t.Frame(g,v,m,r,i,"",y)),PIXI.TextureCache[y]=new PIXI.Texture(PIXI.BaseTextureCache[n],{x:v,y:m,width:r,height:i}),v+=r+u,v+r>f&&(v=o,m+=i+u)}return d},JSONData:function(e,n,r){if(!n.frames)return console.warn("Phaser.AnimationParser.JSONData: Invalid Texture Atlas JSON given, missing 'frames' array"),void console.log(n);for(var i,s=new t.FrameData,o=n.frames,u=0;u tag");for(var i,s,o,u,a,f,l,c,h,p,d,v,m=new t.FrameData,g=n.getElementsByTagName("SubTexture"),y=0;y0)for(var n=0;n0)for(var n=0;n0)for(var n=0;n0?(this._fileIndex=0,this._progressChunk=100/this._fileList.length,this.loadFile()):(this.progress=100,this.progressFloat=100,this.hasLoaded=!0,this.onLoadComplete.dispatch()))},loadFile:function(){if(!this._fileList[this._fileIndex])return void console.warn("Phaser.Loader loadFile invalid index "+this._fileIndex);var e=this._fileList[this._fileIndex],n=this;switch(e.type){case"image":case"spritesheet":case"textureatlas":case"bitmapfont":e.data=new Image,e.data.name=e.key,e.data.onload=function(){return n.fileComplete(n._fileIndex)},e.data.onerror=function(){return n.fileError(n._fileIndex)},this.crossOrigin&&(e.data.crossOrigin=this.crossOrigin),e.data.src=this.baseURL+e.url;break;case"audio":e.url=this.getAudioURL(e.url),null!==e.url?this.game.sound.usingWebAudio?(this._xhr.open("GET",this.baseURL+e.url,!0),this._xhr.responseType="arraybuffer",this._xhr.onload=function(){return n.fileComplete(n._fileIndex)},this._xhr.onerror=function(){return n.fileError(n._fileIndex)},this._xhr.send()):this.game.sound.usingAudioTag&&(this.game.sound.touchLocked?(e.data=new Audio,e.data.name=e.key,e.data.preload="auto",e.data.src=this.baseURL+e.url,this.fileComplete(this._fileIndex)):(e.data=new Audio,e.data.name=e.key,e.data.onerror=function(){return n.fileError(n._fileIndex)},e.data.preload="auto",e.data.src=this.baseURL+e.url,e.data.addEventListener("canplaythrough",t.GAMES[this.game.id].load.fileComplete(this._fileIndex),!1),e.data.load())):this.fileError(this._fileIndex);break;case"json":this._xhr.open("GET",this.baseURL+e.url,!0),this._xhr.responseType="text",this._xhr.onload=function(){return n.jsonLoadComplete(n._fileIndex)},this._xhr.send();break;case"tilemap":if(this._xhr.open("GET",this.baseURL+e.url,!0),this._xhr.responseType="text",e.format===t.Tilemap.TILED_JSON)this._xhr.onload=function(){return n.jsonLoadComplete(n._fileIndex)};else{if(e.format!==t.Tilemap.CSV)throw new Error("Phaser.Loader. Invalid Tilemap format: "+e.format);this._xhr.onload=function(){return n.csvLoadComplete(n._fileIndex)}}this._xhr.onerror=function(){return n.dataLoadError(n._fileIndex)},this._xhr.send();break;case"text":case"script":case"physics":this._xhr.open("GET",this.baseURL+e.url,!0),this._xhr.responseType="text",this._xhr.onload=function(){return n.fileComplete(n._fileIndex)},this._xhr.onerror=function(){return n.fileError(n._fileIndex)},this._xhr.send();break;case"binary":this._xhr.open("GET",this.baseURL+e.url,!0),this._xhr.responseType="arraybuffer",this._xhr.onload=function(){return n.fileComplete(n._fileIndex)},this._xhr.onerror=function(){return n.fileError(n._fileIndex)},this._xhr.send()}},getAudioURL:function(e){var t;"string"==typeof e&&(e=[e]);for(var n=0;n100&&(this.progress=100),null!==this.preloadSprite&&(0===this.preloadSprite.direction?(this.preloadSprite.rect.width=Math.floor(this.preloadSprite.width/100*this.progress),this.preloadSprite.sprite.crop(this.preloadSprite.rect)):(this.preloadSprite.rect.height=Math.floor(this.preloadSprite.height/100*this.progress),this.preloadSprite.sprite.crop(this.preloadSprite.rect))),this.onFileComplete.dispatch(this.progress,this._fileList[e].key,t,this.totalLoadedFiles(),this._fileList.length),this.totalQueuedFiles()>0?(this._fileIndex++,this.loadFile()):(this.hasLoaded=!0,this.isLoading=!1,this.removeAll(),this.onLoadComplete.dispatch())},totalLoadedFiles:function(){for(var e=0,t=0;t=this.durationMS&&(this.usingWebAudio?this.loop?(this.onLoop.dispatch(this),""===this.currentMarker?(this.currentTime=0,this.startTime=this.game.time.now):(this.onMarkerComplete.dispatch(this.currentMarker,this),this.play(this.currentMarker,0,this.volume,!0,!0))):this.stop():this.loop?(this.onLoop.dispatch(this),this.play(this.currentMarker,0,this.volume,!0,!0)):this.stop()))},play:function(e,t,n,r,i){if("undefined"==typeof e&&(e=""),"undefined"==typeof i&&(i=!0),this.isPlaying!==!0||i!==!1||this.override!==!1){if(this.isPlaying&&this.override&&(this.usingWebAudio?"undefined"==typeof this._sound.stop?this._sound.noteOff(0):this._sound.stop(0):this.usingAudioTag&&(this._sound.pause(),this._sound.currentTime=0)),this.currentMarker=e,""!==e){if(!this.markers[e])return void console.warn("Phaser.Sound.play: audio marker "+e+" doesn't exist");this.position=this.markers[e].start,this.volume=this.markers[e].volume,this.loop=this.markers[e].loop,this.duration=this.markers[e].duration,this.durationMS=this.markers[e].durationMS,"undefined"!=typeof n&&(this.volume=n),"undefined"!=typeof r&&(this.loop=r),this._tempMarker=e,this._tempPosition=this.position,this._tempVolume=this.volume,this._tempLoop=this.loop}else t=t||0,"undefined"==typeof n&&(n=this._volume),"undefined"==typeof r&&(r=this.loop),this.position=t,this.volume=n,this.loop=r,this.duration=0,this.durationMS=0,this._tempMarker=e,this._tempPosition=t,this._tempVolume=n,this._tempLoop=r;this.usingWebAudio?this.game.cache.isSoundDecoded(this.key)?(null==this._buffer&&(this._buffer=this.game.cache.getSoundData(this.key)),this._sound=this.context.createBufferSource(),this._sound.buffer=this._buffer,this._sound.connect(this.externalNode?this.externalNode.input:this.gainNode),this.totalDuration=this._sound.buffer.duration,0===this.duration&&(this.duration=this.totalDuration,this.durationMS=1e3*this.totalDuration),this.loop&&""===e&&(this._sound.loop=!0),"undefined"==typeof this._sound.start?this._sound.noteGrainOn(0,this.position,this.duration):this._sound.start(0,this.position,this.duration),this.isPlaying=!0,this.startTime=this.game.time.now,this.currentTime=0,this.stopTime=this.startTime+this.durationMS,this.onPlay.dispatch(this)):(this.pendingPlayback=!0,this.game.cache.getSound(this.key)&&this.game.cache.getSound(this.key).isDecoding===!1&&this.game.sound.decode(this.key,this)):this.game.cache.getSound(this.key)&&this.game.cache.getSound(this.key).locked?(this.game.cache.reloadSound(this.key),this.pendingPlayback=!0):this._sound&&(this.game.device.cocoonJS||4===this._sound.readyState)?(this._sound.play(),this.totalDuration=this._sound.duration,0===this.duration&&(this.duration=this.totalDuration,this.durationMS=1e3*this.totalDuration),this._sound.currentTime=this.position,this._sound.muted=this._muted,this._sound.volume=this._muted?0:this._volume,this.isPlaying=!0,this.startTime=this.game.time.now,this.currentTime=0,this.stopTime=this.startTime+this.durationMS,this.onPlay.dispatch(this)):this.pendingPlayback=!0}},restart:function(e,t,n,r){e=e||"",t=t||0,n=n||1,"undefined"==typeof r&&(r=!1),this.play(e,t,n,r,!0)},pause:function(){this.isPlaying&&this._sound&&(this.stop(),this.isPlaying=!1,this.paused=!0,this.pausedPosition=this.currentTime,this.pausedTime=this.game.time.now,this.onPause.dispatch(this))},resume:function(){if(this.paused&&this._sound){if(this.usingWebAudio){var e=this.position+this.pausedPosition/1e3;this._sound=this.context.createBufferSource(),this._sound.buffer=this._buffer,this._sound.connect(this.externalNode?this.externalNode.input:this.gainNode),this.loop&&(this._sound.loop=!0),"undefined"==typeof this._sound.start?this._sound.noteGrainOn(0,e,this.duration):this._sound.start(0,e,this.duration)}else this._sound.play();this.isPlaying=!0,this.paused=!1,this.startTime+=this.game.time.now-this.pausedTime,this.onResume.dispatch(this)}},stop:function(){this.isPlaying&&this._sound&&(this.usingWebAudio?"undefined"==typeof this._sound.stop?this._sound.noteOff(0):this._sound.stop(0):this.usingAudioTag&&(this._sound.pause(),this._sound.currentTime=0)),this.isPlaying=!1;var e=this.currentMarker;""!==this.currentMarker&&this.onMarkerComplete.dispatch(this.currentMarker,this),this.currentMarker="",this.onStop.dispatch(this,e)}},t.Sound.prototype.constructor=t.Sound,Object.defineProperty(t.Sound.prototype,"isDecoding",{get:function(){return this.game.cache.getSound(this.key).isDecoding}}),Object.defineProperty(t.Sound.prototype,"isDecoded",{get:function(){return this.game.cache.isSoundDecoded(this.key)}}),Object.defineProperty(t.Sound.prototype,"mute",{get:function(){return this._muted},set:function(e){e=e||null,e?(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(t.Sound.prototype,"volume",{get:function(){return this._volume},set:function(e){this.usingWebAudio?(this._volume=e,this.gainNode.gain.value=e):this.usingAudioTag&&this._sound&&e>=0&&1>=e&&(this._volume=e,this._sound.volume=e)}}),t.SoundManager=function(e){this.game=e,this.onSoundDecode=new t.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},t.SoundManager.prototype={boot:function(){if(this.game.device.iOS&&this.game.device.webAudio===!1&&(this.channels=1),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)}window.AudioContext?this.context=new window.AudioContext:window.webkitAudioContext?this.context=new window.webkitAudioContext:window.Audio?(this.usingWebAudio=!1,this.usingAudioTag=!0):(this.usingWebAudio=!1,this.noAudio=!0),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 e=this.context.createBuffer(1,1,22050);this._unlockSource=this.context.createBufferSource(),this._unlockSource.buffer=e,this._unlockSource.connect(this.context.destination),this._unlockSource.noteOn(0)}},stopAll:function(){for(var e=0;e255)return t.Color.getColor(255,255,255);if(e>n)return t.Color.getColor(255,255,255);var i=e+Math.round(Math.random()*(n-e)),s=e+Math.round(Math.random()*(n-e)),o=e+Math.round(Math.random()*(n-e));return t.Color.getColor32(r,i,s,o)},getRGB:function(e){return{alpha:e>>>24,red:e>>16&255,green:e>>8&255,blue:255&e}},getWebRGB:function(e){var t=(e>>>24)/255,n=e>>16&255,r=e>>8&255,i=255&e;return"rgba("+n.toString()+","+r.toString()+","+i.toString()+","+t.toString()+")"},getAlpha:function(e){return e>>>24},getAlphaFloat:function(e){return(e>>>24)/255},getRed:function(e){return e>>16&255},getGreen:function(e){return e>>8&255},getBlue:function(e){return 255&e}},t.Physics=function(e,t){t=t||{},this.game=e,this.config=t,this.arcade=null,this.p2=null,this.ninja=null,this.box2d=null,this.chipmunk=null,this.parseConfig()},t.Physics.ARCADE=0,t.Physics.P2JS=1,t.Physics.NINJA=2,t.Physics.BOX2D=3,t.Physics.CHIPMUNK=5,t.Physics.prototype={parseConfig:function(){this.config.hasOwnProperty("arcade")&&this.config.arcade!==!0||!t.Physics.hasOwnProperty("Arcade")||(this.arcade=new t.Physics.Arcade(this.game),this.game.time.deltaCap=.2),this.config.hasOwnProperty("ninja")&&this.config.ninja===!0&&t.Physics.hasOwnProperty("Ninja")&&(this.ninja=new t.Physics.Ninja(this.game)),this.config.hasOwnProperty("p2")&&this.config.p2===!0&&t.Physics.hasOwnProperty("P2")&&(this.p2=new t.Physics.P2(this.game,this.config))},startSystem:function(e){if(e===t.Physics.ARCADE?this.arcade=new t.Physics.Arcade(this.game):e===t.Physics.P2JS&&(this.p2=new t.Physics.P2(this.game,this.config)),e===t.Physics.NINJA)this.ninja=new t.Physics.Ninja(this.game);else{if(e===t.Physics.BOX2D&&null===this.box2d)throw new Error("The Box2D physics system has not been implemented yet.");if(e===t.Physics.CHIPMUNK&&null===this.chipmunk)throw new Error("The Chipmunk physics system has not been implemented yet.")}},enable:function(e,n,r){"undefined"==typeof n&&(n=t.Physics.ARCADE),"undefined"==typeof r&&(r=!1),n===t.Physics.ARCADE?this.arcade.enable(e):n===t.Physics.P2JS&&this.p2?this.p2.enable(e,r):n===t.Physics.NINJA&&this.ninja&&this.ninja.enableAABB(e)},preUpdate:function(){this.p2&&this.p2.preUpdate()},update:function(){this.p2&&this.p2.update()},setBoundsToWorld:function(){this.arcade&&this.arcade.setBoundsToWorld(),this.ninja&&this.ninja.setBoundsToWorld(),this.p2&&this.p2.setBoundsToWorld()},clear:function(){this.p2&&this.p2.clear()},destroy:function(){this.p2&&this.p2.destroy(),this.arcade=null,this.ninja=null,this.p2=null}},t.Physics.prototype.constructor=t.Physics,t.Physics.Arcade=function(e){this.game=e,this.gravity=new t.Point,this.bounds=new t.Rectangle(0,0,e.world.width,e.world.height),this.checkCollision={up:!0,down:!0,left:!0,right:!0},this.maxObjects=10,this.maxLevels=4,this.OVERLAP_BIAS=4,this.TILE_BIAS=16,this.forceX=!1,this.quadTree=new t.QuadTree(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._overlap=0,this._maxOverlap=0,this._velocity1=0,this._velocity2=0,this._newVelocity1=0,this._newVelocity2=0,this._average=0,this._mapData=[],this._result=!1,this._total=0,this._angle=0,this._dx=0,this._dy=0},t.Physics.Arcade.prototype.constructor=t.Physics.Arcade,t.Physics.Arcade.prototype={setBounds:function(e,t,n,r){this.bounds.setTo(e,t,n,r)},setBoundsToWorld:function(){this.bounds.setTo(this.game.world.bounds.x,this.game.world.bounds.y,this.game.world.bounds.width,this.game.world.bounds.height)},enable:function(e,n){"undefined"==typeof n&&(n=!0);var r=1;if(Array.isArray(e))for(r=e.length;r--;)e[r]instanceof t.Group?this.enable(e[r].children,n):(this.enableBody(e[r]),n&&e[r].hasOwnProperty("children")&&e[r].children.length>0&&this.enable(e[r],!0));else e instanceof t.Group?this.enable(e.children,n):(this.enableBody(e),n&&e.hasOwnProperty("children")&&e.children.length>0&&this.enable(e.children,!0))},enableBody:function(e){e.hasOwnProperty("body")&&null===e.body&&(e.body=new t.Physics.Arcade.Body(e))},updateMotion:function(e){this._velocityDelta=this.computeVelocity(0,e,e.angularVelocity,e.angularAcceleration,e.angularDrag,e.maxAngular)-e.angularVelocity,e.angularVelocity+=this._velocityDelta,e.rotation+=e.angularVelocity*this.game.time.physicsElapsed,e.velocity.x=this.computeVelocity(1,e,e.velocity.x,e.acceleration.x,e.drag.x,e.maxVelocity.x),e.velocity.y=this.computeVelocity(2,e,e.velocity.y,e.acceleration.y,e.drag.y,e.maxVelocity.y)},computeVelocity:function(e,t,n,r,i,s){return s=s||1e4,1==e&&t.allowGravity?n+=(this.gravity.x+t.gravity.x)*this.game.time.physicsElapsed:2==e&&t.allowGravity&&(n+=(this.gravity.y+t.gravity.y)*this.game.time.physicsElapsed),r?n+=r*this.game.time.physicsElapsed:i&&(this._drag=i*this.game.time.physicsElapsed,n-this._drag>0?n-=this._drag:n+this._drag<0?n+=this._drag:n=0),n>s?n=s:-s>n&&(n=-s),n},overlap:function(e,t,n,r,i){if(n=n||null,r=r||null,i=i||n,this._result=!1,this._total=0,Array.isArray(t))for(var s=0,o=t.length;o>s;s++)this.collideHandler(e,t[s],n,r,i,!0);else this.collideHandler(e,t,n,r,i,!0);return this._total>0},collide:function(e,t,n,r,i){if(n=n||null,r=r||null,i=i||n,this._result=!1,this._total=0,Array.isArray(t))for(var s=0,o=t.length;o>s;s++)this.collideHandler(e,t[s],n,r,i,!1);else this.collideHandler(e,t,n,r,i,!1);return this._total>0},collideHandler:function(e,n,r,i,s,o){return"undefined"!=typeof n||e.type!==t.GROUP&&e.type!==t.EMITTER?void (e&&n&&e.exists&&n.exists&&(e.type==t.SPRITE||e.type==t.TILESPRITE?n.type==t.SPRITE||n.type==t.TILESPRITE?this.collideSpriteVsSprite(e,n,r,i,s,o):n.type==t.GROUP||n.type==t.EMITTER?this.collideSpriteVsGroup(e,n,r,i,s,o):n.type==t.TILEMAPLAYER&&this.collideSpriteVsTilemapLayer(e,n,r,i,s):e.type==t.GROUP?n.type==t.SPRITE||n.type==t.TILESPRITE?this.collideSpriteVsGroup(n,e,r,i,s,o):n.type==t.GROUP||n.type==t.EMITTER?this.collideGroupVsGroup(e,n,r,i,s,o):n.type==t.TILEMAPLAYER&&this.collideGroupVsTilemapLayer(e,n,r,i,s):e.type==t.TILEMAPLAYER?n.type==t.SPRITE||n.type==t.TILESPRITE?this.collideSpriteVsTilemapLayer(n,e,r,i,s):(n.type==t.GROUP||n.type==t.EMITTER)&&this.collideGroupVsTilemapLayer(n,e,r,i,s):e.type==t.EMITTER&&(n.type==t.SPRITE||n.type==t.TILESPRITE?this.collideSpriteVsGroup(n,e,r,i,s,o):n.type==t.GROUP||n.type==t.EMITTER?this.collideGroupVsGroup(e,n,r,i,s,o):n.type==t.TILEMAPLAYER&&this.collideGroupVsTilemapLayer(e,n,r,i,s)))):void this.collideGroupVsSelf(e,r,i,s,o)},collideSpriteVsSprite:function(e,t,n,r,i,s){return e.body&&t.body?(this.separate(e.body,t.body,r,i,s)&&(n&&n.call(i,e,t),this._total++),!0):!1},collideSpriteVsGroup:function(e,t,n,r,i,s){if(0!==t.length){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(t),this._potentials=this.quadTree.retrieve(e);for(var o=0,u=this._potentials.length;u>o;o++)this.separate(e.body,this._potentials[o],r,i,s)&&(n&&n.call(i,e,this._potentials[o].sprite),this._total++)}},collideGroupVsSelf:function(e,t,n,r,i){if(0!==e.length)for(var s=e.children.length,o=0;s>o;o++)for(var u=o+1;s>=u;u++)e.children[o]&&e.children[u]&&e.children[o].exists&&e.children[u].exists&&this.collideSpriteVsSprite(e.children[o],e.children[u],t,n,r,i)},collideGroupVsGroup:function(e,t,n,r,i,s){if(0!==e.length&&0!==t.length)for(var o=0,u=e.children.length;u>o;o++)e.children[o].exists&&this.collideSpriteVsGroup(e.children[o],t,n,r,i,s)},collideSpriteVsTilemapLayer:function(e,t,n,r,i){if(this._mapData=t.getTiles(e.body.position.x-e.body.tilePadding.x,e.body.position.y-e.body.tilePadding.y,e.body.width+e.body.tilePadding.x,e.body.height+e.body.tilePadding.y,!1,!1),0!==this._mapData.length)for(var s=0;ss;s++)e.children[s].exists&&this.collideSpriteVsTilemapLayer(e.children[s],t,n,r,i)},separate:function(e,t,n,r,i){return this.intersects(e,t)?n&&n.call(r,e.sprite,t.sprite)===!1?!1:i?!0:(this._result=this.forceX||Math.abs(this.gravity.y+e.gravity.y)=t.right?!1:e.position.y>=t.bottom?!1:!0},separateX:function(e,t,n){return e.immovable&&t.immovable?!1:(this._overlap=0,this.intersects(e,t)&&(this._maxOverlap=e.deltaAbsX()+t.deltaAbsX()+this.OVERLAP_BIAS,0===e.deltaX()&&0===t.deltaX()?(e.embedded=!0,t.embedded=!0):e.deltaX()>t.deltaX()?(this._overlap=e.right-t.x,this._overlap>this._maxOverlap||e.checkCollision.right===!1||t.checkCollision.left===!1?this._overlap=0:(e.touching.none=!1,e.touching.right=!0,t.touching.none=!1,t.touching.left=!0)):e.deltaX()this._maxOverlap||e.checkCollision.left===!1||t.checkCollision.right===!1?this._overlap=0:(e.touching.none=!1,e.touching.left=!0,t.touching.none=!1,t.touching.right=!0)),0!==this._overlap)?(e.overlapX=this._overlap,t.overlapX=this._overlap,n||e.customSeparateX||t.customSeparateX?!0:(this._velocity1=e.velocity.x,this._velocity2=t.velocity.x,e.immovable||t.immovable?e.immovable?t.immovable||(t.x+=this._overlap,t.velocity.x=this._velocity1-this._velocity2*t.bounce.x):(e.x=e.x-this._overlap,e.velocity.x=this._velocity2-this._velocity1*e.bounce.x):(this._overlap*=.5,e.x=e.x-this._overlap,t.x+=this._overlap,this._newVelocity1=Math.sqrt(this._velocity2*this._velocity2*t.mass/e.mass)*(this._velocity2>0?1:-1),this._newVelocity2=Math.sqrt(this._velocity1*this._velocity1*e.mass/t.mass)*(this._velocity1>0?1:-1),this._average=.5*(this._newVelocity1+this._newVelocity2),this._newVelocity1-=this._average,this._newVelocity2-=this._average,e.velocity.x=this._average+this._newVelocity1*e.bounce.x,t.velocity.x=this._average+this._newVelocity2*t.bounce.x),!0)):!1)},separateY:function(e,t,n){return e.immovable&&t.immovable?!1:(this._overlap=0,this.intersects(e,t)&&(this._maxOverlap=e.deltaAbsY()+t.deltaAbsY()+this.OVERLAP_BIAS,0===e.deltaY()&&0===t.deltaY()?(e.embedded=!0,t.embedded=!0):e.deltaY()>t.deltaY()?(this._overlap=e.bottom-t.y,this._overlap>this._maxOverlap||e.checkCollision.down===!1||t.checkCollision.up===!1?this._overlap=0:(e.touching.none=!1,e.touching.down=!0,t.touching.none=!1,t.touching.up=!0)):e.deltaY()this._maxOverlap||e.checkCollision.up===!1||t.checkCollision.down===!1?this._overlap=0:(e.touching.none=!1,e.touching.up=!0,t.touching.none=!1,t.touching.down=!0)),0!==this._overlap)?(e.overlapY=this._overlap,t.overlapY=this._overlap,n||e.customSeparateY||t.customSeparateY?!0:(this._velocity1=e.velocity.y,this._velocity2=t.velocity.y,e.immovable||t.immovable?e.immovable?t.immovable||(t.y+=this._overlap,t.velocity.y=this._velocity1-this._velocity2*t.bounce.y,e.moves&&(t.x+=e.x-e.prev.x)):(e.y=e.y-this._overlap,e.velocity.y=this._velocity2-this._velocity1*e.bounce.y,t.moves&&(e.x+=t.x-t.prev.x)):(this._overlap*=.5,e.y=e.y-this._overlap,t.y+=this._overlap,this._newVelocity1=Math.sqrt(this._velocity2*this._velocity2*t.mass/e.mass)*(this._velocity2>0?1:-1),this._newVelocity2=Math.sqrt(this._velocity1*this._velocity1*e.mass/t.mass)*(this._velocity1>0?1:-1),this._average=.5*(this._newVelocity1+this._newVelocity2),this._newVelocity1-=this._average,this._newVelocity2-=this._average,e.velocity.y=this._average+this._newVelocity1*e.bounce.y,t.velocity.y=this._average+this._newVelocity2*t.bounce.y),!0)):!1)},separateTile:function(e,t,n){if(!n.intersects(t.position.x,t.position.y,t.right,t.bottom))return!1;if(n.collisionCallback&&!n.collisionCallback.call(n.collisionCallbackContext,t.sprite,n))return!1;if(n.layer.callbacks[n.index]&&!n.layer.callbacks[n.index].callback.call(n.layer.callbacks[n.index].callbackContext,t.sprite,n))return!1;if(!(n.faceLeft||n.faceRight||n.faceTop||n.faceBottom))return!1;var r=0,i=0,s=0,o=1;if(t.deltaAbsX()>t.deltaAbsY()?s=-1:t.deltaAbsX()s){if((n.faceLeft||n.faceRight)&&(r=this.tileCheckX(t,n),0!==r&&!n.intersects(t.position.x,t.position.y,t.right,t.bottom)))return!0;(n.faceTop||n.faceBottom)&&(i=this.tileCheckY(t,n))}else{if((n.faceTop||n.faceBottom)&&(i=this.tileCheckY(t,n),0!==i&&!n.intersects(t.position.x,t.position.y,t.right,t.bottom)))return!0;(n.faceLeft||n.faceRight)&&(r=this.tileCheckX(t,n))}return 0!==r||0!==i},tileCheckX:function(e,t){var n=0;return e.deltaX()<0&&!e.blocked.left&&t.collideRight&&e.checkCollision.left?t.faceRight&&e.x0&&!e.blocked.right&&t.collideLeft&&e.checkCollision.right&&t.faceLeft&&e.right>t.left&&(n=e.right-t.left,n>this.TILE_BIAS&&(n=0)),0!==n&&this.processTileSeparationX(e,n),n},tileCheckY:function(e,t){var n=0;return e.deltaY()<0&&!e.blocked.up&&t.collideDown&&e.checkCollision.up?t.faceBottom&&e.y0&&!e.blocked.down&&t.collideUp&&e.checkCollision.down&&t.faceTop&&e.bottom>t.top&&(n=e.bottom-t.top,n>this.TILE_BIAS&&(n=0)),0!==n&&this.processTileSeparationY(e,n),n},processTileSeparationX:function(e,t){0>t?e.blocked.left=!0:t>0&&(e.blocked.right=!0),e.position.x-=t,e.velocity.x=0===e.bounce.x?0:-e.velocity.x*e.bounce.x},processTileSeparationY:function(e,t){0>t?e.blocked.up=!0:t>0&&(e.blocked.down=!0),e.position.y-=t,e.velocity.y=0===e.bounce.y?0:-e.velocity.y*e.bounce.y},moveToObject:function(e,t,n,r){return"undefined"==typeof n&&(n=60),"undefined"==typeof r&&(r=0),this._angle=Math.atan2(t.y-e.y,t.x-e.x),r>0&&(n=this.distanceBetween(e,t)/(r/1e3)),e.body.velocity.x=Math.cos(this._angle)*n,e.body.velocity.y=Math.sin(this._angle)*n,this._angle},moveToPointer:function(e,t,n,r){return"undefined"==typeof t&&(t=60),n=n||this.game.input.activePointer,"undefined"==typeof r&&(r=0),this._angle=this.angleToPointer(e,n),r>0&&(t=this.distanceToPointer(e,n)/(r/1e3)),e.body.velocity.x=Math.cos(this._angle)*t,e.body.velocity.y=Math.sin(this._angle)*t,this._angle},moveToXY:function(e,t,n,r,i){return"undefined"==typeof r&&(r=60),"undefined"==typeof i&&(i=0),this._angle=Math.atan2(n-e.y,t-e.x),i>0&&(r=this.distanceToXY(e,t,n)/(i/1e3)),e.body.velocity.x=Math.cos(this._angle)*r,e.body.velocity.y=Math.sin(this._angle)*r,this._angle},velocityFromAngle:function(e,n,r){return"undefined"==typeof n&&(n=60),r=r||new t.Point,r.setTo(Math.cos(this.game.math.degToRad(e))*n,Math.sin(this.game.math.degToRad(e))*n)},velocityFromRotation:function(e,n,r){return"undefined"==typeof n&&(n=60),r=r||new t.Point,r.setTo(Math.cos(e)*n,Math.sin(e)*n)},accelerationFromRotation:function(e,n,r){return"undefined"==typeof n&&(n=60),r=r||new t.Point,r.setTo(Math.cos(e)*n,Math.sin(e)*n)},accelerateToObject:function(e,t,n,r,i){return"undefined"==typeof n&&(n=60),"undefined"==typeof r&&(r=1e3),"undefined"==typeof i&&(i=1e3),this._angle=this.angleBetween(e,t),e.body.acceleration.setTo(Math.cos(this._angle)*n,Math.sin(this._angle)*n),e.body.maxVelocity.setTo(r,i),this._angle},accelerateToPointer:function(e,t,n,r,i){return"undefined"==typeof n&&(n=60),"undefined"==typeof t&&(t=this.game.input.activePointer),"undefined"==typeof r&&(r=1e3),"undefined"==typeof i&&(i=1e3),this._angle=this.angleToPointer(e,t),e.body.acceleration.setTo(Math.cos(this._angle)*n,Math.sin(this._angle)*n),e.body.maxVelocity.setTo(r,i),this._angle},accelerateToXY:function(e,t,n,r,i,s){return"undefined"==typeof r&&(r=60),"undefined"==typeof i&&(i=1e3),"undefined"==typeof s&&(s=1e3),this._angle=this.angleToXY(e,t,n),e.body.acceleration.setTo(Math.cos(this._angle)*r,Math.sin(this._angle)*r),e.body.maxVelocity.setTo(i,s),this._angle},distanceBetween:function(e,t){return this._dx=e.x-t.x,this._dy=e.y-t.y,Math.sqrt(this._dx*this._dx+this._dy*this._dy)},distanceToXY:function(e,t,n){return this._dx=e.x-t,this._dy=e.y-n,Math.sqrt(this._dx*this._dx+this._dy*this._dy)},distanceToPointer:function(e,t){return t=t||this.game.input.activePointer,this._dx=e.x-t.x,this._dy=e.y-t.y,Math.sqrt(this._dx*this._dx+this._dy*this._dy)},angleBetween:function(e,t){return this._dx=t.x-e.x,this._dy=t.y-e.y,Math.atan2(this._dy,this._dx)},angleToXY:function(e,t,n){return this._dx=t-e.x,this._dy=n-e.y,Math.atan2(this._dy,this._dx)},angleToPointer:function(e,t){return t=t||this.game.input.activePointer,this._dx=t.worldX-e.x,this._dy=t.worldY-e.y,Math.atan2(this._dy,this._dx)}},t.Physics.Arcade.Body=function(e){this.sprite=e,this.game=e.game,this.type=t.Physics.ARCADE,this.offset=new t.Point,this.position=new t.Point(e.x,e.y),this.prev=new t.Point(this.position.x,this.position.y),this.allowRotation=!0,this.rotation=e.rotation,this.preRotation=e.rotation,this.sourceWidth=e.texture.frame.width,this.sourceHeight=e.texture.frame.height,this.width=e.width,this.height=e.height,this.halfWidth=Math.abs(e.width/2),this.halfHeight=Math.abs(e.height/2),this.center=new t.Point(e.x+this.halfWidth,e.y+this.halfHeight),this.velocity=new t.Point,this.newVelocity=new t.Point(0,0),this.deltaMax=new t.Point(0,0),this.acceleration=new t.Point,this.drag=new t.Point,this.allowGravity=!0,this.gravity=new t.Point(0,0),this.bounce=new t.Point,this.maxVelocity=new t.Point(1e4,1e4),this.angularVelocity=0,this.angularAcceleration=0,this.angularDrag=0,this.maxAngular=1e3,this.mass=1,this.angle=0,this.speed=0,this.facing=t.NONE,this.immovable=!1,this.moves=!0,this.customSeparateX=!1,this.customSeparateY=!1,this.overlapX=0,this.overlapY=0,this.embedded=!1,this.collideWorldBounds=!1,this.checkCollision={none:!1,any:!0,up:!0,down:!0,left:!0,right:!0},this.touching={none:!0,up:!1,down:!1,left:!1,right:!1},this.wasTouching={none:!0,up:!1,down:!1,left:!1,right:!1},this.blocked={up:!1,down:!1,left:!1,right:!1},this.tilePadding=new t.Point,this.phase=0,this._reset=!0,this._sx=e.scale.x,this._sy=e.scale.y,this._dx=0,this._dy=0},t.Physics.Arcade.Body.prototype={updateBounds:function(){var e=Math.abs(this.sprite.scale.x),t=Math.abs(this.sprite.scale.y);(e!==this._sx||t!==this._sy)&&(this.width=this.sourceWidth*e,this.height=this.sourceHeight*t,this.halfWidth=Math.floor(this.width/2),this.halfHeight=Math.floor(this.height/2),this._sx=e,this._sy=t,this.center.setTo(this.position.x+this.halfWidth,this.position.y+this.halfHeight),this._reset=!0)},preUpdate:function(){this.phase=1,this.wasTouching.none=this.touching.none,this.wasTouching.up=this.touching.up,this.wasTouching.down=this.touching.down,this.wasTouching.left=this.touching.left,this.wasTouching.right=this.touching.right,this.touching.none=!0,this.touching.up=!1,this.touching.down=!1,this.touching.left=!1,this.touching.right=!1,this.blocked.up=!1,this.blocked.down=!1,this.blocked.left=!1,this.blocked.right=!1,this.embedded=!1,this.updateBounds(),this.position.x=this.sprite.world.x-this.sprite.anchor.x*this.width+this.offset.x,this.position.y=this.sprite.world.y-this.sprite.anchor.y*this.height+this.offset.y,this.rotation=this.sprite.angle,this.preRotation=this.rotation,(this._reset||1===this.sprite._cache[4])&&(this.prev.x=this.position.x,this.prev.y=this.position.y),this.moves&&(this.game.physics.arcade.updateMotion(this),this.newVelocity.set(this.velocity.x*this.game.time.physicsElapsed,this.velocity.y*this.game.time.physicsElapsed),this.position.x+=this.newVelocity.x,this.position.y+=this.newVelocity.y,(this.position.x!==this.prev.x||this.position.y!==this.prev.y)&&(this.speed=Math.sqrt(this.velocity.x*this.velocity.x+this.velocity.y*this.velocity.y),this.angle=Math.atan2(this.velocity.y,this.velocity.x)),this.collideWorldBounds&&this.checkWorldBounds()),this._dx=this.deltaX(),this._dy=this.deltaY(),this._reset=!1},postUpdate:function(){this.phase=2,this.deltaX()<0?this.facing=t.LEFT:this.deltaX()>0&&(this.facing=t.RIGHT),this.deltaY()<0?this.facing=t.UP:this.deltaY()>0&&(this.facing=t.DOWN),this.moves&&(this._dx=this.deltaX(),this._dy=this.deltaY(),0!==this.deltaMax.x&&0!==this._dx&&(this._dx<0&&this._dx<-this.deltaMax.x?this._dx=-this.deltaMax.x:this._dx>0&&this._dx>this.deltaMax.x&&(this._dx=this.deltaMax.x)),0!==this.deltaMax.y&&0!==this._dy&&(this._dy<0&&this._dy<-this.deltaMax.y?this._dy=-this.deltaMax.y:this._dy>0&&this._dy>this.deltaMax.y&&(this._dy=this.deltaMax.y)),this.sprite.x+=this._dx,this.sprite.y+=this._dy),this.center.setTo(this.position.x+this.halfWidth,this.position.y+this.halfHeight),this.allowRotation&&(this.sprite.angle+=this.deltaZ()),this.prev.x=this.position.x,this.prev.y=this.position.y},destroy:function(){this.sprite=null},checkWorldBounds:function(){this.position.xthis.game.physics.arcade.bounds.right&&this.game.physics.arcade.checkCollision.right&&(this.position.x=this.game.physics.arcade.bounds.right-this.width,this.velocity.x*=-this.bounce.x,this.blocked.right=!0),this.position.ythis.game.physics.arcade.bounds.bottom&&this.game.physics.arcade.checkCollision.down&&(this.position.y=this.game.physics.arcade.bounds.bottom-this.height,this.velocity.y*=-this.bounce.y,this.blocked.down=!0)},setSize:function(e,t,n,r){n=n||this.offset.x,r=r||this.offset.y,this.sourceWidth=e,this.sourceHeight=t,this.width=this.sourceWidth*this._sx,this.height=this.sourceHeight*this._sy,this.halfWidth=Math.floor(this.width/2),this.halfHeight=Math.floor(this.height/2),this.offset.setTo(n,r),this.center.setTo(this.position.x+this.halfWidth,this.position.y+this.halfHeight)},reset:function(e,t){this.velocity.set(0),this.acceleration.set(0),this.angularVelocity=0,this.angularAcceleration=0,this.position.x=e-this.sprite.anchor.x*this.width+this.offset.x,this.position.y=t-this.sprite.anchor.y*this.height+this.offset.y,this.prev.x=this.position.x,this.prev.y=this.position.y,this.rotation=this.sprite.angle,this.preRotation=this.rotation,this._sx=this.sprite.scale.x,this._sy=this.sprite.scale.y,this.center.setTo(this.position.x+this.halfWidth,this.position.y+this.halfHeight)},onFloor:function(){return this.blocked.down},onWall:function(){return this.blocked.left||this.blocked.right},deltaAbsX:function(){return this.deltaX()>0?this.deltaX():-this.deltaX()},deltaAbsY:function(){return this.deltaY()>0?this.deltaY():-this.deltaY()},deltaX:function(){return this.position.x-this.prev.x},deltaY:function(){return this.position.y-this.prev.y},deltaZ:function(){return this.rotation-this.preRotation}},Object.defineProperty(t.Physics.Arcade.Body.prototype,"bottom",{get:function(){return this.position.y+this.height}}),Object.defineProperty(t.Physics.Arcade.Body.prototype,"right",{get:function(){return this.position.x+this.width}}),Object.defineProperty(t.Physics.Arcade.Body.prototype,"x",{get:function(){return this.position.x},set:function(e){this.position.x=e}}),Object.defineProperty(t.Physics.Arcade.Body.prototype,"y",{get:function(){return this.position.y},set:function(e){this.position.y=e}}),t.Physics.Arcade.Body.render=function(e,t,n,r){"undefined"==typeof n&&(n=!0),r=r||"rgba(0,255,0,0.4)",n?(e.fillStyle=r,e.fillRect(t.position.x-t.game.camera.x,t.position.y-t.game.camera.y,t.width,t.height)):(e.strokeStyle=r,e.strokeRect(t.position.x-t.game.camera.x,t.position.y-t.game.camera.y,t.width,t.height))},t.Physics.Arcade.Body.renderBodyInfo=function(e,t){e.line("x: "+t.x.toFixed(2),"y: "+t.y.toFixed(2),"width: "+t.width,"height: "+t.height),e.line("velocity x: "+t.velocity.x.toFixed(2),"y: "+t.velocity.y.toFixed(2),"deltaX: "+t._dx.toFixed(2),"deltaY: "+t._dy.toFixed(2)),e.line("acceleration x: "+t.acceleration.x.toFixed(2),"y: "+t.acceleration.y.toFixed(2),"speed: "+t.speed.toFixed(2),"angle: "+t.angle.toFixed(2)),e.line("gravity x: "+t.gravity.x,"y: "+t.gravity.y,"bounce x: "+t.bounce.x.toFixed(2),"y: "+t.bounce.y.toFixed(2)),e.line("touching left: "+t.touching.left,"right: "+t.touching.right,"up: "+t.touching.up,"down: "+t.touching.down),e.line("blocked left: "+t.blocked.left,"right: "+t.blocked.right,"up: "+t.blocked.up,"down: "+t.blocked.down)},t.Physics.Arcade.Body.prototype.constructor=t.Physics.Arcade.Body,t.Particles=function(e){this.game=e,this.emitters={},this.ID=0},t.Particles.prototype={add:function(e){return this.emitters[e.name]=e,e},remove:function(e){delete this.emitters[e.name]},update:function(){for(var e in this.emitters)this.emitters[e].exists&&this.emitters[e].update()}},t.Particles.prototype.constructor=t.Particles,t.Particles.Arcade={},t.Particles.Arcade.Emitter=function(e,n,r,i){this.maxParticles=i||50,t.Group.call(this,e),this.name="emitter"+this.game.particles.ID++,this.type=t.EMITTER,this.x=0,this.y=0,this.width=1,this.height=1,this.minParticleSpeed=new t.Point(-100,-100),this.maxParticleSpeed=new t.Point(100,100),this.minParticleScale=1,this.maxParticleScale=1,this.minRotation=-360,this.maxRotation=360,this.gravity=100,this.particleClass=t.Sprite,this.particleDrag=new t.Point,this.angularDrag=0,this.frequency=100,this.lifespan=2e3,this.bounce=new t.Point,this._quantity=0,this._timer=0,this._counter=0,this._explode=!0,this._frames=null,this.on=!1,this.exists=!0,this.emitX=n,this.emitY=r},t.Particles.Arcade.Emitter.prototype=Object.create(t.Group.prototype),t.Particles.Arcade.Emitter.prototype.constructor=t.Particles.Arcade.Emitter,t.Particles.Arcade.Emitter.prototype.update=function(){if(this.on)if(this._explode){this._counter=0;do this.emitParticle(),this._counter++;while(this._counter=this._timer&&(this.emitParticle(),this._counter++,this._quantity>0&&this._counter>=this._quantity&&(this.on=!1),this._timer=this.game.time.now+this.frequency)},t.Particles.Arcade.Emitter.prototype.makeParticles=function(e,t,n,r,i){"undefined"==typeof t&&(t=0),"undefined"==typeof n&&(n=this.maxParticles),"undefined"==typeof r&&(r=!1),"undefined"==typeof i&&(i=!1);var s,o=0,u=e,a=t;for(this._frames=t;n>o;)"object"==typeof e&&(u=this.game.rnd.pick(e)),"object"==typeof t&&(a=this.game.rnd.pick(t)),s=new this.particleClass(this.game,0,0,u,a),this.game.physics.arcade.enable(s,!1),r?(s.body.checkCollision.any=!0,s.body.checkCollision.none=!1):s.body.checkCollision.none=!0,s.body.collideWorldBounds=i,s.exists=!1,s.visible=!1,s.anchor.set(.5),this.add(s),o++;return this},t.Particles.Arcade.Emitter.prototype.kill=function(){this.on=!1,this.alive=!1,this.exists=!1},t.Particles.Arcade.Emitter.prototype.revive=function(){this.alive=!0,this.exists=!0},t.Particles.Arcade.Emitter.prototype.start=function(e,t,n,r){"undefined"==typeof e&&(e=!0),"undefined"==typeof t&&(t=0),"undefined"==typeof n&&(n=250),"undefined"==typeof r&&(r=0),this.revive(),this.visible=!0,this.on=!0,this._explode=e,this.lifespan=t,this.frequency=n,e?this._quantity=r:this._quantity+=r,this._counter=0,this._timer=this.game.time.now+n},t.Particles.Arcade.Emitter.prototype.emitParticle=function(){var e=this.getFirstExists(!1);null!=e&&(e.angle=0,e.bringToTop(),(1!==this.minParticleScale||1!==this.maxParticleScale)&&e.scale.set(this.game.rnd.realInRange(this.minParticleScale,this.maxParticleScale)),this.width>1||this.height>1?e.reset(this.game.rnd.integerInRange(this.left,this.right),this.game.rnd.integerInRange(this.top,this.bottom)):e.reset(this.emitX,this.emitY),e.lifespan=this.lifespan,e.body.bounce.setTo(this.bounce.x,this.bounce.y),e.body.velocity.x=this.minParticleSpeed.x!==this.maxParticleSpeed.x?this.game.rnd.integerInRange(this.minParticleSpeed.x,this.maxParticleSpeed.x):this.minParticleSpeed.x,e.body.velocity.y=this.minParticleSpeed.y!==this.maxParticleSpeed.y?this.game.rnd.integerInRange(this.minParticleSpeed.y,this.maxParticleSpeed.y):this.minParticleSpeed.y,this.minRotation!==this.maxRotation?e.body.angularVelocity=this.game.rnd.integerInRange(this.minRotation,this.maxRotation):0!==this.minRotation&&(e.body.angularVelocity=this.minRotation),e.frame="object"==typeof this._frames?this.game.rnd.pick(this._frames):this._frames,e.body.gravity.y=this.gravity,e.body.drag.x=this.particleDrag.x,e.body.drag.y=this.particleDrag.y,e.body.angularDrag=this.angularDrag)},t.Particles.Arcade.Emitter.prototype.setSize=function(e,t){this.width=e,this.height=t},t.Particles.Arcade.Emitter.prototype.setXSpeed=function(e,t){e=e||0,t=t||0,this.minParticleSpeed.x=e,this.maxParticleSpeed.x=t},t.Particles.Arcade.Emitter.prototype.setYSpeed=function(e,t){e=e||0,t=t||0,this.minParticleSpeed.y=e,this.maxParticleSpeed.y=t},t.Particles.Arcade.Emitter.prototype.setRotation=function(e,t){e=e||0,t=t||0,this.minRotation=e,this.maxRotation=t},t.Particles.Arcade.Emitter.prototype.at=function(e){e.center&&(this.emitX=e.center.x,this.emitY=e.center.y)},Object.defineProperty(t.Particles.Arcade.Emitter.prototype,"x",{get:function(){return this.emitX},set:function(e){this.emitX=e}}),Object.defineProperty(t.Particles.Arcade.Emitter.prototype,"y",{get:function(){return this.emitY},set:function(e){this.emitY=e}}),Object.defineProperty(t.Particles.Arcade.Emitter.prototype,"left",{get:function(){return Math.floor(this.x-this.width/2)}}),Object.defineProperty(t.Particles.Arcade.Emitter.prototype,"right",{get:function(){return Math.floor(this.x+this.width/2)}}),Object.defineProperty(t.Particles.Arcade.Emitter.prototype,"top",{get:function(){return Math.floor(this.y-this.height/2)}}),Object.defineProperty(t.Particles.Arcade.Emitter.prototype,"bottom",{get:function(){return Math.floor(this.y+this.height/2)}}),t.Tile=function(e,t,n,r,i,s){this.layer=e,this.index=t,this.x=n,this.y=r,this.worldX=n*i,this.worldY=r*s,this.width=i,this.height=s,this.centerX=Math.abs(i/2),this.centerY=Math.abs(s/2),this.alpha=1,this.properties={},this.scanned=!1,this.faceTop=!1,this.faceBottom=!1,this.faceLeft=!1,this.faceRight=!1,this.collideLeft=!1,this.collideRight=!1,this.collideUp=!1,this.collideDown=!1,this.collisionCallback=null,this.collisionCallbackContext=this},t.Tile.prototype={containsPoint:function(e,t){return!(ethis.right||t>this.bottom)},intersects:function(e,t,n,r){return n<=this.worldX?!1:r<=this.worldY?!1:e>=this.worldX+this.width?!1:t>=this.worldY+this.height?!1:!0},setCollisionCallback:function(e,t){this.collisionCallback=e,this.collisionCallbackContext=t},destroy:function(){this.collisionCallback=null,this.collisionCallbackContext=null,this.properties=null},setCollision:function(e,t,n,r){this.collideLeft=e,this.collideRight=t,this.collideUp=n,this.collideDown=r},resetCollision:function(){this.collideLeft=!1,this.collideRight=!1,this.collideUp=!1,this.collideDown=!1,this.faceTop=!1,this.faceBottom=!1,this.faceLeft=!1,this.faceRight=!1},isInteresting:function(e,t){return e&&t?this.collideLeft||this.collideRight||this.collideUp||this.collideDown||this.faceTop||this.faceBottom||this.faceLeft||this.faceRight||this.collisionCallback:e?this.collideLeft||this.collideRight||this.collideUp||this.collideDown:t?this.faceTop||this.faceBottom||this.faceLeft||this.faceRight:!1},copy:function(e){this.index=e.index,this.alpha=e.alpha,this.properties=e.properties,this.collideUp=e.collideUp,this.collideDown=e.collideDown,this.collideLeft=e.collideLeft,this.collideRight=e.collideRight,this.collisionCallback=e.collisionCallback,this.collisionCallbackContext=e.collisionCallbackContext}},t.Tile.prototype.constructor=t.Tile,Object.defineProperty(t.Tile.prototype,"collides",{get:function(){return this.collideLeft||this.collideRight||this.collideUp||this.collideDown}}),Object.defineProperty(t.Tile.prototype,"canCollide",{get:function(){return this.collideLeft||this.collideRight||this.collideUp||this.collideDown||this.collisionCallback}}),Object.defineProperty(t.Tile.prototype,"left",{get:function(){return this.worldX}}),Object.defineProperty(t.Tile.prototype,"right",{get:function(){return this.worldX+this.width}}),Object.defineProperty(t.Tile.prototype,"top",{get:function(){return this.worldY}}),Object.defineProperty(t.Tile.prototype,"bottom",{get:function(){return this.worldY+this.height}}),t.Tilemap=function(e,n,r,i,s,o){this.game=e,this.key=n;var u=t.TilemapParser.parse(this.game,n,r,i,s,o);null!==u&&(this.width=u.width,this.height=u.height,this.tileWidth=u.tileWidth,this.tileHeight=u.tileHeight,this.orientation=u.orientation,this.version=u.version,this.properties=u.properties,this.widthInPixels=u.widthInPixels,this.heightInPixels=u.heightInPixels,this.layers=u.layers,this.tilesets=u.tilesets,this.tiles=u.tiles,this.objects=u.objects,this.collideIndexes=[],this.collision=u.collision,this.images=u.images,this.currentLayer=0,this.debugMap=[],this._results=[],this._tempA=0,this._tempB=0)},t.Tilemap.CSV=0,t.Tilemap.TILED_JSON=1,t.Tilemap.prototype={create:function(e,t,n,r,i,s){return"undefined"==typeof s&&(s=this.game.world),this.width=t,this.height=n,this.setTileSize(r,i),this.layers.length=0,this.createBlankLayer(e,t,n,r,i,s)},setTileSize:function(e,t){this.tileWidth=e,this.tileHeight=t,this.widthInPixels=this.width*e,this.heightInPixels=this.height*t},addTilesetImage:function(e,n,r,i,s,o,u){if("undefined"==typeof r&&(r=this.tileWidth),"undefined"==typeof i&&(i=this.tileHeight),"undefined"==typeof s&&(s=0),"undefined"==typeof o&&(o=0),"undefined"==typeof u&&(u=0),0===r&&(r=32),0===i&&(i=32),"undefined"==typeof n){if("string"!=typeof e)return null;n=e}if("string"==typeof e&&(e=this.getTilesetIndex(e)),this.tilesets[e])return this.tilesets[e].setImage(this.game.cache.getImage(n)),this.tilesets[e];var a=new t.Tileset(n,u,r,i,s,o,{});a.setImage(this.game.cache.getImage(n)),this.tilesets.push(a);for(var f=this.tilesets.length-1,l=s,c=s,h=0,p=0,d=0,v=u;vc;c++)if(this.objects[e][c].gid===n){l=new a(this.game,this.objects[e][c].x,this.objects[e][c].y,r,i),l.name=this.objects[e][c].name,l.visible=this.objects[e][c].visible,l.autoCull=o,l.exists=s,f&&(l.y-=l.height),u.add(l);for(var p in this.objects[e][c].properties)u.set(l,p,this.objects[e][c].properties[p],!1,!1,0)}},createLayer:function(e,n,r,i){"undefined"==typeof n&&(n=this.game.width),"undefined"==typeof r&&(r=this.game.height),"undefined"==typeof i&&(i=this.game.world);var s=e;return"string"==typeof e&&(s=this.getLayerIndex(e)),null===s||s>this.layers.length?void console.warn("Tilemap.createLayer: Invalid layer ID given: "+s):i.add(new t.TilemapLayer(this.game,this,s,n,r))},createBlankLayer:function(e,n,r,i,s,o){if("undefined"==typeof o&&(o=this.game.world),null!==this.getLayerIndex(e))return void console.warn("Tilemap.createBlankLayer: Layer with matching name already exists");for(var u,a=[],f=0;r>f;f++){u=[];for(var l=0;n>l;l++)u.push(null);a.push(u)}var c={name:e,x:0,y:0,width:n,height:r,widthInPixels:n*i,heightInPixels:r*s,alpha:1,visible:!0,properties:{},indexes:[],callbacks:[],bodies:[],data:a};this.layers.push(c),this.currentLayer=this.layers.length-1;var h=c.widthInPixels,p=c.heightInPixels;h>this.game.width&&(h=this.game.width),p>this.game.height&&(p=this.game.height);var a=new t.TilemapLayer(this.game,this,this.layers.length-1,h,p);return a.name=e,o.add(a)},getIndex:function(e,t){for(var n=0;ni;i++)this.layers[r].callbacks[e[i]]={callback:t,callbackContext:n}},setTileLocationCallback:function(e,t,n,r,i,s,o){if(o=this.getLayer(o),this.copy(e,t,n,r,o),!(this._results.length<2))for(var u=1;ur;r++)this.setCollisionByIndex(e[r],t,n,!1);this.calculateFaces(n)},setCollisionBetween:function(e,t,n,r){if("undefined"==typeof n&&(n=!0),r=this.getLayer(r),!(e>t)){for(var i=e;t>=i;i++)this.setCollisionByIndex(i,n,r,!1);this.calculateFaces(r)}},setCollisionByExclusion:function(e,t,n){"undefined"==typeof t&&(t=!0),n=this.getLayer(n);for(var r=0,i=this.tiles.length;i>r;r++)-1===e.indexOf(r)&&this.setCollisionByIndex(r,t,n,!1);this.calculateFaces(n)},setCollisionByIndex:function(e,t,n,r){if("undefined"==typeof t&&(t=!0),"undefined"==typeof n&&(n=this.currentLayer),"undefined"==typeof r&&(r=!0),t)this.collideIndexes.push(e);else{var i=this.collideIndexes.indexOf(e);i>-1&&this.collideIndexes.splice(i,1)}for(var s=0;ss;s++)for(var u=0,a=this.layers[e].width;a>u;u++){var f=this.layers[e].data[s][u];f&&(t=this.getTileAbove(e,u,s),n=this.getTileBelow(e,u,s),r=this.getTileLeft(e,u,s),i=this.getTileRight(e,u,s),f.collides&&(f.faceTop=!0,f.faceBottom=!0,f.faceLeft=!0,f.faceRight=!0),t&&t.collides&&(f.faceTop=!1),n&&n.collides&&(f.faceBottom=!1),r&&r.collides&&(f.faceLeft=!1),i&&i.collides&&(f.faceRight=!1))}},getTileAbove:function(e,t,n){return n>0?this.layers[e].data[n-1][t]:null},getTileBelow:function(e,t,n){return n0?this.layers[e].data[n][t-1]:null},getTileRight:function(e,t,n){return t=0&&n=0&&r-1?this.layers[i].data[r][n].setCollision(!0,!0,!0,!0):this.layers[i].data[r][n].resetCollision(),this.layers[i].dirty=!0,this.calculateFaces(i),this.layers[i].data[r][n]}return null},putTileWorldXY:function(e,t,n,r,i,s){s=this.getLayer(s),t=this.game.math.snapToFloor(t,r)/r,n=this.game.math.snapToFloor(n,i)/i,this.putTile(e,t,n,s)},getTile:function(e,t,n){return n=this.getLayer(n),e>=0&&e=0&&te&&(e=0),0>t&&(t=0),n>this.layers[i].width&&(n=this.layers[i].width),r>this.layers[i].height&&(r=this.layers[i].height),this._results.length=0,this._results.push({x:e,y:t,width:n,height:r,layer:i});for(var s=t;t+r>s;s++)for(var o=e;e+n>o;o++)this._results.push(this.layers[i].data[s][o]);return this._results},paste:function(e,t,n,r){if("undefined"==typeof e&&(e=0),"undefined"==typeof t&&(t=0),r=this.getLayer(r),n&&!(n.length<2)){for(var i=n[1].x-e,s=n[1].y-t,o=1;o1?this.debugMap[this.layers[this.currentLayer].data[n][r]]?"background: "+this.debugMap[this.layers[this.currentLayer].data[n][r]]:"background: #ffffff":"background: rgb(0, 0, 0)");e+="\n"}t[0]=e,console.log.apply(console,t)},destroy:function(){this.removeAllLayers(),this.data=[],this.game=null}},t.Tilemap.prototype.constructor=t.Tilemap,t.TilemapLayer=function(e,n,r,i,s){this.game=e,this.map=n,this.index=r,this.layer=n.layers[r],this.canvas=t.Canvas.create(i,s,"",!0),this.context=this.canvas.getContext("2d"),this.baseTexture=new PIXI.BaseTexture(this.canvas),this.texture=new PIXI.Texture(this.baseTexture),this.textureFrame=new t.Frame(0,0,0,i,s,"tilemapLayer",e.rnd.uuid()),t.Image.call(this,this.game,0,0,this.texture,this.textureFrame),this.name="",this.type=t.TILEMAPLAYER,this.fixedToCamera=!0,this.cameraOffset=new t.Point(0,0),this.tileColor="rgb(255, 255, 255)",this.debug=!1,this.debugAlpha=.5,this.debugColor="rgba(0, 255, 0, 1)",this.debugFill=!1,this.debugFillColor="rgba(0, 255, 0, 0.2)",this.debugCallbackColor="rgba(255, 0, 0, 1)",this.scrollFactorX=1,this.scrollFactorY=1,this.dirty=!0,this.rayStepRate=4,this._mc={cw:n.tileWidth,ch:n.tileHeight,ga:1,dx:0,dy:0,dw:0,dh:0,tx:0,ty:0,tw:0,th:0,tl:0,maxX:0,maxY:0,startX:0,startY:0,x:0,y:0,prevX:0,prevY:0},this._results=[],this.updateMax()},t.TilemapLayer.prototype=Object.create(t.Image.prototype),t.TilemapLayer.prototype.constructor=t.TilemapLayer,t.TilemapLayer.prototype.postUpdate=function(){t.Image.prototype.postUpdate.call(this),this.scrollX=this.game.camera.x*this.scrollFactorX,this.scrollY=this.game.camera.y*this.scrollFactorY,this.render(),1===this._cache[7]&&(this.position.x=(this.game.camera.view.x+this.cameraOffset.x)/this.game.camera.scale.x,this.position.y=(this.game.camera.view.y+this.cameraOffset.y)/this.game.camera.scale.y)},t.TilemapLayer.prototype.resizeWorld=function(){this.game.world.setBounds(0,0,this.layer.widthInPixels,this.layer.heightInPixels)},t.TilemapLayer.prototype._fixX=function(e){return 0>e&&(e=0),1===this.scrollFactorX?e:this._mc.x+(e-this._mc.x/this.scrollFactorX)},t.TilemapLayer.prototype._unfixX=function(e){return 1===this.scrollFactorX?e:this._mc.x/this.scrollFactorX+(e-this._mc.x)},t.TilemapLayer.prototype._fixY=function(e){return 0>e&&(e=0),1===this.scrollFactorY?e:this._mc.y+(e-this._mc.y/this.scrollFactorY)},t.TilemapLayer.prototype._unfixY=function(e){return 1===this.scrollFactorY?e:this._mc.y/this.scrollFactorY+(e-this._mc.y)},t.TilemapLayer.prototype.getTileX=function(e){return this.game.math.snapToFloor(this._fixX(e),this.map.tileWidth)/this.map.tileWidth},t.TilemapLayer.prototype.getTileY=function(e){return this.game.math.snapToFloor(this._fixY(e),this.map.tileHeight)/this.map.tileHeight},t.TilemapLayer.prototype.getTileXY=function(e,t,n){return n.x=this.getTileX(e),n.y=this.getTileY(t),n},t.TilemapLayer.prototype.getRayCastTiles=function(e,t,n,r){("undefined"==typeof t||null===t)&&(t=this.rayStepRate),"undefined"==typeof n&&(n=!1),"undefined"==typeof r&&(r=!1);var i=this.getTiles(e.x,e.y,e.width,e.height,n,r);if(0===i.length)return[];for(var s=e.coordinatesOnLine(t),o=s.length,u=[],a=0;af;f++)if(i[a].containsPoint(s[f][0],s[f][1])){u.push(i[a]);break}return u},t.TilemapLayer.prototype.getTiles=function(e,t,n,r,i,s){"undefined"==typeof i&&(i=!1),"undefined"==typeof s&&(s=!1),e=this._fixX(e),t=this._fixY(t),n>this.layer.widthInPixels&&(n=this.layer.widthInPixels),r>this.layer.heightInPixels&&(r=this.layer.heightInPixels),this._mc.tx=this.game.math.snapToFloor(e,this._mc.cw)/this._mc.cw,this._mc.ty=this.game.math.snapToFloor(t,this._mc.ch)/this._mc.ch,this._mc.tw=(this.game.math.snapToCeil(n,this._mc.cw)+this._mc.cw)/this._mc.cw,this._mc.th=(this.game.math.snapToCeil(r,this._mc.ch)+this._mc.ch)/this._mc.ch,this._results.length=0;for(var o=this._mc.ty;othis.layer.width&&(this._mc.maxX=this.layer.width),this._mc.maxY>this.layer.height&&(this._mc.maxY=this.layer.height)),this.dirty=!0},t.TilemapLayer.prototype.render=function(){if(this.layer.dirty&&(this.dirty=!0),this.dirty&&this.visible){this._mc.prevX=this._mc.dx,this._mc.prevY=this._mc.dy,this._mc.dx=-(this._mc.x-this._mc.startX*this.map.tileWidth),this._mc.dy=-(this._mc.y-this._mc.startY*this.map.tileHeight),this._mc.tx=this._mc.dx,this._mc.ty=this._mc.dy,this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.context.fillStyle=this.tileColor;var e,n;this.debug&&(this.context.globalAlpha=this.debugAlpha);for(var r=this._mc.startY,i=this._mc.startY+this._mc.maxY;i>r;r++){this._column=this.layer.data[r];for(var s=this._mc.startX,o=this._mc.startX+this._mc.maxX;o>s;s++)this._column[s]&&(e=this._column[s],n=this.map.tilesets[this.map.tiles[e.index][2]],this.debug===!1&&e.alpha!==this.context.globalAlpha&&(this.context.globalAlpha=e.alpha),n.draw(this.context,Math.floor(this._mc.tx),Math.floor(this._mc.ty),e.index),e.debug&&(this.context.fillStyle="rgba(0, 255, 0, 0.4)",this.context.fillRect(Math.floor(this._mc.tx),Math.floor(this._mc.ty),this.map.tileWidth,this.map.tileHeight))),this._mc.tx+=this.map.tileWidth;this._mc.tx=this._mc.dx,this._mc.ty+=this.map.tileHeight}return this.debug&&(this.context.globalAlpha=1,this.renderDebug()),this.game.renderType===t.WEBGL&&PIXI.updateWebGLTexture(this.baseTexture,this.game.renderer.gl),this.dirty=!1,this.layer.dirty=!1,!0}},t.TilemapLayer.prototype.renderDebug=function(){this._mc.tx=this._mc.dx,this._mc.ty=this._mc.dy,this.context.strokeStyle=this.debugColor,this.context.fillStyle=this.debugFillColor;for(var e=this._mc.startY,t=this._mc.startY+this._mc.maxY;t>e;e++){this._column=this.layer.data[e];for(var n=this._mc.startX,r=this._mc.startX+this._mc.maxX;r>n;n++){var i=this._column[n];i&&(i.faceTop||i.faceBottom||i.faceLeft||i.faceRight)&&(this._mc.tx=Math.floor(this._mc.tx),this.debugFill&&this.context.fillRect(this._mc.tx,this._mc.ty,this._mc.cw,this._mc.ch),this.context.beginPath(),i.faceTop&&(this.context.moveTo(this._mc.tx,this._mc.ty),this.context.lineTo(this._mc.tx+this._mc.cw,this._mc.ty)),i.faceBottom&&(this.context.moveTo(this._mc.tx,this._mc.ty+this._mc.ch),this.context.lineTo(this._mc.tx+this._mc.cw,this._mc.ty+this._mc.ch)),i.faceLeft&&(this.context.moveTo(this._mc.tx,this._mc.ty),this.context.lineTo(this._mc.tx,this._mc.ty+this._mc.ch)),i.faceRight&&(this.context.moveTo(this._mc.tx+this._mc.cw,this._mc.ty),this.context.lineTo(this._mc.tx+this._mc.cw,this._mc.ty+this._mc.ch)),this.context.stroke()),this._mc.tx+=this.map.tileWidth}this._mc.tx=this._mc.dx,this._mc.ty+=this.map.tileHeight}},Object.defineProperty(t.TilemapLayer.prototype,"scrollX",{get:function(){return this._mc.x},set:function(e){e!==this._mc.x&&e>=0&&this.layer.widthInPixels>this.width&&(this._mc.x=e,this._mc.x>this.layer.widthInPixels-this.width&&(this._mc.x=this.layer.widthInPixels-this.width),this._mc.startX=this.game.math.floor(this._mc.x/this.map.tileWidth),this._mc.startX<0&&(this._mc.startX=0),this._mc.startX+this._mc.maxX>this.layer.width&&(this._mc.startX=this.layer.width-this._mc.maxX),this.dirty=!0)}}),Object.defineProperty(t.TilemapLayer.prototype,"scrollY",{get:function(){return this._mc.y},set:function(e){e!==this._mc.y&&e>=0&&this.layer.heightInPixels>this.height&&(this._mc.y=e,this._mc.y>this.layer.heightInPixels-this.height&&(this._mc.y=this.layer.heightInPixels-this.height),this._mc.startY=this.game.math.floor(this._mc.y/this.map.tileHeight),this._mc.startY<0&&(this._mc.startY=0),this._mc.startY+this._mc.maxY>this.layer.height&&(this._mc.startY=this.layer.height-this._mc.maxY),this.dirty=!0)}}),Object.defineProperty(t.TilemapLayer.prototype,"collisionWidth",{get:function(){return this._mc.cw},set:function(e){this._mc.cw=e,this.dirty=!0}}),Object.defineProperty(t.TilemapLayer.prototype,"collisionHeight",{get:function(){return this._mc.ch},set:function(e){this._mc.ch=e,this.dirty=!0}}),t.TilemapParser={parse:function(e,n,r,i,s,o){if("undefined"==typeof r&&(r=32),"undefined"==typeof i&&(i=32),"undefined"==typeof s&&(s=10),"undefined"==typeof o&&(o=10),"undefined"==typeof n)return this.getEmptyData();if(null===n)return this.getEmptyData(r,i,s,o);var u=e.cache.getTilemapData(n);if(u){if(u.format===t.Tilemap.CSV)return this.parseCSV(n,u.data,r,i);if(!u.format||u.format===t.Tilemap.TILED_JSON)return this.parseTiledJSON(u.data)}else console.warn("Phaser.TilemapParser.parse - No map data found for key "+n)},parseCSV:function(e,n,r,i){var s=this.getEmptyData();n=n.trim();for(var o=[],u=n.split("\n"),a=u.length,f=0,l=0;lf;f++)u.push(e.layers[i].data[f]>0?new t.Tile(s,e.layers[i].data[f],o,a.length,e.tilewidth,e.tileheight):null),o++,o===e.layers[i].width&&(a.push(u),o=0,u=[]);s.data=a,r.push(s)}n.layers=r;for(var c=[],i=0;iy;y++)if(e.layers[i].objects[y].gid){var w={gid:e.layers[i].objects[y].gid,name:e.layers[i].objects[y].name,x:e.layers[i].objects[y].x,y:e.layers[i].objects[y].y,visible:e.layers[i].objects[y].visible,properties:e.layers[i].objects[y].properties};m[e.layers[i].name].push(w)}else if(e.layers[i].objects[y].polyline){var w={name:e.layers[i].objects[y].name,x:e.layers[i].objects[y].x,y:e.layers[i].objects[y].y,width:e.layers[i].objects[y].width,height:e.layers[i].objects[y].height,visible:e.layers[i].objects[y].visible,properties:e.layers[i].objects[y].properties};w.polyline=[];for(var E=0;E=n)&&(n=32),("undefined"==typeof r||0>=r)&&(r=32),"undefined"==typeof i&&(i=0),"undefined"==typeof s&&(s=0),this.name=e,this.firstgid=t,this.tileWidth=n,this.tileHeight=r,this.tileMargin=i,this.tileSpacing=s,this.properties=o,this.image=null,this.rows=0,this.columns=0,this.total=0,this.drawCoords=[]},t.Tileset.prototype={draw:function(e,t,n,r){this.image&&this.drawCoords[r]&&e.drawImage(this.image,this.drawCoords[r][0],this.drawCoords[r][1],this.tileWidth,this.tileHeight,t,n,this.tileWidth,this.tileHeight)},setImage:function(e){this.image=e,this.rows=Math.round((e.height-this.tileMargin)/(this.tileHeight+this.tileSpacing)),this.columns=Math.round((e.width-this.tileMargin)/(this.tileWidth+this.tileSpacing)),this.total=this.rows*this.columns,this.drawCoords.length=0;for(var t=this.tileMargin,n=this.tileMargin,r=this.firstgid,i=0;i=c&&a<=c+this.width){var d=this.y;if(b>=d&&b<=d+this.height)return!0}return!1},b.Rectangle.prototype.constructor=b.Rectangle,b.EmptyRectangle=new b.Rectangle(0,0,0,0),b.Polygon=function(a){if(a instanceof Array||(a=Array.prototype.slice.call(arguments)),"number"==typeof a[0]){for(var c=[],d=0,e=a.length;e>d;d+=2)c.push(new b.Point(a[d],a[d+1]));a=c}this.points=a},b.Polygon.prototype.clone=function(){for(var a=[],c=0;cb!=i>b&&(h-f)*(b-g)/(i-g)+f>a;j&&(c=!c)}return c},b.Polygon.prototype.constructor=b.Polygon,b.Circle=function(a,b,c){this.x=a||0,this.y=b||0,this.radius=c||0},b.Circle.prototype.clone=function(){return new b.Circle(this.x,this.y,this.radius)},b.Circle.prototype.contains=function(a,b){if(this.radius<=0)return!1;var c=this.x-a,d=this.y-b,e=this.radius*this.radius;return c*=c,d*=d,e>=c+d},b.Circle.prototype.constructor=b.Circle,b.Ellipse=function(a,b,c,d){this.x=a||0,this.y=b||0,this.width=c||0,this.height=d||0},b.Ellipse.prototype.clone=function(){return new b.Ellipse(this.x,this.y,this.width,this.height)},b.Ellipse.prototype.contains=function(a,b){if(this.width<=0||this.height<=0)return!1;var c=(a-this.x)/this.width,d=(b-this.y)/this.height;return c*=c,d*=d,1>=c+d},b.Ellipse.prototype.getBounds=function(){return new b.Rectangle(this.x,this.y,this.width,this.height)},b.Ellipse.prototype.constructor=b.Ellipse,b.determineMatrixArrayType=function(){return"undefined"!=typeof Float32Array?Float32Array:Array},b.Matrix2=b.determineMatrixArrayType(),b.Matrix=function(){this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0},b.Matrix.prototype.fromArray=function(a){this.a=a[0],this.b=a[1],this.c=a[3],this.d=a[4],this.tx=a[2],this.ty=a[5]},b.Matrix.prototype.toArray=function(a){this.array||(this.array=new Float32Array(9));var b=this.array;return a?(this.array[0]=this.a,this.array[1]=this.c,this.array[2]=0,this.array[3]=this.b,this.array[4]=this.d,this.array[5]=0,this.array[6]=this.tx,this.array[7]=this.ty,this.array[8]=1):(this.array[0]=this.a,this.array[1]=this.b,this.array[2]=this.tx,this.array[3]=this.c,this.array[4]=this.d,this.array[5]=this.ty,this.array[6]=0,this.array[7]=0,this.array[8]=1),b},b.identityMatrix=new b.Matrix,b.DisplayObject=function(){this.position=new b.Point,this.scale=new b.Point(1,1),this.pivot=new b.Point(0,0),this.rotation=0,this.alpha=1,this.visible=!0,this.hitArea=null,this.buttonMode=!1,this.renderable=!1,this.parent=null,this.stage=null,this.worldAlpha=1,this._interactive=!1,this.defaultCursor="pointer",this.worldTransform=new b.Matrix,this.color=[],this.dynamic=!0,this._sr=0,this._cr=1,this.filterArea=new b.Rectangle(0,0,1,1),this._bounds=new b.Rectangle(0,0,1,1),this._currentBounds=null,this._mask=null,this._cacheAsBitmap=!1,this._cacheIsDirty=!1},b.DisplayObject.prototype.constructor=b.DisplayObject,b.DisplayObject.prototype.setInteractive=function(a){this.interactive=a},Object.defineProperty(b.DisplayObject.prototype,"interactive",{get:function(){return this._interactive},set:function(a){this._interactive=a,this.stage&&(this.stage.dirty=!0)}}),Object.defineProperty(b.DisplayObject.prototype,"worldVisible",{get:function(){var a=this;do{if(!a.visible)return!1;a=a.parent}while(a);return!0}}),Object.defineProperty(b.DisplayObject.prototype,"mask",{get:function(){return this._mask},set:function(a){this._mask&&(this._mask.isMask=!1),this._mask=a,this._mask&&(this._mask.isMask=!0)}}),Object.defineProperty(b.DisplayObject.prototype,"filters",{get:function(){return this._filters},set:function(a){if(a){for(var b=[],c=0;c=0&&b<=this.children.length))throw new Error(a+" The index "+b+" supplied is out of bounds "+this.children.length);a.parent&&a.parent.removeChild(a),a.parent=this,this.children.splice(b,0,a),this.stage&&a.setStageReference(this.stage)},b.DisplayObjectContainer.prototype.swapChildren=function(a,b){if(a!==b){var c=this.children.indexOf(a),d=this.children.indexOf(b);if(0>c||0>d)throw new Error("swapChildren: Both the supplied DisplayObjects must be a child of the caller.");this.children[c]=b,this.children[d]=a}},b.DisplayObjectContainer.prototype.getChildAt=function(a){if(a>=0&&aa;a++)this.children[a].updateTransform()},b.DisplayObjectContainer.prototype.getBounds=function(a){if(0===this.children.length)return b.EmptyRectangle;if(a){var c=this.worldTransform;this.worldTransform=a,this.updateTransform(),this.worldTransform=c}for(var d,e,f,g=1/0,h=1/0,i=-1/0,j=-1/0,k=!1,l=0,m=this.children.length;m>l;l++){var n=this.children[l];n.visible&&(k=!0,d=this.children[l].getBounds(a),g=ge?i:e,j=j>f?j:f)}if(!k)return b.EmptyRectangle;var o=this._bounds;return o.x=g,o.y=h,o.width=i-g,o.height=j-h,o},b.DisplayObjectContainer.prototype.getLocalBounds=function(){var a=this.worldTransform;this.worldTransform=b.identityMatrix;for(var c=0,d=this.children.length;d>c;c++)this.children[c].updateTransform();var e=this.getBounds();return this.worldTransform=a,e},b.DisplayObjectContainer.prototype.setStageReference=function(a){this.stage=a,this._interactive&&(this.stage.dirty=!0);for(var b=0,c=this.children.length;c>b;b++){var d=this.children[b];d.setStageReference(a)}},b.DisplayObjectContainer.prototype.removeStageReference=function(){for(var a=0,b=this.children.length;b>a;a++){var c=this.children[a];c.removeStageReference()}this._interactive&&(this.stage.dirty=!0),this.stage=null},b.DisplayObjectContainer.prototype._renderWebGL=function(a){if(this.visible&&!(this.alpha<=0)){if(this._cacheAsBitmap)return void this._renderCachedSprite(a);var b,c;if(this._mask||this._filters){for(this._mask&&(a.spriteBatch.stop(),a.maskManager.pushMask(this.mask,a),a.spriteBatch.start()),this._filters&&(a.spriteBatch.flush(),a.filterManager.pushFilter(this._filterBlock)),b=0,c=this.children.length;c>b;b++)this.children[b]._renderWebGL(a);a.spriteBatch.stop(),this._filters&&a.filterManager.popFilter(),this._mask&&a.maskManager.popMask(a),a.spriteBatch.start()}else for(b=0,c=this.children.length;c>b;b++)this.children[b]._renderWebGL(a)}},b.DisplayObjectContainer.prototype._renderCanvas=function(a){if(this.visible!==!1&&0!==this.alpha){if(this._cacheAsBitmap)return void this._renderCachedSprite(a);this._mask&&a.maskManager.pushMask(this._mask,a.context);for(var b=0,c=this.children.length;c>b;b++){var d=this.children[b];d._renderCanvas(a)}this._mask&&a.maskManager.popMask(a.context)}},b.Sprite=function(a){b.DisplayObjectContainer.call(this),this.anchor=new b.Point,this.texture=a,this._width=0,this._height=0,this.tint=16777215,this.blendMode=b.blendModes.NORMAL,a.baseTexture.hasLoaded?this.onTextureUpdate():(this.onTextureUpdateBind=this.onTextureUpdate.bind(this),this.texture.addEventListener("update",this.onTextureUpdateBind)),this.renderable=!0},b.Sprite.prototype=Object.create(b.DisplayObjectContainer.prototype),b.Sprite.prototype.constructor=b.Sprite,Object.defineProperty(b.Sprite.prototype,"width",{get:function(){return this.scale.x*this.texture.frame.width},set:function(a){this.scale.x=a/this.texture.frame.width,this._width=a}}),Object.defineProperty(b.Sprite.prototype,"height",{get:function(){return this.scale.y*this.texture.frame.height},set:function(a){this.scale.y=a/this.texture.frame.height,this._height=a}}),b.Sprite.prototype.setTexture=function(a){this.texture.baseTexture!==a.baseTexture?(this.textureChange=!0,this.texture=a):this.texture=a,this.cachedTint=16777215,this.updateFrame=!0},b.Sprite.prototype.onTextureUpdate=function(){this._width&&(this.scale.x=this._width/this.texture.frame.width),this._height&&(this.scale.y=this._height/this.texture.frame.height),this.updateFrame=!0},b.Sprite.prototype.getBounds=function(a){var b=this.texture.frame.width,c=this.texture.frame.height,d=b*(1-this.anchor.x),e=b*-this.anchor.x,f=c*(1-this.anchor.y),g=c*-this.anchor.y,h=a||this.worldTransform,i=h.a,j=h.c,k=h.b,l=h.d,m=h.tx,n=h.ty,o=i*e+k*g+m,p=l*g+j*e+n,q=i*d+k*g+m,r=l*g+j*d+n,s=i*d+k*f+m,t=l*f+j*d+n,u=i*e+k*f+m,v=l*f+j*e+n,w=-1/0,x=-1/0,y=1/0,z=1/0;y=y>o?o:y,y=y>q?q:y,y=y>s?s:y,y=y>u?u:y,z=z>p?p:z,z=z>r?r:z,z=z>t?t:z,z=z>v?v:z,w=o>w?o:w,w=q>w?q:w,w=s>w?s:w,w=u>w?u:w,x=p>x?p:x,x=r>x?r:x,x=t>x?t:x,x=v>x?v:x;var A=this._bounds;return A.x=y,A.width=w-y,A.y=z,A.height=x-z,this._currentBounds=A,A},b.Sprite.prototype._renderWebGL=function(a){if(this.visible&&!(this.alpha<=0)){var b,c;if(this._mask||this._filters){var d=a.spriteBatch;for(this._mask&&(d.stop(),a.maskManager.pushMask(this.mask,a),d.start()),this._filters&&(d.flush(),a.filterManager.pushFilter(this._filterBlock)),d.render(this),b=0,c=this.children.length;c>b;b++)this.children[b]._renderWebGL(a);d.stop(),this._filters&&a.filterManager.popFilter(),this._mask&&a.maskManager.popMask(a),d.start()}else for(a.spriteBatch.render(this),b=0,c=this.children.length;c>b;b++)this.children[b]._renderWebGL(a)}},b.Sprite.prototype._renderCanvas=function(a){if(this.visible!==!1&&0!==this.alpha){var c=this.texture.frame,d=a.context,e=this.texture;if(this.blendMode!==a.currentBlendMode&&(a.currentBlendMode=this.blendMode,d.globalCompositeOperation=b.blendModesCanvas[a.currentBlendMode]),this._mask&&a.maskManager.pushMask(this._mask,a.context),c&&c.width&&c.height&&e.baseTexture.source){d.globalAlpha=this.worldAlpha;var f=this.worldTransform;if(a.roundPixels?d.setTransform(f.a,f.c,f.b,f.d,0|f.tx,0|f.ty):d.setTransform(f.a,f.c,f.b,f.d,f.tx,f.ty),a.smoothProperty&&a.scaleMode!==this.texture.baseTexture.scaleMode&&(a.scaleMode=this.texture.baseTexture.scaleMode,d[a.smoothProperty]=a.scaleMode===b.scaleModes.LINEAR),16777215!==this.tint){if(this.cachedTint!==this.tint){if(!e.baseTexture.hasLoaded)return;this.cachedTint=this.tint,this.tintedTexture=b.CanvasTinter.getTintedTexture(this,this.tint)}d.drawImage(this.tintedTexture,0,0,c.width,c.height,this.anchor.x*-c.width,this.anchor.y*-c.height,c.width,c.height)}else if(e.trim){var g=e.trim;d.drawImage(this.texture.baseTexture.source,c.x,c.y,c.width,c.height,g.x-this.anchor.x*g.width,g.y-this.anchor.y*g.height,c.width,c.height)}else d.drawImage(this.texture.baseTexture.source,c.x,c.y,c.width,c.height,this.anchor.x*-c.width,this.anchor.y*-c.height,c.width,c.height)}for(var h=0,i=this.children.length;i>h;h++){var j=this.children[h];j._renderCanvas(a)}this._mask&&a.maskManager.popMask(a.context)}},b.Sprite.fromFrame=function(a){var c=b.TextureCache[a];if(!c)throw new Error('The frameId "'+a+'" does not exist in the texture cache'+this);return new b.Sprite(c)},b.Sprite.fromImage=function(a,c,d){var e=b.Texture.fromImage(a,c,d);return new b.Sprite(e)},b.SpriteBatch=function(a){b.DisplayObjectContainer.call(this),this.textureThing=a,this.ready=!1},b.SpriteBatch.prototype=Object.create(b.DisplayObjectContainer.prototype),b.SpriteBatch.constructor=b.SpriteBatch,b.SpriteBatch.prototype.initWebGL=function(a){this.fastSpriteBatch=new b.WebGLFastSpriteBatch(a),this.ready=!0},b.SpriteBatch.prototype.updateTransform=function(){b.DisplayObject.prototype.updateTransform.call(this)},b.SpriteBatch.prototype._renderWebGL=function(a){!this.visible||this.alpha<=0||!this.children.length||(this.ready||this.initWebGL(a.gl),a.spriteBatch.stop(),a.shaderManager.activateShader(a.shaderManager.fastShader),this.fastSpriteBatch.begin(this,a),this.fastSpriteBatch.render(this),a.shaderManager.activateShader(a.shaderManager.defaultShader),a.spriteBatch.start())},b.SpriteBatch.prototype._renderCanvas=function(a){var c=a.context;c.globalAlpha=this.worldAlpha,b.DisplayObject.prototype.updateTransform.call(this);for(var d=this.worldTransform,e=!0,f=0;fe?(g>0&&(b+="\n"),b+=f[g]+" ",e=this.style.wordWrapWidth-h):(e-=i,b+=f[g]+" ")}d=2?parseInt(c[c.length-2],10):b.BitmapText.fonts[this.fontName].size,this.dirty=!0,this.tint=a.tint},b.BitmapText.prototype.updateText=function(){for(var a=b.BitmapText.fonts[this.fontName],c=new b.Point,d=null,e=[],f=0,g=[],h=0,i=this.fontSize/a.size,j=0;j=j;j++){var n=0;"right"===this.style.align?n=f-g[j]:"center"===this.style.align&&(n=(f-g[j])/2),m.push(n)}var o=this.children.length,p=e.length,q=this.tint||16777215;for(j=0;p>j;j++){var r=o>j?this.children[j]:this._pool.pop();r?r.setTexture(e[j].texture):r=new b.Sprite(e[j].texture),r.position.x=(e[j].position.x+m[e[j].line])*i,r.position.y=e[j].position.y*i,r.scale.x=r.scale.y=i,r.tint=q,r.parent||this.addChild(r)}for(;this.children.length>p;){var s=this.getChildAt(this.children.length-1);this._pool.push(s),this.removeChild(s)}this.textWidth=f*i,this.textHeight=(c.y+a.lineHeight)*i},b.BitmapText.prototype.updateTransform=function(){this.dirty&&(this.updateText(),this.dirty=!1),b.DisplayObjectContainer.prototype.updateTransform.call(this)},b.BitmapText.fonts={},b.Stage=function(a){b.DisplayObjectContainer.call(this),this.worldTransform=new b.Matrix,this.interactive=!0,this.interactionManager=new b.InteractionManager(this),this.dirty=!0,this.stage=this,this.stage.hitArea=new b.Rectangle(0,0,1e5,1e5),this.setBackgroundColor(a)},b.Stage.prototype=Object.create(b.DisplayObjectContainer.prototype),b.Stage.prototype.constructor=b.Stage,b.Stage.prototype.setInteractionDelegate=function(a){this.interactionManager.setTargetDomElement(a)},b.Stage.prototype.updateTransform=function(){this.worldAlpha=1;for(var a=0,b=this.children.length;b>a;a++)this.children[a].updateTransform();this.dirty&&(this.dirty=!1,this.interactionManager.dirty=!0),this.interactive&&this.interactionManager.update()},b.Stage.prototype.setBackgroundColor=function(a){this.backgroundColor=a||0,this.backgroundColorSplit=b.hex2rgb(this.backgroundColor);var c=this.backgroundColor.toString(16);c="000000".substr(0,6-c.length)+c,this.backgroundColorString="#"+c},b.Stage.prototype.getMousePosition=function(){return this.interactionManager.mouse.global};for(var c=0,d=["ms","moz","webkit","o"],e=0;e>16&255)/255,(a>>8&255)/255,(255&a)/255]},b.rgb2hex=function(a){return(255*a[0]<<16)+(255*a[1]<<8)+255*a[2]},"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}}()),b.AjaxRequest=function(){var a=["Msxml2.XMLHTTP.6.0","Msxml2.XMLHTTP.3.0","Microsoft.XMLHTTP"];if(!window.ActiveXObject)return window.XMLHttpRequest?new window.XMLHttpRequest:!1;for(var b=0;b0&&0===(a&a-1))return a;for(var b=1;a>b;)b<<=1;return b},b.EventTarget=function(){var a={};this.addEventListener=this.on=function(b,c){void 0===a[b]&&(a[b]=[]),-1===a[b].indexOf(c)&&a[b].push(c)},this.dispatchEvent=this.emit=function(b){if(a[b.type]&&a[b.type].length)for(var c=0,d=a[b.type].length;d>c;c++)a[b.type][c](b)},this.removeEventListener=this.off=function(b,c){var d=a[b].indexOf(c);-1!==d&&a[b].splice(d,1)},this.removeAllEventListeners=function(b){var c=a[b];c&&(c.length=0)}},b.PolyK={},b.PolyK.Triangulate=function(a){var c=!0,d=a.length>>1;if(3>d)return[];for(var e=[],f=[],g=0;d>g;g++)f.push(g);g=0;for(var h=d;h>3;){var i=f[(g+0)%h],j=f[(g+1)%h],k=f[(g+2)%h],l=a[2*i],m=a[2*i+1],n=a[2*j],o=a[2*j+1],p=a[2*k],q=a[2*k+1],r=!1;if(b.PolyK._convex(l,m,n,o,p,q,c)){r=!0;for(var s=0;h>s;s++){var t=f[s];if(t!==i&&t!==j&&t!==k&&b.PolyK._PointInTriangle(a[2*t],a[2*t+1],l,m,n,o,p,q)){r=!1;break}}}if(r)e.push(i,j,k),f.splice((g+1)%h,1),h--,g=0;else if(g++>3*h){if(!c)return window.console.log("PIXI Warning: shape too complex to fill"),[];for(e=[],f=[],g=0;d>g;g++)f.push(g);g=0,h=d,c=!1}}return e.push(f[0],f[1],f[2]),e},b.PolyK._PointInTriangle=function(a,b,c,d,e,f,g,h){var i=g-c,j=h-d,k=e-c,l=f-d,m=a-c,n=b-d,o=i*i+j*j,p=i*k+j*l,q=i*m+j*n,r=k*k+l*l,s=k*m+l*n,t=1/(o*r-p*p),u=(r*q-p*s)*t,v=(o*s-p*q)*t;return u>=0&&v>=0&&1>u+v},b.PolyK._convex=function(a,b,c,d,e,f,g){return(b-d)*(e-c)+(c-a)*(f-d)>=0===g},b.initDefaultShaders=function(){},b.CompileVertexShader=function(a,c){return b._CompileShader(a,c,a.VERTEX_SHADER)},b.CompileFragmentShader=function(a,c){return b._CompileShader(a,c,a.FRAGMENT_SHADER)},b._CompileShader=function(a,b,c){var d=b.join("\n"),e=a.createShader(c);return a.shaderSource(e,d),a.compileShader(e),a.getShaderParameter(e,a.COMPILE_STATUS)?e:(window.console.log(a.getShaderInfoLog(e)),null)},b.compileProgram=function(a,c,d){var e=b.CompileFragmentShader(a,d),f=b.CompileVertexShader(a,c),g=a.createProgram();return a.attachShader(g,f),a.attachShader(g,e),a.linkProgram(g),a.getProgramParameter(g,a.LINK_STATUS)||window.console.log("Could not initialise shaders"),g},b.PixiShader=function(a){this.gl=a,this.program=null,this.fragmentSrc=["precision lowp float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform sampler2D uSampler;","void main(void) {"," gl_FragColor = texture2D(uSampler, vTextureCoord) * vColor ;","}"],this.textureCount=0,this.attributes=[],this.init()},b.PixiShader.prototype.init=function(){var a=this.gl,c=b.compileProgram(a,this.vertexSrc||b.PixiShader.defaultVertexSrc,this.fragmentSrc);a.useProgram(c),this.uSampler=a.getUniformLocation(c,"uSampler"),this.projectionVector=a.getUniformLocation(c,"projectionVector"),this.offsetVector=a.getUniformLocation(c,"offsetVector"),this.dimensions=a.getUniformLocation(c,"dimensions"),this.aVertexPosition=a.getAttribLocation(c,"aVertexPosition"),this.aTextureCoord=a.getAttribLocation(c,"aTextureCoord"),this.colorAttribute=a.getAttribLocation(c,"aColor"),-1===this.colorAttribute&&(this.colorAttribute=2),this.attributes=[this.aVertexPosition,this.aTextureCoord,this.colorAttribute];for(var d in this.uniforms)this.uniforms[d].uniformLocation=a.getUniformLocation(c,d);this.initUniforms(),this.program=c},b.PixiShader.prototype.initUniforms=function(){this.textureCount=1;var a,b=this.gl;for(var c in this.uniforms){a=this.uniforms[c];var d=a.type;"sampler2D"===d?(a._init=!1,null!==a.value&&this.initSampler2D(a)):"mat2"===d||"mat3"===d||"mat4"===d?(a.glMatrix=!0,a.glValueLength=1,"mat2"===d?a.glFunc=b.uniformMatrix2fv:"mat3"===d?a.glFunc=b.uniformMatrix3fv:"mat4"===d&&(a.glFunc=b.uniformMatrix4fv)):(a.glFunc=b["uniform"+d],a.glValueLength="2f"===d||"2i"===d?2:"3f"===d||"3i"===d?3:"4f"===d||"4i"===d?4:1)}},b.PixiShader.prototype.initSampler2D=function(a){if(a.value&&a.value.baseTexture&&a.value.baseTexture.hasLoaded){var b=this.gl;if(b.activeTexture(b["TEXTURE"+this.textureCount]),b.bindTexture(b.TEXTURE_2D,a.value.baseTexture._glTextures[b.id]),a.textureData){var c=a.textureData,d=c.magFilter?c.magFilter:b.LINEAR,e=c.minFilter?c.minFilter:b.LINEAR,f=c.wrapS?c.wrapS:b.CLAMP_TO_EDGE,g=c.wrapT?c.wrapT:b.CLAMP_TO_EDGE,h=c.luminance?b.LUMINANCE:b.RGBA;if(c.repeat&&(f=b.REPEAT,g=b.REPEAT),b.pixelStorei(b.UNPACK_FLIP_Y_WEBGL,!!c.flipY),c.width){var i=c.width?c.width:512,j=c.height?c.height:2,k=c.border?c.border:0;b.texImage2D(b.TEXTURE_2D,0,h,i,j,k,h,b.UNSIGNED_BYTE,null)}else b.texImage2D(b.TEXTURE_2D,0,h,b.RGBA,b.UNSIGNED_BYTE,a.value.baseTexture.source);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,d),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,e),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,f),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,g)}b.uniform1i(a.uniformLocation,this.textureCount),a._init=!0,this.textureCount++}},b.PixiShader.prototype.syncUniforms=function(){this.textureCount=1;var a,c=this.gl;for(var d in this.uniforms)a=this.uniforms[d],1===a.glValueLength?a.glMatrix===!0?a.glFunc.call(c,a.uniformLocation,a.transpose,a.value):a.glFunc.call(c,a.uniformLocation,a.value):2===a.glValueLength?a.glFunc.call(c,a.uniformLocation,a.value.x,a.value.y):3===a.glValueLength?a.glFunc.call(c,a.uniformLocation,a.value.x,a.value.y,a.value.z):4===a.glValueLength?a.glFunc.call(c,a.uniformLocation,a.value.x,a.value.y,a.value.z,a.value.w):"sampler2D"===a.type&&(a._init?(c.activeTexture(c["TEXTURE"+this.textureCount]),c.bindTexture(c.TEXTURE_2D,a.value.baseTexture._glTextures[c.id]||b.createWebGLTexture(a.value.baseTexture,c)),c.uniform1i(a.uniformLocation,this.textureCount),this.textureCount++):this.initSampler2D(a))},b.PixiShader.prototype.destroy=function(){this.gl.deleteProgram(this.program),this.uniforms=null,this.gl=null,this.attributes=null},b.PixiShader.defaultVertexSrc=["attribute vec2 aVertexPosition;","attribute vec2 aTextureCoord;","attribute vec2 aColor;","uniform vec2 projectionVector;","uniform vec2 offsetVector;","varying vec2 vTextureCoord;","varying vec4 vColor;","const vec2 center = vec2(-1.0, 1.0);","void main(void) {"," gl_Position = vec4( ((aVertexPosition + offsetVector) / projectionVector) + center , 0.0, 1.0);"," vTextureCoord = aTextureCoord;"," vec3 color = mod(vec3(aColor.y/65536.0, aColor.y/256.0, aColor.y), 256.0) / 256.0;"," vColor = vec4(color * aColor.x, aColor.x);","}"],b.PixiFastShader=function(a){this.gl=a,this.program=null,this.fragmentSrc=["precision lowp float;","varying vec2 vTextureCoord;","varying float vColor;","uniform sampler2D uSampler;","void main(void) {"," gl_FragColor = texture2D(uSampler, vTextureCoord) * vColor ;","}"],this.vertexSrc=["attribute vec2 aVertexPosition;","attribute vec2 aPositionCoord;","attribute vec2 aScale;","attribute float aRotation;","attribute vec2 aTextureCoord;","attribute float aColor;","uniform vec2 projectionVector;","uniform vec2 offsetVector;","uniform mat3 uMatrix;","varying vec2 vTextureCoord;","varying float vColor;","const vec2 center = vec2(-1.0, 1.0);","void main(void) {"," vec2 v;"," vec2 sv = aVertexPosition * aScale;"," v.x = (sv.x) * cos(aRotation) - (sv.y) * sin(aRotation);"," v.y = (sv.x) * sin(aRotation) + (sv.y) * cos(aRotation);"," v = ( uMatrix * vec3(v + aPositionCoord , 1.0) ).xy ;"," gl_Position = vec4( ( v / projectionVector) + center , 0.0, 1.0);"," vTextureCoord = aTextureCoord;"," vColor = aColor;","}"],this.textureCount=0,this.init() +},b.PixiFastShader.prototype.init=function(){var a=this.gl,c=b.compileProgram(a,this.vertexSrc,this.fragmentSrc);a.useProgram(c),this.uSampler=a.getUniformLocation(c,"uSampler"),this.projectionVector=a.getUniformLocation(c,"projectionVector"),this.offsetVector=a.getUniformLocation(c,"offsetVector"),this.dimensions=a.getUniformLocation(c,"dimensions"),this.uMatrix=a.getUniformLocation(c,"uMatrix"),this.aVertexPosition=a.getAttribLocation(c,"aVertexPosition"),this.aPositionCoord=a.getAttribLocation(c,"aPositionCoord"),this.aScale=a.getAttribLocation(c,"aScale"),this.aRotation=a.getAttribLocation(c,"aRotation"),this.aTextureCoord=a.getAttribLocation(c,"aTextureCoord"),this.colorAttribute=a.getAttribLocation(c,"aColor"),-1===this.colorAttribute&&(this.colorAttribute=2),this.attributes=[this.aVertexPosition,this.aPositionCoord,this.aScale,this.aRotation,this.aTextureCoord,this.colorAttribute],this.program=c},b.PixiFastShader.prototype.destroy=function(){this.gl.deleteProgram(this.program),this.uniforms=null,this.gl=null,this.attributes=null},b.StripShader=function(){this.program=null,this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying float vColor;","uniform float alpha;","uniform sampler2D uSampler;","void main(void) {"," gl_FragColor = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y));"," gl_FragColor = gl_FragColor * alpha;","}"],this.vertexSrc=["attribute vec2 aVertexPosition;","attribute vec2 aTextureCoord;","attribute float aColor;","uniform mat3 translationMatrix;","uniform vec2 projectionVector;","varying vec2 vTextureCoord;","uniform vec2 offsetVector;","varying float vColor;","void main(void) {"," vec3 v = translationMatrix * vec3(aVertexPosition, 1.0);"," v -= offsetVector.xyx;"," gl_Position = vec4( v.x / projectionVector.x -1.0, v.y / projectionVector.y + 1.0 , 0.0, 1.0);"," vTextureCoord = aTextureCoord;"," vColor = aColor;","}"]},b.StripShader.prototype.init=function(){var a=b.gl,c=b.compileProgram(a,this.vertexSrc,this.fragmentSrc);a.useProgram(c),this.uSampler=a.getUniformLocation(c,"uSampler"),this.projectionVector=a.getUniformLocation(c,"projectionVector"),this.offsetVector=a.getUniformLocation(c,"offsetVector"),this.colorAttribute=a.getAttribLocation(c,"aColor"),this.aVertexPosition=a.getAttribLocation(c,"aVertexPosition"),this.aTextureCoord=a.getAttribLocation(c,"aTextureCoord"),this.translationMatrix=a.getUniformLocation(c,"translationMatrix"),this.alpha=a.getUniformLocation(c,"alpha"),this.program=c},b.PrimitiveShader=function(a){this.gl=a,this.program=null,this.fragmentSrc=["precision mediump float;","varying vec4 vColor;","void main(void) {"," gl_FragColor = vColor;","}"],this.vertexSrc=["attribute vec2 aVertexPosition;","attribute vec4 aColor;","uniform mat3 translationMatrix;","uniform vec2 projectionVector;","uniform vec2 offsetVector;","uniform float alpha;","uniform vec3 tint;","varying vec4 vColor;","void main(void) {"," vec3 v = translationMatrix * vec3(aVertexPosition , 1.0);"," v -= offsetVector.xyx;"," gl_Position = vec4( v.x / projectionVector.x -1.0, v.y / -projectionVector.y + 1.0 , 0.0, 1.0);"," vColor = aColor * vec4(tint * alpha, alpha);","}"],this.init()},b.PrimitiveShader.prototype.init=function(){var a=this.gl,c=b.compileProgram(a,this.vertexSrc,this.fragmentSrc);a.useProgram(c),this.projectionVector=a.getUniformLocation(c,"projectionVector"),this.offsetVector=a.getUniformLocation(c,"offsetVector"),this.tintColor=a.getUniformLocation(c,"tint"),this.aVertexPosition=a.getAttribLocation(c,"aVertexPosition"),this.colorAttribute=a.getAttribLocation(c,"aColor"),this.attributes=[this.aVertexPosition,this.colorAttribute],this.translationMatrix=a.getUniformLocation(c,"translationMatrix"),this.alpha=a.getUniformLocation(c,"alpha"),this.program=c},b.PrimitiveShader.prototype.destroy=function(){this.gl.deleteProgram(this.program),this.uniforms=null,this.gl=null,this.attribute=null},b.WebGLGraphics=function(){},b.WebGLGraphics.renderGraphics=function(a,c){var d=c.gl,e=c.projection,f=c.offset,g=c.shaderManager.primitiveShader;a._webGL[d.id]||(a._webGL[d.id]={points:[],indices:[],lastIndex:0,buffer:d.createBuffer(),indexBuffer:d.createBuffer()});var h=a._webGL[d.id];a.dirty&&(a.dirty=!1,a.clearDirty&&(a.clearDirty=!1,h.lastIndex=0,h.points=[],h.indices=[]),b.WebGLGraphics.updateGraphics(a,d)),c.shaderManager.activatePrimitiveShader(),d.blendFunc(d.ONE,d.ONE_MINUS_SRC_ALPHA),d.uniformMatrix3fv(g.translationMatrix,!1,a.worldTransform.toArray(!0)),d.uniform2f(g.projectionVector,e.x,-e.y),d.uniform2f(g.offsetVector,-f.x,-f.y),d.uniform3fv(g.tintColor,b.hex2rgb(a.tint)),d.uniform1f(g.alpha,a.worldAlpha),d.bindBuffer(d.ARRAY_BUFFER,h.buffer),d.vertexAttribPointer(g.aVertexPosition,2,d.FLOAT,!1,24,0),d.vertexAttribPointer(g.colorAttribute,4,d.FLOAT,!1,24,8),d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,h.indexBuffer),d.drawElements(d.TRIANGLE_STRIP,h.indices.length,d.UNSIGNED_SHORT,0),c.shaderManager.deactivatePrimitiveShader()},b.WebGLGraphics.updateGraphics=function(a,c){for(var d=a._webGL[c.id],e=d.lastIndex;e3&&b.WebGLGraphics.buildPoly(f,d),f.lineWidth>0&&b.WebGLGraphics.buildLine(f,d)):f.type===b.Graphics.RECT?b.WebGLGraphics.buildRectangle(f,d):(f.type===b.Graphics.CIRC||f.type===b.Graphics.ELIP)&&b.WebGLGraphics.buildCircle(f,d)}d.lastIndex=a.graphicsData.length,d.glPoints=new Float32Array(d.points),c.bindBuffer(c.ARRAY_BUFFER,d.buffer),c.bufferData(c.ARRAY_BUFFER,d.glPoints,c.STATIC_DRAW),d.glIndicies=new Uint16Array(d.indices),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,d.indexBuffer),c.bufferData(c.ELEMENT_ARRAY_BUFFER,d.glIndicies,c.STATIC_DRAW)},b.WebGLGraphics.buildRectangle=function(a,c){var d=a.points,e=d[0],f=d[1],g=d[2],h=d[3];if(a.fill){var i=b.hex2rgb(a.fillColor),j=a.fillAlpha,k=i[0]*j,l=i[1]*j,m=i[2]*j,n=c.points,o=c.indices,p=n.length/6;n.push(e,f),n.push(k,l,m,j),n.push(e+g,f),n.push(k,l,m,j),n.push(e,f+h),n.push(k,l,m,j),n.push(e+g,f+h),n.push(k,l,m,j),o.push(p,p,p+1,p+2,p+3,p+3)}if(a.lineWidth){var q=a.points;a.points=[e,f,e+g,f,e+g,f+h,e,f+h,e,f],b.WebGLGraphics.buildLine(a,c),a.points=q}},b.WebGLGraphics.buildCircle=function(a,c){var d=a.points,e=d[0],f=d[1],g=d[2],h=d[3],i=40,j=2*Math.PI/i,k=0;if(a.fill){var l=b.hex2rgb(a.fillColor),m=a.fillAlpha,n=l[0]*m,o=l[1]*m,p=l[2]*m,q=c.points,r=c.indices,s=q.length/6;for(r.push(s),k=0;i+1>k;k++)q.push(e,f,n,o,p,m),q.push(e+Math.sin(j*k)*g,f+Math.cos(j*k)*h,n,o,p,m),r.push(s++,s++);r.push(s-1)}if(a.lineWidth){var t=a.points;for(a.points=[],k=0;i+1>k;k++)a.points.push(e+Math.sin(j*k)*g,f+Math.cos(j*k)*h);b.WebGLGraphics.buildLine(a,c),a.points=t}},b.WebGLGraphics.buildLine=function(a,c){var d=0,e=a.points;if(0!==e.length){if(a.lineWidth%2)for(d=0;dd;d++)l=e[2*(d-1)],m=e[2*(d-1)+1],n=e[2*d],o=e[2*d+1],p=e[2*(d+1)],q=e[2*(d+1)+1],r=-(m-o),s=l-n,F=Math.sqrt(r*r+s*s),r/=F,s/=F,r*=L,s*=L,t=-(o-q),u=n-p,F=Math.sqrt(t*t+u*u),t/=F,u/=F,t*=L,u*=L,x=-s+m-(-s+o),y=-r+n-(-r+l),z=(-r+l)*(-s+o)-(-r+n)*(-s+m),A=-u+q-(-u+o),B=-t+n-(-t+p),C=(-t+p)*(-u+o)-(-t+n)*(-u+q),D=x*B-A*y,Math.abs(D)<.1?(D+=10.1,G.push(n-r,o-s,O,P,Q,N),G.push(n+r,o+s,O,P,Q,N)):(j=(y*C-B*z)/D,k=(A*z-x*C)/D,E=(j-n)*(j-n)+(k-o)+(k-o),E>19600?(v=r-t,w=s-u,F=Math.sqrt(v*v+w*w),v/=F,w/=F,v*=L,w*=L,G.push(n-v,o-w),G.push(O,P,Q,N),G.push(n+v,o+w),G.push(O,P,Q,N),G.push(n-v,o-w),G.push(O,P,Q,N),J++):(G.push(j,k),G.push(O,P,Q,N),G.push(n-(j-n),o-(k-o)),G.push(O,P,Q,N)));for(l=e[2*(I-2)],m=e[2*(I-2)+1],n=e[2*(I-1)],o=e[2*(I-1)+1],r=-(m-o),s=l-n,F=Math.sqrt(r*r+s*s),r/=F,s/=F,r*=L,s*=L,G.push(n-r,o-s),G.push(O,P,Q,N),G.push(n+r,o+s),G.push(O,P,Q,N),H.push(K),d=0;J>d;d++)H.push(K++);H.push(K-1)}},b.WebGLGraphics.buildPoly=function(a,c){var d=a.points;if(!(d.length<6)){var e=c.points,f=c.indices,g=d.length/2,h=b.hex2rgb(a.fillColor),i=a.fillAlpha,j=h[0]*i,k=h[1]*i,l=h[2]*i,m=b.PolyK.Triangulate(d),n=e.length/6,o=0;for(o=0;oo;o++)e.push(d[2*o],d[2*o+1],j,k,l,i)}},b.glContexts=[],b.WebGLRenderer=function(a,c,d,e,f){b.defaultRenderer||(b.defaultRenderer=this),this.type=b.WEBGL_RENDERER,this.transparent=!!e,this.width=a||800,this.height=c||600,this.view=d||document.createElement("canvas"),this.view.width=this.width,this.view.height=this.height,this.contextLost=this.handleContextLost.bind(this),this.contextRestoredLost=this.handleContextRestored.bind(this),this.view.addEventListener("webglcontextlost",this.contextLost,!1),this.view.addEventListener("webglcontextrestored",this.contextRestoredLost,!1),this.options={alpha:this.transparent,antialias:!!f,premultipliedAlpha:!!e,stencil:!0};try{this.gl=this.view.getContext("experimental-webgl",this.options)}catch(g){try{this.gl=this.view.getContext("webgl",this.options)}catch(h){throw new Error(" This browser does not support webGL. Try using the canvas renderer"+this)}}var i=this.gl;this.glContextId=i.id=b.WebGLRenderer.glContextId++,b.glContexts[this.glContextId]=i,b.blendModesWebGL||(b.blendModesWebGL=[],b.blendModesWebGL[b.blendModes.NORMAL]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],b.blendModesWebGL[b.blendModes.ADD]=[i.SRC_ALPHA,i.DST_ALPHA],b.blendModesWebGL[b.blendModes.MULTIPLY]=[i.DST_COLOR,i.ONE_MINUS_SRC_ALPHA],b.blendModesWebGL[b.blendModes.SCREEN]=[i.SRC_ALPHA,i.ONE],b.blendModesWebGL[b.blendModes.OVERLAY]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],b.blendModesWebGL[b.blendModes.DARKEN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],b.blendModesWebGL[b.blendModes.LIGHTEN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],b.blendModesWebGL[b.blendModes.COLOR_DODGE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],b.blendModesWebGL[b.blendModes.COLOR_BURN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],b.blendModesWebGL[b.blendModes.HARD_LIGHT]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],b.blendModesWebGL[b.blendModes.SOFT_LIGHT]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],b.blendModesWebGL[b.blendModes.DIFFERENCE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],b.blendModesWebGL[b.blendModes.EXCLUSION]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],b.blendModesWebGL[b.blendModes.HUE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],b.blendModesWebGL[b.blendModes.SATURATION]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],b.blendModesWebGL[b.blendModes.COLOR]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],b.blendModesWebGL[b.blendModes.LUMINOSITY]=[i.ONE,i.ONE_MINUS_SRC_ALPHA]),this.projection=new b.Point,this.projection.x=this.width/2,this.projection.y=-this.height/2,this.offset=new b.Point(0,0),this.resize(this.width,this.height),this.contextLost=!1,this.shaderManager=new b.WebGLShaderManager(i),this.spriteBatch=new b.WebGLSpriteBatch(i),this.maskManager=new b.WebGLMaskManager(i),this.filterManager=new b.WebGLFilterManager(i,this.transparent),this.renderSession={},this.renderSession.gl=this.gl,this.renderSession.drawCount=0,this.renderSession.shaderManager=this.shaderManager,this.renderSession.maskManager=this.maskManager,this.renderSession.filterManager=this.filterManager,this.renderSession.spriteBatch=this.spriteBatch,this.renderSession.renderer=this,i.useProgram(this.shaderManager.defaultShader.program),i.disable(i.DEPTH_TEST),i.disable(i.CULL_FACE),i.enable(i.BLEND),i.colorMask(!0,!0,!0,this.transparent)},b.WebGLRenderer.prototype.constructor=b.WebGLRenderer,b.WebGLRenderer.prototype.render=function(a){if(!this.contextLost){this.__stage!==a&&(a.interactive&&a.interactionManager.removeEvents(),this.__stage=a),b.WebGLRenderer.updateTextures(),a.updateTransform(),a._interactive&&(a._interactiveEventsAdded||(a._interactiveEventsAdded=!0,a.interactionManager.setTarget(this)));var c=this.gl;c.viewport(0,0,this.width,this.height),c.bindFramebuffer(c.FRAMEBUFFER,null),this.transparent?c.clearColor(0,0,0,0):c.clearColor(a.backgroundColorSplit[0],a.backgroundColorSplit[1],a.backgroundColorSplit[2],1),c.clear(c.COLOR_BUFFER_BIT),this.renderDisplayObject(a,this.projection),a.interactive?a._interactiveEventsAdded||(a._interactiveEventsAdded=!0,a.interactionManager.setTarget(this)):a._interactiveEventsAdded&&(a._interactiveEventsAdded=!1,a.interactionManager.setTarget(this))}},b.WebGLRenderer.prototype.renderDisplayObject=function(a,b,c){this.renderSession.drawCount=0,this.renderSession.currentBlendMode=9999,this.renderSession.projection=b,this.renderSession.offset=this.offset,this.spriteBatch.begin(this.renderSession),this.filterManager.begin(this.renderSession,c),a._renderWebGL(this.renderSession),this.spriteBatch.end()},b.WebGLRenderer.updateTextures=function(){var a=0;for(a=0;a=0;c--){var d=a._glTextures[c],e=b.glContexts[c];e&&d&&e.deleteTexture(d)}a._glTextures.length=0},b.WebGLRenderer.updateTextureFrame=function(a){a.updateFrame=!1,a._updateWebGLuvs()},b.WebGLRenderer.prototype.resize=function(a,b){this.width=a,this.height=b,this.view.width=a,this.view.height=b,this.gl.viewport(0,0,this.width,this.height),this.projection.x=this.width/2,this.projection.y=-this.height/2},b.createWebGLTexture=function(a,c){return a.hasLoaded&&(a._glTextures[c.id]=c.createTexture(),c.bindTexture(c.TEXTURE_2D,a._glTextures[c.id]),c.pixelStorei(c.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,a.source),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,a.scaleMode===b.scaleModes.LINEAR?c.LINEAR:c.NEAREST),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,a.scaleMode===b.scaleModes.LINEAR?c.LINEAR:c.NEAREST),a._powerOf2?(c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.REPEAT),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.REPEAT)):(c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE)),c.bindTexture(c.TEXTURE_2D,null)),a._glTextures[c.id]},b.updateWebGLTexture=function(a,c){a._glTextures[c.id]&&(c.bindTexture(c.TEXTURE_2D,a._glTextures[c.id]),c.pixelStorei(c.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,a.source),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,a.scaleMode===b.scaleModes.LINEAR?c.LINEAR:c.NEAREST),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,a.scaleMode===b.scaleModes.LINEAR?c.LINEAR:c.NEAREST),a._powerOf2?(c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.REPEAT),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.REPEAT)):(c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE)),c.bindTexture(c.TEXTURE_2D,null))},b.WebGLRenderer.prototype.handleContextLost=function(a){a.preventDefault(),this.contextLost=!0},b.WebGLRenderer.prototype.handleContextRestored=function(){try{this.gl=this.view.getContext("experimental-webgl",this.options)}catch(a){try{this.gl=this.view.getContext("webgl",this.options)}catch(c){throw new Error(" This browser does not support webGL. Try using the canvas renderer"+this)}}var d=this.gl;d.id=b.WebGLRenderer.glContextId++,this.shaderManager.setContext(d),this.spriteBatch.setContext(d),this.maskManager.setContext(d),this.filterManager.setContext(d),this.renderSession.gl=this.gl,d.disable(d.DEPTH_TEST),d.disable(d.CULL_FACE),d.enable(d.BLEND),d.colorMask(!0,!0,!0,this.transparent),this.gl.viewport(0,0,this.width,this.height);for(var e in b.TextureCache){var f=b.TextureCache[e].baseTexture;f._glTextures=[]}this.contextLost=!1},b.WebGLRenderer.prototype.destroy=function(){this.view.removeEventListener("webglcontextlost",this.contextLost),this.view.removeEventListener("webglcontextrestored",this.contextRestoredLost),b.glContexts[this.glContextId]=null,this.projection=null,this.offset=null,this.shaderManager.destroy(),this.spriteBatch.destroy(),this.maskManager.destroy(),this.filterManager.destroy(),this.shaderManager=null,this.spriteBatch=null,this.maskManager=null,this.filterManager=null,this.gl=null,this.renderSession=null},b.WebGLRenderer.glContextId=0,b.WebGLMaskManager=function(a){this.maskStack=[],this.maskPosition=0,this.setContext(a)},b.WebGLMaskManager.prototype.setContext=function(a){this.gl=a},b.WebGLMaskManager.prototype.pushMask=function(a,c){var d=this.gl;0===this.maskStack.length&&(d.enable(d.STENCIL_TEST),d.stencilFunc(d.ALWAYS,1,1)),this.maskStack.push(a),d.colorMask(!1,!1,!1,!0),d.stencilOp(d.KEEP,d.KEEP,d.INCR),b.WebGLGraphics.renderGraphics(a,c),d.colorMask(!0,!0,!0,!0),d.stencilFunc(d.NOTEQUAL,0,this.maskStack.length),d.stencilOp(d.KEEP,d.KEEP,d.KEEP)},b.WebGLMaskManager.prototype.popMask=function(a){var c=this.gl,d=this.maskStack.pop();d&&(c.colorMask(!1,!1,!1,!1),c.stencilOp(c.KEEP,c.KEEP,c.DECR),b.WebGLGraphics.renderGraphics(d,a),c.colorMask(!0,!0,!0,!0),c.stencilFunc(c.NOTEQUAL,0,this.maskStack.length),c.stencilOp(c.KEEP,c.KEEP,c.KEEP)),0===this.maskStack.length&&c.disable(c.STENCIL_TEST)},b.WebGLMaskManager.prototype.destroy=function(){this.maskStack=null,this.gl=null},b.WebGLShaderManager=function(a){this.maxAttibs=10,this.attribState=[],this.tempAttribState=[];for(var b=0;bd;d+=6,e+=4)this.indices[d+0]=e+0,this.indices[d+1]=e+1,this.indices[d+2]=e+2,this.indices[d+3]=e+0,this.indices[d+4]=e+2,this.indices[d+5]=e+3;this.drawing=!1,this.currentBatchSize=0,this.currentBaseTexture=null,this.setContext(a)},b.WebGLSpriteBatch.prototype.setContext=function(a){this.gl=a,this.vertexBuffer=a.createBuffer(),this.indexBuffer=a.createBuffer(),a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,this.indexBuffer),a.bufferData(a.ELEMENT_ARRAY_BUFFER,this.indices,a.STATIC_DRAW),a.bindBuffer(a.ARRAY_BUFFER,this.vertexBuffer),a.bufferData(a.ARRAY_BUFFER,this.vertices,a.DYNAMIC_DRAW),this.currentBlendMode=99999},b.WebGLSpriteBatch.prototype.begin=function(a){this.renderSession=a,this.shader=this.renderSession.shaderManager.defaultShader,this.start()},b.WebGLSpriteBatch.prototype.end=function(){this.flush()},b.WebGLSpriteBatch.prototype.render=function(a){var b=a.texture;(b.baseTexture!==this.currentBaseTexture||this.currentBatchSize>=this.size)&&(this.flush(),this.currentBaseTexture=b.baseTexture),a.blendMode!==this.currentBlendMode&&this.setBlendMode(a.blendMode);var c=a._uvs||a.texture._uvs;if(c){var d,e,f,g,h=a.worldAlpha,i=a.tint,j=this.vertices,k=a.anchor.x,l=a.anchor.y;if(a.texture.trim){var m=a.texture.trim;e=m.x-k*m.width,d=e+b.frame.width,g=m.y-l*m.height,f=g+b.frame.height}else d=b.frame.width*(1-k),e=b.frame.width*-k,f=b.frame.height*(1-l),g=b.frame.height*-l;var n=4*this.currentBatchSize*this.vertSize,o=a.worldTransform,p=o.a,q=o.c,r=o.b,s=o.d,t=o.tx,u=o.ty;j[n++]=p*e+r*g+t,j[n++]=s*g+q*e+u,j[n++]=c.x0,j[n++]=c.y0,j[n++]=h,j[n++]=i,j[n++]=p*d+r*g+t,j[n++]=s*g+q*d+u,j[n++]=c.x1,j[n++]=c.y1,j[n++]=h,j[n++]=i,j[n++]=p*d+r*f+t,j[n++]=s*f+q*d+u,j[n++]=c.x2,j[n++]=c.y2,j[n++]=h,j[n++]=i,j[n++]=p*e+r*f+t,j[n++]=s*f+q*e+u,j[n++]=c.x3,j[n++]=c.y3,j[n++]=h,j[n++]=i,this.currentBatchSize++}},b.WebGLSpriteBatch.prototype.renderTilingSprite=function(a){var c=a.tilingTexture;(c.baseTexture!==this.currentBaseTexture||this.currentBatchSize>=this.size)&&(this.flush(),this.currentBaseTexture=c.baseTexture),a.blendMode!==this.currentBlendMode&&this.setBlendMode(a.blendMode),a._uvs||(a._uvs=new b.TextureUvs);var d=a._uvs;a.tilePosition.x%=c.baseTexture.width*a.tileScaleOffset.x,a.tilePosition.y%=c.baseTexture.height*a.tileScaleOffset.y;var e=a.tilePosition.x/(c.baseTexture.width*a.tileScaleOffset.x),f=a.tilePosition.y/(c.baseTexture.height*a.tileScaleOffset.y),g=a.width/c.baseTexture.width/(a.tileScale.x*a.tileScaleOffset.x),h=a.height/c.baseTexture.height/(a.tileScale.y*a.tileScaleOffset.y);d.x0=0-e,d.y0=0-f,d.x1=1*g-e,d.y1=0-f,d.x2=1*g-e,d.y2=1*h-f,d.x3=0-e,d.y3=1*h-f;var i=a.worldAlpha,j=a.tint,k=this.vertices,l=a.width,m=a.height,n=a.anchor.x,o=a.anchor.y,p=l*(1-n),q=l*-n,r=m*(1-o),s=m*-o,t=4*this.currentBatchSize*this.vertSize,u=a.worldTransform,v=u.a,w=u.c,x=u.b,y=u.d,z=u.tx,A=u.ty;k[t++]=v*q+x*s+z,k[t++]=y*s+w*q+A,k[t++]=d.x0,k[t++]=d.y0,k[t++]=i,k[t++]=j,k[t++]=v*p+x*s+z,k[t++]=y*s+w*p+A,k[t++]=d.x1,k[t++]=d.y1,k[t++]=i,k[t++]=j,k[t++]=v*p+x*r+z,k[t++]=y*r+w*p+A,k[t++]=d.x2,k[t++]=d.y2,k[t++]=i,k[t++]=j,k[t++]=v*q+x*r+z,k[t++]=y*r+w*q+A,k[t++]=d.x3,k[t++]=d.y3,k[t++]=i,k[t++]=j,this.currentBatchSize++},b.WebGLSpriteBatch.prototype.flush=function(){if(0!==this.currentBatchSize){var a=this.gl;if(a.bindTexture(a.TEXTURE_2D,this.currentBaseTexture._glTextures[a.id]||b.createWebGLTexture(this.currentBaseTexture,a)),this.currentBatchSize>.5*this.size)a.bufferSubData(a.ARRAY_BUFFER,0,this.vertices);else{var c=this.vertices.subarray(0,4*this.currentBatchSize*this.vertSize);a.bufferSubData(a.ARRAY_BUFFER,0,c)}a.drawElements(a.TRIANGLES,6*this.currentBatchSize,a.UNSIGNED_SHORT,0),this.currentBatchSize=0,this.renderSession.drawCount++}},b.WebGLSpriteBatch.prototype.stop=function(){this.flush()},b.WebGLSpriteBatch.prototype.start=function(){var a=this.gl;a.activeTexture(a.TEXTURE0),a.bindBuffer(a.ARRAY_BUFFER,this.vertexBuffer),a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,this.indexBuffer);var c=this.renderSession.projection;a.uniform2f(this.shader.projectionVector,c.x,c.y);var d=4*this.vertSize;a.vertexAttribPointer(this.shader.aVertexPosition,2,a.FLOAT,!1,d,0),a.vertexAttribPointer(this.shader.aTextureCoord,2,a.FLOAT,!1,d,8),a.vertexAttribPointer(this.shader.colorAttribute,2,a.FLOAT,!1,d,16),this.currentBlendMode!==b.blendModes.NORMAL&&this.setBlendMode(b.blendModes.NORMAL)},b.WebGLSpriteBatch.prototype.setBlendMode=function(a){this.flush(),this.currentBlendMode=a;var c=b.blendModesWebGL[this.currentBlendMode];this.gl.blendFunc(c[0],c[1])},b.WebGLSpriteBatch.prototype.destroy=function(){this.vertices=null,this.indices=null,this.gl.deleteBuffer(this.vertexBuffer),this.gl.deleteBuffer(this.indexBuffer),this.currentBaseTexture=null,this.gl=null},b.WebGLFastSpriteBatch=function(a){this.vertSize=10,this.maxSize=6e3,this.size=this.maxSize;var b=4*this.size*this.vertSize,c=6*this.maxSize;this.vertices=new Float32Array(b),this.indices=new Uint16Array(c),this.vertexBuffer=null,this.indexBuffer=null,this.lastIndexCount=0;for(var d=0,e=0;c>d;d+=6,e+=4)this.indices[d+0]=e+0,this.indices[d+1]=e+1,this.indices[d+2]=e+2,this.indices[d+3]=e+0,this.indices[d+4]=e+2,this.indices[d+5]=e+3;this.drawing=!1,this.currentBatchSize=0,this.currentBaseTexture=null,this.currentBlendMode=0,this.renderSession=null,this.shader=null,this.matrix=null,this.setContext(a)},b.WebGLFastSpriteBatch.prototype.setContext=function(a){this.gl=a,this.vertexBuffer=a.createBuffer(),this.indexBuffer=a.createBuffer(),a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,this.indexBuffer),a.bufferData(a.ELEMENT_ARRAY_BUFFER,this.indices,a.STATIC_DRAW),a.bindBuffer(a.ARRAY_BUFFER,this.vertexBuffer),a.bufferData(a.ARRAY_BUFFER,this.vertices,a.DYNAMIC_DRAW),this.currentBlendMode=99999},b.WebGLFastSpriteBatch.prototype.begin=function(a,b){this.renderSession=b,this.shader=this.renderSession.shaderManager.fastShader,this.matrix=a.worldTransform.toArray(!0),this.start()},b.WebGLFastSpriteBatch.prototype.end=function(){this.flush()},b.WebGLFastSpriteBatch.prototype.render=function(a){var b=a.children,c=b[0];if(c.texture._uvs){this.currentBaseTexture=c.texture.baseTexture,c.blendMode!==this.currentBlendMode&&this.setBlendMode(c.blendMode);for(var d=0,e=b.length;e>d;d++)this.renderSprite(b[d]);this.flush()}},b.WebGLFastSpriteBatch.prototype.renderSprite=function(a){if(a.visible&&(a.texture.baseTexture===this.currentBaseTexture||(this.flush(),this.currentBaseTexture=a.texture.baseTexture,a.texture._uvs))){var b,c,d,e,f,g,h,i,j=this.vertices;if(b=a.texture._uvs,c=a.texture.frame.width,d=a.texture.frame.height,a.texture.trim){var k=a.texture.trim;f=k.x-a.anchor.x*k.width,e=f+a.texture.frame.width,h=k.y-a.anchor.y*k.height,g=h+a.texture.frame.height}else e=a.texture.frame.width*(1-a.anchor.x),f=a.texture.frame.width*-a.anchor.x,g=a.texture.frame.height*(1-a.anchor.y),h=a.texture.frame.height*-a.anchor.y;i=4*this.currentBatchSize*this.vertSize,j[i++]=f,j[i++]=h,j[i++]=a.position.x,j[i++]=a.position.y,j[i++]=a.scale.x,j[i++]=a.scale.y,j[i++]=a.rotation,j[i++]=b.x0,j[i++]=b.y1,j[i++]=a.alpha,j[i++]=e,j[i++]=h,j[i++]=a.position.x,j[i++]=a.position.y,j[i++]=a.scale.x,j[i++]=a.scale.y,j[i++]=a.rotation,j[i++]=b.x1,j[i++]=b.y1,j[i++]=a.alpha,j[i++]=e,j[i++]=g,j[i++]=a.position.x,j[i++]=a.position.y,j[i++]=a.scale.x,j[i++]=a.scale.y,j[i++]=a.rotation,j[i++]=b.x2,j[i++]=b.y2,j[i++]=a.alpha,j[i++]=f,j[i++]=g,j[i++]=a.position.x,j[i++]=a.position.y,j[i++]=a.scale.x,j[i++]=a.scale.y,j[i++]=a.rotation,j[i++]=b.x3,j[i++]=b.y3,j[i++]=a.alpha,this.currentBatchSize++,this.currentBatchSize>=this.size&&this.flush()}},b.WebGLFastSpriteBatch.prototype.flush=function(){if(0!==this.currentBatchSize){var a=this.gl;if(this.currentBaseTexture._glTextures[a.id]||b.createWebGLTexture(this.currentBaseTexture,a),a.bindTexture(a.TEXTURE_2D,this.currentBaseTexture._glTextures[a.id]),this.currentBatchSize>.5*this.size)a.bufferSubData(a.ARRAY_BUFFER,0,this.vertices);else{var c=this.vertices.subarray(0,4*this.currentBatchSize*this.vertSize);a.bufferSubData(a.ARRAY_BUFFER,0,c)}a.drawElements(a.TRIANGLES,6*this.currentBatchSize,a.UNSIGNED_SHORT,0),this.currentBatchSize=0,this.renderSession.drawCount++}},b.WebGLFastSpriteBatch.prototype.stop=function(){this.flush()},b.WebGLFastSpriteBatch.prototype.start=function(){var a=this.gl;a.activeTexture(a.TEXTURE0),a.bindBuffer(a.ARRAY_BUFFER,this.vertexBuffer),a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,this.indexBuffer);var c=this.renderSession.projection;a.uniform2f(this.shader.projectionVector,c.x,c.y),a.uniformMatrix3fv(this.shader.uMatrix,!1,this.matrix);var d=4*this.vertSize;a.vertexAttribPointer(this.shader.aVertexPosition,2,a.FLOAT,!1,d,0),a.vertexAttribPointer(this.shader.aPositionCoord,2,a.FLOAT,!1,d,8),a.vertexAttribPointer(this.shader.aScale,2,a.FLOAT,!1,d,16),a.vertexAttribPointer(this.shader.aRotation,1,a.FLOAT,!1,d,24),a.vertexAttribPointer(this.shader.aTextureCoord,2,a.FLOAT,!1,d,28),a.vertexAttribPointer(this.shader.colorAttribute,1,a.FLOAT,!1,d,36),this.currentBlendMode!==b.blendModes.NORMAL&&this.setBlendMode(b.blendModes.NORMAL)},b.WebGLFastSpriteBatch.prototype.setBlendMode=function(a){this.flush(),this.currentBlendMode=a;var c=b.blendModesWebGL[this.currentBlendMode];this.gl.blendFunc(c[0],c[1])},b.WebGLFilterManager=function(a,b){this.transparent=b,this.filterStack=[],this.offsetX=0,this.offsetY=0,this.setContext(a)},b.WebGLFilterManager.prototype.setContext=function(a){this.gl=a,this.texturePool=[],this.initShaderBuffers()},b.WebGLFilterManager.prototype.begin=function(a,b){this.renderSession=a,this.defaultShader=a.shaderManager.defaultShader;var c=this.renderSession.projection;this.width=2*c.x,this.height=2*-c.y,this.buffer=b},b.WebGLFilterManager.prototype.pushFilter=function(a){var c=this.gl,d=this.renderSession.projection,e=this.renderSession.offset;this.filterStack.push(a);var f=a.filterPasses[0];this.offsetX+=a.target.filterArea.x,this.offsetY+=a.target.filterArea.y;var g=this.texturePool.pop();g?g.resize(this.width,this.height):g=new b.FilterTexture(this.gl,this.width,this.height),c.bindTexture(c.TEXTURE_2D,g.texture),a.target.filterArea=a.target.getBounds();var h=a.target.filterArea,i=f.padding;h.x-=i,h.y-=i,h.width+=2*i,h.height+=2*i,h.x<0&&(h.x=0),h.width>this.width&&(h.width=this.width),h.y<0&&(h.y=0),h.height>this.height&&(h.height=this.height),c.bindFramebuffer(c.FRAMEBUFFER,g.frameBuffer),c.viewport(0,0,h.width,h.height),d.x=h.width/2,d.y=-h.height/2,e.x=-h.x,e.y=-h.y,c.uniform2f(this.defaultShader.projectionVector,h.width/2,-h.height/2),c.uniform2f(this.defaultShader.offsetVector,-h.x,-h.y),c.colorMask(!0,!0,!0,!0),c.clearColor(0,0,0,0),c.clear(c.COLOR_BUFFER_BIT),a._glFilterTexture=g},b.WebGLFilterManager.prototype.popFilter=function(){var a=this.gl,c=this.filterStack.pop(),d=c.target.filterArea,e=c._glFilterTexture,f=this.renderSession.projection,g=this.renderSession.offset;if(c.filterPasses.length>1){a.viewport(0,0,d.width,d.height),a.bindBuffer(a.ARRAY_BUFFER,this.vertexBuffer),this.vertexArray[0]=0,this.vertexArray[1]=d.height,this.vertexArray[2]=d.width,this.vertexArray[3]=d.height,this.vertexArray[4]=0,this.vertexArray[5]=0,this.vertexArray[6]=d.width,this.vertexArray[7]=0,a.bufferSubData(a.ARRAY_BUFFER,0,this.vertexArray),a.bindBuffer(a.ARRAY_BUFFER,this.uvBuffer),this.uvArray[2]=d.width/this.width,this.uvArray[5]=d.height/this.height,this.uvArray[6]=d.width/this.width,this.uvArray[7]=d.height/this.height,a.bufferSubData(a.ARRAY_BUFFER,0,this.uvArray);var h=e,i=this.texturePool.pop();i||(i=new b.FilterTexture(this.gl,this.width,this.height)),i.resize(this.width,this.height),a.bindFramebuffer(a.FRAMEBUFFER,i.frameBuffer),a.clear(a.COLOR_BUFFER_BIT),a.disable(a.BLEND);for(var j=0;j0&&(b.Texture.frameUpdates.length=0)},b.CanvasRenderer.prototype.resize=function(a,b){this.width=a,this.height=b,this.view.width=a,this.view.height=b},b.CanvasRenderer.prototype.renderDisplayObject=function(a,b){this.renderSession.context=b||this.context,a._renderCanvas(this.renderSession)},b.CanvasRenderer.prototype.renderStripFlat=function(a){var b=this.context,c=a.verticies,d=c.length/2;this.count++,b.beginPath();for(var e=1;d-2>e;e++){var f=2*e,g=c[f],h=c[f+2],i=c[f+4],j=c[f+1],k=c[f+3],l=c[f+5];b.moveTo(g,j),b.lineTo(h,k),b.lineTo(i,l)}b.fillStyle="#FF0000",b.fill(),b.closePath()},b.CanvasRenderer.prototype.renderStrip=function(a){var b=this.context,c=a.verticies,d=a.uvs,e=c.length/2;this.count++;for(var f=1;e-2>f;f++){var g=2*f,h=c[g],i=c[g+2],j=c[g+4],k=c[g+1],l=c[g+3],m=c[g+5],n=d[g]*a.texture.width,o=d[g+2]*a.texture.width,p=d[g+4]*a.texture.width,q=d[g+1]*a.texture.height,r=d[g+3]*a.texture.height,s=d[g+5]*a.texture.height;b.save(),b.beginPath(),b.moveTo(h,k),b.lineTo(i,l),b.lineTo(j,m),b.closePath(),b.clip();var t=n*r+q*p+o*s-r*p-q*o-n*s,u=h*r+q*j+i*s-r*j-q*i-h*s,v=n*i+h*p+o*j-i*p-h*o-n*j,w=n*r*j+q*i*p+h*o*s-h*r*p-q*o*j-n*i*s,x=k*r+q*m+l*s-r*m-q*l-k*s,y=n*l+k*p+o*m-l*p-k*o-n*m,z=n*r*m+q*l*p+k*o*s-k*r*p-q*o*m-n*l*s;b.transform(u/t,x/t,v/t,y/t,w/t,z/t),b.drawImage(a.texture.baseTexture.source,0,0),b.restore()}},b.CanvasBuffer=function(a,b){this.width=a,this.height=b,this.canvas=document.createElement("canvas"),this.context=this.canvas.getContext("2d"),this.canvas.width=a,this.canvas.height=b},b.CanvasBuffer.prototype.clear=function(){this.context.clearRect(0,0,this.width,this.height)},b.CanvasBuffer.prototype.resize=function(a,b){this.width=this.canvas.width=a,this.height=this.canvas.height=b},b.CanvasGraphics=function(){},b.CanvasGraphics.renderGraphics=function(a,c){for(var d=a.worldAlpha,e="",f=0;f1&&(d=1,window.console.log("Pixi.js warning: masks in canvas can only mask using the first path in the graphics object"));for(var e=0;1>e;e++){var f=a.graphicsData[e],g=f.points;if(f.type===b.Graphics.POLY){c.beginPath(),c.moveTo(g[0],g[1]);for(var h=1;hd;d++)this.children[d]._renderWebGL(a);a.spriteBatch.stop()}this._filters&&a.filterManager.popFilter(),this._mask&&a.maskManager.popMask(a),a.drawCount++,a.spriteBatch.start()}},b.Graphics.prototype._renderCanvas=function(a){if(this.visible!==!1&&0!==this.alpha&&this.isMask!==!0){var c=a.context,d=this.worldTransform;this.blendMode!==a.currentBlendMode&&(a.currentBlendMode=this.blendMode,c.globalCompositeOperation=b.blendModesCanvas[a.currentBlendMode]),c.setTransform(d.a,d.c,d.b,d.d,d.tx,d.ty),b.CanvasGraphics.renderGraphics(this,c);for(var e=0,f=this.children.length;f>e;e++)this.children[e]._renderCanvas(a)}},b.Graphics.prototype.getBounds=function(a){this.bounds||this.updateBounds();var b=this.bounds.x,c=this.bounds.width+this.bounds.x,d=this.bounds.y,e=this.bounds.height+this.bounds.y,f=a||this.worldTransform,g=f.a,h=f.c,i=f.b,j=f.d,k=f.tx,l=f.ty,m=g*c+i*e+k,n=j*e+h*c+l,o=g*b+i*e+k,p=j*e+h*b+l,q=g*b+i*d+k,r=j*d+h*b+l,s=g*c+i*d+k,t=j*d+h*c+l,u=-1/0,v=-1/0,w=1/0,x=1/0;w=w>m?m:w,w=w>o?o:w,w=w>q?q:w,w=w>s?s:w,x=x>n?n:x,x=x>p?p:x,x=x>r?r:x,x=x>t?t:x,u=m>u?m:u,u=o>u?o:u,u=q>u?q:u,u=s>u?s:u,v=n>v?n:v,v=p>v?p:v,v=r>v?r:v,v=t>v?t:v;var y=this._bounds;return y.x=w,y.width=u-w,y.y=x,y.height=v-x,y},b.Graphics.prototype.updateBounds=function(){for(var a,c,d,e,f,g=1/0,h=-1/0,i=1/0,j=-1/0,k=0;kc?c:g,h=c+e>h?c+e:h,i=i>d?c:i,j=d+f>j?d+f:j;else if(m===b.Graphics.CIRC||m===b.Graphics.ELIP)c=a[0],d=a[1],e=a[2]+n/2,f=a[3]+n/2,g=g>c-e?c-e:g,h=c+e>h?c+e:h,i=i>d-f?d-f:i,j=d+f>j?d+f:j;else for(var o=0;oc-n?c-n:g,h=c+n>h?c+n:h,i=i>d-n?d-n:i,j=d+n>j?d+n:j}var p=this.boundsPadding;this.bounds=new b.Rectangle(g-p,i-p,h-g+2*p,j-i+2*p)},b.Graphics.prototype._generateCachedSprite=function(){var a=this.getLocalBounds();if(this._cachedSprite)this._cachedSprite.buffer.resize(a.width,a.height);else{var c=new b.CanvasBuffer(a.width,a.height),d=b.Texture.fromCanvas(c.canvas);this._cachedSprite=new b.Sprite(d),this._cachedSprite.buffer=c,this._cachedSprite.worldTransform=this.worldTransform}this._cachedSprite.anchor.x=-(a.x/a.width),this._cachedSprite.anchor.y=-(a.y/a.height),this._cachedSprite.buffer.context.translate(-a.x,-a.y),b.CanvasGraphics.renderGraphics(this,this._cachedSprite.buffer.context)},b.Graphics.prototype.destroyCachedSprite=function(){this._cachedSprite.texture.destroy(!0),this._cachedSprite=null},b.Graphics.POLY=0,b.Graphics.RECT=1,b.Graphics.CIRC=2,b.Graphics.ELIP=3,b.TilingSprite=function(a,c,d){b.Sprite.call(this,a),this.width=c||100,this.height=d||100,this.tileScale=new b.Point(1,1),this.tileScaleOffset=new b.Point(1,1),this.tilePosition=new b.Point(0,0),this.renderable=!0,this.tint=16777215,this.blendMode=b.blendModes.NORMAL},b.TilingSprite.prototype=Object.create(b.Sprite.prototype),b.TilingSprite.prototype.constructor=b.TilingSprite,Object.defineProperty(b.TilingSprite.prototype,"width",{get:function(){return this._width},set:function(a){this._width=a}}),Object.defineProperty(b.TilingSprite.prototype,"height",{get:function(){return this._height},set:function(a){this._height=a}}),b.TilingSprite.prototype.onTextureUpdate=function(){this.updateFrame=!0},b.TilingSprite.prototype.setTexture=function(a){this.texture!==a&&(this.texture=a,this.refreshTexture=!0,this.cachedTint=16777215)},b.TilingSprite.prototype._renderWebGL=function(a){if(this.visible!==!1&&0!==this.alpha){var c,d;for(this.mask&&(a.spriteBatch.stop(),a.maskManager.pushMask(this.mask,a),a.spriteBatch.start()),this.filters&&(a.spriteBatch.flush(),a.filterManager.pushFilter(this._filterBlock)),!this.tilingTexture||this.refreshTexture?(this.generateTilingTexture(!0),this.tilingTexture&&this.tilingTexture.needsUpdate&&(b.updateWebGLTexture(this.tilingTexture.baseTexture,a.gl),this.tilingTexture.needsUpdate=!1)):a.spriteBatch.renderTilingSprite(this),c=0,d=this.children.length;d>c;c++)this.children[c]._renderWebGL(a);a.spriteBatch.stop(),this.filters&&a.filterManager.popFilter(),this.mask&&a.maskManager.popMask(a),a.spriteBatch.start()}},b.TilingSprite.prototype._renderCanvas=function(a){if(this.visible!==!1&&0!==this.alpha){var c=a.context;this._mask&&a.maskManager.pushMask(this._mask,c),c.globalAlpha=this.worldAlpha;var d=this.worldTransform;c.setTransform(d.a,d.c,d.b,d.d,d.tx,d.ty),(!this.__tilePattern||this.refreshTexture)&&(this.generateTilingTexture(!1),this.tilingTexture&&(this.__tilePattern=c.createPattern(this.tilingTexture.baseTexture.source,"repeat"))),this.blendMode!==a.currentBlendMode&&(a.currentBlendMode=this.blendMode,c.globalCompositeOperation=b.blendModesCanvas[a.currentBlendMode]),c.beginPath();var e=this.tilePosition,f=this.tileScale;e.x%=this.tilingTexture.baseTexture.width,e.y%=this.tilingTexture.baseTexture.height,c.scale(f.x,f.y),c.translate(e.x,e.y),c.fillStyle=this.__tilePattern,c.fillRect(-e.x,-e.y,this.width/f.x,this.height/f.y),c.scale(1/f.x,1/f.y),c.translate(-e.x,-e.y),c.closePath(),this._mask&&a.maskManager.popMask(a.context)}},b.TilingSprite.prototype.getBounds=function(){var a=this._width,b=this._height,c=a*(1-this.anchor.x),d=a*-this.anchor.x,e=b*(1-this.anchor.y),f=b*-this.anchor.y,g=this.worldTransform,h=g.a,i=g.c,j=g.b,k=g.d,l=g.tx,m=g.ty,n=h*d+j*f+l,o=k*f+i*d+m,p=h*c+j*f+l,q=k*f+i*c+m,r=h*c+j*e+l,s=k*e+i*c+m,t=h*d+j*e+l,u=k*e+i*d+m,v=-1/0,w=-1/0,x=1/0,y=1/0;x=x>n?n:x,x=x>p?p:x,x=x>r?r:x,x=x>t?t:x,y=y>o?o:y,y=y>q?q:y,y=y>s?s:y,y=y>u?u:y,v=n>v?n:v,v=p>v?p:v,v=r>v?r:v,v=t>v?t:v,w=o>w?o:w,w=q>w?q:w,w=s>w?s:w,w=u>w?u:w;var z=this._bounds;return z.x=x,z.width=v-x,z.y=y,z.height=w-y,this._currentBounds=z,z},b.TilingSprite.prototype.generateTilingTexture=function(a){var c=this.texture;if(c.baseTexture.hasLoaded){var d,e,f=c.baseTexture,g=c.frame,h=g.width!==f.width||g.height!==f.height,i=!1;if(a?(d=b.getNextPowerOfTwo(g.width),e=b.getNextPowerOfTwo(g.height),g.width!==d&&g.height!==e&&(i=!0)):h&&(d=g.width,e=g.height,i=!0),i){var j;this.tilingTexture&&this.tilingTexture.isTiling?(j=this.tilingTexture.canvasBuffer,j.resize(d,e),this.tilingTexture.baseTexture.width=d,this.tilingTexture.baseTexture.height=e,this.tilingTexture.needsUpdate=!0):(j=new b.CanvasBuffer(d,e),this.tilingTexture=b.Texture.fromCanvas(j.canvas),this.tilingTexture.canvasBuffer=j,this.tilingTexture.isTiling=!0),j.context.drawImage(c.baseTexture.source,g.x,g.y,g.width,g.height,0,0,d,e),this.tileScaleOffset.x=g.width/d,this.tileScaleOffset.y=g.height/e}else this.tilingTexture&&this.tilingTexture.isTiling&&this.tilingTexture.destroy(!0),this.tileScaleOffset.x=1,this.tileScaleOffset.y=1,this.tilingTexture=c;this.refreshTexture=!1,this.tilingTexture.baseTexture._powerOf2=!0}},b.BaseTextureCache={},b.texturesToUpdate=[],b.texturesToDestroy=[],b.BaseTextureCacheIdGenerator=0,b.BaseTexture=function(a,c){if(b.EventTarget.call(this),this.width=100,this.height=100,this.scaleMode=c||b.scaleModes.DEFAULT,this.hasLoaded=!1,this.source=a,this.id=b.BaseTextureCacheIdGenerator++,this._glTextures=[],a){if(this.source.complete||this.source.getContext)this.hasLoaded=!0,this.width=this.source.width,this.height=this.source.height,b.texturesToUpdate.push(this);else{var d=this;this.source.onload=function(){d.hasLoaded=!0,d.width=d.source.width,d.height=d.source.height,b.texturesToUpdate.push(d),d.dispatchEvent({type:"loaded",content:d})}}this.imageUrl=null,this._powerOf2=!1}},b.BaseTexture.prototype.constructor=b.BaseTexture,b.BaseTexture.prototype.destroy=function(){this.imageUrl&&(delete b.BaseTextureCache[this.imageUrl],this.imageUrl=null,this.source.src=null),this.source=null,b.texturesToDestroy.push(this)},b.BaseTexture.prototype.updateSourceImage=function(a){this.hasLoaded=!1,this.source.src=null,this.source.src=a},b.BaseTexture.fromImage=function(a,c,d){var e=b.BaseTextureCache[a];if(!e){var f=new Image;c&&(f.crossOrigin=""),f.src=a,e=new b.BaseTexture(f,d),e.imageUrl=a,b.BaseTextureCache[a]=e}return e},b.BaseTexture.fromCanvas=function(a,c){a._pixiId||(a._pixiId="canvas_"+b.TextureCacheIdGenerator++);var d=b.BaseTextureCache[a._pixiId];return d||(d=new b.BaseTexture(a,c),b.BaseTextureCache[a._pixiId]=d),d},b.TextureCache={},b.FrameCache={},b.TextureCacheIdGenerator=0,b.Texture=function(a,c){if(b.EventTarget.call(this),c||(this.noFrame=!0,c=new b.Rectangle(0,0,1,1)),a instanceof b.Texture&&(a=a.baseTexture),this.baseTexture=a,this.frame=c,this.trim=null,this.scope=this,this._uvs=null,a.hasLoaded)this.noFrame&&(c=new b.Rectangle(0,0,a.width,a.height)),this.setFrame(c);else{var d=this;a.addEventListener("loaded",function(){d.onBaseTextureLoaded()})}},b.Texture.prototype.constructor=b.Texture,b.Texture.prototype.onBaseTextureLoaded=function(){var a=this.baseTexture;a.removeEventListener("loaded",this.onLoaded),this.noFrame&&(this.frame=new b.Rectangle(0,0,a.width,a.height)),this.setFrame(this.frame),this.scope.dispatchEvent({type:"update",content:this})},b.Texture.prototype.destroy=function(a){a&&this.baseTexture.destroy()},b.Texture.prototype.setFrame=function(a){if(this.frame=a,this.width=a.width,this.height=a.height,a.x+a.width>this.baseTexture.width||a.y+a.height>this.baseTexture.height)throw new Error("Texture Error: frame does not fit inside the base Texture dimensions "+this);this.updateFrame=!0,b.Texture.frameUpdates.push(this)},b.Texture.prototype._updateWebGLuvs=function(){this._uvs||(this._uvs=new b.TextureUvs);var a=this.frame,c=this.baseTexture.width,d=this.baseTexture.height;this._uvs.x0=a.x/c,this._uvs.y0=a.y/d,this._uvs.x1=(a.x+a.width)/c,this._uvs.y1=a.y/d,this._uvs.x2=(a.x+a.width)/c,this._uvs.y2=(a.y+a.height)/d,this._uvs.x3=a.x/c,this._uvs.y3=(a.y+a.height)/d},b.Texture.fromImage=function(a,c,d){var e=b.TextureCache[a];return e||(e=new b.Texture(b.BaseTexture.fromImage(a,c,d)),b.TextureCache[a]=e),e},b.Texture.fromFrame=function(a){var c=b.TextureCache[a];if(!c)throw new Error('The frameId "'+a+'" does not exist in the texture cache ');return c},b.Texture.fromCanvas=function(a,c){var d=b.BaseTexture.fromCanvas(a,c);return new b.Texture(d)},b.Texture.addTextureToCache=function(a,c){b.TextureCache[c]=a},b.Texture.removeTextureFromCache=function(a){var c=b.TextureCache[a];return delete b.TextureCache[a],delete b.BaseTextureCache[a],c},b.Texture.frameUpdates=[],b.TextureUvs=function(){this.x0=0,this.y0=0,this.x1=0,this.y1=0,this.x2=0,this.y2=0,this.x3=0,this.y4=0},b.RenderTexture=function(a,c,d){if(b.EventTarget.call(this),this.width=a||100,this.height=c||100,this.frame=new b.Rectangle(0,0,this.width,this.height),this.baseTexture=new b.BaseTexture,this.baseTexture.width=this.width,this.baseTexture.height=this.height,this.baseTexture._glTextures=[],this.baseTexture.hasLoaded=!0,this.renderer=d||b.defaultRenderer,this.renderer.type===b.WEBGL_RENDERER){var e=this.renderer.gl;this.textureBuffer=new b.FilterTexture(e,this.width,this.height),this.baseTexture._glTextures[e.id]=this.textureBuffer.texture,this.render=this.renderWebGL,this.projection=new b.Point(this.width/2,-this.height/2)}else console.log("renderer canvas"),this.render=this.renderCanvas,this.textureBuffer=new b.CanvasBuffer(this.width,this.height),this.baseTexture.source=this.textureBuffer.canvas;b.Texture.frameUpdates.push(this)},b.RenderTexture.prototype=Object.create(b.Texture.prototype),b.RenderTexture.prototype.constructor=b.RenderTexture,b.RenderTexture.prototype.resize=function(a,c){if(this.width=a,this.height=c,this.frame.width=this.width,this.frame.height=this.height,this.renderer.type===b.WEBGL_RENDERER){this.projection.x=this.width/2,this.projection.y=-this.height/2;var d=this.renderer.gl;d.bindTexture(d.TEXTURE_2D,this.baseTexture._glTextures[d.id]),d.texImage2D(d.TEXTURE_2D,0,d.RGBA,this.width,this.height,0,d.RGBA,d.UNSIGNED_BYTE,null)}else this.textureBuffer.resize(this.width,this.height);b.Texture.frameUpdates.push(this)},b.RenderTexture.prototype.renderWebGL=function(a,c,d){var e=this.renderer.gl;e.colorMask(!0,!0,!0,!0),e.viewport(0,0,this.width,this.height),e.bindFramebuffer(e.FRAMEBUFFER,this.textureBuffer.frameBuffer),d&&this.textureBuffer.clear();var f=a.children,g=a.worldTransform;a.worldTransform=b.RenderTexture.tempMatrix,a.worldTransform.d=-1,a.worldTransform.ty=-2*this.projection.y,c&&(a.worldTransform.tx=c.x,a.worldTransform.ty-=c.y);for(var h=0,i=f.length;i>h;h++)f[h].updateTransform();b.WebGLRenderer.updateTextures(),this.renderer.renderDisplayObject(a,this.projection,this.textureBuffer.frameBuffer),a.worldTransform=g},b.RenderTexture.prototype.renderCanvas=function(a,c,d){var e=a.children,f=a.worldTransform;a.worldTransform=b.RenderTexture.tempMatrix,c&&(a.worldTransform.tx=c.x,a.worldTransform.ty=c.y);for(var g=0,h=e.length;h>g;g++)e[g].updateTransform();d&&this.textureBuffer.clear();var i=this.textureBuffer.context;this.renderer.renderDisplayObject(a,i),i.setTransform(1,0,0,1,0,0),a.worldTransform=f},b.RenderTexture.tempMatrix=new b.Matrix,"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=b),exports.PIXI=b):"undefined"!=typeof define&&define.amd?define("PIXI",function(){return a.PIXI=b}()):a.PIXI=b}).call(this),function(){var a=this,b=b||{VERSION:"<%= version %>",DEV_VERSION:"2.0.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,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=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}},"function"!=typeof Function.prototype.bind&&(Function.prototype.bind=function(){var a=Array.prototype.slice;return function(b){function c(){var f=e.concat(a.call(arguments));d.apply(this instanceof c?this:b,f)}var d=this,e=a.call(arguments,1);if("function"!=typeof d)throw new TypeError;return c.prototype=function f(a){return a&&(f.prototype=a),this instanceof f?void 0:new f}(d.prototype),c}}()),Array.isArray||(Array.isArray=function(a){return"[object Array]"==Object.prototype.toString.call(a)}),b.Circle=function(a,b,c){a=a||0,b=b||0,c=c||0,this.x=a,this.y=b,this._diameter=c,this._radius=c>0?.5*c:0},b.Circle.prototype={circumference:function(){return 2*Math.PI*this._radius},setTo:function(a,b,c){return this.x=a,this.y=b,this._diameter=c,this._radius=.5*c,this},copyFrom:function(a){return this.setTo(a.x,a.y,a.diameter)},copyTo:function(a){return a.x=this.x,a.y=this.y,a.diameter=this._diameter,a},distance:function(a,c){return"undefined"==typeof c&&(c=!1),c?b.Math.distanceRound(this.x,this.y,a.x,a.y):b.Math.distance(this.x,this.y,a.x,a.y)},clone:function(a){return"undefined"==typeof a?a=new b.Circle(this.x,this.y,this.diameter):a.setTo(this.x,this.y,this.diameter),a},contains:function(a,c){return b.Circle.contains(this,a,c)},circumferencePoint:function(a,c,d){return b.Circle.circumferencePoint(this,a,c,d)},offset:function(a,b){return this.x+=a,this.y+=b,this},offsetPoint:function(a){return this.offset(a.x,a.y)},toString:function(){return"[{Phaser.Circle (x="+this.x+" y="+this.y+" diameter="+this.diameter+" radius="+this.radius+")}]"}},b.Circle.prototype.constructor=b.Circle,Object.defineProperty(b.Circle.prototype,"diameter",{get:function(){return this._diameter},set:function(a){a>0&&(this._diameter=a,this._radius=.5*a)}}),Object.defineProperty(b.Circle.prototype,"radius",{get:function(){return this._radius},set:function(a){a>0&&(this._radius=a,this._diameter=2*a)}}),Object.defineProperty(b.Circle.prototype,"left",{get:function(){return this.x-this._radius},set:function(a){a>this.x?(this._radius=0,this._diameter=0):this.radius=this.x-a}}),Object.defineProperty(b.Circle.prototype,"right",{get:function(){return this.x+this._radius},set:function(a){athis.y?(this._radius=0,this._diameter=0):this.radius=this.y-a}}),Object.defineProperty(b.Circle.prototype,"bottom",{get:function(){return this.y+this._radius},set:function(a){a0?Math.PI*this._radius*this._radius:0}}),Object.defineProperty(b.Circle.prototype,"empty",{get:function(){return 0===this._diameter},set:function(a){a===!0&&this.setTo(0,0,0)}}),b.Circle.contains=function(a,b,c){if(a.radius>0&&b>=a.left&&b<=a.right&&c>=a.top&&c<=a.bottom){var d=(a.x-b)*(a.x-b),e=(a.y-c)*(a.y-c);return d+e<=a.radius*a.radius}return!1},b.Circle.equals=function(a,b){return a.x==b.x&&a.y==b.y&&a.diameter==b.diameter},b.Circle.intersects=function(a,c){return b.Math.distance(a.x,a.y,c.x,c.y)<=a.radius+c.radius},b.Circle.circumferencePoint=function(a,c,d,e){return"undefined"==typeof d&&(d=!1),"undefined"==typeof e&&(e=new b.Point),d===!0&&(c=b.Math.degToRad(c)),e.x=a.x+a.radius*Math.cos(c),e.y=a.y+a.radius*Math.sin(c),e},b.Circle.intersectsRectangle=function(a,b){var c=Math.abs(a.x-b.x-b.halfWidth),d=b.halfWidth+a.radius;if(c>d)return!1;var e=Math.abs(a.y-b.y-b.halfHeight),f=b.halfHeight+a.radius;if(e>f)return!1;if(c<=b.halfWidth||e<=b.halfHeight)return!0;var g=c-b.halfWidth,h=e-b.halfHeight,i=g*g,j=h*h,k=a.radius*a.radius;return k>=i+j},PIXI.Circle=b.Circle,b.Point=function(a,b){a=a||0,b=b||0,this.x=a,this.y=b},b.Point.prototype={copyFrom:function(a){return this.setTo(a.x,a.y)},invert:function(){return this.setTo(this.y,this.x)},setTo:function(a,b){return this.x=a||0,this.y=b||(0!==b?this.x:0),this},set:function(a,b){return this.x=a||0,this.y=b||(0!==b?this.x:0),this},add:function(a,b){return this.x+=a,this.y+=b,this},subtract:function(a,b){return this.x-=a,this.y-=b,this},multiply:function(a,b){return this.x*=a,this.y*=b,this},divide:function(a,b){return this.x/=a,this.y/=b,this},clampX:function(a,c){return this.x=b.Math.clamp(this.x,a,c),this},clampY:function(a,c){return this.y=b.Math.clamp(this.y,a,c),this},clamp:function(a,c){return this.x=b.Math.clamp(this.x,a,c),this.y=b.Math.clamp(this.y,a,c),this},clone:function(a){return"undefined"==typeof a?a=new b.Point(this.x,this.y):a.setTo(this.x,this.y),a},copyTo:function(a){return a.x=this.x,a.y=this.y,a},distance:function(a,c){return b.Point.distance(this,a,c)},equals:function(a){return a.x==this.x&&a.y==this.y},rotate:function(a,c,d,e,f){return b.Point.rotate(this,a,c,d,e,f)},getMagnitude:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},setMagnitude:function(a){return this.normalize().multiply(a,a)},normalize:function(){if(!this.isZero()){var a=this.getMagnitude();this.x/=a,this.y/=a}return this},isZero:function(){return 0===this.x&&0===this.y},toString:function(){return"[{Point (x="+this.x+" y="+this.y+")}]"}},b.Point.prototype.constructor=b.Point,b.Point.add=function(a,c,d){return"undefined"==typeof d&&(d=new b.Point),d.x=a.x+c.x,d.y=a.y+c.y,d},b.Point.subtract=function(a,c,d){return"undefined"==typeof d&&(d=new b.Point),d.x=a.x-c.x,d.y=a.y-c.y,d},b.Point.multiply=function(a,c,d){return"undefined"==typeof d&&(d=new b.Point),d.x=a.x*c.x,d.y=a.y*c.y,d},b.Point.divide=function(a,c,d){return"undefined"==typeof d&&(d=new b.Point),d.x=a.x/c.x,d.y=a.y/c.y,d},b.Point.equals=function(a,b){return a.x==b.x&&a.y==b.y},b.Point.distance=function(a,c,d){return"undefined"==typeof d&&(d=!1),d?b.Math.distanceRound(a.x,a.y,c.x,c.y):b.Math.distance(a.x,a.y,c.x,c.y)},b.Point.rotate=function(a,c,d,e,f,g){return f=f||!1,g=g||null,f&&(e=b.Math.degToRad(e)),null===g&&(g=Math.sqrt((c-a.x)*(c-a.x)+(d-a.y)*(d-a.y))),a.setTo(c+g*Math.cos(e),d+g*Math.sin(e))},PIXI.Point=b.Point,b.Rectangle=function(a,b,c,d){a=a||0,b=b||0,c=c||0,d=d||0,this.x=a,this.y=b,this.width=c,this.height=d},b.Rectangle.prototype={offset:function(a,b){return this.x+=a,this.y+=b,this},offsetPoint:function(a){return this.offset(a.x,a.y)},setTo:function(a,b,c,d){return this.x=a,this.y=b,this.width=c,this.height=d,this},floor:function(){this.x=Math.floor(this.x),this.y=Math.floor(this.y)},floorAll:function(){this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.width=Math.floor(this.width),this.height=Math.floor(this.height)},copyFrom:function(a){return this.setTo(a.x,a.y,a.width,a.height)},copyTo:function(a){return a.x=this.x,a.y=this.y,a.width=this.width,a.height=this.height,a},inflate:function(a,c){return b.Rectangle.inflate(this,a,c)},size:function(a){return b.Rectangle.size(this,a)},clone:function(a){return b.Rectangle.clone(this,a)},contains:function(a,c){return b.Rectangle.contains(this,a,c)},containsRect:function(a){return b.Rectangle.containsRect(this,a)},equals:function(a){return b.Rectangle.equals(this,a)},intersection:function(a,c){return b.Rectangle.intersection(this,a,c)},intersects:function(a,c){return b.Rectangle.intersects(this,a,c)},intersectsRaw:function(a,c,d,e,f){return b.Rectangle.intersectsRaw(this,a,c,d,e,f)},union:function(a,c){return b.Rectangle.union(this,a,c)},toString:function(){return"[{Rectangle (x="+this.x+" y="+this.y+" width="+this.width+" height="+this.height+" empty="+this.empty+")}]"}},Object.defineProperty(b.Rectangle.prototype,"halfWidth",{get:function(){return Math.round(this.width/2)}}),Object.defineProperty(b.Rectangle.prototype,"halfHeight",{get:function(){return Math.round(this.height/2)}}),Object.defineProperty(b.Rectangle.prototype,"bottom",{get:function(){return this.y+this.height},set:function(a){this.height=a<=this.y?0:this.y-a}}),Object.defineProperty(b.Rectangle.prototype,"bottomRight",{get:function(){return new b.Point(this.right,this.bottom)},set:function(a){this.right=a.x,this.bottom=a.y}}),Object.defineProperty(b.Rectangle.prototype,"left",{get:function(){return this.x},set:function(a){this.width=a>=this.right?0:this.right-a,this.x=a}}),Object.defineProperty(b.Rectangle.prototype,"right",{get:function(){return this.x+this.width},set:function(a){this.width=a<=this.x?0:this.x+a}}),Object.defineProperty(b.Rectangle.prototype,"volume",{get:function(){return this.width*this.height}}),Object.defineProperty(b.Rectangle.prototype,"perimeter",{get:function(){return 2*this.width+2*this.height}}),Object.defineProperty(b.Rectangle.prototype,"centerX",{get:function(){return this.x+this.halfWidth},set:function(a){this.x=a-this.halfWidth}}),Object.defineProperty(b.Rectangle.prototype,"centerY",{get:function(){return this.y+this.halfHeight},set:function(a){this.y=a-this.halfHeight}}),Object.defineProperty(b.Rectangle.prototype,"top",{get:function(){return this.y},set:function(a){a>=this.bottom?(this.height=0,this.y=a):this.height=this.bottom-a}}),Object.defineProperty(b.Rectangle.prototype,"topLeft",{get:function(){return new b.Point(this.x,this.y)},set:function(a){this.x=a.x,this.y=a.y}}),Object.defineProperty(b.Rectangle.prototype,"empty",{get:function(){return!this.width||!this.height},set:function(a){a===!0&&this.setTo(0,0,0,0)}}),b.Rectangle.prototype.constructor=b.Rectangle,b.Rectangle.inflate=function(a,b,c){return a.x-=b,a.width+=2*b,a.y-=c,a.height+=2*c,a},b.Rectangle.inflatePoint=function(a,c){return b.Rectangle.inflate(a,c.x,c.y)},b.Rectangle.size=function(a,c){return"undefined"==typeof c?c=new b.Point(a.width,a.height):c.setTo(a.width,a.height),c},b.Rectangle.clone=function(a,c){return"undefined"==typeof c?c=new b.Rectangle(a.x,a.y,a.width,a.height):c.setTo(a.x,a.y,a.width,a.height),c},b.Rectangle.contains=function(a,b,c){return a.width<=0||a.height<=0?!1:b>=a.x&&b<=a.right&&c>=a.y&&c<=a.bottom},b.Rectangle.containsRaw=function(a,b,c,d,e,f){return e>=a&&a+c>=e&&f>=b&&b+d>=f},b.Rectangle.containsPoint=function(a,c){return b.Rectangle.contains(a,c.x,c.y)},b.Rectangle.containsRect=function(a,b){return a.volume>b.volume?!1:a.x>=b.x&&a.y>=b.y&&a.right<=b.right&&a.bottom<=b.bottom},b.Rectangle.equals=function(a,b){return a.x==b.x&&a.y==b.y&&a.width==b.width&&a.height==b.height},b.Rectangle.intersection=function(a,c,d){return"undefined"==typeof d&&(d=new b.Rectangle),b.Rectangle.intersects(a,c)&&(d.x=Math.max(a.x,c.x),d.y=Math.max(a.y,c.y),d.width=Math.min(a.right,c.right)-d.x,d.height=Math.min(a.bottom,c.bottom)-d.y),d},b.Rectangle.intersects=function(a,b){return a.width<=0||a.height<=0||b.width<=0||b.height<=0?!1:!(a.rightb.right||a.y>b.bottom)},b.Rectangle.intersectsRaw=function(a,b,c,d,e,f){return"undefined"==typeof f&&(f=0),!(b>a.right+f||ca.bottom+f||e=c&&d>=a&&b>=e&&f>=b},coordinatesOnLine:function(a,b){"undefined"==typeof a&&(a=1),"undefined"==typeof b&&(b=[]);var c=Math.round(this.start.x),d=Math.round(this.start.y),e=Math.round(this.end.x),f=Math.round(this.end.y),g=Math.abs(e-c),h=Math.abs(f-d),i=e>c?1:-1,j=f>d?1:-1,k=g-h;b.push([c,d]);for(var l=1;c!=e||d!=f;){var m=k<<1;m>-h&&(k-=h,c+=i),g>m&&(k+=g,d+=j),l%a===0&&b.push([c,d]),l++}return b}},Object.defineProperty(b.Line.prototype,"length",{get:function(){return Math.sqrt((this.end.x-this.start.x)*(this.end.x-this.start.x)+(this.end.y-this.start.y)*(this.end.y-this.start.y))}}),Object.defineProperty(b.Line.prototype,"angle",{get:function(){return Math.atan2(this.end.x-this.start.x,this.end.y-this.start.y)}}),Object.defineProperty(b.Line.prototype,"slope",{get:function(){return(this.end.y-this.start.y)/(this.end.x-this.start.x)}}),Object.defineProperty(b.Line.prototype,"perpSlope",{get:function(){return-((this.end.x-this.start.x)/(this.end.y-this.start.y))}}),Object.defineProperty(b.Line.prototype,"x",{get:function(){return Math.min(this.start.x,this.end.x)}}),Object.defineProperty(b.Line.prototype,"y",{get:function(){return Math.min(this.start.y,this.end.y)}}),Object.defineProperty(b.Line.prototype,"left",{get:function(){return Math.min(this.start.x,this.end.x)}}),Object.defineProperty(b.Line.prototype,"right",{get:function(){return Math.max(this.start.x,this.end.x)}}),Object.defineProperty(b.Line.prototype,"top",{get:function(){return Math.min(this.start.y,this.end.y)}}),Object.defineProperty(b.Line.prototype,"bottom",{get:function(){return Math.max(this.start.y,this.end.y)}}),Object.defineProperty(b.Line.prototype,"width",{get:function(){return Math.abs(this.start.x-this.end.x)}}),Object.defineProperty(b.Line.prototype,"height",{get:function(){return Math.abs(this.start.y-this.end.y)}}),b.Line.intersectsPoints=function(a,c,d,e,f,g){"undefined"==typeof f&&(f=!0),"undefined"==typeof g&&(g=new b.Point);var h=c.y-a.y,i=e.y-d.y,j=a.x-c.x,k=d.x-e.x,l=c.x*a.y-a.x*c.y,m=e.x*d.y-d.x*e.y,n=h*k-i*j;if(0===n)return null;if(g.x=(j*m-k*l)/n,g.y=(i*l-h*m)/n,f){if(Math.pow(g.x-c.x+(g.y-c.y),2)>Math.pow(a.x-c.x+(a.y-c.y),2))return null;if(Math.pow(g.x-a.x+(g.y-a.y),2)>Math.pow(a.x-c.x+(a.y-c.y),2))return null;if(Math.pow(g.x-e.x+(g.y-e.y),2)>Math.pow(d.x-e.x+(d.y-e.y),2))return null;if(Math.pow(g.x-d.x+(g.y-d.y),2)>Math.pow(d.x-e.x+(d.y-e.y),2))return null}return g},b.Line.intersects=function(a,c,d,e){return b.Line.intersectsPoints(a.start,a.end,c.start,c.end,d,e)},b.Ellipse=function(a,c,d,e){this.type=b.ELLIPSE,a=a||0,c=c||0,d=d||0,e=e||0,this.x=a,this.y=c,this.width=d,this.height=e},b.Ellipse.prototype={setTo:function(a,b,c,d){return this.x=a,this.y=b,this.width=c,this.height=d,this},copyFrom:function(a){return this.setTo(a.x,a.y,a.width,a.height)},copyTo:function(a){return a.x=this.x,a.y=this.y,a.width=this.width,a.height=this.height,a},clone:function(a){return"undefined"==typeof a?a=new b.Ellipse(this.x,this.y,this.width,this.height):a.setTo(this.x,this.y,this.width,this.height),a},contains:function(a,c){return b.Ellipse.contains(this,a,c)},toString:function(){return"[{Phaser.Ellipse (x="+this.x+" y="+this.y+" width="+this.width+" height="+this.height+")}]"}},b.Ellipse.prototype.constructor=b.Ellipse,Object.defineProperty(b.Ellipse.prototype,"left",{get:function(){return this.x},set:function(a){this.x=a}}),Object.defineProperty(b.Ellipse.prototype,"right",{get:function(){return this.x+this.width},set:function(a){this.width=ad+e},b.Ellipse.prototype.getBounds=function(){return new b.Rectangle(this.x,this.y,this.width,this.height)},PIXI.Ellipse=b.Ellipse,b.Polygon=function(a){if(this.type=b.POLYGON,a instanceof Array||(a=Array.prototype.slice.call(arguments)),"number"==typeof a[0]){for(var c=[],d=0,e=a.length;e>d;d+=2)c.push(new b.Point(a[d],a[d+1]));a=c}this.points=a},b.Polygon.prototype={clone:function(){for(var a=[],c=0;cb!=i>b&&(h-f)*(b-g)/(i-g)+f>a;j&&(c=!0)}return c}},b.Polygon.prototype.constructor=b.Polygon,PIXI.Polygon=b.Polygon,b.Camera=function(a,c,d,e,f,g){this.game=a,this.world=a.world,this.id=0,this.view=new b.Rectangle(d,e,f,g),this.screenView=new b.Rectangle(d,e,f,g),this.bounds=new b.Rectangle(d,e,f,g),this.deadzone=null,this.visible=!0,this.atLimit={x:!1,y:!1},this.target=null,this._edge=0,this.displayObject=null,this.scale=null},b.Camera.FOLLOW_LOCKON=0,b.Camera.FOLLOW_PLATFORMER=1,b.Camera.FOLLOW_TOPDOWN=2,b.Camera.FOLLOW_TOPDOWN_TIGHT=3,b.Camera.prototype={follow:function(a,c){"undefined"==typeof c&&(c=b.Camera.FOLLOW_LOCKON),this.target=a;var d;switch(c){case b.Camera.FOLLOW_PLATFORMER:var e=this.width/8,f=this.height/3;this.deadzone=new b.Rectangle((this.width-e)/2,(this.height-f)/2-.25*f,e,f);break;case b.Camera.FOLLOW_TOPDOWN:d=Math.max(this.width,this.height)/4,this.deadzone=new b.Rectangle((this.width-d)/2,(this.height-d)/2,d,d);break;case b.Camera.FOLLOW_TOPDOWN_TIGHT:d=Math.max(this.width,this.height)/8,this.deadzone=new b.Rectangle((this.width-d)/2,(this.height-d)/2,d,d);break;case b.Camera.FOLLOW_LOCKON:this.deadzone=null;break;default:this.deadzone=null}},focusOn:function(a){this.setPosition(Math.round(a.x-this.view.halfWidth),Math.round(a.y-this.view.halfHeight))},focusOnXY:function(a,b){this.setPosition(Math.round(a-this.view.halfWidth),Math.round(b-this.view.halfHeight))},update:function(){this.target&&this.updateTarget(),this.bounds&&this.checkBounds(),this.displayObject.position.x=-this.view.x,this.displayObject.position.y=-this.view.y},updateTarget:function(){this.deadzone?(this._edge=this.target.x-this.deadzone.x,this.view.x>this._edge&&(this.view.x=this._edge),this._edge=this.target.x+this.target.width-this.deadzone.x-this.deadzone.width,this.view.xthis._edge&&(this.view.y=this._edge),this._edge=this.target.y+this.target.height-this.deadzone.y-this.deadzone.height,this.view.y=this.bounds.right&&(this.atLimit.x=!0,this.view.x=this.bounds.right-this.width),this.view.y<=this.bounds.top&&(this.atLimit.y=!0,this.view.y=this.bounds.top),this.view.bottom>=this.bounds.bottom&&(this.atLimit.y=!0,this.view.y=this.bounds.bottom-this.height),this.view.floor()},setPosition:function(a,b){this.view.x=a,this.view.y=b,this.bounds&&this.checkBounds()},setSize:function(a,b){this.view.width=a,this.view.height=b},reset:function(){this.target=null,this.view.x=0,this.view.y=0}},b.Camera.prototype.constructor=b.Camera,Object.defineProperty(b.Camera.prototype,"x",{get:function(){return this.view.x},set:function(a){this.view.x=a,this.bounds&&this.checkBounds()}}),Object.defineProperty(b.Camera.prototype,"y",{get:function(){return this.view.y},set:function(a){this.view.y=a,this.bounds&&this.checkBounds()}}),Object.defineProperty(b.Camera.prototype,"width",{get:function(){return this.view.width},set:function(a){this.view.width=a}}),Object.defineProperty(b.Camera.prototype,"height",{get:function(){return this.view.height},set:function(a){this.view.height=a}}),b.State=function(){this.game=null,this.add=null,this.make=null,this.camera=null,this.cache=null,this.input=null,this.load=null,this.math=null,this.sound=null,this.scale=null,this.stage=null,this.time=null,this.tweens=null,this.world=null,this.particles=null,this.physics=null,this.rnd=null},b.State.prototype={preload:function(){},loadUpdate:function(){},loadRender:function(){},create:function(){},update:function(){},render:function(){},paused:function(){},shutdown:function(){}},b.State.prototype.constructor=b.State,b.StateManager=function(a,b){this.game=a,this.states={},this._pendingState=null,"undefined"!=typeof b&&null!==b&&(this._pendingState=b),this._clearWorld=!1,this._clearCache=!1,this._created=!1,this._args=[],this.current="",this.onInitCallback=null,this.onPreloadCallback=null,this.onCreateCallback=null,this.onUpdateCallback=null,this.onRenderCallback=null,this.onPreRenderCallback=null,this.onLoadUpdateCallback=null,this.onLoadRenderCallback=null,this.onPausedCallback=null,this.onResumedCallback=null,this.onShutDownCallback=null},b.StateManager.prototype={boot:function(){this.game.onPause.add(this.pause,this),this.game.onResume.add(this.resume,this),this.game.load.onLoadComplete.add(this.loadComplete,this),null!==this._pendingState&&("string"==typeof this._pendingState?this.start(this._pendingState,!1,!1):this.add("default",this._pendingState,!0))},add:function(a,c,d){"undefined"==typeof d&&(d=!1);var e;return c instanceof b.State?e=c:"object"==typeof c?(e=c,e.game=this.game):"function"==typeof c&&(e=new c(this.game)),this.states[a]=e,d&&(this.game.isBooted?this.start(a):this._pendingState=a),e},remove:function(a){this.current==a&&(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.onDestroyCallback=null),delete this.states[a]},start:function(a,b,c){"undefined"==typeof b&&(b=!0),"undefined"==typeof c&&(c=!1),this.checkState(a)&&(this._pendingState=a,this._clearWorld=b,this._clearCache=c,arguments.length>3&&(this._args=Array.prototype.splice.call(arguments,3)))},dummy:function(){},preUpdate:function(){this._pendingState&&this.game.isBooted&&(this.current&&(this.onShutDownCallback.call(this.callbackContext,this.game),this.game.tweens.removeAll(),this.game.camera.reset(),this.game.input.reset(!0),this.game.physics.clear(),this.game.time.removeAll(),this._clearWorld&&(this.game.world.shutdown(),this._clearCache===!0&&this.game.cache.destroy())),this.setCurrentState(this._pendingState),this.onPreloadCallback?(this.game.load.reset(),this.onPreloadCallback.call(this.callbackContext,this.game),0===this.game.load.totalQueuedFiles()?this.loadComplete():this.game.load.start()):this.loadComplete(),this.current===this._pendingState&&(this._pendingState=null))},checkState:function(a){if(this.states[a]){var b=!1;return this.states[a].preload&&(b=!0),this.states[a].create&&(b=!0),this.states[a].update&&(b=!0),this.states[a].render&&(b=!0),b===!1?(console.warn("Invalid Phaser State object given. Must contain at least a one of the required functions: preload, create, update or render"),!1):!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},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.onPausedCallback=this.states[a].paused||null,this.onResumedCallback=this.states[a].resumed||null,this.onShutDownCallback=this.states[a].shutdown||this.dummy,this.current=a,this._created=!1,this.onInitCallback.apply(this.callbackContext,this._args),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)},preRender:function(){this.onPreRenderCallback&&this.onPreRenderCallback.call(this.callbackContext,this.game)},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.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.onDestroyCallback=null,this.game=null,this.states={},this._pendingState=null}},b.StateManager.prototype.constructor=b.StateManager,b.LinkedList=function(){this.next=null,this.prev=null,this.first=null,this.last=null,this.total=0},b.LinkedList.prototype={add:function(a){return 0===this.total&&null==this.first&&null==this.last?(this.first=a,this.last=a,this.next=a,a.prev=this,this.total++,a):(this.last.next=a,a.prev=this.last,this.last=a,this.total++,a)},remove:function(a){a==this.first?this.first=this.first.next:a==this.last&&(this.last=this.last.prev),a.prev&&(a.prev.next=a.next),a.next&&(a.next.prev=a.prev),a.next=a.prev=null,null==this.first&&(this.last=null),this.total--},callAll:function(a){if(this.first&&this.last){var b=this.first;do b&&b[a]&&b[a].call(b),b=b.next;while(b!=this.last.next)}}},b.LinkedList.prototype.constructor=b.LinkedList,b.Signal=function(){this._bindings=[],this._prevParams=null;var a=this;this.dispatch=function(){b.Signal.prototype.dispatch.apply(a,arguments)}},b.Signal.prototype={memorize:!1,_shouldPropagate:!0,active:!0,validateListener:function(a,b){if("function"!=typeof a)throw new Error("listener is a required param of {fn}() and should be a Function.".replace("{fn}",b))},_registerListener:function(a,c,d,e){var f,g=this._indexOfListener(a,d);if(-1!==g){if(f=this._bindings[g],f.isOnce()!==c)throw new Error("You cannot add"+(c?"":"Once")+"() then add"+(c?"Once":"")+"() the same listener without removing the relationship first.")}else f=new b.SignalBinding(this,a,c,d,e),this._addBinding(f);return this.memorize&&this._prevParams&&f.execute(this._prevParams),f},_addBinding:function(a){var b=this._bindings.length;do--b;while(this._bindings[b]&&a._priority<=this._bindings[b]._priority);this._bindings.splice(b+1,0,a)},_indexOfListener:function(a,b){for(var c,d=this._bindings.length;d--;)if(c=this._bindings[d],c._listener===a&&c.context===b)return d;return-1},has:function(a,b){return-1!==this._indexOfListener(a,b)},add:function(a,b,c){return this.validateListener(a,"add"),this._registerListener(a,!1,b,c)},addOnce:function(a,b,c){return this.validateListener(a,"addOnce"),this._registerListener(a,!0,b,c)},remove:function(a,b){this.validateListener(a,"remove");var c=this._indexOfListener(a,b);return-1!==c&&(this._bindings[c]._destroy(),this._bindings.splice(c,1)),a},removeAll:function(){for(var a=this._bindings.length;a--;)this._bindings[a]._destroy();this._bindings.length=0},getNumListeners:function(){return this._bindings.length},halt:function(){this._shouldPropagate=!1},dispatch:function(){if(this.active){var a,b=Array.prototype.slice.call(arguments),c=this._bindings.length;if(this.memorize&&(this._prevParams=b),c){a=this._bindings.slice(),this._shouldPropagate=!0;do c--;while(a[c]&&this._shouldPropagate&&a[c].execute(b)!==!1)}}},forget:function(){this._prevParams=null},dispose:function(){this.removeAll(),delete this._bindings,delete this._prevParams},toString:function(){return"[Phaser.Signal active:"+this.active+" numListeners:"+this.getNumListeners()+"]"}},b.Signal.prototype.constructor=b.Signal,b.SignalBinding=function(a,b,c,d,e){this._listener=b,this._isOnce=c,this.context=d,this._signal=a,this._priority=e||0},b.SignalBinding.prototype={active:!0,params:null,execute:function(a){var b,c;return this.active&&this._listener&&(c=this.params?this.params.concat(a):a,b=this._listener.apply(this.context,c),this._isOnce&&this.detach()),b},detach:function(){return this.isBound()?this._signal.remove(this._listener,this.context):null},isBound:function(){return!!this._signal&&!!this._listener},isOnce:function(){return this._isOnce},getListener:function(){return this._listener},getSignal:function(){return this._signal},_destroy:function(){delete this._signal,delete this._listener,delete this.context},toString:function(){return"[Phaser.SignalBinding isOnce:"+this._isOnce+", isBound:"+this.isBound()+", active:"+this.active+"]"}},b.SignalBinding.prototype.constructor=b.SignalBinding,b.Filter=function(a,c,d){this.game=a,this.type=b.WEBGL_FILTER,this.passes=[this],this.shaders=[],this.dirty=!0,this.padding=0,this.uniforms={time:{type:"1f",value:0},resolution:{type:"2f",value:{x:256,y:256}},mouse:{type:"2f",value:{x:0,y:0}}},this.fragmentSrc=d||[]},b.Filter.prototype={init:function(){},setResolution:function(a,b){this.uniforms.resolution.value.x=a,this.uniforms.resolution.value.y=b},update:function(a){"undefined"!=typeof a&&(a.x>0&&(this.uniforms.mouse.x=a.x.toFixed(2)),a.y>0&&(this.uniforms.mouse.y=a.y.toFixed(2))),this.uniforms.time.value=this.game.time.totalElapsedSeconds()},destroy:function(){this.game=null}},b.Filter.prototype.constructor=b.Filter,Object.defineProperty(b.Filter.prototype,"width",{get:function(){return this.uniforms.resolution.value.x},set:function(a){this.uniforms.resolution.value.x=a}}),Object.defineProperty(b.Filter.prototype,"height",{get:function(){return this.uniforms.resolution.value.y},set:function(a){this.uniforms.resolution.value.y=a +}}),b.Plugin=function(a,b){"undefined"==typeof b&&(b=null),this.game=a,this.parent=b,this.active=!1,this.visible=!1,this.hasPreUpdate=!1,this.hasUpdate=!1,this.hasPostUpdate=!1,this.hasRender=!1,this.hasPostRender=!1},b.Plugin.prototype={preUpdate:function(){},update:function(){},render:function(){},postRender:function(){},destroy:function(){this.game=null,this.parent=null,this.active=!1,this.visible=!1}},b.Plugin.prototype.constructor=b.Plugin,b.PluginManager=function(a,b){this.game=a,this._parent=b,this.plugins=[],this._pluginsLength=0},b.PluginManager.prototype={add:function(a){var b=!1;return"function"==typeof a?a=new a(this.game,this._parent):(a.game=this.game,a.parent=this._parent),"function"==typeof a.preUpdate&&(a.hasPreUpdate=!0,b=!0),"function"==typeof a.update&&(a.hasUpdate=!0,b=!0),"function"==typeof a.postUpdate&&(a.hasPostUpdate=!0,b=!0),"function"==typeof a.render&&(a.hasRender=!0,b=!0),"function"==typeof a.postRender&&(a.hasPostRender=!0,b=!0),b?((a.hasPreUpdate||a.hasUpdate||a.hasPostUpdate)&&(a.active=!0),(a.hasRender||a.hasPostRender)&&(a.visible=!0),this._pluginsLength=this.plugins.push(a),"function"==typeof a.init&&a.init(),a):null},remove:function(a){if(0!==this._pluginsLength)for(this._p=0;this._pb;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?"visibilitychange":null,this._hiddenVar&&document.addEventListener(this._hiddenVar,this._onChange,!1),window.onpagehide=this._onChange,window.onpageshow=this._onChange,window.onblur=this._onChange,window.onfocus=this._onChange},b.Stage.prototype.visibilityChange=function(a){return this.disableVisibilityChange?void 0:"pagehide"===a.type||"blur"===a.type||"pageshow"===a.type||"focus"===a.type?void("pagehide"===a.type||"blur"===a.type?this.game.focusLoss(a):("pageshow"===a.type||"focus"===a.type)&&this.game.focusGain(a)):void(document.hidden||document.mozHidden||document.msHidden||document.webkitHidden?this.game.gamePaused(a):this.game.gameResumed(a))},b.Stage.prototype.setBackgroundColor=function(a){this._backgroundColor=a||0,this.backgroundColorSplit=PIXI.hex2rgb(this.backgroundColor);var b=this._backgroundColor.toString(16);b="000000".substr(0,6-b.length)+b,this.backgroundColorString="#"+b},Object.defineProperty(b.Stage.prototype,"backgroundColor",{get:function(){return this._backgroundColor},set:function(a){this._backgroundColor=a,this.game.transparent===!1&&("string"==typeof a&&(a=b.Color.hexToRGB(a)),this.setBackgroundColor(a))}}),Object.defineProperty(b.Stage.prototype,"smoothed",{get:function(){return!PIXI.scaleModes.LINEAR},set:function(a){PIXI.scaleModes.LINEAR=a?0:1}}),b.Group=function(a,c,d,e,f,g){"undefined"==typeof e&&(e=!1),"undefined"==typeof f&&(f=!1),"undefined"==typeof g&&(g=b.Physics.ARCADE),this.game=a,"undefined"==typeof c&&(c=a.world),this.name=d||"group",PIXI.DisplayObjectContainer.call(this),e?this.game.stage.addChild(this):c&&c.addChild(this),this.z=0,this.type=b.GROUP,this.alive=!0,this.exists=!0,this.scale=new b.Point(1,1),this.cursor=null,this.cameraOffset=new b.Point,this.enableBody=f,this.enableBodyDebug=!1,this.physicsBodyType=g,this._sortProperty="z",this._cache=[0,0,0,0,1,0,1,0,0,0]},b.Group.prototype=Object.create(PIXI.DisplayObjectContainer.prototype),b.Group.prototype.constructor=b.Group,b.Group.RETURN_NONE=0,b.Group.RETURN_TOTAL=1,b.Group.RETURN_CHILD=2,b.Group.SORT_ASCENDING=-1,b.Group.SORT_DESCENDING=1,b.Group.prototype.add=function(a){return a.parent!==this&&(this.enableBody&&this.game.physics.enable(a,this.physicsBodyType),this.addChild(a),a.z=this.children.length,a.events&&a.events.onAddedToGroup.dispatch(a,this),null===this.cursor&&(this.cursor=a)),a},b.Group.prototype.addAt=function(a,b){return a.parent!==this&&(this.enableBody&&this.game.physics.enable(a,this.physicsBodyType),this.addChildAt(a,b),this.updateZ(),a.events&&a.events.onAddedToGroup.dispatch(a,this),null===this.cursor&&(this.cursor=a)),a},b.Group.prototype.getAt=function(a){return 0>a||a>=this.children.length?-1:this.getChildAt(a)},b.Group.prototype.create=function(a,c,d,e,f){"undefined"==typeof f&&(f=!0);var g=new b.Sprite(this.game,a,c,d,e);return this.enableBody&&this.game.physics.enable(g,this.physicsBodyType),g.exists=f,g.visible=f,g.alive=f,this.addChild(g),g.z=this.children.length,g.events&&g.events.onAddedToGroup.dispatch(g,this),null===this.cursor&&(this.cursor=g),g},b.Group.prototype.createMultiple=function(a,b,c,d){"undefined"==typeof d&&(d=!1);for(var e=0;a>e;e++)this.create(0,0,b,c,d)},b.Group.prototype.updateZ=function(){for(var a=this.children.length;a--;)this.children[a].z=a},b.Group.prototype.next=function(){this.cursor&&(this._cache[8]===this.children.length?this._cache[8]=0:this._cache[8]++,this.cursor=this.children[this._cache[8]])},b.Group.prototype.previous=function(){this.cursor&&(0===this._cache[8]?this._cache[8]=this.children.length-1:this._cache[8]--,this.cursor=this.children[this._cache[8]])},b.Group.prototype.swap=function(a,b){var c=this.swapChildren(a,b);return c&&this.updateZ(),c},b.Group.prototype.bringToTop=function(a){return a.parent===this&&this.getIndex(a)0&&(this.remove(a),this.addAt(a,0)),a},b.Group.prototype.moveUp=function(a){if(a.parent===this&&this.getIndex(a)0){var b=this.getIndex(a),c=this.getAt(b-1);c&&this.swap(b,c)}return a},b.Group.prototype.xy=function(a,b,c){return 0>a||a>this.children.length?-1:(this.getChildAt(a).x=b,void(this.getChildAt(a).y=c))},b.Group.prototype.reverse=function(){this.children.reverse(),this.updateZ()},b.Group.prototype.getIndex=function(a){return this.children.indexOf(a)},b.Group.prototype.replace=function(a,c){var d=this.getIndex(a);if(-1!==d){void 0!==c.parent&&(c.events.onRemovedFromGroup.dispatch(c,this),c.parent.removeChild(c),c.parent instanceof b.Group&&c.parent.updateZ());var e=a;return this.remove(e),this.addAt(c,d),e}},b.Group.prototype.setProperty=function(a,b,c,d){d=d||0;var e=b.length;1==e?0===d?a[b[0]]=c:1==d?a[b[0]]+=c:2==d?a[b[0]]-=c:3==d?a[b[0]]*=c:4==d&&(a[b[0]]/=c):2==e?0===d?a[b[0]][b[1]]=c:1==d?a[b[0]][b[1]]+=c:2==d?a[b[0]][b[1]]-=c:3==d?a[b[0]][b[1]]*=c:4==d&&(a[b[0]][b[1]]/=c):3==e?0===d?a[b[0]][b[1]][b[2]]=c:1==d?a[b[0]][b[1]][b[2]]+=c:2==d?a[b[0]][b[1]][b[2]]-=c:3==d?a[b[0]][b[1]][b[2]]*=c:4==d&&(a[b[0]][b[1]][b[2]]/=c):4==e&&(0===d?a[b[0]][b[1]][b[2]][b[3]]=c:1==d?a[b[0]][b[1]][b[2]][b[3]]+=c:2==d?a[b[0]][b[1]][b[2]][b[3]]-=c:3==d?a[b[0]][b[1]][b[2]][b[3]]*=c:4==d&&(a[b[0]][b[1]][b[2]][b[3]]/=c))},b.Group.prototype.set=function(a,b,c,d,e,f){b=b.split("."),"undefined"==typeof d&&(d=!1),"undefined"==typeof e&&(e=!1),(d===!1||d&&a.alive)&&(e===!1||e&&a.visible)&&this.setProperty(a,b,c,f)},b.Group.prototype.setAll=function(a,b,c,d,e){a=a.split("."),"undefined"==typeof c&&(c=!1),"undefined"==typeof d&&(d=!1),e=e||0;for(var f=0,g=this.children.length;g>f;f++)(!c||c&&this.children[f].alive)&&(!d||d&&this.children[f].visible)&&this.setProperty(this.children[f],a,b,e)},b.Group.prototype.setAllChildren=function(a,c,d,e,f){"undefined"==typeof d&&(d=!1),"undefined"==typeof e&&(e=!1),f=f||0;for(var g=0,h=this.children.length;h>g;g++)(!d||d&&this.children[g].alive)&&(!e||e&&this.children[g].visible)&&(this.children[g]instanceof b.Group?this.children[g].setAllChildren(a,c,d,e,f):this.setProperty(this.children[g],a.split("."),c,f))},b.Group.prototype.addAll=function(a,b,c,d){this.setAll(a,b,c,d,1)},b.Group.prototype.subAll=function(a,b,c,d){this.setAll(a,b,c,d,2)},b.Group.prototype.multiplyAll=function(a,b,c,d){this.setAll(a,b,c,d,3)},b.Group.prototype.divideAll=function(a,b,c,d){this.setAll(a,b,c,d,4)},b.Group.prototype.callAllExists=function(a,b){for(var c=Array.prototype.splice.call(arguments,2),d=0,e=this.children.length;e>d;d++)this.children[d].exists===b&&this.children[d][a]&&this.children[d][a].apply(this.children[d],c)},b.Group.prototype.callbackFromArray=function(a,b,c){if(1==c){if(a[b[0]])return a[b[0]]}else if(2==c){if(a[b[0]][b[1]])return a[b[0]][b[1]]}else if(3==c){if(a[b[0]][b[1]][b[2]])return a[b[0]][b[1]][b[2]]}else if(4==c){if(a[b[0]][b[1]][b[2]][b[3]])return a[b[0]][b[1]][b[2]][b[3]]}else if(a[b])return a[b];return!1},b.Group.prototype.callAll=function(a,b){if("undefined"!=typeof a){a=a.split(".");var c=a.length;if("undefined"==typeof b||null===b||""===b)b=null;else if("string"==typeof b){b=b.split(".");var d=b.length}for(var e=Array.prototype.splice.call(arguments,2),f=null,g=null,h=0,i=this.children.length;i>h;h++)f=this.callbackFromArray(this.children[h],a,c),b&&f?(g=this.callbackFromArray(this.children[h],b,d),f&&f.apply(g,e)):f&&f.apply(this.children[h],e)}},b.Group.prototype.preUpdate=function(){if(!this.exists||!this.parent.exists)return this.renderOrderID=-1,!1;for(var a=this.children.length;a--;)this.children[a].preUpdate();return!0},b.Group.prototype.update=function(){for(var a=this.children.length;a--;)this.children[a].update()},b.Group.prototype.postUpdate=function(){1===this._cache[7]&&(this.x=this.game.camera.view.x+this.cameraOffset.x,this.y=this.game.camera.view.y+this.cameraOffset.y);for(var a=this.children.length;a--;)this.children[a].postUpdate()},b.Group.prototype.forEach=function(a,b,c){"undefined"==typeof c&&(c=!1);var d=Array.prototype.splice.call(arguments,3);d.unshift(null);for(var e=0,f=this.children.length;f>e;e++)(!c||c&&this.children[e].exists)&&(d[0]=this.children[e],a.apply(b,d))},b.Group.prototype.forEachExists=function(a,c){var d=Array.prototype.splice.call(arguments,2);d.unshift(null),this.iterate("exists",!0,b.Group.RETURN_TOTAL,a,c,d)},b.Group.prototype.forEachAlive=function(a,c){var d=Array.prototype.splice.call(arguments,2);d.unshift(null),this.iterate("alive",!0,b.Group.RETURN_TOTAL,a,c,d)},b.Group.prototype.forEachDead=function(a,c){var d=Array.prototype.splice.call(arguments,2);d.unshift(null),this.iterate("alive",!1,b.Group.RETURN_TOTAL,a,c,d)},b.Group.prototype.sort=function(a,c){this.children.length<2||("undefined"==typeof a&&(a="z"),"undefined"==typeof c&&(c=b.Group.SORT_ASCENDING),this._sortProperty=a,this.children.sort(c===b.Group.SORT_ASCENDING?this.ascendingSortHandler.bind(this):this.descendingSortHandler.bind(this)),this.updateZ())},b.Group.prototype.ascendingSortHandler=function(a,b){return a[this._sortProperty]b[this._sortProperty]?1:a.zb[this._sortProperty]?-1:0},b.Group.prototype.iterate=function(a,c,d,e,f,g){if(d===b.Group.RETURN_TOTAL&&0===this.children.length)return 0;"undefined"==typeof e&&(e=!1);for(var h=0,i=0,j=this.children.length;j>i;i++)if(this.children[i][a]===c&&(h++,e&&(g[0]=this.children[i],e.apply(f,g)),d===b.Group.RETURN_CHILD))return this.children[i];return d===b.Group.RETURN_TOTAL?h:d===b.Group.RETURN_CHILD?null:void 0},b.Group.prototype.getFirstExists=function(a){return"boolean"!=typeof a&&(a=!0),this.iterate("exists",a,b.Group.RETURN_CHILD)},b.Group.prototype.getFirstAlive=function(){return this.iterate("alive",!0,b.Group.RETURN_CHILD)},b.Group.prototype.getFirstDead=function(){return this.iterate("alive",!1,b.Group.RETURN_CHILD)},b.Group.prototype.getTop=function(){return this.children.length>0?this.children[this.children.length-1]:void 0},b.Group.prototype.getBottom=function(){return this.children.length>0?this.children[0]:void 0},b.Group.prototype.countLiving=function(){return this.iterate("alive",!0,b.Group.RETURN_TOTAL)},b.Group.prototype.countDead=function(){return this.iterate("alive",!1,b.Group.RETURN_TOTAL)},b.Group.prototype.getRandom=function(a,b){return 0===this.children.length?null:(a=a||0,b=b||this.children.length,this.game.math.getRandom(this.children,a,b))},b.Group.prototype.remove=function(a){return 0!==this.children.length?(a.events&&a.events.onRemovedFromGroup.dispatch(a,this),this.removeChild(a),this.updateZ(),this.cursor===a&&this.next(),!0):void 0},b.Group.prototype.removeAll=function(){if(0!==this.children.length){do this.children[0].events&&this.children[0].events.onRemovedFromGroup.dispatch(this.children[0],this),this.removeChild(this.children[0]);while(this.children.length>0);this.cursor=null}},b.Group.prototype.removeBetween=function(a,b){if(0!==this.children.length){if(a>b||0>a||b>this.children.length)return!1;for(var c=a;b>c;c++)this.children[c].events&&this.children[c].events.onRemovedFromGroup.dispatch(this.children[c],this),this.removeChild(this.children[c]),this.cursor===this.children[c]&&(this.cursor=null);this.updateZ()}},b.Group.prototype.destroy=function(a,b){if(null!==this.game){if("undefined"==typeof a&&(a=!0),"undefined"==typeof b&&(b=!1),a){if(this.children.length>0)do this.children[0].parent&&this.children[0].destroy(a);while(this.children.length>0)}else this.removeAll();this.cursor=null,b||(this.parent.removeChild(this),this.game=null,this.exists=!1)}},Object.defineProperty(b.Group.prototype,"total",{get:function(){return this.iterate("exists",!0,b.Group.RETURN_TOTAL)}}),Object.defineProperty(b.Group.prototype,"length",{get:function(){return this.children.length}}),Object.defineProperty(b.Group.prototype,"angle",{get:function(){return b.Math.radToDeg(this.rotation)},set:function(a){this.rotation=b.Math.degToRad(a)}}),Object.defineProperty(b.Group.prototype,"fixedToCamera",{get:function(){return!!this._cache[7]},set:function(a){a?(this._cache[7]=1,this.cameraOffset.set(this.x,this.y)):this._cache[7]=0}}),b.World=function(a){b.Group.call(this,a,null,"__world",!1),this.bounds=new b.Rectangle(0,0,a.width,a.height),this.camera=null},b.World.prototype=Object.create(b.Group.prototype),b.World.prototype.constructor=b.World,b.World.prototype.boot=function(){this.camera=new b.Camera(this.game,0,0,0,this.game.width,this.game.height),this.camera.displayObject=this,this.camera.scale=this.scale,this.game.camera=this.camera,this.game.stage.addChild(this)},b.World.prototype.setBounds=function(a,b,c,d){cwindow.outerHeight&&(this.orientation=90),this.scaleFactor=new b.Point(1,1),this.scaleFactorInversed=new b.Point(1,1),this.margin=new b.Point(0,0),this.aspectRatio=0,this.sourceAspectRatio=c/d,this.event=null,this.scaleMode=b.ScaleManager.NO_SCALE,this.fullScreenScaleMode=b.ScaleManager.NO_SCALE,this._startHeight=0,this._width=0,this._height=0;var e=this;window.addEventListener("orientationchange",function(a){return e.checkOrientation(a)},!1),window.addEventListener("resize",function(a){return e.checkResize(a)},!1),document.addEventListener("webkitfullscreenchange",function(a){return e.fullScreenChange(a)},!1),document.addEventListener("mozfullscreenchange",function(a){return e.fullScreenChange(a)},!1),document.addEventListener("fullscreenchange",function(a){return e.fullScreenChange(a)},!1)},b.ScaleManager.EXACT_FIT=0,b.ScaleManager.NO_SCALE=1,b.ScaleManager.SHOW_ALL=2,b.ScaleManager.prototype={startFullScreen:function(a){!this.isFullScreen&&this.game.device.fullscreen&&("undefined"!=typeof a&&this.game.renderType===b.CANVAS&&(this.game.stage.smoothed=a),this._width=this.width,this._height=this.height,this.game.device.fullscreenKeyboard?this.fullScreenTarget[this.game.device.requestFullscreen](Element.ALLOW_KEYBOARD_INPUT):this.fullScreenTarget[this.game.device.requestFullscreen]())},stopFullScreen:function(){this.fullScreenTarget[this.game.device.cancelFullscreen]()},fullScreenChange:function(a){this.event=a,this.isFullScreen?(this.fullScreenScaleMode===b.ScaleManager.EXACT_FIT?(this.fullScreenTarget.style.width="100%",this.fullScreenTarget.style.height="100%",this.width=window.outerWidth,this.height=window.outerHeight,this.game.input.scale.setTo(this.game.width/this.width,this.game.height/this.height),this.aspectRatio=this.width/this.height,this.scaleFactor.x=this.game.width/this.width,this.scaleFactor.y=this.game.height/this.height,this.checkResize()):this.fullScreenScaleMode===b.ScaleManager.SHOW_ALL&&(this.setShowAll(),this.refresh()),this.enterFullScreen.dispatch(this.width,this.height)):(this.fullScreenTarget.style.width=this.game.width+"px",this.fullScreenTarget.style.height=this.game.height+"px",this.width=this._width,this.height=this._height,this.game.input.scale.setTo(this.game.width/this.width,this.game.height/this.height),this.aspectRatio=this.width/this.height,this.scaleFactor.x=this.game.width/this.width,this.scaleFactor.y=this.game.height/this.height,this.leaveFullScreen.dispatch(this.width,this.height))},forceOrientation:function(a,c,d){"undefined"==typeof c&&(c=!1),this.forceLandscape=a,this.forcePortrait=c,"undefined"!=typeof d&&((null==d||this.game.cache.checkImageKey(d)===!1)&&(d="__default"),this.orientationSprite=new b.Image(this.game,this.game.width/2,this.game.height/2,PIXI.TextureCache[d]),this.orientationSprite.anchor.set(.5),this.checkOrientationState(),this.incorrectOrientation?(this.orientationSprite.visible=!0,this.game.world.visible=!1):(this.orientationSprite.visible=!1,this.game.world.visible=!0),this.game.stage.addChild(this.orientationSprite))},checkOrientationState:function(){this.incorrectOrientation?(this.forceLandscape&&window.innerWidth>window.innerHeight||this.forcePortrait&&window.innerHeight>window.innerWidth)&&(this.incorrectOrientation=!1,this.leaveIncorrectOrientation.dispatch(),this.orientationSprite&&(this.orientationSprite.visible=!1,this.game.world.visible=!0),this.scaleMode!==b.ScaleManager.NO_SCALE&&this.refresh()):(this.forceLandscape&&window.innerWidthwindow.outerHeight?90:0,this.isLandscape?this.enterLandscape.dispatch(this.orientation,!0,!1):this.enterPortrait.dispatch(this.orientation,!1,!0),this.scaleMode!==b.ScaleManager.NO_SCALE&&this.refresh(),this.checkOrientationState()},refresh:function(){if(this.game.device.iPad===!1&&this.game.device.webApp===!1&&this.game.device.desktop===!1&&(this.game.device.android&&this.game.device.chrome===!1?window.scrollTo(0,1):window.scrollTo(0,0)),null==this._check&&this.maxIterations>0){this._iterations=this.maxIterations;var a=this;this._check=window.setInterval(function(){return a.setScreenSize()},10),this.setScreenSize()}},setScreenSize:function(a){"undefined"==typeof a&&(a=!1),this.game.device.iPad===!1&&this.game.device.webApp===!1&&this.game.device.desktop===!1&&(this.game.device.android&&this.game.device.chrome===!1?window.scrollTo(0,1):window.scrollTo(0,0)),this._iterations--,(a||window.innerHeight>this._startHeight||this._iterations<0)&&(document.documentElement.style.minHeight=window.innerHeight+"px",this.incorrectOrientation===!0?this.setMaximum():this.isFullScreen?this.fullScreenScaleMode==b.ScaleManager.EXACT_FIT?this.setExactFit():this.fullScreenScaleMode==b.ScaleManager.SHOW_ALL&&this.setShowAll():this.scaleMode==b.ScaleManager.EXACT_FIT?this.setExactFit():this.scaleMode==b.ScaleManager.SHOW_ALL&&this.setShowAll(),this.setSize(),clearInterval(this._check),this._check=null)},setSize:function(){this.incorrectOrientation===!1&&(this.maxWidth&&this.width>this.maxWidth&&(this.width=this.maxWidth),this.maxHeight&&this.height>this.maxHeight&&(this.height=this.maxHeight),this.minWidth&&this.widththis.maxWidth?this.maxWidth:a,this.height=this.maxHeight&&b>this.maxHeight?this.maxHeight:b}},b.ScaleManager.prototype.constructor=b.ScaleManager,Object.defineProperty(b.ScaleManager.prototype,"isFullScreen",{get:function(){return document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement}}),Object.defineProperty(b.ScaleManager.prototype,"isPortrait",{get:function(){return 0===this.orientation||180==this.orientation}}),Object.defineProperty(b.ScaleManager.prototype,"isLandscape",{get:function(){return 90===this.orientation||-90===this.orientation}}),b.Game=function(a,c,d,e,f,g,h,i){this.id=b.GAMES.push(this)-1,this.config=null,this.physicsConfig=i,this.parent="",this.width=800,this.height=600,this.transparent=!1,this.antialias=!0,this.renderer=b.AUTO,this.renderType=b.AUTO,this.state=null,this.isBooted=!1,this.isRunning=!1,this.raf=null,this.add=null,this.make=null,this.cache=null,this.input=null,this.load=null,this.math=null,this.net=null,this.scale=null,this.sound=null,this.stage=null,this.time=null,this.tweens=null,this.world=null,this.physics=null,this.rnd=null,this.device=null,this.camera=null,this.canvas=null,this.context=null,this.debug=null,this.particles=null,this.stepping=!1,this.pendingStep=!1,this.stepCount=0,this.onPause=null,this.onResume=null,this.onBlur=null,this.onFocus=null,this._paused=!1,this._codePaused=!1,1===arguments.length&&"object"==typeof arguments[0]?this.parseConfig(arguments[0]):("undefined"!=typeof a&&(this.width=a),"undefined"!=typeof c&&(this.height=c),"undefined"!=typeof d&&(this.renderer=d,this.renderType=d),"undefined"!=typeof e&&(this.parent=e),"undefined"!=typeof g&&(this.transparent=g),"undefined"!=typeof h&&(this.antialias=h),this.rnd=new b.RandomDataGenerator([(Date.now()*Math.random()).toString()]),this.state=new b.StateManager(this,f));var j=this;return this._onBoot=function(){return j.boot()},"complete"===document.readyState||"interactive"===document.readyState?window.setTimeout(this._onBoot,0):(document.addEventListener("DOMContentLoaded",this._onBoot,!1),window.addEventListener("load",this._onBoot,!1)),this},b.Game.prototype={parseConfig:function(a){this.config=a,a.width&&(this.width=b.Utils.parseDimension(a.width,0)),a.height&&(this.height=b.Utils.parseDimension(a.height,1)),a.renderer&&(this.renderer=a.renderer,this.renderType=a.renderer),a.parent&&(this.parent=a.parent),a.transparent&&(this.transparent=a.transparent),a.antialias&&(this.antialias=a.antialias),a.physicsConfig&&(this.physicsConfig=a.physicsConfig);var c=[(Date.now()*Math.random()).toString()];a.seed&&(c=a.seed),this.rnd=new b.RandomDataGenerator(c);var d=null;a.state&&(d=a.state),this.state=new b.StateManager(this,d)},boot:function(){this.isBooted||(document.body?(document.removeEventListener("DOMContentLoaded",this._onBoot),window.removeEventListener("load",this._onBoot),this.onPause=new b.Signal,this.onResume=new b.Signal,this.onBlur=new b.Signal,this.onFocus=new b.Signal,this.isBooted=!0,this.device=new b.Device(this),this.math=b.Math,this.stage=new b.Stage(this,this.width,this.height),this.scale=new b.ScaleManager(this,this.width,this.height),this.setUpRenderer(),this.device.checkFullScreenSupport(),this.world=new b.World(this),this.add=new b.GameObjectFactory(this),this.make=new b.GameObjectCreator(this),this.cache=new b.Cache(this),this.load=new b.Loader(this),this.time=new b.Time(this),this.tweens=new b.TweenManager(this),this.input=new b.Input(this),this.sound=new b.SoundManager(this),this.physics=new b.Physics(this,this.physicsConfig),this.particles=new b.Particles(this),this.plugins=new b.PluginManager(this,this),this.net=new b.Net(this),this.debug=new b.Utils.Debug(this),this.time.boot(),this.stage.boot(),this.world.boot(),this.input.boot(),this.sound.boot(),this.state.boot(),this.debug.boot(),this.showDebugHeader(),this.isRunning=!0,this.raf=this.config&&this.config.forceSetTimeOut?new b.RequestAnimationFrame(this,this.config.forceSetTimeOut):new b.RequestAnimationFrame(this,!1),this.raf.start()):window.setTimeout(this._onBoot,20))},showDebugHeader:function(){var a=b.DEV_VERSION,c="Canvas",d="HTML Audio",e=1;if(this.renderType===b.WEBGL?(c="WebGL",e++):this.renderType==b.HEADLESS&&(c="Headless"),this.device.webAudio&&(d="WebAudio",e++),this.device.chrome){for(var f=["%c %c %c Phaser v"+a+" - "+c+" - "+d+" %c %c http://phaser.io %c %c ♥%c♥%c♥ ","background: #0cf300","background: #00bc17","color: #ffffff; background: #00711f;","background: #00bc17","background: #0cf300","background: #00bc17"],g=0;3>g;g++)f.push(e>g?"color: #ff2424; background: #fff":"color: #959595; background: #fff");console.log.apply(console,f)}else console.log("Phaser v"+a+" - Renderer: "+c+" - Audio: "+d+" - http://phaser.io") +},setUpRenderer:function(){if(this.device.trident&&(this.renderType=b.CANVAS),this.renderType===b.HEADLESS||this.renderType===b.CANVAS||this.renderType===b.AUTO&&this.device.webGL===!1){if(!this.device.canvas)throw new Error("Phaser.Game - cannot create Canvas or WebGL context, aborting.");this.renderType===b.AUTO&&(this.renderType=b.CANVAS),this.renderer=new PIXI.CanvasRenderer(this.width,this.height,this.canvas,this.transparent),this.context=this.renderer.context}else this.renderType=b.WEBGL,this.renderer=new PIXI.WebGLRenderer(this.width,this.height,this.canvas,this.transparent,this.antialias),this.context=null;this.renderType!==b.HEADLESS&&(this.stage.smoothed=this.antialias,b.Canvas.addToDOM(this.canvas,this.parent,!0),b.Canvas.setTouchAction(this.canvas))},update:function(a){this.time.update(a),this._paused||this.pendingStep?this.debug.preUpdate():(this.stepping&&(this.pendingStep=!0),this.debug.preUpdate(),this.physics.preUpdate(),this.state.preUpdate(),this.plugins.preUpdate(),this.stage.preUpdate(),this.stage.update(),this.tweens.update(),this.sound.update(),this.input.update(),this.state.update(),this.physics.update(),this.particles.update(),this.plugins.update(),this.stage.postUpdate(),this.plugins.postUpdate()),this.renderType!=b.HEADLESS&&(this.renderer.render(this.stage),this.plugins.render(),this.state.render(),this.plugins.postRender())},enableStep:function(){this.stepping=!0,this.pendingStep=!1,this.stepCount=0},disableStep:function(){this.stepping=!1,this.pendingStep=!1},step:function(){this.pendingStep=!1,this.stepCount++},destroy:function(){this.raf.stop(),this.input.destroy(),this.state.destroy(),this.physics.destroy(),this.state=null,this.cache=null,this.input=null,this.load=null,this.sound=null,this.stage=null,this.time=null,this.world=null,this.isBooted=!1},gamePaused:function(a){this._paused||(this._paused=!0,this.time.gamePaused(),this.sound.setMute(),this.onPause.dispatch(a))},gameResumed:function(a){this._paused&&!this._codePaused&&(this._paused=!1,this.time.gameResumed(),this.input.reset(),this.sound.unsetMute(),this.onResume.dispatch(a))},focusLoss:function(a){this.onBlur.dispatch(a),this.gamePaused(a)},focusGain:function(a){this.onFocus.dispatch(a),this.gameResumed(a)}},b.Game.prototype.constructor=b.Game,Object.defineProperty(b.Game.prototype,"paused",{get:function(){return this._paused},set:function(a){a===!0?this._paused===!1&&(this._paused=!0,this._codePaused=!0,this.sound.mute=!0,this.time.gamePaused(),this.onPause.dispatch(this)):this._paused&&(this._paused=!1,this._codePaused=!1,this.input.reset(),this.sound.mute=!1,this.time.gameResumed(),this.onResume.dispatch(this))}}),b.Input=function(a){this.game=a,this.hitCanvas=null,this.hitContext=null,this.moveCallback=null,this.moveCallbackContext=this,this.pollRate=0,this.disabled=!1,this.multiInputOverride=b.Input.MOUSE_TOUCH_COMBINE,this.position=null,this.speed=null,this.circle=null,this.scale=null,this.maxPointers=10,this.currentPointers=0,this.tapRate=200,this.doubleTapRate=300,this.holdRate=2e3,this.justPressedRate=200,this.justReleasedRate=200,this.recordPointerHistory=!1,this.recordRate=100,this.recordLimit=100,this.pointer1=null,this.pointer2=null,this.pointer3=null,this.pointer4=null,this.pointer5=null,this.pointer6=null,this.pointer7=null,this.pointer8=null,this.pointer9=null,this.pointer10=null,this.activePointer=null,this.mousePointer=null,this.mouse=null,this.keyboard=null,this.touch=null,this.mspointer=null,this.gamepad=null,this.onDown=null,this.onUp=null,this.onTap=null,this.onHold=null,this.interactiveItems=new b.LinkedList,this._localPoint=new b.Point,this._pollCounter=0,this._oldPosition=null,this._x=0,this._y=0},b.Input.MOUSE_OVERRIDES_TOUCH=0,b.Input.TOUCH_OVERRIDES_MOUSE=1,b.Input.MOUSE_TOUCH_COMBINE=2,b.Input.prototype={boot:function(){this.mousePointer=new b.Pointer(this.game,0),this.pointer1=new b.Pointer(this.game,1),this.pointer2=new b.Pointer(this.game,2),this.mouse=new b.Mouse(this.game),this.keyboard=new b.Keyboard(this.game),this.touch=new b.Touch(this.game),this.mspointer=new b.MSPointer(this.game),this.gamepad=new b.Gamepad(this.game),this.onDown=new b.Signal,this.onUp=new b.Signal,this.onTap=new b.Signal,this.onHold=new b.Signal,this.scale=new b.Point(1,1),this.speed=new b.Point,this.position=new b.Point,this._oldPosition=new b.Point,this.circle=new b.Circle(0,0,44),this.activePointer=this.mousePointer,this.currentPointers=0,this.hitCanvas=document.createElement("canvas"),this.hitCanvas.width=1,this.hitCanvas.height=1,this.hitContext=this.hitCanvas.getContext("2d"),this.mouse.start(),this.keyboard.start(),this.touch.start(),this.mspointer.start(),this.mousePointer.active=!0},destroy:function(){this.mouse.stop(),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=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["pointer"+b];return null},getPointerFromIdentifier:function(a){if(this.pointer1.identifier==a)return this.pointer1;if(this.pointer2.identifier==a)return this.pointer2;for(var b=3;10>=b;b++)if(this["pointer"+b]&&this["pointer"+b].identifier==a)return this["pointer"+b];return null},getLocalPosition:function(a,c,d){"undefined"==typeof d&&(d=new b.Point);var e=a.worldTransform,f=1/(e.a*e.d+e.b*-e.c);return d.setTo(e.d*f*c.x+-e.b*f*c.y+(e.ty*e.b-e.tx*e.d)*f,e.a*f*c.y+-e.c*f*c.x+(-e.ty*e.a+e.tx*e.c)*f)},hitTest:function(a,c,d){if(!a.worldVisible)return!1;if(this.getLocalPosition(a,c,this._localPoint),d.copyFrom(this._localPoint),a.hitArea&&a.hitArea.contains)return a.hitArea.contains(this._localPoint.x,this._localPoint.y)?!0:!1;if(a instanceof b.TileSprite){var e=a.width,f=a.height,g=-e*a.anchor.x;if(this._localPoint.x>g&&this._localPoint.xh&&this._localPoint.yg&&this._localPoint.xh&&this._localPoint.yi;i++)if(this.hitTest(a.children[i],c,d))return!0;return!1}},b.Input.prototype.constructor=b.Input,Object.defineProperty(b.Input.prototype,"x",{get:function(){return this._x},set:function(a){this._x=Math.floor(a)}}),Object.defineProperty(b.Input.prototype,"y",{get:function(){return this._y},set:function(a){this._y=Math.floor(a)}}),Object.defineProperty(b.Input.prototype,"pollLocked",{get:function(){return this.pollRate>0&&this._pollCounter=a;a++)this["pointer"+a]&&this["pointer"+a].active&&this.currentPointers++;return this.currentPointers}}),Object.defineProperty(b.Input.prototype,"worldX",{get:function(){return this.game.camera.view.x+this.x}}),Object.defineProperty(b.Input.prototype,"worldY",{get:function(){return this.game.camera.view.y+this.y}}),b.Key=function(a,c){this.game=a,this.event=null,this.isDown=!1,this.isUp=!0,this.altKey=!1,this.ctrlKey=!1,this.shiftKey=!1,this.timeDown=0,this.duration=0,this.timeUp=-2500,this.repeats=0,this.keyCode=c,this.onDown=new b.Signal,this.onHoldCallback=null,this.onHoldContext=null,this.onUp=new b.Signal},b.Key.prototype={update:function(){this.isDown&&(this.duration=this.game.time.now-this.timeDown,this.repeats++,this.onHoldCallback&&this.onHoldCallback.call(this.onHoldContext,this))},processKeyDown:function(a){this.event=a,this.isDown||(this.altKey=a.altKey,this.ctrlKey=a.ctrlKey,this.shiftKey=a.shiftKey,this.isDown=!0,this.isUp=!1,this.timeDown=this.game.time.now,this.duration=0,this.repeats=0,this.onDown.dispatch(this))},processKeyUp:function(a){this.event=a,this.isUp||(this.isDown=!1,this.isUp=!0,this.timeUp=this.game.time.now,this.duration=this.game.time.now-this.timeDown,this.onUp.dispatch(this))},reset:function(){this.isDown=!1,this.isUp=!0,this.timeUp=this.game.time.now,this.duration=this.game.time.now-this.timeDown},justPressed:function(a){return"undefined"==typeof a&&(a=2500),this.isDown&&this.duration=this.game.input.holdRate&&((this.game.input.multiInputOverride==b.Input.MOUSE_OVERRIDES_TOUCH||this.game.input.multiInputOverride==b.Input.MOUSE_TOUCH_COMBINE||this.game.input.multiInputOverride==b.Input.TOUCH_OVERRIDES_MOUSE&&0===this.game.input.currentPointers)&&this.game.input.onHold.dispatch(this),this._holdSent=!0),this.game.input.recordPointerHistory&&this.game.time.now>=this._nextDrop&&(this._nextDrop=this.game.time.now+this.game.input.recordRate,this._history.push({x:this.position.x,y:this.position.y}),this._history.length>this.game.input.recordLimit&&this._history.shift()))},move:function(a,c){if(!this.game.input.pollLocked){if("undefined"==typeof c&&(c=!1),"undefined"!=typeof a.button&&(this.button=a.button),this.clientX=a.clientX,this.clientY=a.clientY,this.pageX=a.pageX,this.pageY=a.pageY,this.screenX=a.screenX,this.screenY=a.screenY,this.x=(this.pageX-this.game.stage.offset.x)*this.game.input.scale.x,this.y=(this.pageY-this.game.stage.offset.y)*this.game.input.scale.y,this.position.setTo(this.x,this.y),this.circle.x=this.x,this.circle.y=this.y,(this.game.input.multiInputOverride==b.Input.MOUSE_OVERRIDES_TOUCH||this.game.input.multiInputOverride==b.Input.MOUSE_TOUCH_COMBINE||this.game.input.multiInputOverride==b.Input.TOUCH_OVERRIDES_MOUSE&&0===this.game.input.currentPointers)&&(this.game.input.activePointer=this,this.game.input.x=this.x,this.game.input.y=this.y,this.game.input.position.setTo(this.game.input.x,this.game.input.y),this.game.input.circle.x=this.game.input.x,this.game.input.circle.y=this.game.input.y),this.game.paused)return this;if(this.game.input.moveCallback&&this.game.input.moveCallback.call(this.game.input.moveCallbackContext,this,this.x,this.y),null!==this.targetObject&&this.targetObject.isDragged===!0)return this.targetObject.update(this)===!1&&(this.targetObject=null),this;if(this._highestRenderOrderID=Number.MAX_SAFE_INTEGER,this._highestRenderObject=null,this._highestInputPriorityID=-1,this.game.input.interactiveItems.total>0){var d=this.game.input.interactiveItems.next;do d.validForInput(this._highestInputPriorityID,this._highestRenderOrderID)&&(!c&&d.checkPointerOver(this)||c&&d.checkPointerDown(this))&&(this._highestRenderOrderID=d.sprite._cache[3],this._highestInputPriorityID=d.priorityID,this._highestRenderObject=d),d=d.next;while(null!=d)}return null===this._highestRenderObject?this.targetObject&&(this.targetObject._pointerOutHandler(this),this.targetObject=null):null===this.targetObject?(this.targetObject=this._highestRenderObject,this._highestRenderObject._pointerOverHandler(this)):this.targetObject===this._highestRenderObject?this._highestRenderObject.update(this)===!1&&(this.targetObject=null):(this.targetObject._pointerOutHandler(this),this.targetObject=this._highestRenderObject,this.targetObject._pointerOverHandler(this)),this}},leave:function(a){this.withinGame=!1,this.move(a,!1)},stop:function(a){if(this._stateReset)return void a.preventDefault();if(this.timeUp=this.game.time.now,(this.game.input.multiInputOverride==b.Input.MOUSE_OVERRIDES_TOUCH||this.game.input.multiInputOverride==b.Input.MOUSE_TOUCH_COMBINE||this.game.input.multiInputOverride==b.Input.TOUCH_OVERRIDES_MOUSE&&0===this.game.input.currentPointers)&&(this.game.input.onUp.dispatch(this,a),this.duration>=0&&this.duration<=this.game.input.tapRate&&(this.timeUp-this.previousTapTime0&&(this.active=!1),this.withinGame=!1,this.isDown=!1,this.isUp=!0,this.isMouse===!1&&this.game.input.currentPointers--,this.game.input.interactiveItems.total>0){var c=this.game.input.interactiveItems.next;do c&&c._releasedHandler(this),c=c.next;while(null!=c)}return this.targetObject&&this.targetObject._releasedHandler(this),this.targetObject=null,this},justPressed:function(a){return a=a||this.game.input.justPressedRate,this.isDown===!0&&this.timeDown+a>this.game.time.now},justReleased:function(a){return a=a||this.game.input.justReleasedRate,this.isUp===!0&&this.timeUp+a>this.game.time.now},reset:function(){this.isMouse===!1&&(this.active=!1),this.identifier=null,this.isDown=!1,this.isUp=!0,this.totalTouches=0,this._holdSent=!1,this._history.length=0,this._stateReset=!0,this.targetObject&&this.targetObject._releasedHandler(this),this.targetObject=null}},b.Pointer.prototype.constructor=b.Pointer,Object.defineProperty(b.Pointer.prototype,"duration",{get:function(){return this.isUp?-1:this.game.time.now-this.timeDown}}),Object.defineProperty(b.Pointer.prototype,"worldX",{get:function(){return this.game.world.camera.x+this.x}}),Object.defineProperty(b.Pointer.prototype,"worldY",{get:function(){return this.game.world.camera.y+this.y}}),b.Touch=function(a){this.game=a,this.disabled=!1,this.callbackContext=this.game,this.touchStartCallback=null,this.touchMoveCallback=null,this.touchEndCallback=null,this.touchEnterCallback=null,this.touchLeaveCallback=null,this.touchCancelCallback=null,this.preventDefault=!0,this.event=null,this._onTouchStart=null,this._onTouchMove=null,this._onTouchEnd=null,this._onTouchEnter=null,this._onTouchLeave=null,this._onTouchCancel=null,this._onTouchMove=null},b.Touch.prototype={start:function(){if(null===this._onTouchStart){var a=this;this.game.device.touch&&(this._onTouchStart=function(b){return a.onTouchStart(b)},this._onTouchMove=function(b){return a.onTouchMove(b)},this._onTouchEnd=function(b){return a.onTouchEnd(b)},this._onTouchEnter=function(b){return a.onTouchEnter(b)},this._onTouchLeave=function(b){return a.onTouchLeave(b)},this._onTouchCancel=function(b){return a.onTouchCancel(b)},this.game.canvas.addEventListener("touchstart",this._onTouchStart,!1),this.game.canvas.addEventListener("touchmove",this._onTouchMove,!1),this.game.canvas.addEventListener("touchend",this._onTouchEnd,!1),this.game.canvas.addEventListener("touchenter",this._onTouchEnter,!1),this.game.canvas.addEventListener("touchleave",this._onTouchLeave,!1),this.game.canvas.addEventListener("touchcancel",this._onTouchCancel,!1))}},consumeDocumentTouches:function(){this._documentTouchMove=function(a){a.preventDefault()},document.addEventListener("touchmove",this._documentTouchMove,!1)},onTouchStart:function(a){if(this.event=a,this.touchStartCallback&&this.touchStartCallback.call(this.callbackContext,a),!this.game.input.disabled&&!this.disabled){this.preventDefault&&a.preventDefault();for(var b=0;b0&&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].isDown===!1&&this.game.time.now-this._buttons[a].timeUpd;d++)this._pointerData[d]={id:d,x:0,y:0,isDown:!1,isUp:!1,isOver:!1,isOut:!1,timeOver:0,timeOut:0,timeDown:0,timeUp:0,downDuration:0,isDragged:!1};this.snapOffset=new b.Point,this.enabled=!0,this.sprite.events&&null===this.sprite.events.onInputOver&&(this.sprite.events.onInputOver=new b.Signal,this.sprite.events.onInputOut=new b.Signal,this.sprite.events.onInputDown=new b.Signal,this.sprite.events.onInputUp=new b.Signal,this.sprite.events.onDragStart=new b.Signal,this.sprite.events.onDragStop=new b.Signal)}return this.sprite},reset:function(){this.enabled=!1;for(var a=0;10>a;a++)this._pointerData[a]={id:a,x:0,y:0,isDown:!1,isUp:!1,isOver:!1,isOut:!1,timeOver:0,timeOut:0,timeDown:0,timeUp:0,downDuration:0,isDragged:!1}},stop:function(){this.enabled!==!1&&(this.enabled=!1,this.game.input.interactiveItems.remove(this))},destroy:function(){this.enabled&&(this._setHandCursor&&(this.game.canvas.style.cursor="default",this._setHandCursor=!1),this.enabled=!1,this.game.input.interactiveItems.remove(this),this._pointerData.length=0,this.boundsRect=null,this.boundsSprite=null,this.sprite=null)},validForInput:function(a,b){return 0===this.sprite.scale.x||0===this.sprite.scale.y?!1:this.pixelPerfectClick||this.pixelPerfectOver?!0:this.priorityID>a||this.priorityID===a&&this.sprite._cache[3]b;b++)if(this._pointerData[b].isOver)return!0}return!1},pointerOut:function(a){if(this.enabled){if("undefined"!=typeof a)return this._pointerData[a].isOut;for(var b=0;10>b;b++)if(this._pointerData[b].isOut)return!0}return!1},pointerTimeOver:function(a){return a=a||0,this._pointerData[a].timeOver},pointerTimeOut:function(a){return a=a||0,this._pointerData[a].timeOut},pointerDragged:function(a){return a=a||0,this._pointerData[a].isDragged},checkPointerDown:function(a){return this.enabled===!1||this.sprite.visible===!1||this.sprite.parent.visible===!1?!1:this.game.input.hitTest(this.sprite,a,this._tempPoint)?this.pixelPerfectClick?this.checkPixel(this._tempPoint.x,this._tempPoint.y):!0:!1},checkPointerOver:function(a){return this.enabled===!1||this.sprite.visible===!1||this.sprite.parent.visible===!1?!1:this.game.input.hitTest(this.sprite,a,this._tempPoint)?this.pixelPerfectOver?this.checkPixel(this._tempPoint.x,this._tempPoint.y):!0:!1},checkPixel:function(a,b,c){if(this.sprite.texture.baseTexture.source){if(this.game.input.hitContext.clearRect(0,0,1,1),null===a&&null===b){this.game.input.getLocalPosition(this.sprite,c,this._tempPoint);var a=this._tempPoint.x,b=this._tempPoint.y}0!==this.sprite.anchor.x&&(a-=-this.sprite.texture.frame.width*this.sprite.anchor.x),0!==this.sprite.anchor.y&&(b-=-this.sprite.texture.frame.height*this.sprite.anchor.y),a+=this.sprite.texture.frame.x,b+=this.sprite.texture.frame.y,this.game.input.hitContext.drawImage(this.sprite.texture.baseTexture.source,a,b,1,1,0,0,1,1);var d=this.game.input.hitContext.getImageData(0,0,1,1);if(d.data[3]>=this.pixelPerfectAlpha)return!0}return!1},update:function(a){return null!==this.sprite?this.enabled&&this.sprite.visible&&this.sprite.parent.visible?this.draggable&&this._draggedPointerID==a.id?this.updateDrag(a):this._pointerData[a.id].isOver===!0?this.checkPointerOver(a)?(this._pointerData[a.id].x=a.x-this.sprite.x,this._pointerData[a.id].y=a.y-this.sprite.y,!0):(this._pointerOutHandler(a),!1):void 0:(this._pointerOutHandler(a),!1):void 0},_pointerOverHandler:function(a){null!==this.sprite&&this._pointerData[a.id].isOver===!1&&(this._pointerData[a.id].isOver=!0,this._pointerData[a.id].isOut=!1,this._pointerData[a.id].timeOver=this.game.time.now,this._pointerData[a.id].x=a.x-this.sprite.x,this._pointerData[a.id].y=a.y-this.sprite.y,this.useHandCursor&&this._pointerData[a.id].isDragged===!1&&(this.game.canvas.style.cursor="pointer",this._setHandCursor=!1),this.sprite.events.onInputOver.dispatch(this.sprite,a))},_pointerOutHandler:function(a){null!==this.sprite&&(this._pointerData[a.id].isOver=!1,this._pointerData[a.id].isOut=!0,this._pointerData[a.id].timeOut=this.game.time.now,this.useHandCursor&&this._pointerData[a.id].isDragged===!1&&(this.game.canvas.style.cursor="default",this._setHandCursor=!1),this.sprite&&this.sprite.events&&this.sprite.events.onInputOut.dispatch(this.sprite,a))},_touchedHandler:function(a){if(null!==this.sprite){if(this._pointerData[a.id].isDown===!1&&this._pointerData[a.id].isOver===!0){if(this.pixelPerfectClick&&!this.checkPixel(null,null,a))return;this._pointerData[a.id].isDown=!0,this._pointerData[a.id].isUp=!1,this._pointerData[a.id].timeDown=this.game.time.now,this.sprite.events.onInputDown.dispatch(this.sprite,a),this.draggable&&this.isDragged===!1&&this.startDrag(a),this.bringToTop&&this.sprite.bringToTop()}return this.consumePointerEvent}},_releasedHandler:function(a){null!==this.sprite&&this._pointerData[a.id].isDown&&a.isUp&&(this._pointerData[a.id].isDown=!1,this._pointerData[a.id].isUp=!0,this._pointerData[a.id].timeUp=this.game.time.now,this._pointerData[a.id].downDuration=this._pointerData[a.id].timeUp-this._pointerData[a.id].timeDown,this.checkPointerOver(a)?this.sprite.events.onInputUp.dispatch(this.sprite,a,!0):(this.sprite.events.onInputUp.dispatch(this.sprite,a,!1),this.useHandCursor&&(this.game.canvas.style.cursor="default",this._setHandCursor=!1)),this.draggable&&this.isDragged&&this._draggedPointerID==a.id&&this.stopDrag(a))},updateDrag:function(a){return a.isUp?(this.stopDrag(a),!1):(this.sprite.fixedToCamera?(this.allowHorizontalDrag&&(this.sprite.cameraOffset.x=a.x+this._dragPoint.x+this.dragOffset.x),this.allowVerticalDrag&&(this.sprite.cameraOffset.y=a.y+this._dragPoint.y+this.dragOffset.y),this.boundsRect&&this.checkBoundsRect(),this.boundsSprite&&this.checkBoundsSprite(),this.snapOnDrag&&(this.sprite.cameraOffset.x=Math.round((this.sprite.cameraOffset.x-this.snapOffsetX%this.snapX)/this.snapX)*this.snapX+this.snapOffsetX%this.snapX,this.sprite.cameraOffset.y=Math.round((this.sprite.cameraOffset.y-this.snapOffsetY%this.snapY)/this.snapY)*this.snapY+this.snapOffsetY%this.snapY)):(this.allowHorizontalDrag&&(this.sprite.x=a.x+this._dragPoint.x+this.dragOffset.x),this.allowVerticalDrag&&(this.sprite.y=a.y+this._dragPoint.y+this.dragOffset.y),this.boundsRect&&this.checkBoundsRect(),this.boundsSprite&&this.checkBoundsSprite(),this.snapOnDrag&&(this.sprite.x=Math.round((this.sprite.x-this.snapOffsetX%this.snapX)/this.snapX)*this.snapX+this.snapOffsetX%this.snapX,this.sprite.y=Math.round((this.sprite.y-this.snapOffsetY%this.snapY)/this.snapY)*this.snapY+this.snapOffsetY%this.snapY)),!0)},justOver:function(a,b){return a=a||0,b=b||500,this._pointerData[a].isOver&&this.overDuration(a)a;a++)this._pointerData[a].isDragged=!1;this.draggable=!1,this.isDragged=!1,this._draggedPointerID=-1},startDrag:function(a){if(this.isDragged=!0,this._draggedPointerID=a.id,this._pointerData[a.id].isDragged=!0,this.sprite.fixedToCamera)this.dragFromCenter?(this.sprite.centerOn(a.x,a.y),this._dragPoint.setTo(this.sprite.cameraOffset.x-a.x,this.sprite.cameraOffset.y-a.y)):this._dragPoint.setTo(this.sprite.cameraOffset.x-a.x,this.sprite.cameraOffset.y-a.y);else if(this.dragFromCenter){var b=this.sprite.getBounds();this.sprite.x=a.x+(this.sprite.x-b.centerX),this.sprite.y=a.y+(this.sprite.y-b.centerY),this._dragPoint.setTo(this.sprite.x-a.x,this.sprite.y-a.y)}else this._dragPoint.setTo(this.sprite.x-a.x,this.sprite.y-a.y);this.updateDrag(a),this.bringToTop&&this.sprite.bringToTop(),this.sprite.events.onDragStart.dispatch(this.sprite,a)},stopDrag:function(a){this.isDragged=!1,this._draggedPointerID=-1,this._pointerData[a.id].isDragged=!1,this.snapOnRelease&&(this.sprite.fixedToCamera?(this.sprite.cameraOffset.x=Math.round((this.sprite.cameraOffset.x-this.snapOffsetX%this.snapX)/this.snapX)*this.snapX+this.snapOffsetX%this.snapX,this.sprite.cameraOffset.y=Math.round((this.sprite.cameraOffset.y-this.snapOffsetY%this.snapY)/this.snapY)*this.snapY+this.snapOffsetY%this.snapY):(this.sprite.x=Math.round((this.sprite.x-this.snapOffsetX%this.snapX)/this.snapX)*this.snapX+this.snapOffsetX%this.snapX,this.sprite.y=Math.round((this.sprite.y-this.snapOffsetY%this.snapY)/this.snapY)*this.snapY+this.snapOffsetY%this.snapY)),this.sprite.events.onDragStop.dispatch(this.sprite,a),this.checkPointerOver(a)===!1&&this._pointerOutHandler(a)},setDragLock:function(a,b){"undefined"==typeof a&&(a=!0),"undefined"==typeof b&&(b=!0),this.allowHorizontalDrag=a,this.allowVerticalDrag=b},enableSnap:function(a,b,c,d,e,f){"undefined"==typeof c&&(c=!0),"undefined"==typeof d&&(d=!1),"undefined"==typeof e&&(e=0),"undefined"==typeof f&&(f=0),this.snapX=a,this.snapY=b,this.snapOffsetX=e,this.snapOffsetY=f,this.snapOnDrag=c,this.snapOnRelease=d},disableSnap:function(){this.snapOnDrag=!1,this.snapOnRelease=!1},checkBoundsRect:function(){this.sprite.fixedToCamera?(this.sprite.cameraOffset.xthis.boundsRect.right&&(this.sprite.cameraOffset.x=this.boundsRect.right-this.sprite.width),this.sprite.cameraOffset.ythis.boundsRect.bottom&&(this.sprite.cameraOffset.y=this.boundsRect.bottom-this.sprite.height)):(this.sprite.xthis.boundsRect.right&&(this.sprite.x=this.boundsRect.right-this.sprite.width),this.sprite.ythis.boundsRect.bottom&&(this.sprite.y=this.boundsRect.bottom-this.sprite.height))},checkBoundsSprite:function(){this.sprite.fixedToCamera&&this.boundsSprite.fixedToCamera?(this.sprite.cameraOffset.xthis.boundsSprite.camerOffset.x+this.boundsSprite.width&&(this.sprite.cameraOffset.x=this.boundsSprite.camerOffset.x+this.boundsSprite.width-this.sprite.width),this.sprite.cameraOffset.ythis.boundsSprite.camerOffset.y+this.boundsSprite.height&&(this.sprite.cameraOffset.y=this.boundsSprite.camerOffset.y+this.boundsSprite.height-this.sprite.height)):(this.sprite.xthis.boundsSprite.x+this.boundsSprite.width&&(this.sprite.x=this.boundsSprite.x+this.boundsSprite.width-this.sprite.width),this.sprite.ythis.boundsSprite.y+this.boundsSprite.height&&(this.sprite.y=this.boundsSprite.y+this.boundsSprite.height-this.sprite.height))}},b.InputHandler.prototype.constructor=b.InputHandler,b.Events=function(a){this.parent=a,this.onAddedToGroup=new b.Signal,this.onRemovedFromGroup=new b.Signal,this.onKilled=new b.Signal,this.onRevived=new b.Signal,this.onOutOfBounds=new b.Signal,this.onEnterBounds=new b.Signal,this.onInputOver=null,this.onInputOut=null,this.onInputDown=null,this.onInputUp=null,this.onDragStart=null,this.onDragStop=null,this.onAnimationStart=null,this.onAnimationComplete=null,this.onAnimationLoop=null},b.Events.prototype={destroy:function(){this.parent=null,this.onAddedToGroup.dispose(),this.onRemovedFromGroup.dispose(),this.onKilled.dispose(),this.onRevived.dispose(),this.onOutOfBounds.dispose(),this.onInputOver&&(this.onInputOver.dispose(),this.onInputOut.dispose(),this.onInputDown.dispose(),this.onInputUp.dispose(),this.onDragStart.dispose(),this.onDragStop.dispose()),this.onAnimationStart&&(this.onAnimationStart.dispose(),this.onAnimationComplete.dispose(),this.onAnimationLoop.dispose())}},b.Events.prototype.constructor=b.Events,b.GameObjectFactory=function(a){this.game=a,this.world=this.game.world},b.GameObjectFactory.prototype={existing:function(a){return this.world.add(a)},image:function(a,c,d,e,f){return"undefined"==typeof f&&(f=this.world),f.add(new b.Image(this.game,a,c,d,e))},sprite:function(a,b,c,d,e){return"undefined"==typeof e&&(e=this.world),e.create(a,b,c,d)},tween:function(a){return this.game.tweens.create(a)},group:function(a,c,d,e,f){return new b.Group(this.game,a,c,d,e,f)},physicsGroup:function(a,c,d,e){return new b.Group(this.game,c,d,e,!0,a)},spriteBatch:function(a,c,d){return"undefined"==typeof c&&(c="group"),"undefined"==typeof d&&(d=!1),new b.SpriteBatch(this.game,a,c,d)},audio:function(a,b,c,d){return this.game.sound.add(a,b,c,d)},sound:function(a,b,c,d){return this.game.sound.add(a,b,c,d)},tileSprite:function(a,c,d,e,f,g,h){return"undefined"==typeof h&&(h=this.world),h.add(new b.TileSprite(this.game,a,c,d,e,f,g))},text:function(a,c,d,e,f){return"undefined"==typeof f&&(f=this.world),f.add(new b.Text(this.game,a,c,d,e))},button:function(a,c,d,e,f,g,h,i,j,k){return"undefined"==typeof k&&(k=this.world),k.add(new b.Button(this.game,a,c,d,e,f,g,h,i,j))},graphics:function(a,c,d){return"undefined"==typeof d&&(d=this.world),d.add(new b.Graphics(this.game,a,c))},emitter:function(a,c,d){return this.game.particles.add(new b.Particles.Arcade.Emitter(this.game,a,c,d))},retroFont:function(a,c,d,e,f,g,h,i,j){return new b.RetroFont(this.game,a,c,d,e,f,g,h,i,j)},bitmapText:function(a,c,d,e,f,g){return"undefined"==typeof g&&(g=this.world),g.add(new b.BitmapText(this.game,a,c,d,e,f))},tilemap:function(a,c,d,e,f){return new b.Tilemap(this.game,a,c,d,e,f)},renderTexture:function(a,c,d,e){("undefined"==typeof d||""===d)&&(d=this.game.rnd.uuid()),"undefined"==typeof e&&(e=!1);var f=new b.RenderTexture(this.game,a,c,d);return e&&this.game.cache.addRenderTexture(d,f),f},bitmapData:function(a,c,d,e){"undefined"==typeof e&&(e=!1),("undefined"==typeof d||""===d)&&(d=this.game.rnd.uuid());var f=new b.BitmapData(this.game,d,a,c);return e&&this.game.cache.addBitmapData(d,f),f},filter:function(a){var c=Array.prototype.splice.call(arguments,1),a=new b.Filter[a](this.game);return a.init.apply(a,c),a}},b.GameObjectFactory.prototype.constructor=b.GameObjectFactory,b.GameObjectCreator=function(a){this.game=a,this.world=this.game.world},b.GameObjectCreator.prototype={image:function(a,c,d,e){return new b.Image(this.game,a,c,d,e)},sprite:function(a,c,d,e){return new b.Sprite(this.game,a,c,d,e)},tween:function(a){return new b.Tween(a,this.game)},group:function(a,c,d,e,f){return new b.Group(this.game,null,c,d,e,f)},spriteBatch:function(a,c,d){return"undefined"==typeof c&&(c="group"),"undefined"==typeof d&&(d=!1),new b.SpriteBatch(this.game,a,c,d)},audio:function(a,b,c,d){return this.game.sound.add(a,b,c,d)},sound:function(a,b,c,d){return this.game.sound.add(a,b,c,d)},tileSprite:function(a,c,d,e,f,g){return new b.TileSprite(this.game,a,c,d,e,f,g)},text:function(a,c,d,e){return new b.Text(this.game,a,c,d,e)},button:function(a,c,d,e,f,g,h,i,j){return new b.Button(this.game,a,c,d,e,f,g,h,i,j)},graphics:function(a,c){return new b.Graphics(this.game,a,c)},emitter:function(a,c,d){return new b.Particles.Arcade.Emitter(this.game,a,c,d)},retroFont:function(a,c,d,e,f,g,h,i,j){return new b.RetroFont(this.game,a,c,d,e,f,g,h,i,j)},bitmapText:function(a,c,d,e,f){return new b.BitmapText(this.game,a,c,d,e,f)},tilemap:function(a,c,d,e,f){return new b.Tilemap(this.game,a,c,d,e,f)},renderTexture:function(a,c,d,e){("undefined"==typeof d||""===d)&&(d=this.game.rnd.uuid()),"undefined"==typeof e&&(e=!1);var f=new b.RenderTexture(this.game,a,c,d);return e&&this.game.cache.addRenderTexture(d,f),f},bitmapData:function(a,c,d,e){"undefined"==typeof e&&(e=!1),("undefined"==typeof d||""===d)&&(d=this.game.rnd.uuid());var f=new b.BitmapData(this.game,d,a,c);return e&&this.game.cache.addBitmapData(d,f),f},filter:function(a){var c=Array.prototype.splice.call(arguments,1),a=new b.Filter[a](this.game);return a.init.apply(a,c),a}},b.GameObjectCreator.prototype.constructor=b.GameObjectCreator,b.BitmapData=function(a,c,d,e){"undefined"==typeof d&&(d=100),"undefined"==typeof e&&(e=100),this.game=a,this.key=c,this.width=d,this.height=e,this.canvas=b.Canvas.create(d,e,"",!0),this.context=this.canvas.getContext("2d"),this.ctx=this.context,this.imageData=this.context.getImageData(0,0,d,e),this.pixels=this.imageData.data.buffer?this.imageData.data.buffer:this.imageData.data,this.baseTexture=new PIXI.BaseTexture(this.canvas),this.texture=new PIXI.Texture(this.baseTexture),this.textureFrame=new b.Frame(0,0,0,d,e,"bitmapData",a.rnd.uuid()),this.type=b.BITMAPDATA,this.dirty=!1},b.BitmapData.prototype={add:function(a){if(Array.isArray(a))for(var b=0;b=0&&a<=this.width&&b>=0&&b<=this.height&&(this.pixels[b*this.width+a]=f<<24|e<<16|d<<8|c,this.context.putImageData(this.imageData,0,0),this.dirty=!0)},setPixel:function(a,b,c,d,e){this.setPixel32(a,b,c,d,e,255)},getPixel:function(a,b){return a>=0&&a<=this.width&&b>=0&&b<=this.height?this.data32[b*this.width+a]:void 0},getPixel32:function(a,b){return a>=0&&a<=this.width&&b>=0&&b<=this.height?this.data32[b*this.width+a]:void 0},getPixels:function(a){return this.context.getImageData(a.x,a.y,a.width,a.height)},copyPixels:function(a,b,c,d){"string"==typeof a&&(a=this.game.cache.getImage(a)),a&&this.context.drawImage(a,b.x,b.y,b.width,b.height,c,d,b.width,b.height)},draw:function(a,b,c){"string"==typeof a&&(a=this.game.cache.getImage(a)),a&&this.context.drawImage(a,0,0,a.width,a.height,b,c,a.width,a.height)},alphaMask:function(a,b){var c=this.context.globalCompositeOperation;"string"==typeof b&&(b=this.game.cache.getImage(b)),b&&this.context.drawImage(b,0,0),this.context.globalCompositeOperation="source-atop","string"==typeof a&&(a=this.game.cache.getImage(a)),a&&this.context.drawImage(a,0,0),this.context.globalCompositeOperation=c},render:function(){this.game.renderType===b.WEBGL&&this.dirty&&(PIXI.updateWebGLTexture(this.baseTexture,this.game.renderer.gl),this.dirty=!1)}},b.BitmapData.prototype.constructor=b.BitmapData,b.Sprite=function(a,c,d,e,f){c=c||0,d=d||0,e=e||null,f=f||null,this.game=a,this.name="",this.type=b.SPRITE,this.z=0,this.events=new b.Events(this),this.animations=new b.AnimationManager(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.body=null,this.health=1,this.lifespan=0,this.checkWorldBounds=!1,this.outOfBoundsKill=!1,this.debug=!1,this.cameraOffset=new b.Point,this._cache=[0,0,0,0,1,0,1,0],this._bounds=new b.Rectangle},b.Sprite.prototype=Object.create(PIXI.Sprite.prototype),b.Sprite.prototype.constructor=b.Sprite,b.Sprite.prototype.preUpdate=function(){if(1===this._cache[4]&&this.exists)return this.world.setTo(this.parent.position.x+this.position.x,this.parent.position.y+this.position.y),this.worldTransform.tx=this.world.x,this.worldTransform.ty=this.world.y,this._cache[0]=this.world.x,this._cache[1]=this.world.y,this._cache[2]=this.rotation,this.body&&this.body.preUpdate(),this._cache[4]=0,!1; +if(this._cache[0]=this.world.x,this._cache[1]=this.world.y,this._cache[2]=this.rotation,!this.exists||!this.parent.exists)return this._cache[3]=-1,!1;if(this.lifespan>0&&(this.lifespan-=this.game.time.elapsed,this.lifespan<=0))return this.kill(),!1;if((this.autoCull||this.checkWorldBounds)&&this._bounds.copyFrom(this.getBounds()),this.autoCull&&(this.renderable=this.game.world.camera.screenView.intersects(this._bounds)),this.checkWorldBounds)if(1===this._cache[5]&&this.game.world.bounds.intersects(this._bounds))this._cache[5]=0,this.events.onEnterBounds.dispatch(this);else if(0===this._cache[5]&&!this.game.world.bounds.intersects(this._bounds)&&(this._cache[5]=1,this.events.onOutOfBounds.dispatch(this),this.outOfBoundsKill))return this.kill(),!1;this.world.setTo(this.game.camera.x+this.worldTransform.tx,this.game.camera.y+this.worldTransform.ty),this.visible&&(this._cache[3]=this.game.stage.currentRenderOrderID++),this.animations.update(),this.body&&this.body.preUpdate();for(var a=0,b=this.children.length;b>a;a++)this.children[a].preUpdate();return!0},b.Sprite.prototype.update=function(){},b.Sprite.prototype.postUpdate=function(){this.key instanceof b.BitmapData&&this.key.render(),this.exists&&this.body&&this.body.postUpdate(),1===this._cache[7]&&(this.position.x=(this.game.camera.view.x+this.cameraOffset.x)/this.game.camera.scale.x,this.position.y=(this.game.camera.view.y+this.cameraOffset.y)/this.game.camera.scale.y);for(var a=0,c=this.children.length;c>a;a++)this.children[a].postUpdate()},b.Sprite.prototype.loadTexture=function(a,c){return c=c||0,a instanceof b.RenderTexture?(this.key=a.key,void this.setTexture(a)):a instanceof b.BitmapData?(this.key=a,void this.setTexture(a.texture)):a instanceof PIXI.Texture?(this.key=a,void this.setTexture(a)):null===a||"undefined"==typeof a?(this.key="__default",void this.setTexture(PIXI.TextureCache[this.key])):"string"!=typeof a||this.game.cache.checkImageKey(a)?this.game.cache.isSpriteSheet(a)?(this.key=a,this.animations.loadFrameData(this.game.cache.getFrameData(a)),"string"==typeof c?this.frameName=c:this.frame=c,void 0):(this.key=a,void this.setTexture(PIXI.TextureCache[a])):(this.key="__missing",void this.setTexture(PIXI.TextureCache[this.key]))},b.Sprite.prototype.crop=function(a){if("undefined"==typeof a||null===a)this.texture.hasOwnProperty("sourceWidth")&&this.texture.setFrame(new b.Rectangle(0,0,this.texture.sourceWidth,this.texture.sourceHeight));else if(this.texture instanceof PIXI.Texture){var c={};b.Utils.extend(!0,c,this.texture),c.sourceWidth=c.width,c.sourceHeight=c.height,c.frame=a,c.width=a.width,c.height=a.height,this.texture=c,this.texture.updateFrame=!0,PIXI.Texture.frameUpdates.push(this.texture)}else this.texture.setFrame(a)},b.Sprite.prototype.revive=function(a){return"undefined"==typeof a&&(a=1),this.alive=!0,this.exists=!0,this.visible=!0,this.health=a,this.events&&this.events.onRevived.dispatch(this),this},b.Sprite.prototype.kill=function(){return this.alive=!1,this.exists=!1,this.visible=!1,this.events&&this.events.onKilled.dispatch(this),this},b.Sprite.prototype.destroy=function(a){if(null!==this.game){"undefined"==typeof a&&(a=!0),this.parent&&(this.parent instanceof b.Group?this.parent.remove(this):this.parent.removeChild(this)),this.input&&this.input.destroy(),this.animations&&this.animations.destroy(),this.body&&this.body.destroy(),this.events&&this.events.destroy();var c=this.children.length;if(a)for(;c--;)this.children[c].destroy(a);else for(;c--;)this.removeChild(this.children[c]);this.alive=!1,this.exists=!1,this.visible=!1,this.filters=null,this.mask=null,this.game=null}},b.Sprite.prototype.damage=function(a){return this.alive&&(this.health-=a,this.health<=0&&this.kill()),this},b.Sprite.prototype.reset=function(a,b,c){return"undefined"==typeof c&&(c=1),this.world.setTo(a,b),this.position.x=a,this.position.y=b,this.alive=!0,this.exists=!0,this.visible=!0,this.renderable=!0,this._outOfBoundsFired=!1,this.health=c,this.body&&this.body.reset(a,b,!1,!1),this._cache[4]=1,this},b.Sprite.prototype.bringToTop=function(){return this.parent&&this.parent.bringToTop(this),this},b.Sprite.prototype.play=function(a,b,c,d){return this.animations?this.animations.play(a,b,c,d):void 0},b.Sprite.prototype.overlap=function(a){return b.Rectangle.intersects(this.getBounds(),a.getBounds())},Object.defineProperty(b.Sprite.prototype,"angle",{get:function(){return b.Math.wrapAngle(b.Math.radToDeg(this.rotation))},set:function(a){this.rotation=b.Math.degToRad(b.Math.wrapAngle(a))}}),Object.defineProperty(b.Sprite.prototype,"deltaX",{get:function(){return this.world.x-this._cache[0]}}),Object.defineProperty(b.Sprite.prototype,"deltaY",{get:function(){return this.world.y-this._cache[1]}}),Object.defineProperty(b.Sprite.prototype,"deltaZ",{get:function(){return this.rotation-this._cache[2]}}),Object.defineProperty(b.Sprite.prototype,"inWorld",{get:function(){return this.game.world.bounds.intersects(this.getBounds())}}),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,"exists",{get:function(){return!!this._cache[6]},set:function(a){a?(this._cache[6]=1,this.body&&this.body.type===b.Physics.P2JS&&this.body.addToWorld(),this.visible=!0):(this._cache[6]=0,this.body&&this.body.type===b.Physics.P2JS&&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)}}),Object.defineProperty(b.Sprite.prototype,"x",{get:function(){return this.position.x},set:function(a){this.position.x=a,this.body&&this.body.type===b.Physics.ARCADE&&2===this.body.phase&&(this.body._reset=1)}}),Object.defineProperty(b.Sprite.prototype,"y",{get:function(){return this.position.y},set:function(a){this.position.y=a,this.body&&this.body.type===b.Physics.ARCADE&&2===this.body.phase&&(this.body._reset=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.z=0,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=[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.render(),1===this._cache[7]&&(this.position.x=(this.game.camera.view.x+this.cameraOffset.x)/this.game.camera.scale.x,this.position.y=(this.game.camera.view.y+this.cameraOffset.y)/this.game.camera.scale.y);for(var a=0,c=this.children.length;c>a;a++)this.children[a].postUpdate()},b.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,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"==typeof a||null===a)this.texture.hasOwnProperty("sourceWidth")&&this.texture.setFrame(new b.Rectangle(0,0,this.texture.sourceWidth,this.texture.sourceHeight));else if(this.texture instanceof PIXI.Texture){var c={};b.Utils.extend(!0,c,this.texture),c.sourceWidth=c.width,c.sourceHeight=c.height,c.frame=a,c.width=a.width,c.height=a.height,this.texture=c,this.texture.updateFrame=!0,PIXI.Texture.frameUpdates.push(this.texture)}else this.texture.setFrame(a)},b.Image.prototype.revive=function(){return this.alive=!0,this.exists=!0,this.visible=!0,this.events&&this.events.onRevived.dispatch(this),this},b.Image.prototype.kill=function(){return this.alive=!1,this.exists=!1,this.visible=!1,this.events&&this.events.onKilled.dispatch(this),this},b.Image.prototype.destroy=function(a){if(null!==this.game){"undefined"==typeof a&&(a=!0),this.parent&&(this.parent instanceof b.Group?this.parent.remove(this):this.parent.removeChild(this)),this.events&&this.events.destroy(),this.input&&this.input.destroy();var c=this.children.length;if(a)for(;c--;)this.children[c].destroy(a);else for(;c--;)this.removeChild(this.children[c]);this.alive=!1,this.exists=!1,this.visible=!1,this.filters=null,this.mask=null,this.game=null}},b.Image.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},b.Image.prototype.bringToTop=function(){return this.parent&&this.parent.bringToTop(this),this},Object.defineProperty(b.Image.prototype,"angle",{get:function(){return b.Math.wrapAngle(b.Math.radToDeg(this.rotation))},set:function(a){this.rotation=b.Math.degToRad(b.Math.wrapAngle(a))}}),Object.defineProperty(b.Image.prototype,"deltaX",{get:function(){return this.world.x-this._cache[0]}}),Object.defineProperty(b.Image.prototype,"deltaY",{get:function(){return this.world.y-this._cache[1]}}),Object.defineProperty(b.Image.prototype,"deltaZ",{get:function(){return this.rotation-this._cache[2]}}),Object.defineProperty(b.Image.prototype,"inWorld",{get:function(){return this.game.world.bounds.intersects(this.getBounds())}}),Object.defineProperty(b.Image.prototype,"inCamera",{get:function(){return this.game.world.camera.screenView.intersects(this.getBounds())}}),Object.defineProperty(b.Image.prototype,"frame",{get:function(){return this._frame},set:function(a){if(a!==this.frame&&this.game.cache.isSpriteSheet(this.key)){var b=this.game.cache.getFrameData(this.key);b&&aa;a++)this.children[a].preUpdate();return!0},b.TileSprite.prototype.update=function(){},b.TileSprite.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.TileSprite.prototype.autoScroll=function(a,b){this._scroll.set(a,b)},b.TileSprite.prototype.stopScroll=function(){this._scroll.set(0,0)},b.TileSprite.prototype.loadTexture=function(a,c){return c=c||0,a instanceof b.RenderTexture?(this.key=a.key,void this.setTexture(a)):a instanceof b.BitmapData?(this.key=a,void this.setTexture(a.texture)):a instanceof PIXI.Texture?(this.key=a,void this.setTexture(a)):null===a||"undefined"==typeof a?(this.key="__default",void this.setTexture(PIXI.TextureCache[this.key])):"string"!=typeof a||this.game.cache.checkImageKey(a)?this.game.cache.isSpriteSheet(a)?(this.key=a,this.animations.loadFrameData(this.game.cache.getFrameData(a)),"string"==typeof c?this.frameName=c:this.frame=c,void 0):(this.key=a,void this.setTexture(PIXI.TextureCache[a])):(this.key="__missing",void this.setTexture(PIXI.TextureCache[this.key]))},b.TileSprite.prototype.destroy=function(a){if(null!==this.game){"undefined"==typeof a&&(a=!0),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}},b.TileSprite.prototype.play=function(a,b,c,d){return this.animations.play(a,b,c,d)},b.TileSprite.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.TileSprite.prototype,"angle",{get:function(){return b.Math.wrapAngle(b.Math.radToDeg(this.rotation))},set:function(a){this.rotation=b.Math.degToRad(b.Math.wrapAngle(a))}}),Object.defineProperty(b.TileSprite.prototype,"frame",{get:function(){return this.animations.frame},set:function(a){a!==this.animations.frame&&(this.animations.frame=a)}}),Object.defineProperty(b.TileSprite.prototype,"frameName",{get:function(){return this.animations.frameName},set:function(a){a!==this.animations.frameName&&(this.animations.frameName=a)}}),Object.defineProperty(b.TileSprite.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.TileSprite.prototype,"exists",{get:function(){return!!this._cache[6]},set:function(a){a?(this._cache[6]=1,this.body&&this.body.type===b.Physics.P2JS&&this.body.addToWorld(),this.visible=!0):(this._cache[6]=0,this.body&&this.body.type===b.Physics.P2JS&&(this.body.safeRemove=!0),this.visible=!1)}}),Object.defineProperty(b.TileSprite.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.TileSprite.prototype,"x",{get:function(){return this.position.x},set:function(a){this.position.x=a,this.body&&this.body.type===b.Physics.ARCADE&&2===this.body.phase&&(this.body._reset=1)}}),Object.defineProperty(b.TileSprite.prototype,"y",{get:function(){return this.position.y},set:function(a){this.position.y=a,this.body&&this.body.type===b.Physics.ARCADE&&2===this.body.phase&&(this.body._reset=1)}}),b.Text=function(a,c,d,e,f){c=c||0,d=d||0,e=e||" ",f=f||{},e=0===e.length?" ":e.toString(),this.game=a,this.exists=!0,this.name="",this.type=b.TEXT,this.z=0,this.world=new b.Point(c,d),this._text=e,this._font="",this._fontSize=32,this._fontWeight="normal",this._lineSpacing=0,this.events=new b.Events(this),this.input=null,this.cameraOffset=new b.Point,this.setStyle(f),PIXI.Text.call(this,e,this.style),this.position.set(c,d),this._cache=[0,0,0,0,1,0,1,0]},b.Text.prototype=Object.create(PIXI.Text.prototype),b.Text.prototype.constructor=b.Text,b.Text.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.renderOrderID=-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.Text.prototype.update=function(){},b.Text.prototype.postUpdate=function(){1===this._cache[7]&&(this.position.x=(this.game.camera.view.x+this.cameraOffset.x)/this.game.camera.scale.x,this.position.y=(this.game.camera.view.y+this.cameraOffset.y)/this.game.camera.scale.y);for(var a=0,b=this.children.length;b>a;a++)this.children[a].postUpdate()},b.Text.prototype.destroy=function(a){if(null!==this.game){"undefined"==typeof a&&(a=!0),this.parent&&(this.parent instanceof b.Group?this.parent.remove(this):this.parent.removeChild(this)),this.texture.destroy(),this.canvas.parentNode?this.canvas.parentNode.removeChild(this.canvas):(this.canvas=null,this.context=null);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}},b.Text.prototype.setShadow=function(a,b,c,d){this.style.shadowOffsetX=a||0,this.style.shadowOffsetY=b||0,this.style.shadowColor=c||"rgba(0,0,0,0)",this.style.shadowBlur=d||0,this.dirty=!0},b.Text.prototype.setStyle=function(a){a=a||{},a.font=a.font||"bold 20pt Arial",a.fill=a.fill||"black",a.align=a.align||"left",a.stroke=a.stroke||"black",a.strokeThickness=a.strokeThickness||0,a.wordWrap=a.wordWrap||!1,a.wordWrapWidth=a.wordWrapWidth||100,a.shadowOffsetX=a.shadowOffsetX||0,a.shadowOffsetY=a.shadowOffsetY||0,a.shadowColor=a.shadowColor||"rgba(0,0,0,0)",a.shadowBlur=a.shadowBlur||0,this.style=a,this.dirty=!0},b.Text.prototype.updateText=function(){this.context.font=this.style.font;var a=this.text;this.style.wordWrap&&(a=this.runWordWrap(this.text));for(var b=a.split(/(?:\r\n|\r|\n)/),c=[],d=0,e=0;ee?(g>0&&(b+="\n"),b+=f[g]+" ",e=this.style.wordWrapWidth-h):(e-=i,b+=f[g]+" ")}d?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~",b.RetroFont.TEXT_SET2=" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ",b.RetroFont.TEXT_SET3="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ",b.RetroFont.TEXT_SET4="ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789",b.RetroFont.TEXT_SET5="ABCDEFGHIJKLMNOPQRSTUVWXYZ.,/() '!?-*:0123456789",b.RetroFont.TEXT_SET6="ABCDEFGHIJKLMNOPQRSTUVWXYZ!?:;0123456789\"(),-.' ",b.RetroFont.TEXT_SET7="AGMSY+:4BHNTZ!;5CIOU.?06DJPV,(17EKQW\")28FLRX-'39",b.RetroFont.TEXT_SET8="0123456789 .ABCDEFGHIJKLMNOPQRSTUVWXYZ",b.RetroFont.TEXT_SET9="ABCDEFGHIJKLMNOPQRSTUVWXYZ()-0123456789.:,'\"?!",b.RetroFont.TEXT_SET10="ABCDEFGHIJKLMNOPQRSTUVWXYZ",b.RetroFont.TEXT_SET11="ABCDEFGHIJKLMNOPQRSTUVWXYZ.,\"-+!?()':;0123456789",b.RetroFont.prototype.setFixedWidth=function(a,b){"undefined"==typeof b&&(b="left"),this.fixedWidth=a,this.align=b},b.RetroFont.prototype.setText=function(a,b,c,d,e,f){this.multiLine=b||!1,this.customSpacingX=c||0,this.customSpacingY=d||0,this.align=e||"left",this.autoUpperCase=f?!1:!0,a.length>0&&(this.text=a)},b.RetroFont.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.RetroFont.prototype.buildRetroFontText=function(){var a=0,c=0;if(this.multiLine){var d=this._text.split("\n");this.fixedWidth>0?this.resize(this.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;ea&&(a=0),this.pasteLine(d[e],a,c,this.customSpacingX),c+=this.characterHeight+this.customSpacingY}}else{switch(this.fixedWidth>0?this.resize(this.fixedWidth,this.characterHeight):this.resize(this._text.length*(this.characterWidth+this.customSpacingX),this.characterHeight),this.textureBuffer.clear(),this.align){case b.RetroFont.ALIGN_LEFT:a=0;break;case b.RetroFont.ALIGN_RIGHT:a=this.width-this._text.length*(this.characterWidth+this.customSpacingX);break;case b.RetroFont.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.RetroFont.prototype.pasteLine=function(a,c,d,e){for(var f=new b.Point,g=0;g=0&&(this.stamp.frame=this.grabData[a.charCodeAt(g)],f.set(c,d),this.render(this.stamp,f,!1),c+=this.characterWidth+e,c>this.width))break},b.RetroFont.prototype.getLongestLine=function(){var a=0;if(this._text.length>0)for(var b=this._text.split("\n"),c=0;ca&&(a=b[c].length);return a},b.RetroFont.prototype.removeUnsupportedCharacters=function(a){for(var b="",c=0;c=0||!a&&"\n"===d)&&(b=b.concat(d))}return b},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())}}),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.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},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},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.msInterpolationMode="nearest-neighbor",a},setImageRenderingBicubic:function(a){return a.style["image-rendering"]="auto",a.style.msInterpolationMode="bicubic",a}},b.Device=function(a){this.game=a,this.desktop=!1,this.iOS=!1,this.cocoonJS=!1,this.ejecta=!1,this.android=!1,this.chromeOS=!1,this.linux=!1,this.macOS=!1,this.windows=!1,this.windowsPhone=!1,this.canvas=!1,this.file=!1,this.fileSystem=!1,this.localStorage=!1,this.webGL=!1,this.worker=!1,this.touch=!1,this.mspointer=!1,this.css3D=!1,this.pointerLock=!1,this.typedArray=!1,this.vibration=!1,this.getUserMedia=!1,this.quirksMode=!1,this.arora=!1,this.chrome=!1,this.epiphany=!1,this.firefox=!1,this.ie=!1,this.ieVersion=0,this.trident=!1,this.tridentVersion=0,this.mobileSafari=!1,this.midori=!1,this.opera=!1,this.safari=!1,this.webApp=!1,this.silk=!1,this.audioData=!1,this.webAudio=!1,this.ogg=!1,this.opus=!1,this.mp3=!1,this.wav=!1,this.m4a=!1,this.webm=!1,this.iPhone=!1,this.iPhone4=!1,this.iPad=!1,this.pixelRatio=0,this.littleEndian=!1,this.fullscreen=!1,this.requestFullscreen="",this.cancelFullscreen="",this.fullscreenKeyboard=!1,this._checkAudio(),this._checkBrowser(),this._checkCSS3D(),this._checkDevice(),this._checkFeatures(),this._checkOS()},b.Device.prototype={_checkOS:function(){var a=navigator.userAgent;/Android/.test(a)?this.android=!0:/CrOS/.test(a)?this.chromeOS=!0:/iP[ao]d|iPhone/i.test(a)?this.iOS=!0:/Linux/.test(a)?this.linux=!0:/Mac OS/.test(a)?this.macOS=!0:/Windows/.test(a)&&(this.windows=!0,/Windows Phone/i.test(a)&&(this.windowsPhone=!0)),(this.windows||this.macOS||this.linux&&this.silk===!1)&&(this.desktop=!0),(this.windowsPhone||/Windows NT/i.test(a)&&/Touch/i.test(a))&&(this.desktop=!1)},_checkFeatures:function(){this.canvas=!!window.CanvasRenderingContext2D||this.cocoonJS;try{this.localStorage=!!localStorage.getItem}catch(a){this.localStorage=!1}this.file=!!(window.File&&window.FileReader&&window.FileList&&window.Blob),this.fileSystem=!!window.requestFileSystem,this.webGL=function(){try{var a=document.createElement("canvas");return!!window.WebGLRenderingContext&&(a.getContext("webgl")||a.getContext("experimental-webgl"))}catch(b){return!1}}(),this.webGL=null===this.webGL||this.webGL===!1?!1:!0,this.worker=!!window.Worker,("ontouchstart"in document.documentElement||window.navigator.maxTouchPoints&&window.navigator.maxTouchPoints>1)&&(this.touch=!0),(window.navigator.msPointerEnabled||window.navigator.pointerEnabled)&&(this.mspointer=!0),this.pointerLock="pointerLockElement"in document||"mozPointerLockElement"in document||"webkitPointerLockElement"in document,this.quirksMode="CSS1Compat"===document.compatMode?!1:!0,this.getUserMedia=!!(navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia)},checkFullScreenSupport:function(){for(var a=["requestFullscreen","requestFullScreen","webkitRequestFullscreen","webkitRequestFullScreen","msRequestFullscreen","msRequestFullScreen","mozRequestFullScreen","mozRequestFullscreen"],b=0;b0,this.typedArray=!0):(this.littleEndian=!1,this.typedArray=!1),navigator.vibrate=navigator.vibrate||navigator.webkitVibrate||navigator.mozVibrate||navigator.msVibrate,navigator.vibrate&&(this.vibration=!0)},_checkCSS3D:function(){var a,b=document.createElement("p"),c={webkitTransform:"-webkit-transform",OTransform:"-o-transform",msTransform:"-ms-transform",MozTransform:"-moz-transform",transform:"transform"};document.body.insertBefore(b,null);for(var d in c)void 0!==b.style[d]&&(b.style[d]="translate3d(1px,1px,1px)",a=window.getComputedStyle(b).getPropertyValue(c[d]));document.body.removeChild(b),this.css3D=void 0!==a&&a.length>0&&"none"!==a},canPlayAudio:function(a){return"mp3"==a&&this.mp3?!0:"ogg"==a&&(this.ogg||this.opus)?!0:"m4a"==a&&this.m4a?!0:"wav"==a&&this.wav?!0:"webm"==a&&this.webm?!0:!1},isConsoleOpen:function(){return window.console&&window.console.firebug?!0:window.console&&(console.profile(),console.profileEnd(),console.clear&&console.clear(),console.profiles)?console.profiles.length>0:!1}},b.Device.prototype.constructor=b.Device,b.RequestAnimationFrame=function(a,b){"undefined"==typeof b&&(b=!1),this.game=a,this.isRunning=!1,this.forceSetTimeOut=b;for(var c=["ms","moz","webkit","o"],d=0;da},fuzzyGreaterThan:function(a,b,c){return"undefined"==typeof c&&(c=1e-4),a>b-c},fuzzyCeil:function(a,b){return"undefined"==typeof b&&(b=1e-4),Math.ceil(a-b)},fuzzyFloor:function(a,b){return"undefined"==typeof b&&(b=1e-4),Math.floor(a+b)},average:function(){for(var a=[],b=0;b0?Math.floor(a):Math.ceil(a)},shear:function(a){return a%1},snapTo:function(a,b,c){return"undefined"==typeof c&&(c=0),0===b?a:(a-=c,a=b*Math.round(a/b),c+a)},snapToFloor:function(a,b,c){return"undefined"==typeof c&&(c=0),0===b?a:(a-=c,a=b*Math.floor(a/b),c+a)},snapToCeil:function(a,b,c){return"undefined"==typeof c&&(c=0),0===b?a:(a-=c,a=b*Math.ceil(a/b),c+a)},snapToInArray:function(a,b,c){if("undefined"==typeof c&&(c=!0),c&&b.sort(),a=f-a?f:e},roundTo:function(a,b,c){"undefined"==typeof b&&(b=0),"undefined"==typeof c&&(c=10);var d=Math.pow(c,-b);return Math.round(a*d)/d},floorTo:function(a,b,c){"undefined"==typeof b&&(b=0),"undefined"==typeof c&&(c=10);var d=Math.pow(c,-b);return Math.floor(a*d)/d},ceilTo:function(a,b,c){"undefined"==typeof b&&(b=0),"undefined"==typeof c&&(c=10);var d=Math.pow(c,-b);return Math.ceil(a*d)/d},interpolateFloat:function(a,b,c){return(b-a)*c+a},angleBetween:function(a,b,c,d){return Math.atan2(c-a,d-b)},angleBetweenPoints:function(a,b){return Math.atan2(b.x-a.x,b.y-a.y)},reverseAngle:function(a){return this.normalizeAngle(a+Math.PI,!0)},normalizeAngle:function(a){return a%=2*Math.PI,a>=0?a:a+2*Math.PI},normalizeLatitude:function(a){return Math.max(-90,Math.min(90,a))},normalizeLongitude:function(a){return a%360==180?180:(a%=360,-180>a?a+360:a>180?a-360:a)},nearestAngleBetween:function(a,b,c){"undefined"==typeof c&&(c=!0);var d=c?Math.PI:180;return a=this.normalizeAngle(a,c),b=this.normalizeAngle(b,c),-d/2>a&&b>d/2&&(a+=2*d),-d/2>b&&a>d/2&&(b+=2*d),b-a},interpolateAngles:function(a,b,c,d,e){return"undefined"==typeof d&&(d=!0),"undefined"==typeof e&&(e=null),a=this.normalizeAngle(a,d),b=this.normalizeAngleToAnother(b,a,d),"function"==typeof e?e(c,a,b-a,1):this.interpolateFloat(a,b,c)},chanceRoll:function(a){return"undefined"==typeof a&&(a=50),0>=a?!1:a>=100?!0:100*Math.random()>=a?!1:!0},numberArray:function(a,b){for(var c=[],d=a;b>=d;d++)c.push(d);return c},maxAdd:function(a,b,c){return a+=b,a>c&&(a=c),a},minSub:function(a,b,c){return a-=b,c>a&&(a=c),a},wrap:function(a,b,c){var d=c-b;if(0>=d)return 0;var e=(a-b)%d;return 0>e&&(e+=d),e+b},wrapValue:function(a,b,c){var d;return a=Math.abs(a),b=Math.abs(b),c=Math.abs(c),d=(a+b)%c},randomSign:function(){return Math.random()>.5?1:-1},isOdd:function(a){return 1&a},isEven:function(a){return 1&a?!1:!0},min:function(){if(1===arguments.length&&"object"==typeof arguments[0])var a=arguments[0];else var a=arguments;for(var b=1,c=0,d=a.length;d>b;b++)a[b]b;b++)a[b]>a[c]&&(c=b);return a[c]},minProperty:function(a){if(2===arguments.length&&"object"==typeof arguments[1])var b=arguments[1];else var b=arguments.slice(1);for(var c=1,d=0,e=b.length;e>c;c++)b[c][a]c;c++)b[c][a]>b[d][a]&&(d=c);return b[d][a]},wrapAngle:function(a,b){var c=b?Math.PI/180:1;return this.wrap(a,-180*c,180*c)},angleLimit:function(a,b,c){var d=a;return a>c?d=c:b>a&&(d=b),d},linearInterpolation:function(a,b){var c=a.length-1,d=c*b,e=Math.floor(d);return 0>b?this.linear(a[0],a[1],d):b>1?this.linear(a[c],a[c-1],c-d):this.linear(a[e],a[e+1>c?c:e+1],d-e)},bezierInterpolation:function(a,b){for(var c=0,d=a.length-1,e=0;d>=e;e++)c+=Math.pow(1-b,d-e)*Math.pow(b,e)*a[e]*this.bernstein(d,e);return c},catmullRomInterpolation:function(a,b){var c=a.length-1,d=c*b,e=Math.floor(d);return a[0]===a[c]?(0>b&&(e=Math.floor(d=c*(1+b))),this.catmullRom(a[(e-1+c)%c],a[e],a[(e+1)%c],a[(e+2)%c],d-e)):0>b?a[0]-(this.catmullRom(a[0],a[0],a[1],a[1],-d)-a[0]):b>1?a[c]-(this.catmullRom(a[c],a[c],a[c-1],a[c-1],d-c)-a[c]):this.catmullRom(a[e?e-1:0],a[e],a[e+1>c?c:e+1],a[e+2>c?c:e+2],d-e)},linear:function(a,b,c){return(b-a)*c+a},bernstein:function(a,b){return this.factorial(a)/this.factorial(b)/this.factorial(a-b)},catmullRom:function(a,b,c,d,e){var f=.5*(c-a),g=.5*(d-b),h=e*e,i=e*h;return(2*b-2*c+f+g)*i+(-3*b+3*c-2*f-g)*h+f*e+b},difference:function(a,b){return Math.abs(a-b)},getRandom:function(a,b,c){if("undefined"==typeof b&&(b=0),"undefined"==typeof c&&(c=0),null!=a){var d=c;if((0===d||d>a.length-b)&&(d=a.length-b),d>0)return a[b+Math.floor(Math.random()*d)]}return null},removeRandom:function(a,b,c){if("undefined"==typeof b&&(b=0),"undefined"==typeof c&&(c=0),null!=a){var d=c;if((0===d||d>a.length-b)&&(d=a.length-b),d>0){var e=b+Math.floor(Math.random()*d),f=a.splice(e,1);return f[0]}}return null},floor:function(a){var b=0|a;return a>0?b:b!=a?b-1:b},ceil:function(a){var b=0|a;return a>0&&b!=a?b+1:b},sinCosGenerator:function(a,b,c,d){"undefined"==typeof b&&(b=1),"undefined"==typeof c&&(c=1),"undefined"==typeof d&&(d=1);for(var e=b,f=c,g=d*Math.PI/a,h=[],i=[],j=0;a>j;j++)f-=e*g,e+=f*g,h[j]=f,i[j]=e;return{sin:i,cos:h,length:a}},shift:function(a){var b=a.shift();return a.push(b),b},shuffleArray:function(a){for(var b=a.length-1;b>0;b--){var c=Math.floor(Math.random()*(b+1)),d=a[b];a[b]=a[c],a[c]=d}return a},distance:function(a,b,c,d){var e=a-c,f=b-d;return Math.sqrt(e*e+f*f)},distancePow:function(a,b,c,d,e){return"undefined"==typeof e&&(e=2),Math.sqrt(Math.pow(c-a,e)+Math.pow(d-b,e))},distanceRounded:function(a,c,d,e){return Math.round(b.Math.distance(a,c,d,e))},clamp:function(a,b,c){return b>a?b:a>c?c:a},clampBottom:function(a,b){return b>a?b:a},within:function(a,b,c){return Math.abs(a-b)<=c},mapLinear:function(a,b,c,d,e){return d+(a-b)*(e-d)/(c-b)},smoothstep:function(a,b,c){return b>=a?0:a>=c?1:(a=(a-b)/(c-b),a*a*(3-2*a))},smootherstep:function(a,b,c){return b>=a?0:a>=c?1:(a=(a-b)/(c-b),a*a*a*(a*(6*a-15)+10))},sign:function(a){return 0>a?-1:a>0?1:0},degToRad:function(){var a=Math.PI/180;return function(b){return b*a}}(),radToDeg:function(){var a=180/Math.PI;return function(b){return b*a}}()},b.RandomDataGenerator=function(a){"undefined"==typeof a&&(a=[]),this.c=1,this.s0=0,this.s1=0,this.s2=0,this.sow(a)},b.RandomDataGenerator.prototype={rnd:function(){var a=2091639*this.s0+2.3283064365386963e-10*this.c;return this.c=0|a,this.s0=this.s1,this.s1=this.s2,this.s2=a-this.c,this.s2},sow:function(a){"undefined"==typeof a&&(a=[]),this.s0=this.hash(" "),this.s1=this.hash(this.s0),this.s2=this.hash(this.s1),this.c=1;for(var b,c=0;b=a[c++];)this.s0-=this.hash(b),this.s0+=~~(this.s0<0),this.s1-=this.hash(b),this.s1+=~~(this.s1<0),this.s2-=this.hash(b),this.s2+=~~(this.s2<0)},hash:function(a){var b,c,d;for(d=4022871197,a=a.toString(),c=0;c>>0,b-=d,b*=d,d=b>>>0,b-=d,d+=4294967296*b;return 2.3283064365386963e-10*(d>>>0)},integer:function(){return 4294967296*this.rnd.apply(this)},frac:function(){return this.rnd.apply(this)+1.1102230246251565e-16*(2097152*this.rnd.apply(this)|0)},real:function(){return this.integer()+this.frac()},integerInRange:function(a,b){return Math.round(this.realInRange(a,b))},realInRange:function(a,b){return this.frac()*(b-a)+a},normal:function(){return 1-2*this.frac()},uuid:function(){var a="",b="";for(b=a="";a++<36;b+=~a%5|3*a&4?(15^a?8^this.frac()*(20^a?16:4):4).toString(16):"-");return b},pick:function(a){return a[this.integerInRange(0,a.length-1)]},weightedPick:function(a){return a[~~(Math.pow(this.frac(),2)*(a.length-1))]},timestamp:function(a,b){return this.realInRange(a||9466848e5,b||1577862e6)},angle:function(){return this.integerInRange(-180,180)}},b.RandomDataGenerator.prototype.constructor=b.RandomDataGenerator,b.QuadTree=function(a,b,c,d,e,f,g){this.maxObjects=10,this.maxLevels=4,this.level=0,this.bounds={},this.objects=[],this.nodes=[],this.reset(a,b,c,d,e,f,g)},b.QuadTree.prototype={reset:function(a,b,c,d,e,f,g){this.maxObjects=e||10,this.maxLevels=f||4,this.level=g||0,this.bounds={x:Math.round(a),y:Math.round(b),width:c,height:d,subWidth:Math.floor(c/2),subHeight:Math.floor(d/2),right:Math.round(a)+Math.floor(c/2),bottom:Math.round(b)+Math.floor(d/2)},this.objects.length=0,this.nodes.length=0},populate:function(a){a.forEach(this.populateHandler,this,!0)},populateHandler:function(a){a.body&&a.exists&&this.insert(a.body)},split:function(){this.level++,this.nodes[0]=new b.QuadTree(this.bounds.right,this.bounds.y,this.bounds.subWidth,this.bounds.subHeight,this.maxObjects,this.maxLevels,this.level),this.nodes[1]=new b.QuadTree(this.bounds.x,this.bounds.y,this.bounds.subWidth,this.bounds.subHeight,this.maxObjects,this.maxLevels,this.level),this.nodes[2]=new b.QuadTree(this.bounds.x,this.bounds.bottom,this.bounds.subWidth,this.bounds.subHeight,this.maxObjects,this.maxLevels,this.level),this.nodes[3]=new b.QuadTree(this.bounds.right,this.bounds.bottom,this.bounds.subWidth,this.bounds.subHeight,this.maxObjects,this.maxLevels,this.level)},insert:function(a){var b,c=0;if(null!=this.nodes[0]&&(b=this.getIndex(a),-1!==b))return void this.nodes[b].insert(a);if(this.objects.push(a),this.objects.length>this.maxObjects&&this.levelthis.bounds.bottom&&(b=2):a.x>this.bounds.right&&(a.ythis.bounds.bottom&&(b=3)),b},retrieve:function(a){var b=this.objects,c=this.getIndex(a.body);return this.nodes[0]&&(-1!==c?b=b.concat(this.nodes[c].retrieve(a)):(b=b.concat(this.nodes[0].retrieve(a)),b=b.concat(this.nodes[1].retrieve(a)),b=b.concat(this.nodes[2].retrieve(a)),b=b.concat(this.nodes[3].retrieve(a)))),b},clear:function(){this.objects.length=0;for(var a=this.nodes.length;a--;)this.nodes[a].clear(),this.nodes.splice(a,1);this.nodes.length=0}},b.QuadTree.prototype.constructor=b.QuadTree,b.Net=function(a){this.game=a},b.Net.prototype={getHostName:function(){return window.location&&window.location.hostname?window.location.hostname:null},checkDomainName:function(a){return-1!==window.location.hostname.indexOf(a)},updateQueryString:function(a,b,c,d){"undefined"==typeof c&&(c=!1),("undefined"==typeof d||""===d)&&(d=window.location.href);var e="",f=new RegExp("([?|&])"+a+"=.*?(&|#|$)(.*)","gi");if(f.test(d))e="undefined"!=typeof b&&null!==b?d.replace(f,"$1"+a+"="+b+"$2$3"):d.replace(f,"$1$3").replace(/(&|\?)$/,"");else if("undefined"!=typeof b&&null!==b){var g=-1!==d.indexOf("?")?"&":"?",h=d.split("#");d=h[0]+g+a+"="+b,h[1]&&(d+="#"+h[1]),e=d}else e=d;return c?void(window.location.href=e):e},getQueryString:function(a){"undefined"==typeof a&&(a="");var b={},c=location.search.substring(1).split("&");for(var d in c){var e=c[d].split("=");if(e.length>1){if(a&&a==this.decodeURI(e[0]))return this.decodeURI(e[1]);b[this.decodeURI(e[0])]=this.decodeURI(e[1])}}return b},decodeURI:function(a){return decodeURIComponent(a.replace(/\+/g," "))}},b.Net.prototype.constructor=b.Net,b.TweenManager=function(a){this.game=a,this._tweens=[],this._add=[],this.game.onPause.add(this._pauseAll,this),this.game.onResume.add(this._resumeAll,this)},b.TweenManager.prototype={getAll:function(){return this._tweens},removeAll:function(){for(var a=0;aa;)this._tweens[a].update(this.game.time.now)?a++:(this._tweens.splice(a,1),b--);return this._add.length>0&&(this._tweens=this._tweens.concat(this._add),this._add.length=0),!0},isTweening:function(a){return this._tweens.some(function(b){return b._object===a})},_pauseAll:function(){for(var a=this._tweens.length-1;a>=0;a--)this._tweens[a]._pause()},_resumeAll:function(){for(var a=this._tweens.length-1;a>=0;a--)this._tweens[a]._resume()},pauseAll:function(){for(var a=this._tweens.length-1;a>=0;a--)this._tweens[a].pause()},resumeAll:function(){for(var a=this._tweens.length-1;a>=0;a--)this._tweens[a].resume(!0)}},b.TweenManager.prototype.constructor=b.TweenManager,b.Tween=function(a,c,d){this._object=a,this.game=c,this._manager=d,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._repeat=0,this._yoyo=!1,this._reversed=!1,this._delayTime=0,this._startTime=null,this._easingFunction=b.Easing.Linear.None,this._interpolationFunction=b.Math.linearInterpolation,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onUpdateCallback=null,this._onUpdateCallbackContext=null,this._paused=!1,this._pausedTime=0,this._codePaused=!1,this.pendingDelete=!1,this.onStart=new b.Signal,this.onLoop=new b.Signal,this.onComplete=new b.Signal,this.isRunning=!1},b.Tween.prototype={to:function(a,b,c,d,e,f,g){b=b||1e3,c=c||null,d=d||!1,e=e||0,f=f||0,g=g||!1;var h;return this._parent?(h=this._manager.create(this._object),this._lastChild.chain(h),this._lastChild=h):(h=this,this._parent=this,this._lastChild=this),h._repeat=f,h._duration=b,h._valuesEnd=a,null!==c&&(h._easingFunction=c),e>0&&(h._delayTime=e),h._yoyo=g,d?this.start():this},start:function(){if(null!==this.game&&null!==this._object){this._manager.add(this),this.isRunning=!0,this._onStartCallbackFired=!1,this._startTime=this.game.time.now+this._delayTime;for(var a in this._valuesEnd){if(Array.isArray(this._valuesEnd[a])){if(0===this._valuesEnd[a].length)continue;this._valuesEnd[a]=[this._object[a]].concat(this._valuesEnd[a])}this._valuesStart[a]=this._object[a],Array.isArray(this._valuesStart[a])||(this._valuesStart[a]*=1),this._valuesStartRepeat[a]=this._valuesStart[a]||0}return this}},generateData:function(a,b){if(null===this.game||null===this._object)return null;this._startTime=0;for(var c in this._valuesEnd){if(Array.isArray(this._valuesEnd[c])){if(0===this._valuesEnd[c].length)continue;this._valuesEnd[c]=[this._object[c]].concat(this._valuesEnd[c])}this._valuesStart[c]=this._object[c],Array.isArray(this._valuesStart[c])||(this._valuesStart[c]*=1),this._valuesStartRepeat[c]=this._valuesStart[c]||0}for(var d=0,e=Math.floor(a*(this._duration/1e3)),f=this._duration/e,g=[];e--;){var c,h=(d-this._startTime)/this._duration;h=h>1?1:h;var i=this._easingFunction(h),j={};for(c in this._valuesEnd){var k=this._valuesStart[c]||0,l=this._valuesEnd[c];l instanceof Array?j[c]=this._interpolationFunction(l,i):("string"==typeof l&&(l=k+parseFloat(l,10)),"number"==typeof l&&(j[c]=k+(l-k)*i))}g.push(j),d+=f}if(this._yoyo){var m=g.slice();m.reverse(),g=g.concat(m)}return"undefined"!=typeof b?b=b.concat(g):g},stop:function(){return this.isRunning=!1,this._onUpdateCallback=null,this._manager.remove(this),this},delay:function(a){return this._delayTime=a,this},repeat:function(a){return this._repeat=a,this},yoyo:function(a){return this._yoyo=a,this},easing:function(a){return this._easingFunction=a,this},interpolation:function(a){return this._interpolationFunction=a,this},chain:function(){return this._chainedTweens=arguments,this},loop:function(){return this._lastChild.chain(this),this},onUpdateCallback:function(a,b){return this._onUpdateCallback=a,this._onUpdateCallbackContext=b,this},pause:function(){this._codePaused=!0,this._paused=!0,this._pausedTime=this.game.time.now},_pause:function(){this._codePaused||(this._paused=!0,this._pausedTime=this.game.time.now)},resume:function(){this._paused&&(this._paused=!1,this._codePaused=!1,this._startTime+=this.game.time.now-this._pausedTime)},_resume:function(){this._codePaused||(this._startTime+=this.game.time.pauseDuration,this._paused=!1)},update:function(a){if(this.pendingDelete)return!1;if(this._paused||a1?1:c;var d=this._easingFunction(c);for(b in this._valuesEnd){var e=this._valuesStart[b]||0,f=this._valuesEnd[b];f instanceof Array?this._object[b]=this._interpolationFunction(f,d):("string"==typeof f&&(f=e+parseFloat(f,10)),"number"==typeof f&&(this._object[b]=e+(f-e)*d))}if(null!==this._onUpdateCallback&&this._onUpdateCallback.call(this._onUpdateCallbackContext,this,d),1==c){if(this._repeat>0){isFinite(this._repeat)&&this._repeat--;for(b in this._valuesStartRepeat){if("string"==typeof this._valuesEnd[b]&&(this._valuesStartRepeat[b]=this._valuesStartRepeat[b]+parseFloat(this._valuesEnd[b],10)),this._yoyo){var g=this._valuesStartRepeat[b];this._valuesStartRepeat[b]=this._valuesEnd[b],this._valuesEnd[b]=g,this._reversed=!this._reversed}this._valuesStart[b]=this._valuesStartRepeat[b]}return this._startTime=a+this._delayTime,this.onLoop.dispatch(this._object),!0}this.isRunning=!1,this.onComplete.dispatch(this._object);for(var h=0,i=this._chainedTweens.length;i>h;h++)this._chainedTweens[h].start(a);return!1}return!0}},b.Tween.prototype.constructor=b.Tween,b.Easing={Linear:{None:function(a){return a}},Quadratic:{In:function(a){return a*a},Out:function(a){return a*(2-a)},InOut:function(a){return(a*=2)<1?.5*a*a:-.5*(--a*(a-2)-1)}},Cubic:{In:function(a){return a*a*a},Out:function(a){return--a*a*a+1},InOut:function(a){return(a*=2)<1?.5*a*a*a:.5*((a-=2)*a*a+2)}},Quartic:{In:function(a){return a*a*a*a},Out:function(a){return 1- --a*a*a*a},InOut:function(a){return(a*=2)<1?.5*a*a*a*a:-.5*((a-=2)*a*a*a-2)}},Quintic:{In:function(a){return a*a*a*a*a},Out:function(a){return--a*a*a*a*a+1},InOut:function(a){return(a*=2)<1?.5*a*a*a*a*a:.5*((a-=2)*a*a*a*a+2)}},Sinusoidal:{In:function(a){return 1-Math.cos(a*Math.PI/2)},Out:function(a){return Math.sin(a*Math.PI/2)},InOut:function(a){return.5*(1-Math.cos(Math.PI*a))}},Exponential:{In:function(a){return 0===a?0:Math.pow(1024,a-1)},Out:function(a){return 1===a?1:1-Math.pow(2,-10*a)},InOut:function(a){return 0===a?0:1===a?1:(a*=2)<1?.5*Math.pow(1024,a-1):.5*(-Math.pow(2,-10*(a-1))+2)}},Circular:{In:function(a){return 1-Math.sqrt(1-a*a)},Out:function(a){return Math.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.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.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()},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;a0&&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._i0&&(this.events.sort(this.sortHandler),this.nextTick=this.events[0].tick)},sortHandler:function(a,b){return a.tickb.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.nextTick&&this._len>0){for(this._i=0;this._i=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){var a=this.game.time.now-this._pauseStarted;this._pauseTotal+=a;for(var b=0;bthis._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-this._pauseTotal}}),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.currentFrame=this.currentAnim.currentFrame,this.sprite.setTexture(PIXI.TextureCache[this.currentFrame.uuid]),this.sprite.__tilePattern&&(this.__tilePattern=!1,this.tilingTexture=!1),this._anims[a])},validateFrames:function(a,b){"undefined"==typeof b&&(b=!0);for(var c=0;cthis._frameData.total)return!1}else if(this._frameData.checkFrameName(a[c])===!1)return!1;return!0},play:function(a,b,c,d){if(this._anims[a]){if(this.currentAnim!=this._anims[a])return this.currentAnim=this._anims[a],this.currentAnim.paused=!1,this.currentAnim.play(b,c,d);if(this.currentAnim.isPlaying===!1)return this.currentAnim.paused=!1,this.currentAnim.play(b,c,d)}},stop:function(a,b){"undefined"==typeof b&&(b=!1),"string"==typeof a?this._anims[a]&&(this.currentAnim=this._anims[a],this.currentAnim.stop(b)):this.currentAnim&&this.currentAnim.stop(b)},update:function(){return this.updateIfVisible&&!this.sprite.visible?!1:this.currentAnim&&this.currentAnim.update()===!0?(this.currentFrame=this.currentAnim.currentFrame,!0):!1},getAnimation:function(a){return"string"==typeof a&&this._anims[a]?this._anims[a]:null},refreshFrame:function(){this.sprite.setTexture(PIXI.TextureCache[this.currentFrame.uuid]),this.sprite.__tilePattern&&(this.__tilePattern=!1,this.tilingTexture=!1)},destroy:function(){this._anims={},this._frameData=null,this._frameIndex=0,this.currentAnim=null,this.currentFrame=null}},b.AnimationManager.prototype.constructor=b.AnimationManager,Object.defineProperty(b.AnimationManager.prototype,"frameData",{get:function(){return this._frameData}}),Object.defineProperty(b.AnimationManager.prototype,"frameTotal",{get:function(){return this._frameData?this._frameData.total:-1}}),Object.defineProperty(b.AnimationManager.prototype,"paused",{get:function(){return this.currentAnim.isPaused},set:function(a){this.currentAnim.paused=a}}),Object.defineProperty(b.AnimationManager.prototype,"frame",{get:function(){return this.currentFrame?this._frameIndex:void 0},set:function(a){"number"==typeof a&&this._frameData&&null!==this._frameData.getFrame(a)&&(this.currentFrame=this._frameData.getFrame(a),this.currentFrame&&(this._frameIndex=a,this.sprite.setTexture(PIXI.TextureCache[this.currentFrame.uuid]),this.sprite.__tilePattern&&(this.__tilePattern=!1,this.tilingTexture=!1)))}}),Object.defineProperty(b.AnimationManager.prototype,"frameName",{get:function(){return this.currentFrame?this.currentFrame.name:void 0},set:function(a){"string"==typeof a&&this._frameData&&null!==this._frameData.getFrameByName(a)?(this.currentFrame=this._frameData.getFrameByName(a),this.currentFrame&&(this._frameIndex=this.currentFrame.index,this.sprite.setTexture(PIXI.TextureCache[this.currentFrame.uuid]),this.sprite.__tilePattern&&(this.__tilePattern=!1,this.tilingTexture=!1))):console.warn("Cannot set frameName: "+a)}}),b.Animation=function(a,c,d,e,f,g,h){this.game=a,this._parent=c,this._frameData=e,this.name=d,this._frames=[],this._frames=this._frames.concat(f),this.delay=1e3/g,this.loop=h,this.loopCount=0,this.killOnComplete=!1,this.isFinished=!1,this.isPlaying=!1,this.isPaused=!1,this._pauseStartTime=0,this._frameIndex=0,this._frameDiff=0,this._frameSkip=1,this.currentFrame=this._frameData.getFrame(this._frames[this._frameIndex]),this.onStart=new b.Signal,this.onComplete=new b.Signal,this.onLoop=new b.Signal,this.game.onPause.add(this.onPause,this),this.game.onResume.add(this.onResume,this)},b.Animation.prototype={play:function(a,b,c){return"number"==typeof a&&(this.delay=1e3/a),"boolean"==typeof b&&(this.loop=b),"undefined"!=typeof c&&(this.killOnComplete=c),this.isPlaying=!0,this.isFinished=!1,this.paused=!1,this.loopCount=0,this._timeLastFrame=this.game.time.now,this._timeNextFrame=this.game.time.now+this.delay,this._frameIndex=0,this.currentFrame=this._frameData.getFrame(this._frames[this._frameIndex]),this._parent.setTexture(PIXI.TextureCache[this.currentFrame.uuid]),this._parent.__tilePattern&&(this._parent.__tilePattern=!1,this._parent.tilingTexture=!1),this._parent.events.onAnimationStart.dispatch(this._parent,this),this.onStart.dispatch(this._parent,this),this},restart:function(){this.isPlaying=!0,this.isFinished=!1,this.paused=!1,this.loopCount=0,this._timeLastFrame=this.game.time.now,this._timeNextFrame=this.game.time.now+this.delay,this._frameIndex=0,this.currentFrame=this._frameData.getFrame(this._frames[this._frameIndex]),this.onStart.dispatch(this._parent,this)},stop:function(a,b){"undefined"==typeof a&&(a=!1),"undefined"==typeof b&&(b=!1),this.isPlaying=!1,this.isFinished=!0,this.paused=!1,a&&(this.currentFrame=this._frameData.getFrame(this._frames[0])),b&&(this._parent.events.onAnimationComplete.dispatch(this._parent,this),this.onComplete.dispatch(this._parent,this))},onPause:function(){this.isPlaying&&(this._frameDiff=this._timeNextFrame-this.game.time.now)},onResume:function(){this.isPlaying&&(this._timeNextFrame=this.game.time.now+this._frameDiff)},update:function(){return this.isPaused?!1:this.isPlaying===!0&&this.game.time.now>=this._timeNextFrame?(this._frameSkip=1,this._frameDiff=this.game.time.now-this._timeNextFrame,this._timeLastFrame=this.game.time.now,this._frameDiff>this.delay&&(this._frameSkip=Math.floor(this._frameDiff/this.delay),this._frameDiff-=this._frameSkip*this.delay),this._timeNextFrame=this.game.time.now+(this.delay-this._frameDiff),this._frameIndex+=this._frameSkip,this._frameIndex>=this._frames.length?this.loop?(this._frameIndex%=this._frames.length,this.currentFrame=this._frameData.getFrame(this._frames[this._frameIndex]),this.currentFrame&&(this._parent.setTexture(PIXI.TextureCache[this.currentFrame.uuid]),this._parent.__tilePattern&&(this._parent.__tilePattern=!1,this._parent.tilingTexture=!1)),this.loopCount++,this._parent.events.onAnimationLoop.dispatch(this._parent,this),this.onLoop.dispatch(this._parent,this)):this.complete():(this.currentFrame=this._frameData.getFrame(this._frames[this._frameIndex]),this.currentFrame&&(this._parent.setTexture(PIXI.TextureCache[this.currentFrame.uuid]),this._parent.__tilePattern&&(this._parent.__tilePattern=!1,this._parent.tilingTexture=!1))),!0):!1},destroy:function(){this.game=null,this._parent=null,this._frames=null,this._frameData=null,this.currentFrame=null,this.isPlaying=!1,this.onStart.destroy(),this.onLoop.destroy(),this.onComplete.destroy(),this.game.onPause.remove(this.onPause,this),this.game.onResume.remove(this.onResume,this)},complete:function(){this.isPlaying=!1,this.isFinished=!0,this.paused=!1,this._parent.events.onAnimationComplete.dispatch(this._parent,this),this.onComplete.dispatch(this._parent,this),this.killOnComplete&&this._parent.kill()}},b.Animation.prototype.constructor=b.Animation,Object.defineProperty(b.Animation.prototype,"paused",{get:function(){return this.isPaused},set:function(a){this.isPaused=a,a?this._pauseStartTime=this.game.time.now:this.isPlaying&&(this._timeNextFrame=this.game.time.now+this.delay)}}),Object.defineProperty(b.Animation.prototype,"frameTotal",{get:function(){return this._frames.length}}),Object.defineProperty(b.Animation.prototype,"frame",{get:function(){return null!==this.currentFrame?this.currentFrame.index:this._frameIndex},set:function(a){this.currentFrame=this._frameData.getFrame(this._frames[a]),null!==this.currentFrame&&(this._frameIndex=a,this._parent.setTexture(PIXI.TextureCache[this.currentFrame.uuid]))}}),Object.defineProperty(b.Animation.prototype,"speed",{get:function(){return Math.round(1e3/this.delay)},set:function(a){a>=1&&(this.delay=1e3/a)}}),b.Animation.generateFrameNames=function(a,c,d,e,f){"undefined"==typeof e&&(e="");var g=[],h="";if(d>c)for(var i=c;d>=i;i++)h="number"==typeof f?b.Utils.pad(i.toString(),f,"0",1):i.toString(),h=a+h+e,g.push(h);else for(var i=c;i>=d;i--)h="number"==typeof f?b.Utils.pad(i.toString(),f,"0",1):i.toString(),h=a+h+e,g.push(h);return g},b.Frame=function(a,c,d,e,f,g,h){this.index=a,this.x=c,this.y=d,this.width=e,this.height=f,this.name=g,this.uuid=h,this.centerX=Math.floor(e/2),this.centerY=Math.floor(f/2),this.distance=b.Math.distance(0,0,e,f),this.rotated=!1,this.rotationDirection="cw",this.trimmed=!1,this.sourceSizeW=e,this.sourceSizeH=f,this.spriteSourceSizeX=0,this.spriteSourceSizeY=0,this.spriteSourceSizeW=0,this.spriteSourceSizeH=0},b.Frame.prototype={setTrim:function(a,b,c,d,e,f,g){this.trimmed=a,a&&(this.width=b,this.height=c,this.sourceSizeW=b,this.sourceSizeH=c,this.centerX=Math.floor(b/2),this.centerY=Math.floor(c/2),this.spriteSourceSizeX=d,this.spriteSourceSizeY=e,this.spriteSourceSizeW=f,this.spriteSourceSizeH=g)},getRect:function(a){return"undefined"==typeof a?a=new b.Rectangle(this.x,this.y,this.width,this.height):a.setTo(this.x,this.y,this.width,this.height),a}},b.Frame.prototype.constructor=b.Frame,b.FrameData=function(){this._frames=[],this._frameNames=[]},b.FrameData.prototype={addFrame:function(a){return a.index=this._frames.length,this._frames.push(a),""!==a.name&&(this._frameNames[a.name]=a.index),a},getFrame:function(a){return a>this._frames.length&&(a=0),this._frames[a]},getFrameByName:function(a){return"number"==typeof this._frameNames[a]?this._frames[this._frameNames[a]]:null},checkFrameName:function(a){return null==this._frameNames[a]?!1:!0},getFrameRange:function(a,b,c){"undefined"==typeof c&&(c=[]);for(var d=a;b>=d;d++)c.push(this._frames[d]);return c},getFrames:function(a,b,c){if("undefined"==typeof b&&(b=!0),"undefined"==typeof c&&(c=[]),"undefined"==typeof a||0===a.length)for(var d=0;dd;d++)c.push(b?this.getFrame(a[d]):this.getFrameByName(a[d]));return c},getFrameIndexes:function(a,b,c){if("undefined"==typeof b&&(b=!0),"undefined"==typeof c&&(c=[]),"undefined"==typeof a||0===a.length)for(var d=0,e=this._frames.length;e>d;d++)c.push(this._frames[d].index);else for(var d=0,e=a.length;e>d;d++)b?c.push(a[d]):this.getFrameByName(a[d])&&c.push(this.getFrameByName(a[d]).index);return c}},b.FrameData.prototype.constructor=b.FrameData,Object.defineProperty(b.FrameData.prototype,"total",{get:function(){return this._frames.length}}),b.AnimationParser={spriteSheet:function(a,c,d,e,f,g,h){var i=a.cache.getImage(c);if(null==i)return null;var j=i.width,k=i.height;0>=d&&(d=Math.floor(-j/Math.min(-1,d))),0>=e&&(e=Math.floor(-k/Math.min(-1,e)));var l=Math.floor((j-g)/(d+h)),m=Math.floor((k-g)/(e+h)),n=l*m;if(-1!==f&&(n=f),0===j||0===k||d>j||e>k||0===n)return console.warn("Phaser.AnimationParser.spriteSheet: width/height zero or width/height < given frameWidth/frameHeight"),null;for(var o=new b.FrameData,p=g,q=g,r=0;n>r;r++){var s=a.rnd.uuid();o.addFrame(new b.Frame(r,p,q,d,e,"",s)),PIXI.TextureCache[s]=new PIXI.Texture(PIXI.BaseTextureCache[c],{x:p,y:q,width:d,height:e}),p+=d+h,p+d>j&&(p=g,q+=e+h)}return o},JSONData:function(a,c,d){if(!c.frames)return console.warn("Phaser.AnimationParser.JSONData: Invalid Texture Atlas JSON given, missing 'frames' array"),void console.log(c);for(var e,f=new b.FrameData,g=c.frames,h=0;h tag");for(var e,f,g,h,i,j,k,l,m,n,o,p,q=new b.FrameData,r=c.getElementsByTagName("SubTexture"),s=0;s0)for(var c=0;c0)for(var c=0;c0)for(var c=0;c0?(this._fileIndex=0,this._progressChunk=100/this._fileList.length,this.loadFile()):(this.progress=100,this.progressFloat=100,this.hasLoaded=!0,this.onLoadComplete.dispatch()))},loadFile:function(){if(!this._fileList[this._fileIndex])return void console.warn("Phaser.Loader loadFile invalid index "+this._fileIndex);var a=this._fileList[this._fileIndex],c=this;switch(a.type){case"image":case"spritesheet":case"textureatlas":case"bitmapfont":a.data=new Image,a.data.name=a.key,a.data.onload=function(){return c.fileComplete(c._fileIndex)},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;c100&&(this.progress=100),null!==this.preloadSprite&&(0===this.preloadSprite.direction?(this.preloadSprite.rect.width=Math.floor(this.preloadSprite.width/100*this.progress),this.preloadSprite.sprite.crop(this.preloadSprite.rect)):(this.preloadSprite.rect.height=Math.floor(this.preloadSprite.height/100*this.progress),this.preloadSprite.sprite.crop(this.preloadSprite.rect))),this.onFileComplete.dispatch(this.progress,this._fileList[a].key,b,this.totalLoadedFiles(),this._fileList.length),this.totalQueuedFiles()>0?(this._fileIndex++,this.loadFile()):(this.hasLoaded=!0,this.isLoading=!1,this.removeAll(),this.onLoadComplete.dispatch())},totalLoadedFiles:function(){for(var a=0,b=0;b=this.durationMS&&(this.usingWebAudio?this.loop?(this.onLoop.dispatch(this),""===this.currentMarker?(this.currentTime=0,this.startTime=this.game.time.now):(this.onMarkerComplete.dispatch(this.currentMarker,this),this.play(this.currentMarker,0,this.volume,!0,!0))):this.stop():this.loop?(this.onLoop.dispatch(this),this.play(this.currentMarker,0,this.volume,!0,!0)):this.stop()))},play:function(a,b,c,d,e){if("undefined"==typeof a&&(a=""),"undefined"==typeof e&&(e=!0),this.isPlaying!==!0||e!==!1||this.override!==!1){if(this.isPlaying&&this.override&&(this.usingWebAudio?"undefined"==typeof this._sound.stop?this._sound.noteOff(0):this._sound.stop(0):this.usingAudioTag&&(this._sound.pause(),this._sound.currentTime=0)),this.currentMarker=a,""!==a){if(!this.markers[a])return void console.warn("Phaser.Sound.play: audio marker "+a+" doesn't exist");this.position=this.markers[a].start,this.volume=this.markers[a].volume,this.loop=this.markers[a].loop,this.duration=this.markers[a].duration,this.durationMS=this.markers[a].durationMS,"undefined"!=typeof c&&(this.volume=c),"undefined"!=typeof d&&(this.loop=d),this._tempMarker=a,this._tempPosition=this.position,this._tempVolume=this.volume,this._tempLoop=this.loop}else b=b||0,"undefined"==typeof c&&(c=this._volume),"undefined"==typeof d&&(d=this.loop),this.position=b,this.volume=c,this.loop=d,this.duration=0,this.durationMS=0,this._tempMarker=a,this._tempPosition=b,this._tempVolume=c,this._tempLoop=d;this.usingWebAudio?this.game.cache.isSoundDecoded(this.key)?(null==this._buffer&&(this._buffer=this.game.cache.getSoundData(this.key)),this._sound=this.context.createBufferSource(),this._sound.buffer=this._buffer,this._sound.connect(this.externalNode?this.externalNode.input:this.gainNode),this.totalDuration=this._sound.buffer.duration,0===this.duration&&(this.duration=this.totalDuration,this.durationMS=1e3*this.totalDuration),this.loop&&""===a&&(this._sound.loop=!0),"undefined"==typeof this._sound.start?this._sound.noteGrainOn(0,this.position,this.duration):this._sound.start(0,this.position,this.duration),this.isPlaying=!0,this.startTime=this.game.time.now,this.currentTime=0,this.stopTime=this.startTime+this.durationMS,this.onPlay.dispatch(this)):(this.pendingPlayback=!0,this.game.cache.getSound(this.key)&&this.game.cache.getSound(this.key).isDecoding===!1&&this.game.sound.decode(this.key,this)):this.game.cache.getSound(this.key)&&this.game.cache.getSound(this.key).locked?(this.game.cache.reloadSound(this.key),this.pendingPlayback=!0):this._sound&&(this.game.device.cocoonJS||4===this._sound.readyState)?(this._sound.play(),this.totalDuration=this._sound.duration,0===this.duration&&(this.duration=this.totalDuration,this.durationMS=1e3*this.totalDuration),this._sound.currentTime=this.position,this._sound.muted=this._muted,this._sound.volume=this._muted?0:this._volume,this.isPlaying=!0,this.startTime=this.game.time.now,this.currentTime=0,this.stopTime=this.startTime+this.durationMS,this.onPlay.dispatch(this)):this.pendingPlayback=!0}},restart:function(a,b,c,d){a=a||"",b=b||0,c=c||1,"undefined"==typeof d&&(d=!1),this.play(a,b,c,d,!0)},pause:function(){this.isPlaying&&this._sound&&(this.stop(),this.isPlaying=!1,this.paused=!0,this.pausedPosition=this.currentTime,this.pausedTime=this.game.time.now,this.onPause.dispatch(this))},resume:function(){if(this.paused&&this._sound){if(this.usingWebAudio){var a=this.position+this.pausedPosition/1e3;this._sound=this.context.createBufferSource(),this._sound.buffer=this._buffer,this._sound.connect(this.externalNode?this.externalNode.input:this.gainNode),this.loop&&(this._sound.loop=!0),"undefined"==typeof this._sound.start?this._sound.noteGrainOn(0,a,this.duration):this._sound.start(0,a,this.duration)}else this._sound.play();this.isPlaying=!0,this.paused=!1,this.startTime+=this.game.time.now-this.pausedTime,this.onResume.dispatch(this)}},stop:function(){this.isPlaying&&this._sound&&(this.usingWebAudio?"undefined"==typeof this._sound.stop?this._sound.noteOff(0):this._sound.stop(0):this.usingAudioTag&&(this._sound.pause(),this._sound.currentTime=0)),this.isPlaying=!1;var a=this.currentMarker;""!==this.currentMarker&&this.onMarkerComplete.dispatch(this.currentMarker,this),this.currentMarker="",this.onStop.dispatch(this,a)}},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},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.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)}window.AudioContext?this.context=new window.AudioContext:window.webkitAudioContext?this.context=new window.webkitAudioContext:window.Audio?(this.usingWebAudio=!1,this.usingAudioTag=!0):(this.usingWebAudio=!1,this.noAudio=!0),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;a255)return b.Color.getColor(255,255,255);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=function(a,b){b=b||{},this.game=a,this.config=b,this.arcade=null,this.p2=null,this.ninja=null,this.box2d=null,this.chipmunk=null,this.parseConfig()},b.Physics.ARCADE=0,b.Physics.P2JS=1,b.Physics.NINJA=2,b.Physics.BOX2D=3,b.Physics.CHIPMUNK=5,b.Physics.prototype={parseConfig:function(){this.config.hasOwnProperty("arcade")&&this.config.arcade!==!0||!b.Physics.hasOwnProperty("Arcade")||(this.arcade=new b.Physics.Arcade(this.game),this.game.time.deltaCap=.2),this.config.hasOwnProperty("ninja")&&this.config.ninja===!0&&b.Physics.hasOwnProperty("Ninja")&&(this.ninja=new b.Physics.Ninja(this.game)),this.config.hasOwnProperty("p2")&&this.config.p2===!0&&b.Physics.hasOwnProperty("P2")&&(this.p2=new b.Physics.P2(this.game,this.config))},startSystem:function(a){if(a===b.Physics.ARCADE?this.arcade=new b.Physics.Arcade(this.game):a===b.Physics.P2JS&&(this.p2=new b.Physics.P2(this.game,this.config)),a===b.Physics.NINJA)this.ninja=new b.Physics.Ninja(this.game);else{if(a===b.Physics.BOX2D&&null===this.box2d)throw new Error("The Box2D physics system has not been implemented yet.");if(a===b.Physics.CHIPMUNK&&null===this.chipmunk)throw new Error("The Chipmunk physics system has not been implemented yet.")}},enable:function(a,c,d){"undefined"==typeof c&&(c=b.Physics.ARCADE),"undefined"==typeof d&&(d=!1),c===b.Physics.ARCADE?this.arcade.enable(a):c===b.Physics.P2JS&&this.p2?this.p2.enable(a,d):c===b.Physics.NINJA&&this.ninja&&this.ninja.enableAABB(a)},preUpdate:function(){this.p2&&this.p2.preUpdate()},update:function(){this.p2&&this.p2.update()},setBoundsToWorld:function(){this.arcade&&this.arcade.setBoundsToWorld(),this.ninja&&this.ninja.setBoundsToWorld(),this.p2&&this.p2.setBoundsToWorld()},clear:function(){this.p2&&this.p2.clear()},destroy:function(){this.p2&&this.p2.destroy(),this.arcade=null,this.ninja=null,this.p2=null}},b.Physics.prototype.constructor=b.Physics,b.Physics.Arcade=function(a){this.game=a,this.gravity=new b.Point,this.bounds=new b.Rectangle(0,0,a.world.width,a.world.height),this.checkCollision={up:!0,down:!0,left:!0,right:!0},this.maxObjects=10,this.maxLevels=4,this.OVERLAP_BIAS=4,this.TILE_BIAS=16,this.forceX=!1,this.quadTree=new b.QuadTree(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._overlap=0,this._maxOverlap=0,this._velocity1=0,this._velocity2=0,this._newVelocity1=0,this._newVelocity2=0,this._average=0,this._mapData=[],this._result=!1,this._total=0,this._angle=0,this._dx=0,this._dy=0},b.Physics.Arcade.prototype.constructor=b.Physics.Arcade,b.Physics.Arcade.prototype={setBounds:function(a,b,c,d){this.bounds.setTo(a,b,c,d)},setBoundsToWorld:function(){this.bounds.setTo(this.game.world.bounds.x,this.game.world.bounds.y,this.game.world.bounds.width,this.game.world.bounds.height)},enable:function(a,c){"undefined"==typeof c&&(c=!0);var d=1;if(Array.isArray(a))for(d=a.length;d--;)a[d]instanceof b.Group?this.enable(a[d].children,c):(this.enableBody(a[d]),c&&a[d].hasOwnProperty("children")&&a[d].children.length>0&&this.enable(a[d],!0));else a instanceof b.Group?this.enable(a.children,c):(this.enableBody(a),c&&a.hasOwnProperty("children")&&a.children.length>0&&this.enable(a.children,!0))},enableBody:function(a){a.hasOwnProperty("body")&&null===a.body&&(a.body=new b.Physics.Arcade.Body(a))},updateMotion:function(a){this._velocityDelta=this.computeVelocity(0,a,a.angularVelocity,a.angularAcceleration,a.angularDrag,a.maxAngular)-a.angularVelocity,a.angularVelocity+=this._velocityDelta,a.rotation+=a.angularVelocity*this.game.time.physicsElapsed,a.velocity.x=this.computeVelocity(1,a,a.velocity.x,a.acceleration.x,a.drag.x,a.maxVelocity.x),a.velocity.y=this.computeVelocity(2,a,a.velocity.y,a.acceleration.y,a.drag.y,a.maxVelocity.y)},computeVelocity:function(a,b,c,d,e,f){return f=f||1e4,1==a&&b.allowGravity?c+=(this.gravity.x+b.gravity.x)*this.game.time.physicsElapsed:2==a&&b.allowGravity&&(c+=(this.gravity.y+b.gravity.y)*this.game.time.physicsElapsed),d?c+=d*this.game.time.physicsElapsed:e&&(this._drag=e*this.game.time.physicsElapsed,c-this._drag>0?c-=this._drag:c+this._drag<0?c+=this._drag:c=0),c>f?c=f:-f>c&&(c=-f),c},overlap:function(a,b,c,d,e){if(c=c||null,d=d||null,e=e||c,this._result=!1,this._total=0,Array.isArray(b))for(var f=0,g=b.length;g>f;f++)this.collideHandler(a,b[f],c,d,e,!0);else this.collideHandler(a,b,c,d,e,!0);return this._total>0},collide:function(a,b,c,d,e){if(c=c||null,d=d||null,e=e||c,this._result=!1,this._total=0,Array.isArray(b))for(var f=0,g=b.length;g>f;f++)this.collideHandler(a,b[f],c,d,e,!1);else this.collideHandler(a,b,c,d,e,!1);return this._total>0},collideHandler:function(a,c,d,e,f,g){return"undefined"!=typeof c||a.type!==b.GROUP&&a.type!==b.EMITTER?void(a&&c&&a.exists&&c.exists&&(a.type==b.SPRITE||a.type==b.TILESPRITE?c.type==b.SPRITE||c.type==b.TILESPRITE?this.collideSpriteVsSprite(a,c,d,e,f,g):c.type==b.GROUP||c.type==b.EMITTER?this.collideSpriteVsGroup(a,c,d,e,f,g):c.type==b.TILEMAPLAYER&&this.collideSpriteVsTilemapLayer(a,c,d,e,f):a.type==b.GROUP?c.type==b.SPRITE||c.type==b.TILESPRITE?this.collideSpriteVsGroup(c,a,d,e,f,g):c.type==b.GROUP||c.type==b.EMITTER?this.collideGroupVsGroup(a,c,d,e,f,g):c.type==b.TILEMAPLAYER&&this.collideGroupVsTilemapLayer(a,c,d,e,f):a.type==b.TILEMAPLAYER?c.type==b.SPRITE||c.type==b.TILESPRITE?this.collideSpriteVsTilemapLayer(c,a,d,e,f):(c.type==b.GROUP||c.type==b.EMITTER)&&this.collideGroupVsTilemapLayer(c,a,d,e,f):a.type==b.EMITTER&&(c.type==b.SPRITE||c.type==b.TILESPRITE?this.collideSpriteVsGroup(c,a,d,e,f,g):c.type==b.GROUP||c.type==b.EMITTER?this.collideGroupVsGroup(a,c,d,e,f,g):c.type==b.TILEMAPLAYER&&this.collideGroupVsTilemapLayer(a,c,d,e,f)))):void this.collideGroupVsSelf(a,d,e,f,g)},collideSpriteVsSprite:function(a,b,c,d,e,f){return a.body&&b.body?(this.separate(a.body,b.body,d,e,f)&&(c&&c.call(e,a,b),this._total++),!0):!1},collideSpriteVsGroup:function(a,b,c,d,e,f){if(0!==b.length){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(b),this._potentials=this.quadTree.retrieve(a);for(var g=0,h=this._potentials.length;h>g;g++)this.separate(a.body,this._potentials[g],d,e,f)&&(c&&c.call(e,a,this._potentials[g].sprite),this._total++)}},collideGroupVsSelf:function(a,b,c,d,e){if(0!==a.length)for(var f=a.children.length,g=0;f>g;g++)for(var h=g+1;f>=h;h++)a.children[g]&&a.children[h]&&a.children[g].exists&&a.children[h].exists&&this.collideSpriteVsSprite(a.children[g],a.children[h],b,c,d,e)},collideGroupVsGroup:function(a,b,c,d,e,f){if(0!==a.length&&0!==b.length)for(var g=0,h=a.children.length;h>g;g++)a.children[g].exists&&this.collideSpriteVsGroup(a.children[g],b,c,d,e,f)},collideSpriteVsTilemapLayer:function(a,b,c,d,e){if(this._mapData=b.getTiles(a.body.position.x-a.body.tilePadding.x,a.body.position.y-a.body.tilePadding.y,a.body.width+a.body.tilePadding.x,a.body.height+a.body.tilePadding.y,!1,!1),0!==this._mapData.length)for(var f=0;ff;f++)a.children[f].exists&&this.collideSpriteVsTilemapLayer(a.children[f],b,c,d,e)},separate:function(a,b,c,d,e){return this.intersects(a,b)?c&&c.call(d,a.sprite,b.sprite)===!1?!1:e?!0:(this._result=this.forceX||Math.abs(this.gravity.y+a.gravity.y)=b.right?!1:a.position.y>=b.bottom?!1:!0},separateX:function(a,b,c){return a.immovable&&b.immovable?!1:(this._overlap=0,this.intersects(a,b)&&(this._maxOverlap=a.deltaAbsX()+b.deltaAbsX()+this.OVERLAP_BIAS,0===a.deltaX()&&0===b.deltaX()?(a.embedded=!0,b.embedded=!0):a.deltaX()>b.deltaX()?(this._overlap=a.right-b.x,this._overlap>this._maxOverlap||a.checkCollision.right===!1||b.checkCollision.left===!1?this._overlap=0:(a.touching.none=!1,a.touching.right=!0,b.touching.none=!1,b.touching.left=!0)):a.deltaX()this._maxOverlap||a.checkCollision.left===!1||b.checkCollision.right===!1?this._overlap=0:(a.touching.none=!1,a.touching.left=!0,b.touching.none=!1,b.touching.right=!0)),0!==this._overlap)?(a.overlapX=this._overlap,b.overlapX=this._overlap,c||a.customSeparateX||b.customSeparateX?!0:(this._velocity1=a.velocity.x,this._velocity2=b.velocity.x,a.immovable||b.immovable?a.immovable?b.immovable||(b.x+=this._overlap,b.velocity.x=this._velocity1-this._velocity2*b.bounce.x):(a.x=a.x-this._overlap,a.velocity.x=this._velocity2-this._velocity1*a.bounce.x):(this._overlap*=.5,a.x=a.x-this._overlap,b.x+=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.x=this._average+this._newVelocity1*a.bounce.x,b.velocity.x=this._average+this._newVelocity2*b.bounce.x),!0)):!1)},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()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)),0!==this._overlap)?(a.overlapY=this._overlap,b.overlapY=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(!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()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.x0&&!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.y0&&!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},moveToObject:function(a,b,c,d){return"undefined"==typeof c&&(c=60),"undefined"==typeof d&&(d=0),this._angle=Math.atan2(b.y-a.y,b.x-a.x),d>0&&(c=this.distanceBetween(a,b)/(d/1e3)),a.body.velocity.x=Math.cos(this._angle)*c,a.body.velocity.y=Math.sin(this._angle)*c,this._angle},moveToPointer:function(a,b,c,d){return"undefined"==typeof b&&(b=60),c=c||this.game.input.activePointer,"undefined"==typeof d&&(d=0),this._angle=this.angleToPointer(a,c),d>0&&(b=this.distanceToPointer(a,c)/(d/1e3)),a.body.velocity.x=Math.cos(this._angle)*b,a.body.velocity.y=Math.sin(this._angle)*b,this._angle},moveToXY:function(a,b,c,d,e){return"undefined"==typeof d&&(d=60),"undefined"==typeof e&&(e=0),this._angle=Math.atan2(c-a.y,b-a.x),e>0&&(d=this.distanceToXY(a,b,c)/(e/1e3)),a.body.velocity.x=Math.cos(this._angle)*d,a.body.velocity.y=Math.sin(this._angle)*d,this._angle},velocityFromAngle:function(a,c,d){return"undefined"==typeof c&&(c=60),d=d||new b.Point,d.setTo(Math.cos(this.game.math.degToRad(a))*c,Math.sin(this.game.math.degToRad(a))*c)},velocityFromRotation:function(a,c,d){return"undefined"==typeof c&&(c=60),d=d||new b.Point,d.setTo(Math.cos(a)*c,Math.sin(a)*c)},accelerationFromRotation:function(a,c,d){return"undefined"==typeof c&&(c=60),d=d||new b.Point,d.setTo(Math.cos(a)*c,Math.sin(a)*c)},accelerateToObject:function(a,b,c,d,e){return"undefined"==typeof c&&(c=60),"undefined"==typeof d&&(d=1e3),"undefined"==typeof e&&(e=1e3),this._angle=this.angleBetween(a,b),a.body.acceleration.setTo(Math.cos(this._angle)*c,Math.sin(this._angle)*c),a.body.maxVelocity.setTo(d,e),this._angle},accelerateToPointer:function(a,b,c,d,e){return"undefined"==typeof c&&(c=60),"undefined"==typeof b&&(b=this.game.input.activePointer),"undefined"==typeof d&&(d=1e3),"undefined"==typeof e&&(e=1e3),this._angle=this.angleToPointer(a,b),a.body.acceleration.setTo(Math.cos(this._angle)*c,Math.sin(this._angle)*c),a.body.maxVelocity.setTo(d,e),this._angle},accelerateToXY:function(a,b,c,d,e,f){return"undefined"==typeof d&&(d=60),"undefined"==typeof e&&(e=1e3),"undefined"==typeof f&&(f=1e3),this._angle=this.angleToXY(a,b,c),a.body.acceleration.setTo(Math.cos(this._angle)*d,Math.sin(this._angle)*d),a.body.maxVelocity.setTo(e,f),this._angle},distanceBetween:function(a,b){return this._dx=a.x-b.x,this._dy=a.y-b.y,Math.sqrt(this._dx*this._dx+this._dy*this._dy)},distanceToXY:function(a,b,c){return this._dx=a.x-b,this._dy=a.y-c,Math.sqrt(this._dx*this._dx+this._dy*this._dy)},distanceToPointer:function(a,b){return b=b||this.game.input.activePointer,this._dx=a.x-b.x,this._dy=a.y-b.y,Math.sqrt(this._dx*this._dx+this._dy*this._dy)},angleBetween:function(a,b){return this._dx=b.x-a.x,this._dy=b.y-a.y,Math.atan2(this._dy,this._dx)},angleToXY:function(a,b,c){return this._dx=b-a.x,this._dy=c-a.y,Math.atan2(this._dy,this._dx)},angleToPointer:function(a,b){return b=b||this.game.input.activePointer,this._dx=b.worldX-a.x,this._dy=b.worldY-a.y,Math.atan2(this._dy,this._dx)}},b.Physics.Arcade.Body=function(a){this.sprite=a,this.game=a.game,this.type=b.Physics.ARCADE,this.offset=new b.Point,this.position=new b.Point(a.x,a.y),this.prev=new b.Point(this.position.x,this.position.y),this.allowRotation=!0,this.rotation=a.rotation,this.preRotation=a.rotation,this.sourceWidth=a.texture.frame.width,this.sourceHeight=a.texture.frame.height,this.width=a.width,this.height=a.height,this.halfWidth=Math.abs(a.width/2),this.halfHeight=Math.abs(a.height/2),this.center=new b.Point(a.x+this.halfWidth,a.y+this.halfHeight),this.velocity=new b.Point,this.newVelocity=new b.Point(0,0),this.deltaMax=new b.Point(0,0),this.acceleration=new b.Point,this.drag=new b.Point,this.allowGravity=!0,this.gravity=new b.Point(0,0),this.bounce=new b.Point,this.maxVelocity=new b.Point(1e4,1e4),this.angularVelocity=0,this.angularAcceleration=0,this.angularDrag=0,this.maxAngular=1e3,this.mass=1,this.angle=0,this.speed=0,this.facing=b.NONE,this.immovable=!1,this.moves=!0,this.customSeparateX=!1,this.customSeparateY=!1,this.overlapX=0,this.overlapY=0,this.embedded=!1,this.collideWorldBounds=!1,this.checkCollision={none:!1,any:!0,up:!0,down:!0,left:!0,right:!0},this.touching={none:!0,up:!1,down:!1,left:!1,right:!1},this.wasTouching={none:!0,up:!1,down:!1,left:!1,right:!1},this.blocked={up:!1,down:!1,left:!1,right:!1},this.tilePadding=new b.Point,this.phase=0,this._reset=!0,this._sx=a.scale.x,this._sy=a.scale.y,this._dx=0,this._dy=0},b.Physics.Arcade.Body.prototype={updateBounds:function(){var a=Math.abs(this.sprite.scale.x),b=Math.abs(this.sprite.scale.y);(a!==this._sx||b!==this._sy)&&(this.width=this.sourceWidth*a,this.height=this.sourceHeight*b,this.halfWidth=Math.floor(this.width/2),this.halfHeight=Math.floor(this.height/2),this._sx=a,this._sy=b,this.center.setTo(this.position.x+this.halfWidth,this.position.y+this.halfHeight),this._reset=!0)},preUpdate:function(){this.phase=1,this.wasTouching.none=this.touching.none,this.wasTouching.up=this.touching.up,this.wasTouching.down=this.touching.down,this.wasTouching.left=this.touching.left,this.wasTouching.right=this.touching.right,this.touching.none=!0,this.touching.up=!1,this.touching.down=!1,this.touching.left=!1,this.touching.right=!1,this.blocked.up=!1,this.blocked.down=!1,this.blocked.left=!1,this.blocked.right=!1,this.embedded=!1,this.updateBounds(),this.position.x=this.sprite.world.x-this.sprite.anchor.x*this.width+this.offset.x,this.position.y=this.sprite.world.y-this.sprite.anchor.y*this.height+this.offset.y,this.rotation=this.sprite.angle,this.preRotation=this.rotation,(this._reset||1===this.sprite._cache[4])&&(this.prev.x=this.position.x,this.prev.y=this.position.y),this.moves&&(this.game.physics.arcade.updateMotion(this),this.newVelocity.set(this.velocity.x*this.game.time.physicsElapsed,this.velocity.y*this.game.time.physicsElapsed),this.position.x+=this.newVelocity.x,this.position.y+=this.newVelocity.y,(this.position.x!==this.prev.x||this.position.y!==this.prev.y)&&(this.speed=Math.sqrt(this.velocity.x*this.velocity.x+this.velocity.y*this.velocity.y),this.angle=Math.atan2(this.velocity.y,this.velocity.x)),this.collideWorldBounds&&this.checkWorldBounds()),this._dx=this.deltaX(),this._dy=this.deltaY(),this._reset=!1},postUpdate:function(){this.phase=2,this.deltaX()<0?this.facing=b.LEFT:this.deltaX()>0&&(this.facing=b.RIGHT),this.deltaY()<0?this.facing=b.UP:this.deltaY()>0&&(this.facing=b.DOWN),this.moves&&(this._dx=this.deltaX(),this._dy=this.deltaY(),0!==this.deltaMax.x&&0!==this._dx&&(this._dx<0&&this._dx<-this.deltaMax.x?this._dx=-this.deltaMax.x:this._dx>0&&this._dx>this.deltaMax.x&&(this._dx=this.deltaMax.x)),0!==this.deltaMax.y&&0!==this._dy&&(this._dy<0&&this._dy<-this.deltaMax.y?this._dy=-this.deltaMax.y:this._dy>0&&this._dy>this.deltaMax.y&&(this._dy=this.deltaMax.y)),this.sprite.x+=this._dx,this.sprite.y+=this._dy),this.center.setTo(this.position.x+this.halfWidth,this.position.y+this.halfHeight),this.allowRotation&&(this.sprite.angle+=this.deltaZ()),this.prev.x=this.position.x,this.prev.y=this.position.y},destroy:function(){this.sprite=null},checkWorldBounds:function(){this.position.xthis.game.physics.arcade.bounds.right&&this.game.physics.arcade.checkCollision.right&&(this.position.x=this.game.physics.arcade.bounds.right-this.width,this.velocity.x*=-this.bounce.x,this.blocked.right=!0),this.position.ythis.game.physics.arcade.bounds.bottom&&this.game.physics.arcade.checkCollision.down&&(this.position.y=this.game.physics.arcade.bounds.bottom-this.height,this.velocity.y*=-this.bounce.y,this.blocked.down=!0) +},setSize:function(a,b,c,d){c=c||this.offset.x,d=d||this.offset.y,this.sourceWidth=a,this.sourceHeight=b,this.width=this.sourceWidth*this._sx,this.height=this.sourceHeight*this._sy,this.halfWidth=Math.floor(this.width/2),this.halfHeight=Math.floor(this.height/2),this.offset.setTo(c,d),this.center.setTo(this.position.x+this.halfWidth,this.position.y+this.halfHeight)},reset:function(a,b){this.velocity.set(0),this.acceleration.set(0),this.angularVelocity=0,this.angularAcceleration=0,this.position.x=a-this.sprite.anchor.x*this.width+this.offset.x,this.position.y=b-this.sprite.anchor.y*this.height+this.offset.y,this.prev.x=this.position.x,this.prev.y=this.position.y,this.rotation=this.sprite.angle,this.preRotation=this.rotation,this._sx=this.sprite.scale.x,this._sy=this.sprite.scale.y,this.center.setTo(this.position.x+this.halfWidth,this.position.y+this.halfHeight)},onFloor:function(){return this.blocked.down},onWall:function(){return this.blocked.left||this.blocked.right},deltaAbsX:function(){return this.deltaX()>0?this.deltaX():-this.deltaX()},deltaAbsY:function(){return this.deltaY()>0?this.deltaY():-this.deltaY()},deltaX:function(){return this.position.x-this.prev.x},deltaY:function(){return this.position.y-this.prev.y},deltaZ:function(){return this.rotation-this.preRotation}},Object.defineProperty(b.Physics.Arcade.Body.prototype,"bottom",{get:function(){return this.position.y+this.height}}),Object.defineProperty(b.Physics.Arcade.Body.prototype,"right",{get:function(){return this.position.x+this.width}}),Object.defineProperty(b.Physics.Arcade.Body.prototype,"x",{get:function(){return this.position.x},set:function(a){this.position.x=a}}),Object.defineProperty(b.Physics.Arcade.Body.prototype,"y",{get:function(){return this.position.y},set:function(a){this.position.y=a}}),b.Physics.Arcade.Body.render=function(a,b,c,d){"undefined"==typeof c&&(c=!0),d=d||"rgba(0,255,0,0.4)",c?(a.fillStyle=d,a.fillRect(b.position.x-b.game.camera.x,b.position.y-b.game.camera.y,b.width,b.height)):(a.strokeStyle=d,a.strokeRect(b.position.x-b.game.camera.x,b.position.y-b.game.camera.y,b.width,b.height))},b.Physics.Arcade.Body.renderBodyInfo=function(a,b){a.line("x: "+b.x.toFixed(2),"y: "+b.y.toFixed(2),"width: "+b.width,"height: "+b.height),a.line("velocity x: "+b.velocity.x.toFixed(2),"y: "+b.velocity.y.toFixed(2),"deltaX: "+b._dx.toFixed(2),"deltaY: "+b._dy.toFixed(2)),a.line("acceleration x: "+b.acceleration.x.toFixed(2),"y: "+b.acceleration.y.toFixed(2),"speed: "+b.speed.toFixed(2),"angle: "+b.angle.toFixed(2)),a.line("gravity x: "+b.gravity.x,"y: "+b.gravity.y,"bounce x: "+b.bounce.x.toFixed(2),"y: "+b.bounce.y.toFixed(2)),a.line("touching left: "+b.touching.left,"right: "+b.touching.right,"up: "+b.touching.up,"down: "+b.touching.down),a.line("blocked left: "+b.blocked.left,"right: "+b.blocked.right,"up: "+b.blocked.up,"down: "+b.blocked.down)},b.Physics.Arcade.Body.prototype.constructor=b.Physics.Arcade.Body,b.Particles=function(a){this.game=a,this.emitters={},this.ID=0},b.Particles.prototype={add:function(a){return this.emitters[a.name]=a,a},remove:function(a){delete this.emitters[a.name]},update:function(){for(var a in this.emitters)this.emitters[a].exists&&this.emitters[a].update()}},b.Particles.prototype.constructor=b.Particles,b.Particles.Arcade={},b.Particles.Arcade.Emitter=function(a,c,d,e){this.maxParticles=e||50,b.Group.call(this,a),this.name="emitter"+this.game.particles.ID++,this.type=b.EMITTER,this.x=0,this.y=0,this.width=1,this.height=1,this.minParticleSpeed=new b.Point(-100,-100),this.maxParticleSpeed=new b.Point(100,100),this.minParticleScale=1,this.maxParticleScale=1,this.minRotation=-360,this.maxRotation=360,this.gravity=100,this.particleClass=b.Sprite,this.particleDrag=new b.Point,this.angularDrag=0,this.frequency=100,this.lifespan=2e3,this.bounce=new b.Point,this._quantity=0,this._timer=0,this._counter=0,this._explode=!0,this._frames=null,this.on=!1,this.exists=!0,this.emitX=c,this.emitY=d},b.Particles.Arcade.Emitter.prototype=Object.create(b.Group.prototype),b.Particles.Arcade.Emitter.prototype.constructor=b.Particles.Arcade.Emitter,b.Particles.Arcade.Emitter.prototype.update=function(){if(this.on)if(this._explode){this._counter=0;do this.emitParticle(),this._counter++;while(this._counter=this._timer&&(this.emitParticle(),this._counter++,this._quantity>0&&this._counter>=this._quantity&&(this.on=!1),this._timer=this.game.time.now+this.frequency)},b.Particles.Arcade.Emitter.prototype.makeParticles=function(a,b,c,d,e){"undefined"==typeof b&&(b=0),"undefined"==typeof c&&(c=this.maxParticles),"undefined"==typeof d&&(d=!1),"undefined"==typeof e&&(e=!1);var f,g=0,h=a,i=b;for(this._frames=b;c>g;)"object"==typeof a&&(h=this.game.rnd.pick(a)),"object"==typeof b&&(i=this.game.rnd.pick(b)),f=new this.particleClass(this.game,0,0,h,i),this.game.physics.arcade.enable(f,!1),d?(f.body.checkCollision.any=!0,f.body.checkCollision.none=!1):f.body.checkCollision.none=!0,f.body.collideWorldBounds=e,f.exists=!1,f.visible=!1,f.anchor.set(.5),this.add(f),g++;return this},b.Particles.Arcade.Emitter.prototype.kill=function(){this.on=!1,this.alive=!1,this.exists=!1},b.Particles.Arcade.Emitter.prototype.revive=function(){this.alive=!0,this.exists=!0},b.Particles.Arcade.Emitter.prototype.start=function(a,b,c,d){"undefined"==typeof a&&(a=!0),"undefined"==typeof b&&(b=0),"undefined"==typeof c&&(c=250),"undefined"==typeof d&&(d=0),this.revive(),this.visible=!0,this.on=!0,this._explode=a,this.lifespan=b,this.frequency=c,a?this._quantity=d:this._quantity+=d,this._counter=0,this._timer=this.game.time.now+c},b.Particles.Arcade.Emitter.prototype.emitParticle=function(){var a=this.getFirstExists(!1);null!=a&&(a.angle=0,a.bringToTop(),(1!==this.minParticleScale||1!==this.maxParticleScale)&&a.scale.set(this.game.rnd.realInRange(this.minParticleScale,this.maxParticleScale)),this.width>1||this.height>1?a.reset(this.game.rnd.integerInRange(this.left,this.right),this.game.rnd.integerInRange(this.top,this.bottom)):a.reset(this.emitX,this.emitY),a.lifespan=this.lifespan,a.body.bounce.setTo(this.bounce.x,this.bounce.y),a.body.velocity.x=this.minParticleSpeed.x!==this.maxParticleSpeed.x?this.game.rnd.integerInRange(this.minParticleSpeed.x,this.maxParticleSpeed.x):this.minParticleSpeed.x,a.body.velocity.y=this.minParticleSpeed.y!==this.maxParticleSpeed.y?this.game.rnd.integerInRange(this.minParticleSpeed.y,this.maxParticleSpeed.y):this.minParticleSpeed.y,this.minRotation!==this.maxRotation?a.body.angularVelocity=this.game.rnd.integerInRange(this.minRotation,this.maxRotation):0!==this.minRotation&&(a.body.angularVelocity=this.minRotation),a.frame="object"==typeof this._frames?this.game.rnd.pick(this._frames):this._frames,a.body.gravity.y=this.gravity,a.body.drag.x=this.particleDrag.x,a.body.drag.y=this.particleDrag.y,a.body.angularDrag=this.angularDrag)},b.Particles.Arcade.Emitter.prototype.setSize=function(a,b){this.width=a,this.height=b},b.Particles.Arcade.Emitter.prototype.setXSpeed=function(a,b){a=a||0,b=b||0,this.minParticleSpeed.x=a,this.maxParticleSpeed.x=b},b.Particles.Arcade.Emitter.prototype.setYSpeed=function(a,b){a=a||0,b=b||0,this.minParticleSpeed.y=a,this.maxParticleSpeed.y=b},b.Particles.Arcade.Emitter.prototype.setRotation=function(a,b){a=a||0,b=b||0,this.minRotation=a,this.maxRotation=b},b.Particles.Arcade.Emitter.prototype.at=function(a){a.center&&(this.emitX=a.center.x,this.emitY=a.center.y)},Object.defineProperty(b.Particles.Arcade.Emitter.prototype,"x",{get:function(){return this.emitX},set:function(a){this.emitX=a}}),Object.defineProperty(b.Particles.Arcade.Emitter.prototype,"y",{get:function(){return this.emitY},set:function(a){this.emitY=a}}),Object.defineProperty(b.Particles.Arcade.Emitter.prototype,"left",{get:function(){return Math.floor(this.x-this.width/2)}}),Object.defineProperty(b.Particles.Arcade.Emitter.prototype,"right",{get:function(){return Math.floor(this.x+this.width/2)}}),Object.defineProperty(b.Particles.Arcade.Emitter.prototype,"top",{get:function(){return Math.floor(this.y-this.height/2)}}),Object.defineProperty(b.Particles.Arcade.Emitter.prototype,"bottom",{get:function(){return Math.floor(this.y+this.height/2)}}),b.Tile=function(a,b,c,d,e,f){this.layer=a,this.index=b,this.x=c,this.y=d,this.worldX=c*e,this.worldY=d*f,this.width=e,this.height=f,this.centerX=Math.abs(e/2),this.centerY=Math.abs(f/2),this.alpha=1,this.properties={},this.scanned=!1,this.faceTop=!1,this.faceBottom=!1,this.faceLeft=!1,this.faceRight=!1,this.collideLeft=!1,this.collideRight=!1,this.collideUp=!1,this.collideDown=!1,this.collisionCallback=null,this.collisionCallbackContext=this},b.Tile.prototype={containsPoint:function(a,b){return!(athis.right||b>this.bottom)},intersects:function(a,b,c,d){return c<=this.worldX?!1:d<=this.worldY?!1:a>=this.worldX+this.width?!1:b>=this.worldY+this.height?!1:!0},setCollisionCallback:function(a,b){this.collisionCallback=a,this.collisionCallbackContext=b},destroy:function(){this.collisionCallback=null,this.collisionCallbackContext=null,this.properties=null},setCollision:function(a,b,c,d){this.collideLeft=a,this.collideRight=b,this.collideUp=c,this.collideDown=d},resetCollision:function(){this.collideLeft=!1,this.collideRight=!1,this.collideUp=!1,this.collideDown=!1,this.faceTop=!1,this.faceBottom=!1,this.faceLeft=!1,this.faceRight=!1},isInteresting:function(a,b){return a&&b?this.collideLeft||this.collideRight||this.collideUp||this.collideDown||this.faceTop||this.faceBottom||this.faceLeft||this.faceRight||this.collisionCallback:a?this.collideLeft||this.collideRight||this.collideUp||this.collideDown:b?this.faceTop||this.faceBottom||this.faceLeft||this.faceRight:!1},copy:function(a){this.index=a.index,this.alpha=a.alpha,this.properties=a.properties,this.collideUp=a.collideUp,this.collideDown=a.collideDown,this.collideLeft=a.collideLeft,this.collideRight=a.collideRight,this.collisionCallback=a.collisionCallback,this.collisionCallbackContext=a.collisionCallbackContext}},b.Tile.prototype.constructor=b.Tile,Object.defineProperty(b.Tile.prototype,"collides",{get:function(){return this.collideLeft||this.collideRight||this.collideUp||this.collideDown}}),Object.defineProperty(b.Tile.prototype,"canCollide",{get:function(){return this.collideLeft||this.collideRight||this.collideUp||this.collideDown||this.collisionCallback}}),Object.defineProperty(b.Tile.prototype,"left",{get:function(){return this.worldX}}),Object.defineProperty(b.Tile.prototype,"right",{get:function(){return this.worldX+this.width}}),Object.defineProperty(b.Tile.prototype,"top",{get:function(){return this.worldY}}),Object.defineProperty(b.Tile.prototype,"bottom",{get:function(){return this.worldY+this.height}}),b.Tilemap=function(a,c,d,e,f,g){this.game=a,this.key=c;var h=b.TilemapParser.parse(this.game,c,d,e,f,g);null!==h&&(this.width=h.width,this.height=h.height,this.tileWidth=h.tileWidth,this.tileHeight=h.tileHeight,this.orientation=h.orientation,this.version=h.version,this.properties=h.properties,this.widthInPixels=h.widthInPixels,this.heightInPixels=h.heightInPixels,this.layers=h.layers,this.tilesets=h.tilesets,this.tiles=h.tiles,this.objects=h.objects,this.collideIndexes=[],this.collision=h.collision,this.images=h.images,this.currentLayer=0,this.debugMap=[],this._results=[],this._tempA=0,this._tempB=0)},b.Tilemap.CSV=0,b.Tilemap.TILED_JSON=1,b.Tilemap.prototype={create:function(a,b,c,d,e,f){return"undefined"==typeof f&&(f=this.game.world),this.width=b,this.height=c,this.setTileSize(d,e),this.layers.length=0,this.createBlankLayer(a,b,c,d,e,f)},setTileSize:function(a,b){this.tileWidth=a,this.tileHeight=b,this.widthInPixels=this.width*a,this.heightInPixels=this.height*b},addTilesetImage:function(a,c,d,e,f,g,h){if("undefined"==typeof d&&(d=this.tileWidth),"undefined"==typeof e&&(e=this.tileHeight),"undefined"==typeof f&&(f=0),"undefined"==typeof g&&(g=0),"undefined"==typeof h&&(h=0),0===d&&(d=32),0===e&&(e=32),"undefined"==typeof c){if("string"!=typeof a)return null;c=a}if("string"==typeof a&&(a=this.getTilesetIndex(a)),this.tilesets[a])return this.tilesets[a].setImage(this.game.cache.getImage(c)),this.tilesets[a];var i=new b.Tileset(c,h,d,e,f,g,{});i.setImage(this.game.cache.getImage(c)),this.tilesets.push(i);for(var j=this.tilesets.length-1,k=f,l=f,m=0,n=0,o=0,p=h;pl;l++)if(this.objects[a][l].gid===c){k=new i(this.game,this.objects[a][l].x,this.objects[a][l].y,d,e),k.name=this.objects[a][l].name,k.visible=this.objects[a][l].visible,k.autoCull=g,k.exists=f,j&&(k.y-=k.height),h.add(k);for(var n in this.objects[a][l].properties)h.set(k,n,this.objects[a][l].properties[n],!1,!1,0)}},createLayer:function(a,c,d,e){"undefined"==typeof c&&(c=this.game.width),"undefined"==typeof d&&(d=this.game.height),"undefined"==typeof e&&(e=this.game.world);var f=a;return"string"==typeof a&&(f=this.getLayerIndex(a)),null===f||f>this.layers.length?void console.warn("Tilemap.createLayer: Invalid layer ID given: "+f):e.add(new b.TilemapLayer(this.game,this,f,c,d))},createBlankLayer:function(a,c,d,e,f,g){if("undefined"==typeof g&&(g=this.game.world),null!==this.getLayerIndex(a))return void console.warn("Tilemap.createBlankLayer: Layer with matching name already exists");for(var h,i=[],j=0;d>j;j++){h=[];for(var k=0;c>k;k++)h.push(null);i.push(h)}var l={name:a,x:0,y:0,width:c,height:d,widthInPixels:c*e,heightInPixels:d*f,alpha:1,visible:!0,properties:{},indexes:[],callbacks:[],bodies:[],data:i};this.layers.push(l),this.currentLayer=this.layers.length-1;var m=l.widthInPixels,n=l.heightInPixels;m>this.game.width&&(m=this.game.width),n>this.game.height&&(n=this.game.height);var i=new b.TilemapLayer(this.game,this,this.layers.length-1,m,n);return i.name=a,g.add(i)},getIndex:function(a,b){for(var c=0;ce;e++)this.layers[d].callbacks[a[e]]={callback:b,callbackContext:c}},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;hd;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){if("undefined"==typeof b&&(b=!0),"undefined"==typeof c&&(c=this.currentLayer),"undefined"==typeof d&&(d=!0),b)this.collideIndexes.push(a);else{var e=this.collideIndexes.indexOf(a);e>-1&&this.collideIndexes.splice(e,1)}for(var f=0;ff;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 c0?this.layers[a].data[c][b-1]:null},getTileRight:function(a,b,c){return b=0&&c=0&&d-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){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=0&&ba&&(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;g1?this.debugMap[this.layers[this.currentLayer].data[c][d]]?"background: "+this.debugMap[this.layers[this.currentLayer].data[c][d]]:"background: #ffffff":"background: rgb(0, 0, 0)");a+="\n"}b[0]=a,console.log.apply(console,b)},destroy:function(){this.removeAllLayers(),this.data=[],this.game=null}},b.Tilemap.prototype.constructor=b.Tilemap,b.TilemapLayer=function(a,c,d,e,f){this.game=a,this.map=c,this.index=d,this.layer=c.layers[d],this.canvas=b.Canvas.create(e,f,"",!0),this.context=this.canvas.getContext("2d"),this.baseTexture=new PIXI.BaseTexture(this.canvas),this.texture=new PIXI.Texture(this.baseTexture),this.textureFrame=new b.Frame(0,0,0,e,f,"tilemapLayer",a.rnd.uuid()),b.Image.call(this,this.game,0,0,this.texture,this.textureFrame),this.name="",this.type=b.TILEMAPLAYER,this.fixedToCamera=!0,this.cameraOffset=new b.Point(0,0),this.tileColor="rgb(255, 255, 255)",this.debug=!1,this.debugAlpha=.5,this.debugColor="rgba(0, 255, 0, 1)",this.debugFill=!1,this.debugFillColor="rgba(0, 255, 0, 0.2)",this.debugCallbackColor="rgba(255, 0, 0, 1)",this.scrollFactorX=1,this.scrollFactorY=1,this.dirty=!0,this.rayStepRate=4,this._mc={cw:c.tileWidth,ch:c.tileHeight,ga:1,dx:0,dy:0,dw:0,dh:0,tx:0,ty:0,tw:0,th:0,tl:0,maxX:0,maxY:0,startX:0,startY:0,x:0,y:0,prevX:0,prevY:0},this._results=[],this.updateMax()},b.TilemapLayer.prototype=Object.create(b.Image.prototype),b.TilemapLayer.prototype.constructor=b.TilemapLayer,b.TilemapLayer.prototype.postUpdate=function(){b.Image.prototype.postUpdate.call(this),this.scrollX=this.game.camera.x*this.scrollFactorX,this.scrollY=this.game.camera.y*this.scrollFactorY,this.render(),1===this._cache[7]&&(this.position.x=(this.game.camera.view.x+this.cameraOffset.x)/this.game.camera.scale.x,this.position.y=(this.game.camera.view.y+this.cameraOffset.y)/this.game.camera.scale.y)},b.TilemapLayer.prototype.resizeWorld=function(){this.game.world.setBounds(0,0,this.layer.widthInPixels,this.layer.heightInPixels)},b.TilemapLayer.prototype._fixX=function(a){return 0>a&&(a=0),1===this.scrollFactorX?a:this._mc.x+(a-this._mc.x/this.scrollFactorX)},b.TilemapLayer.prototype._unfixX=function(a){return 1===this.scrollFactorX?a:this._mc.x/this.scrollFactorX+(a-this._mc.x)},b.TilemapLayer.prototype._fixY=function(a){return 0>a&&(a=0),1===this.scrollFactorY?a:this._mc.y+(a-this._mc.y/this.scrollFactorY)},b.TilemapLayer.prototype._unfixY=function(a){return 1===this.scrollFactorY?a:this._mc.y/this.scrollFactorY+(a-this._mc.y)},b.TilemapLayer.prototype.getTileX=function(a){return this.game.math.snapToFloor(this._fixX(a),this.map.tileWidth)/this.map.tileWidth},b.TilemapLayer.prototype.getTileY=function(a){return this.game.math.snapToFloor(this._fixY(a),this.map.tileHeight)/this.map.tileHeight},b.TilemapLayer.prototype.getTileXY=function(a,b,c){return c.x=this.getTileX(a),c.y=this.getTileY(b),c},b.TilemapLayer.prototype.getRayCastTiles=function(a,b,c,d){("undefined"==typeof b||null===b)&&(b=this.rayStepRate),"undefined"==typeof c&&(c=!1),"undefined"==typeof d&&(d=!1);var e=this.getTiles(a.x,a.y,a.width,a.height,c,d);if(0===e.length)return[];for(var f=a.coordinatesOnLine(b),g=f.length,h=[],i=0;ij;j++)if(e[i].containsPoint(f[j][0],f[j][1])){h.push(e[i]);break}return h},b.TilemapLayer.prototype.getTiles=function(a,b,c,d,e,f){"undefined"==typeof e&&(e=!1),"undefined"==typeof f&&(f=!1),a=this._fixX(a),b=this._fixY(b),c>this.layer.widthInPixels&&(c=this.layer.widthInPixels),d>this.layer.heightInPixels&&(d=this.layer.heightInPixels),this._mc.tx=this.game.math.snapToFloor(a,this._mc.cw)/this._mc.cw,this._mc.ty=this.game.math.snapToFloor(b,this._mc.ch)/this._mc.ch,this._mc.tw=(this.game.math.snapToCeil(c,this._mc.cw)+this._mc.cw)/this._mc.cw,this._mc.th=(this.game.math.snapToCeil(d,this._mc.ch)+this._mc.ch)/this._mc.ch,this._results.length=0;for(var g=this._mc.ty;gthis.layer.width&&(this._mc.maxX=this.layer.width),this._mc.maxY>this.layer.height&&(this._mc.maxY=this.layer.height)),this.dirty=!0},b.TilemapLayer.prototype.render=function(){if(this.layer.dirty&&(this.dirty=!0),this.dirty&&this.visible){this._mc.prevX=this._mc.dx,this._mc.prevY=this._mc.dy,this._mc.dx=-(this._mc.x-this._mc.startX*this.map.tileWidth),this._mc.dy=-(this._mc.y-this._mc.startY*this.map.tileHeight),this._mc.tx=this._mc.dx,this._mc.ty=this._mc.dy,this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.context.fillStyle=this.tileColor;var a,c;this.debug&&(this.context.globalAlpha=this.debugAlpha);for(var d=this._mc.startY,e=this._mc.startY+this._mc.maxY;e>d;d++){this._column=this.layer.data[d];for(var f=this._mc.startX,g=this._mc.startX+this._mc.maxX;g>f;f++)this._column[f]&&(a=this._column[f],c=this.map.tilesets[this.map.tiles[a.index][2]],this.debug===!1&&a.alpha!==this.context.globalAlpha&&(this.context.globalAlpha=a.alpha),c.draw(this.context,Math.floor(this._mc.tx),Math.floor(this._mc.ty),a.index),a.debug&&(this.context.fillStyle="rgba(0, 255, 0, 0.4)",this.context.fillRect(Math.floor(this._mc.tx),Math.floor(this._mc.ty),this.map.tileWidth,this.map.tileHeight))),this._mc.tx+=this.map.tileWidth;this._mc.tx=this._mc.dx,this._mc.ty+=this.map.tileHeight}return this.debug&&(this.context.globalAlpha=1,this.renderDebug()),this.game.renderType===b.WEBGL&&PIXI.updateWebGLTexture(this.baseTexture,this.game.renderer.gl),this.dirty=!1,this.layer.dirty=!1,!0}},b.TilemapLayer.prototype.renderDebug=function(){this._mc.tx=this._mc.dx,this._mc.ty=this._mc.dy,this.context.strokeStyle=this.debugColor,this.context.fillStyle=this.debugFillColor;for(var a=this._mc.startY,b=this._mc.startY+this._mc.maxY;b>a;a++){this._column=this.layer.data[a];for(var c=this._mc.startX,d=this._mc.startX+this._mc.maxX;d>c;c++){var e=this._column[c];e&&(e.faceTop||e.faceBottom||e.faceLeft||e.faceRight)&&(this._mc.tx=Math.floor(this._mc.tx),this.debugFill&&this.context.fillRect(this._mc.tx,this._mc.ty,this._mc.cw,this._mc.ch),this.context.beginPath(),e.faceTop&&(this.context.moveTo(this._mc.tx,this._mc.ty),this.context.lineTo(this._mc.tx+this._mc.cw,this._mc.ty)),e.faceBottom&&(this.context.moveTo(this._mc.tx,this._mc.ty+this._mc.ch),this.context.lineTo(this._mc.tx+this._mc.cw,this._mc.ty+this._mc.ch)),e.faceLeft&&(this.context.moveTo(this._mc.tx,this._mc.ty),this.context.lineTo(this._mc.tx,this._mc.ty+this._mc.ch)),e.faceRight&&(this.context.moveTo(this._mc.tx+this._mc.cw,this._mc.ty),this.context.lineTo(this._mc.tx+this._mc.cw,this._mc.ty+this._mc.ch)),this.context.stroke()),this._mc.tx+=this.map.tileWidth}this._mc.tx=this._mc.dx,this._mc.ty+=this.map.tileHeight}},Object.defineProperty(b.TilemapLayer.prototype,"scrollX",{get:function(){return this._mc.x},set:function(a){a!==this._mc.x&&a>=0&&this.layer.widthInPixels>this.width&&(this._mc.x=a,this._mc.x>this.layer.widthInPixels-this.width&&(this._mc.x=this.layer.widthInPixels-this.width),this._mc.startX=this.game.math.floor(this._mc.x/this.map.tileWidth),this._mc.startX<0&&(this._mc.startX=0),this._mc.startX+this._mc.maxX>this.layer.width&&(this._mc.startX=this.layer.width-this._mc.maxX),this.dirty=!0)}}),Object.defineProperty(b.TilemapLayer.prototype,"scrollY",{get:function(){return this._mc.y},set:function(a){a!==this._mc.y&&a>=0&&this.layer.heightInPixels>this.height&&(this._mc.y=a,this._mc.y>this.layer.heightInPixels-this.height&&(this._mc.y=this.layer.heightInPixels-this.height),this._mc.startY=this.game.math.floor(this._mc.y/this.map.tileHeight),this._mc.startY<0&&(this._mc.startY=0),this._mc.startY+this._mc.maxY>this.layer.height&&(this._mc.startY=this.layer.height-this._mc.maxY),this.dirty=!0)}}),Object.defineProperty(b.TilemapLayer.prototype,"collisionWidth",{get:function(){return this._mc.cw},set:function(a){this._mc.cw=a,this.dirty=!0}}),Object.defineProperty(b.TilemapLayer.prototype,"collisionHeight",{get:function(){return this._mc.ch},set:function(a){this._mc.ch=a,this.dirty=!0}}),b.TilemapParser={parse:function(a,c,d,e,f,g){if("undefined"==typeof d&&(d=32),"undefined"==typeof e&&(e=32),"undefined"==typeof f&&(f=10),"undefined"==typeof g&&(g=10),"undefined"==typeof c)return this.getEmptyData();if(null===c)return this.getEmptyData(d,e,f,g);var h=a.cache.getTilemapData(c);if(h){if(h.format===b.Tilemap.CSV)return this.parseCSV(c,h.data,d,e);if(!h.format||h.format===b.Tilemap.TILED_JSON)return this.parseTiledJSON(h.data)}else console.warn("Phaser.TilemapParser.parse - No map data found for key "+c)},parseCSV:function(a,c,d,e){var f=this.getEmptyData();c=c.trim();for(var g=[],h=c.split("\n"),i=h.length,j=0,k=0;kj;j++)h.push(a.layers[e].data[j]>0?new b.Tile(f,a.layers[e].data[j],g,i.length,a.tilewidth,a.tileheight):null),g++,g===a.layers[e].width&&(i.push(h),g=0,h=[]);f.data=i,d.push(f)}c.layers=d;for(var l=[],e=0;es;s++)if(a.layers[e].objects[s].gid){var t={gid:a.layers[e].objects[s].gid,name:a.layers[e].objects[s].name,x:a.layers[e].objects[s].x,y:a.layers[e].objects[s].y,visible:a.layers[e].objects[s].visible,properties:a.layers[e].objects[s].properties};q[a.layers[e].name].push(t)}else if(a.layers[e].objects[s].polyline){var t={name:a.layers[e].objects[s].name,x:a.layers[e].objects[s].x,y:a.layers[e].objects[s].y,width:a.layers[e].objects[s].width,height:a.layers[e].objects[s].height,visible:a.layers[e].objects[s].visible,properties:a.layers[e].objects[s].properties};t.polyline=[];for(var u=0;u=c)&&(c=32),("undefined"==typeof d||0>=d)&&(d=32),"undefined"==typeof e&&(e=0),"undefined"==typeof f&&(f=0),this.name=a,this.firstgid=b,this.tileWidth=c,this.tileHeight=d,this.tileMargin=e,this.tileSpacing=f,this.properties=g,this.image=null,this.rows=0,this.columns=0,this.total=0,this.drawCoords=[]},b.Tileset.prototype={draw:function(a,b,c,d){this.image&&this.drawCoords[d]&&a.drawImage(this.image,this.drawCoords[d][0],this.drawCoords[d][1],this.tileWidth,this.tileHeight,b,c,this.tileWidth,this.tileHeight)},setImage:function(a){this.image=a,this.rows=Math.round((a.height-this.tileMargin)/(this.tileHeight+this.tileSpacing)),this.columns=Math.round((a.width-this.tileMargin)/(this.tileWidth+this.tileSpacing)),this.total=this.rows*this.columns,this.drawCoords.length=0;for(var b=this.tileMargin,c=this.tileMargin,d=this.firstgid,e=0;ethis.depCount&&!this.defined){if(G(c)){if(this.events.error&&this.map.isDefine||h.onError!==da)try{f=i.execCb(b,c,e,f)}catch(d){a=d}else f=i.execCb(b,c,e,f);this.map.isDefine&&void 0===f&&((e=this.module)?f=e.exports:this.usingExports&& +(f=this.exports));if(a)return a.requireMap=this.map,a.requireModules=this.map.isDefine?[this.map.id]:null,a.requireType=this.map.isDefine?"define":"require",w(this.error=a)}else f=c;this.exports=f;if(this.map.isDefine&&!this.ignore&&(p[b]=f,h.onResourceLoad))h.onResourceLoad(i,this.map,this.depMaps);y(b);this.defined=!0}this.defining=!1;this.defined&&!this.defineEmitted&&(this.defineEmitted=!0,this.emit("defined",this.exports),this.defineEmitComplete=!0)}}else this.fetch()}},callPlugin:function(){var a= +this.map,b=a.id,d=m(a.prefix);this.depMaps.push(d);r(d,"defined",t(this,function(f){var d,g;g=j(ba,this.map.id);var J=this.map.name,u=this.map.parentMap?this.map.parentMap.name:null,p=i.makeRequire(a.parentMap,{enableBuildCallback:!0});if(this.map.unnormalized){if(f.normalize&&(J=f.normalize(J,function(a){return c(a,u,!0)})||""),f=m(a.prefix+"!"+J,this.map.parentMap),r(f,"defined",t(this,function(a){this.init([],function(){return a},null,{enabled:!0,ignore:!0})})),g=j(k,f.id)){this.depMaps.push(f); +if(this.events.error)g.on("error",t(this,function(a){this.emit("error",a)}));g.enable()}}else g?(this.map.url=i.nameToUrl(g),this.load()):(d=t(this,function(a){this.init([],function(){return a},null,{enabled:!0})}),d.error=t(this,function(a){this.inited=!0;this.error=a;a.requireModules=[b];B(k,function(a){0===a.map.id.indexOf(b+"_unnormalized")&&y(a.map.id)});w(a)}),d.fromText=t(this,function(f,c){var g=a.name,J=m(g),k=O;c&&(f=c);k&&(O=!1);q(J);s(l.config,b)&&(l.config[g]=l.config[b]);try{h.exec(f)}catch(j){return w(C("fromtexteval", +"fromText eval for "+b+" failed: "+j,j,[b]))}k&&(O=!0);this.depMaps.push(J);i.completeLoad(g);p([g],d)}),f.load(a.name,p,d,l))}));i.enable(d,this);this.pluginMaps[d.id]=d},enable:function(){W[this.map.id]=this;this.enabling=this.enabled=!0;v(this.depMaps,t(this,function(a,b){var c,f;if("string"===typeof a){a=m(a,this.map.isDefine?this.map:this.map.parentMap,!1,!this.skipMap);this.depMaps[b]=a;if(c=j(N,a.id)){this.depExports[b]=c(this);return}this.depCount+=1;r(a,"defined",t(this,function(a){this.defineDep(b, +a);this.check()}));this.errback&&r(a,"error",t(this,this.errback))}c=a.id;f=k[c];!s(N,c)&&(f&&!f.enabled)&&i.enable(a,this)}));B(this.pluginMaps,t(this,function(a){var b=j(k,a.id);b&&!b.enabled&&i.enable(a,this)}));this.enabling=!1;this.check()},on:function(a,b){var c=this.events[a];c||(c=this.events[a]=[]);c.push(b)},emit:function(a,b){v(this.events[a],function(a){a(b)});"error"===a&&delete this.events[a]}};i={config:l,contextName:b,registry:k,defined:p,urlFetched:T,defQueue:A,Module:$,makeModuleMap:m, +nextTick:h.nextTick,onError:w,configure:function(a){a.baseUrl&&"/"!==a.baseUrl.charAt(a.baseUrl.length-1)&&(a.baseUrl+="/");var b=l.shim,c={paths:!0,bundles:!0,config:!0,map:!0};B(a,function(a,b){c[b]?(l[b]||(l[b]={}),V(l[b],a,!0,!0)):l[b]=a});a.bundles&&B(a.bundles,function(a,b){v(a,function(a){a!==b&&(ba[a]=b)})});a.shim&&(B(a.shim,function(a,c){H(a)&&(a={deps:a});if((a.exports||a.init)&&!a.exportsFn)a.exportsFn=i.makeShimExports(a);b[c]=a}),l.shim=b);a.packages&&v(a.packages,function(a){var b, +a="string"===typeof a?{name:a}:a;b=a.name;a.location&&(l.paths[b]=a.location);l.pkgs[b]=a.name+"/"+(a.main||"main").replace(ja,"").replace(R,"")});B(k,function(a,b){!a.inited&&!a.map.unnormalized&&(a.map=m(b))});if(a.deps||a.callback)i.require(a.deps||[],a.callback)},makeShimExports:function(a){return function(){var b;a.init&&(b=a.init.apply(ca,arguments));return b||a.exports&&ea(a.exports)}},makeRequire:function(a,e){function g(f,c,d){var j,l;e.enableBuildCallback&&(c&&G(c))&&(c.__requireJsBuild= +!0);if("string"===typeof f){if(G(c))return w(C("requireargs","Invalid require call"),d);if(a&&s(N,f))return N[f](k[a.id]);if(h.get)return h.get(i,f,a,g);j=m(f,a,!1,!0);j=j.id;return!s(p,j)?w(C("notloaded",'Module name "'+j+'" has not been loaded yet for context: '+b+(a?"":". Use require([])"))):p[j]}L();i.nextTick(function(){L();l=q(m(null,a));l.skipMap=e.skipMap;l.init(f,c,d,{enabled:!0});D()});return g}e=e||{};V(g,{isBrowser:z,toUrl:function(b){var e,d=b.lastIndexOf("."),g=b.split("/")[0];if(-1!== +d&&(!("."===g||".."===g)||1g.attachEvent.toString().indexOf("[native code"))&&!Z?(O=!0,g.attachEvent("onreadystatechange",b.onScriptLoad)): +(g.addEventListener("load",b.onScriptLoad,!1),g.addEventListener("error",b.onScriptError,!1)),g.src=d,L=g,D?y.insertBefore(g,D):y.appendChild(g),L=null,g;if(fa)try{importScripts(d),b.completeLoad(c)}catch(j){b.onError(C("importscripts","importScripts failed for "+c+" at "+d,j,[c]))}};z&&!r.skipDataMain&&U(document.getElementsByTagName("script"),function(b){y||(y=b.parentNode);if(K=b.getAttribute("data-main"))return q=K,r.baseUrl||(E=q.split("/"),q=E.pop(),Q=E.length?E.join("/")+"/":"./",r.baseUrl= +Q),q=q.replace(R,""),h.jsExtRegExp.test(q)&&(q=K),r.deps=r.deps?r.deps.concat(q):[q],!0});define=function(b,c,d){var g,h;"string"!==typeof b&&(d=c,c=b,b=null);H(c)||(d=c,c=null);!c&&G(d)&&(c=[],d.length&&(d.toString().replace(la,"").replace(ma,function(b,d){c.push(d)}),c=(1===d.length?["require"]:["require","exports","module"]).concat(c)));if(O){if(!(g=L))P&&"interactive"===P.readyState||U(document.getElementsByTagName("script"),function(b){if("interactive"===b.readyState)return P=b}),g=P;g&&(b|| +(b=g.getAttribute("data-requiremodule")),h=F[g.getAttribute("data-requirecontext")])}(h?h.defQueue:S).push([b,c,d])};define.amd={jQuery:!0};h.exec=function(b){return eval(b)};h(r)}})(this); diff --git a/space/SpaceInvaders-master/SpaceInvaders-master/assets/javascript/main.js b/space/SpaceInvaders-master/SpaceInvaders-master/assets/javascript/main.js new file mode 100644 index 00000000..0828e5f6 --- /dev/null +++ b/space/SpaceInvaders-master/SpaceInvaders-master/assets/javascript/main.js @@ -0,0 +1,28 @@ +/** + * Created by stryker on 2014.03.05.. + */ +require(['state/Load','state/Start','state/Play','state/End','lib/phaser-no-physics.min'],function(Load,Start,Play,End){ + + var _game = new Phaser.Game(800, 600, Phaser.AUTO, 'game'); + + + //Load state + Load.init(_game,'Start'); //args: game object, next state + _game.state.add('Load',Load.getLoadState()); //args: state name, geting the load state + + //Start State + Start.init(_game,'Play'); + _game.state.add('Start',Start.getStartState()); + + //Play State + Play.init(_game,'End'); + _game.state.add('Play',Play.getPlayState()); + + //End State + End.init(_game,'Play'); + _game.state.add('End',End.getEndState()); + + //Starting the Load state + _game.state.start('Load'); + +}); diff --git a/space/SpaceInvaders-master/SpaceInvaders-master/assets/javascript/module/Aliens.js b/space/SpaceInvaders-master/SpaceInvaders-master/assets/javascript/module/Aliens.js new file mode 100644 index 00000000..6c412005 --- /dev/null +++ b/space/SpaceInvaders-master/SpaceInvaders-master/assets/javascript/module/Aliens.js @@ -0,0 +1,154 @@ +/** + * Created by stryker on 2014.03.05.. + */ +define(['module/HUD'],function(HUD){ + + //Private variables + var _game = null; + //var _alienGroups = []; + var _playerShip = null; + + //Private class + //This is a wrapper for the aliengroup + //Instead of extending Phaser group, i wrap it up in a class + var _Aliens = function(configuration){ + var _alienGroup = _game.add.group(), + _cols = configuration.cols, + _rows = configuration.rows, + _scoreValue = configuration.scoreValue, + _firingTime = configuration.firingTime, + _bulletSpeed = configuration.bulletSpeed, + _health = configuration.health, + _easing = configuration.easing, + _alien = null, + _tween = null, + _bulletGroup = null, + _bullet = null, + _explosionGroup = null, + _explosion = null, + _livingAlien = [], + _randomAlienIndex = null, + _shooter = null, + _shootingEvent = null; + + _alienGroup.enableBody = true; + _alienGroup.physicsBodyType = Phaser.Physics.ARCADE; + _createAllienGroup(); + + function _createAllienGroup(){ + //making aliens + for(var i=0;i < _cols;i++){ + for(var j=0; j < _rows;j++){ + _alien = _alienGroup.create(i * 48, j * 50, 'invader'); + + //custome properties + _alien.health = _health; + _alien.myScore = _scoreValue; + + _alien.anchor.setTo(0.5, 0.5); + _alien.animations.add('fly', [ 0, 1, 2, 3 ], 20, true); + _alien.play('fly'); + _alien.body.moves = false; + } + } + + + //setting aliens postition + _alienGroup.x = 100; + _alienGroup.y = 50; + + // All this does is basically start the invaders moving. + _tween = _game.add.tween(_alienGroup).to( { x: 200 }, 2000, _easing, true, 0, 1000, true); + + } + + + + var _fireBullet = function(){ + _bullet = _bulletGroup.getFirstExists(false); + + _livingAlien = []; + + _alienGroup.forEachAlive(function(alien){ + _livingAlien.push(alien); + }); + + if(_bullet && _livingAlien.length > 0){ + + //_bullet.lifespan = _game.height / (_bulletSpeed/1000); + _bullet.checkWorldBounds = true; + + _randomAlienIndex = _game.rnd.integerInRange(0,_livingAlien.length); + + _shooter = _livingAlien[_randomAlienIndex]; + + if(_shooter){ + _bullet.reset(_shooter.body.x,_shooter.body.y); + + _game.physics.arcade.moveToObject(_bullet,_playerShip,_bulletSpeed); + } + //all alien died + }else if(_livingAlien.length == 0){ + _game.state.start('End'); + } + + }; + + var _collisionHandler = function(bullet, alien){ + + alien.damage(bullet.bulletDamage); + bullet.kill(); + + if(alien.health == 0){ + _explosion = _explosionGroup.getFirstExists(false); + _explosion.reset(alien.body.x,alien.body.y); + _explosion.play('kaboom',30,false,true); + } + + HUD.updateScoreText(alien.myScore); + }; + + //Public functions + return{ + setBulletGroup: function(bullets){ + _bulletGroup = bullets.getBulletGroup(); + }, + getBulletGroup: function(){ + return _bulletGroup; + }, + setExplosionGroup: function(explosions){ + _explosionGroup = explosions.getExplosionGroup(); + }, + startShooting: function(){ + _shootingEvent = _game.time.events.loop(_firingTime,_fireBullet,this); + }, + stopShooting: function(){ + _game.time.events.remove(_shootingEvent); + }, + createOverLap: function(bulletGroup){ + _game.physics.arcade.overlap(bulletGroup, _alienGroup, _collisionHandler, null, this); + }, + getAlienGroup: function(){ + return _alienGroup; + } + + } + + };//End of _Aliens + + //Public functions + return{ + init: function(game){ + _game = game; + }, + preload: function(){ + _game.load.spritesheet('invader', 'assets/img/invader32x32x4.png', 32, 32); + }, + create: function(configuration){ + return( new _Aliens(configuration) ); + }, + setPlayerShip: function(playerShip){ + _playerShip = playerShip; + } + } +}); \ No newline at end of file diff --git a/space/SpaceInvaders-master/SpaceInvaders-master/assets/javascript/module/Background.js b/space/SpaceInvaders-master/SpaceInvaders-master/assets/javascript/module/Background.js new file mode 100644 index 00000000..219fe93c --- /dev/null +++ b/space/SpaceInvaders-master/SpaceInvaders-master/assets/javascript/module/Background.js @@ -0,0 +1,25 @@ +/** + * Created by stryker on 2014.03.05.. + */ +define(function(){ + + //Private variables + var _game = null, + _starfield = null; + + return{ + init: function(game,level,mode){ + _game = game; + }, + preload: function(){ + _game.load.image('starfield', 'assets/img/starfield.png'); + }, + create: function(){ + _starfield = _game.add.tileSprite(0, 0,800,600, 'starfield'); + }, + update: function(){ + _starfield.tilePosition.y +=2; + } + + } +}); \ No newline at end of file diff --git a/space/SpaceInvaders-master/SpaceInvaders-master/assets/javascript/module/Bullets.js b/space/SpaceInvaders-master/SpaceInvaders-master/assets/javascript/module/Bullets.js new file mode 100644 index 00000000..c10ce4d4 --- /dev/null +++ b/space/SpaceInvaders-master/SpaceInvaders-master/assets/javascript/module/Bullets.js @@ -0,0 +1,39 @@ +/** + * Created by stryker on 2014.03.05.. + */ +define(function(){ + var _game = null; + + var _Bullets = function(quantity,type,damage){ + var _bulletGroup = _game.add.group(); + _bulletGroup.enableBody = true; + _bulletGroup.physicsBodyType = Phaser.Physics.ARCADE; + _bulletGroup.createMultiple(quantity,type); + _bulletGroup.setAll('anchor.x',0.5); + _bulletGroup.setAll('anchor.y',1); + _bulletGroup.setAll('outOfBoundsKill',true); + + //costume property + _bulletGroup.setAll('bulletDamage',damage); + + return{ + getBulletGroup : function(){ + return _bulletGroup; + } + } + + }; + + return{ + init: function(game){ + _game = game; + }, + preload: function(){ + _game.load.image('bullet','assets/img/bullet.png'); + _game.load.image('enemyBullet','assets/img/enemy-bullet.png'); + }, + create: function(quantity,type,damage){ + return( new _Bullets(quantity,type,damage) ); + } + } +}); \ No newline at end of file diff --git a/space/SpaceInvaders-master/SpaceInvaders-master/assets/javascript/module/Explosions.js b/space/SpaceInvaders-master/SpaceInvaders-master/assets/javascript/module/Explosions.js new file mode 100644 index 00000000..a1ed2491 --- /dev/null +++ b/space/SpaceInvaders-master/SpaceInvaders-master/assets/javascript/module/Explosions.js @@ -0,0 +1,36 @@ +define(function(){ + var _game = null; + + var _Exploisons = function(quantity,type){ + var _explosions = _game.add.group(); + _explosions.createMultiple(quantity,type); + _explosions.forEach(setupExploisons,this); + + var _type = type; + + function setupExploisons(exploison){ + exploison.anchor.x = 0.5; + exploison.anchor.y = 0.5; + exploison.animations.add(type); + } + + return{ + getExplosionGroup: function(){ + return _explosions; + } + } + + } + + return{ + init: function(game){ + _game = game; + }, + preload: function(){ + _game.load.spritesheet('kaboom','assets/img/explode.png',128,128); + }, + create: function(quantity,type){ + return( new _Exploisons(quantity,type)); + } + } +}); \ No newline at end of file diff --git a/space/SpaceInvaders-master/SpaceInvaders-master/assets/javascript/module/HUD.js b/space/SpaceInvaders-master/SpaceInvaders-master/assets/javascript/module/HUD.js new file mode 100644 index 00000000..35f47a3e --- /dev/null +++ b/space/SpaceInvaders-master/SpaceInvaders-master/assets/javascript/module/HUD.js @@ -0,0 +1,47 @@ +/** + * Created by stryker on 2014.03.05.. + */ +define(function(){ + //Private variables + var _game = null, + _health = null, + _healthText = null, + _lives = null, + _livesText = null, + _score = null, + _scoreText = null, + _stateText = null; + + return{ + init: function(game){ + _game = game; + }, + preload: function(){ + //_game.load.image('ship', 'assets/img/player.png'); + }, + createStat: function(score,health,lives){ + _score = score; + _scoreText = _game.add.text(10, 10, "Score: " + score, { fontSize: '34px', fill: '#fff' }); + _health = health; + _healthText = _game.add.text(10, 50, "Health: " + health, { fontSize: '34px', fill: '#fff' }); + _lives = lives; + _livesText = _game.add.text(10, 90, "Lives: " + lives, { fontSize: '34px', fill: '#fff' }); + + //_stateText.visible = false; + }, + updateHealthText: function(health){ + _healthText.text = "Health: "+health; + }, + updateLivesText: function(lives){ + _livesText.text = "Lives: "+lives; + }, + updateScoreText: function(score){ + _scoreText.text = "Score: "+(_score+=score); + }, + createTitle: function(title){ + _stateText = _game.add.text(_game.world.centerX,_game.world.centerY, + title,{font: '84px Arial',fill: '#fff'}) + _stateText.anchor.setTo(0.5,0.5); + } + } +}); \ No newline at end of file diff --git a/space/SpaceInvaders-master/SpaceInvaders-master/assets/javascript/module/Level.js b/space/SpaceInvaders-master/SpaceInvaders-master/assets/javascript/module/Level.js new file mode 100644 index 00000000..91d3ddbf --- /dev/null +++ b/space/SpaceInvaders-master/SpaceInvaders-master/assets/javascript/module/Level.js @@ -0,0 +1,3 @@ +/** + * Created by stryker on 2014.03.05.. + */ diff --git a/space/SpaceInvaders-master/SpaceInvaders-master/assets/javascript/module/Player.js b/space/SpaceInvaders-master/SpaceInvaders-master/assets/javascript/module/Player.js new file mode 100644 index 00000000..15ed2d74 --- /dev/null +++ b/space/SpaceInvaders-master/SpaceInvaders-master/assets/javascript/module/Player.js @@ -0,0 +1,120 @@ +/** + * Created by stryker on 2014.03.05.. + * Player module + */ +define(['module/HUD'],function(HUD){ + + //Private Variables + var _game = null, + _health = null, + _lives = null, + _score = null, + _firingTime = null, + _ship = null, + _cursors = null, + _bulletGroup = null, + _bullet = null, + _explosionGroup = null, + _explosion = null, + _alienGroup = null, + _aliens = null, + _shootingEvent = null, + _bulletSpeed = null; + + var _fireBullet = function(){ + _bullet = _bulletGroup.getFirstExists(false); + + if(_bullet){ + //_bullet.lifespan = _game.height / (_bulletSpeed/1000); + _bullet.checkWorldBounds = true; + _bullet.reset(_ship.x,_ship.y+8); + _bullet.body.velocity.y = -_bulletSpeed; + } + }; + + var _collisionHandler = function(ship,bullet){ + + ship.damage(bullet.bulletDamage); + + bullet.kill(); + HUD.updateHealthText(ship.health); + + //ship lose a life + if(ship.health == 0){ + this.stopShooting(); + _explosion = _explosionGroup.getFirstExists(false); + _explosion.reset(_ship.body.x,_ship.body.y); + _explosion.play('kaboom',30,false,true); + + _lives--; + HUD.updateLivesText(_lives); + + //lose life + if(_lives > 0){ + ship.revive(_health); + this.startShooting(); + //dead + }else{ + _game.state.start('End'); + } + } + + }; + + return{ + init: function(game){ + _game = game; + }, + preload: function(){ + _game.load.image('ship', 'assets/img/player.png'); + }, + create: function(configuration){ + _ship = _game.add.sprite(400,500,'ship'); + _ship.anchor.setTo(0.5,0.5); + _game.physics.enable(_ship,Phaser.Physics.ARCADE); + _ship.body.collideWorldBounds = true; + _ship.health = configuration.health; + _health = configuration.health; + _lives = configuration.lives; + _score = configuration.score; + _firingTime = configuration.firingTime; + _bulletSpeed = configuration.bulletSpeed; + + _cursors = _game.input.keyboard.createCursorKeys(); + }, + update: function(){ + _ship.body.velocity.setTo(0,0); + + if(_cursors.left.isDown){ + _ship.body.velocity.x = -200; + }else if(_cursors.right.isDown){ + _ship.body.velocity.x = 200; + } + }, + setBulletGroup: function(bullets){ + _bulletGroup = bullets.getBulletGroup(); + }, + getBulletGroup: function(){ + return _bulletGroup; + }, + setExplosionGroup: function(explosions){ + _explosionGroup = explosions.getExplosionGroup(); + }, + startShooting: function(){ + _shootingEvent = _game.time.events.loop(_firingTime,_fireBullet,this); + }, + stopShooting: function(){ + _game.time.events.remove(_shootingEvent); + }, + getPlayerShip: function(){ + return _ship; + }, + createOverLap: function(bulletGroup){ + _game.physics.arcade.overlap(_ship,bulletGroup,_collisionHandler,null,this); + }, + setAliensAndAlienGroup: function(aliens){ + _aliens = aliens; + _alienGroup=aliens.getAlienGroup(); + } + } +}); \ No newline at end of file diff --git a/space/SpaceInvaders-master/SpaceInvaders-master/assets/javascript/state/End.js b/space/SpaceInvaders-master/SpaceInvaders-master/assets/javascript/state/End.js new file mode 100644 index 00000000..058c7e07 --- /dev/null +++ b/space/SpaceInvaders-master/SpaceInvaders-master/assets/javascript/state/End.js @@ -0,0 +1,28 @@ +/** + * Created by stryker on 2014.03.22.. + */ +define(['module/HUD'],function(HUD){ + var _game = null, + _nextState = null; + + var _End = { + create: function(){ + HUD.createTitle(' Game Over \n Press Spacebar'); + + //Starting the Play state after the spacebar is down + _game.input.keyboard.addKey(Phaser.Keyboard.SPACEBAR).onDown.addOnce(function(){ + _game.state.start(_nextState); + }); + } + } + + return{ + init: function(game,nextState){ + _game = game; + _nextState = nextState; + }, + getEndState: function(){ + return (_End); + } + } +}) \ No newline at end of file diff --git a/space/SpaceInvaders-master/SpaceInvaders-master/assets/javascript/state/Load.js b/space/SpaceInvaders-master/SpaceInvaders-master/assets/javascript/state/Load.js new file mode 100644 index 00000000..7e563333 --- /dev/null +++ b/space/SpaceInvaders-master/SpaceInvaders-master/assets/javascript/state/Load.js @@ -0,0 +1,52 @@ +/** + * Created by stryker on 2014.03.22.. + */ +define(['module/Background','module/Player','module/Aliens','module/Bullets','module/Explosions','module/HUD'],function(Background,Player,Aliens,Bullets,Explosions,HUD){ + + var _game = null, + _nextStage = null; + + //Loading State + var _Load = { + preload: function(){ + + //Background + Background.init(_game,0,'easy'); + Background.preload(); + + //Hud + HUD.init(_game); + + //Player + Player.init(_game); + Player.preload(); + + //Aliens + Aliens.init(_game); + Aliens.preload(); + + //Bullets + Bullets.init(_game); + Bullets.preload(); + + //Exploisons + Explosions.init(_game); + Explosions.preload(); + + }, + create: function(){ + _game.state.start(_nextStage); + } + } + + return{ + init: function(game,nextStage){ + _game = game; + _nextStage = nextStage; + }, + getLoadState: function(){ + return(_Load); + } + + } +}) \ No newline at end of file diff --git a/space/SpaceInvaders-master/SpaceInvaders-master/assets/javascript/state/Play.js b/space/SpaceInvaders-master/SpaceInvaders-master/assets/javascript/state/Play.js new file mode 100644 index 00000000..66308fbb --- /dev/null +++ b/space/SpaceInvaders-master/SpaceInvaders-master/assets/javascript/state/Play.js @@ -0,0 +1,72 @@ +/** + * Created by stryker on 2014.03.22.. + */ +define(['module/Background','module/Player','module/Aliens','module/Bullets','module/Explosions','module/HUD'],function(Background,Player,Aliens,Bullets,Explosions,HUD){ + var _game = null, + _nextState = null; + + var aliens = null; + + //Playing State + var _Play = { + create: function(){ + + Background.create(); + + HUD.createStat(0,100,3); + + //Setting up Player + var playerConfiguration = { + health: 100, + lives: 3, + score: 0, + firingTime: 300, + bulletSpeed: 500 + }; + + Player.create(playerConfiguration); + Player.setBulletGroup(Bullets.create(10,'bullet',100)); + Player.setExplosionGroup(Explosions.create(1,'kaboom')); + + //Setting up Aliens + var alienConfiguration = { + rows:4, + cols:10, + scoreValue:10, + firingTime:200, + bulletSpeed:200, + health: 100, + easing: Phaser.Easing.Linear.None + }; + + aliens = Aliens.create(alienConfiguration); + aliens.setBulletGroup(Bullets.create(30,'enemyBullet',10)); + aliens.setExplosionGroup(Explosions.create(5,'kaboom')); + Aliens.setPlayerShip(Player.getPlayerShip()); + + Player.setAliensAndAlienGroup(aliens); + + //They start shoting, shooting is triggered by a time loop + Player.startShooting(); + aliens.startShooting(); + }, + update: function(){ + Background.update(); + Player.update(); + + //Setting up the collision handling + aliens.createOverLap(Player.getBulletGroup()); + Player.createOverLap(aliens.getBulletGroup()); + } + } + + return{ + init: function(game,nextState){ + _game = game; + _nextState = nextState; + }, + getPlayState: function(){ + return(_Play); + } + } +}) \ No newline at end of file diff --git a/space/SpaceInvaders-master/SpaceInvaders-master/assets/javascript/state/Start.js b/space/SpaceInvaders-master/SpaceInvaders-master/assets/javascript/state/Start.js new file mode 100644 index 00000000..b71c4138 --- /dev/null +++ b/space/SpaceInvaders-master/SpaceInvaders-master/assets/javascript/state/Start.js @@ -0,0 +1,35 @@ +/** + * Created by stryker on 2014.03.22.. + */ +define(['module/HUD'],function(HUD){ + var _game = null, + _nextState = null, + _activationKey = null; + + //Start State + var _Start = { + create: function(){ + //creating the titel screen + HUD.createTitle(' Space Invader \n Press Spacebar'); + + //Seeting up the Physics for the game + _game.physics.startSystem(Phaser.Physics.ARCADE); + + //Starting the next state(Play) after the spacebar is down + _game.input.keyboard.addKey(Phaser.Keyboard.SPACEBAR).onDown.addOnce(function(){ + _game.state.start(_nextState); + }); + } + } + + return{ + init: function(game,nextState){ + _game = game; + _nextState = nextState; + }, + getStartState: function(){ + return(_Start); + } + + } +}) \ No newline at end of file diff --git a/space/SpaceInvaders-master/SpaceInvaders-master/index.html b/space/SpaceInvaders-master/SpaceInvaders-master/index.html new file mode 100644 index 00000000..38e747df --- /dev/null +++ b/space/SpaceInvaders-master/SpaceInvaders-master/index.html @@ -0,0 +1,13 @@ + + + + + Space Invaders + + + + +
+
+ + \ No newline at end of file diff --git a/space/SpaceInvaders-master/SpaceInvaders-master/indexOpt.html b/space/SpaceInvaders-master/SpaceInvaders-master/indexOpt.html new file mode 100644 index 00000000..afec9e17 --- /dev/null +++ b/space/SpaceInvaders-master/SpaceInvaders-master/indexOpt.html @@ -0,0 +1,14 @@ + + + + + Get Started + + + + + +
+
+ +