-
Notifications
You must be signed in to change notification settings - Fork 0
/
bundle.min.js
1 lines (1 loc) · 26.3 KB
/
bundle.min.js
1
!function e(t,r,n){function o(a,s){if(!r[a]){if(!t[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(i)return i(a,!0);var l=new Error("Cannot find module '"+a+"'");throw l.code="MODULE_NOT_FOUND",l}var c=r[a]={exports:{}};t[a][0].call(c.exports,function(e){var r=t[a][1][e];return o(r?r:e)},c,c.exports,e,t,r,n)}return r[a].exports}for(var i="function"==typeof require&&require,a=0;a<n.length;a++)o(n[a]);return o}({1:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}var o=e("./states/boot"),i=n(o),a=e("./states/game"),s=n(a),u=e("./states/menu"),l=n(u),c=e("./states/preloader"),f=n(c),p=new Phaser.Game(144,256,Phaser.AUTO,"phaser-flappy-bird-game",null,!0);p.state.add("boot",new i.default),p.state.add("preloader",new f.default),p.state.add("menu",new l.default),p.state.add("game",new s.default),p.state.start("boot")},{"./states/boot":11,"./states/game":12,"./states/menu":13,"./states/preloader":14}],2:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(r,"__esModule",{value:!0});var s=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),u=e("../util"),l=n(u),c=function(e){function t(e,r,n,a){o(this,t);var s=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r,n,a,1));return s.alive=!0,s.animations.add("fly",[0,1,2,0,1,2],5,!1),l.default.vcenter(s,s.game.world),s.anchor.set(.3,.5),s.game.physics.enable(s),s.body.allowGravity=!1,s.body.immovable=!1,s.body.collideWorldBounds=!0,s.wing=e.add.audio("wing"),s.tween=s.game.add.tween(s).to({y:s.y-10},400,Phaser.Easing.Default.In,!1,0,-1,!0),s.tween.start(),s}return a(t,e),s(t,[{key:"fly",value:function(){if(this.body&&this.body.allowGravity){if(!this.alive)return;var e=this.game.add.tween(this);e.to({angle:-30},100),e.start(),this.body.velocity.y=-200,this.wing.play(),this.play("fly"),this.tween.pause()}else this.tween.resume();this.play("fly")}},{key:"update",value:function(){this.body&&this.body.allowGravity?this.alive&&(this.angle+=2):this.fly()}},{key:"start",value:function(){this.body.allowGravity=!0,this.tween.pause()}},{key:"die",value:function(e,t){this.alive=!1;var r=this.game.add.tween(this);r.to({angle:90},500,Phaser.Easing.Exponential.In),this.body.immovable=!1,r.start(),r.onComplete.add(e,t)}},{key:"reset",value:function(){this.body.allowGravity=!1,this.body.immovable=!1,l.default.vcenter(this,this.game.world),this.angle=0,this.alive=!0,this.body.gravity.y=0}}]),t}(Phaser.Sprite);r.default=c},{"../util":15}],3:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(r,"__esModule",{value:!0});var s=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),u=e("./score"),l=n(u),c="flappy-bird-best",f=function(e){function t(e,r,n){o(this,t);var a=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r,n,!1,!1));a.board=a.create(0,0,"board"),a.score=new l.default(e,"md",a),a.score.y=17,a.score.x=101-a.score.width,a.best=new l.default(e,"md",a);var s=localStorage.getItem(c);return s&&(a.best.score=Number.parseInt(s)),a.best.y=38,a.best.x=101-a.best.width,a.medal=null,a}return a(t,e),s(t,[{key:"setScore",value:function(e){this.score.score=e;var t="";e>=10&&e<20?t="bronze":e>=20&&e<20?t="silver":e>=30&&e<20?t="gold":e>=40&&(t="platinum"),t&&(this.medal=this.create(14,21,t)),e>this.best.score&&localStorage.setItem(c,e)}}]),t}(Phaser.Group);r.default=f},{"./score":9}],4:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(r,"__esModule",{value:!0});var s=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),u=e("./board"),l=n(u),c=e("./start-button"),f=n(c),p=e("../util"),h=n(p),d=function(e){function t(e,r,n,a){o(this,t);var s=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r)),u=e.world,c=e.add;return s.over=c.sprite(0,0,"over"),s.board=new l.default(e,s),s.board.y=40,s.restart=new f.default(e,0,120,n,a),s.swooshing=c.audio("swooshing"),s.tmpScore=0,s.addMultiple([s.over,s.board,s.restart]),s.forEach(function(e){return h.default.hcenter(e,s)}),h.default.center(s,u),s.hide(),s}return a(t,e),s(t,[{key:"hide",value:function(){this.visible=!1,this.setAll("alpha",0)}},{key:"setScore",value:function(e){this.board.setScore(e)}},{key:"show",value:function(){var e=this,t=this.game.add;this.visible=!0;var r=this.over.y;this.over.y-=10;var n=this.board.score.score,o=this.board.best.score<this.board.score.score;this.board.score.x=101-this.board.score.width,o&&(this.board.best.x=this.board.score.x),this.board.score.score=0;var i=t.tween(this.over).to({y:r,alpha:1},300);i.onComplete.add(function(){r=e.board.y,e.board.y+=20,i=t.tween(e.board).to({y:r,alpha:1},300,Phaser.Easing.Default.In,!1,500),i.onStart.add(function(){return e.swooshing.play()}),i.onComplete.add(function(){i=t.tween(e.board.score).to({score:n},200),o&&(i.start(),i=t.tween(e.board.best).to({score:n},200)),i.onComplete.add(function(){i=t.tween(e.restart).to({alpha:1},200,Phaser.Easing.Default.In,!1,200),i.start()}),i.start()}),i.start()}),this.swooshing.play(),i.start()}}]),t}(Phaser.Group);r.default=d},{"../util":15,"./board":3,"./start-button":10}],5:[function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),s=function e(t,r,n){null===t&&(t=Function.prototype);var o=Object.getOwnPropertyDescriptor(t,r);if(void 0===o){var i=Object.getPrototypeOf(t);return null===i?void 0:e(i,r,n)}if("value"in o)return o.value;var a=o.get;if(void 0!==a)return a.call(n)},u=function(e){function t(e){n(this,t);var r=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,0,0,"ground"));return r.game.physics.enable(r),r.y=e.world.height-r.height,r.body.allowGravity=!1,r.body.immovable=!0,r.body.velocity.x=-100,r}return i(t,e),a(t,[{key:"stop",value:function(){this.body.velocity.x=0}},{key:"reset",value:function(){this.body.velocity.x=-60}},{key:"update",value:function(){s(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"update",this).call(this),this.x=this.x<=this.game.world.width-this.width?0:this.x}}]),t}(Phaser.Sprite);r.default=u},{}],6:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(r,"__esModule",{value:!0});var s=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),u=e("./start-button"),l=n(u),c=e("../util"),f=n(c),p=function(e){function t(e,r){o(this,t);var n=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r,"main menu",!1,!1)),a=(e.add,e.world);return n.title=n.create(0,0,"title"),f.default.hcenter(n.title,a),n.title.y=50,n.start=new l.default(e,0,180,n.onStartGame,n),n.addMultiple([n.title,n.start],!0),n}return a(t,e),s(t,[{key:"onStartGame",value:function(){var e=this,t=this.game.add.tween(this.game.world).to({alpha:0},200,Phaser.Easing.Default.In,!0);t.onComplete.add(function(){e.game.state.start("game")})}}]),t}(Phaser.Group);r.default=p},{"../util":15,"./start-button":10}],7:[function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),s=function(e){function t(e,r){n(this,t);var i=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r)),a=e.world;return i.enableBody=!0,i.topPipe=i.create(a.width,0,"pipe-top"),i.topPipe.y=(Math.floor(3*Math.random())+2)*a.height/8-i.topPipe.height,i.bottomPipe=i.create(a.width,0,"pipe-bottom"),i.bottomPipe.y=i.topPipe.y+i.topPipe.height+a.height/8*2,i.pass=!1,i.setAll("body.allowGravity",!1),i.setAll("body.immovable",!0),i.setAll("body.velocity.x",-60),i.setAll("checkWorldBounds",!0),i.setAll("outOfBoundsKill",!0),i}return i(t,e),a(t,[{key:"stop",value:function(){this.setAll("body.velocity.x",0)}}]),t}(Phaser.Group);r.default=s},{}],8:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(r,"__esModule",{value:!0});var s=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),u=e("../util"),l=n(u),c=function(e){function t(e,r){o(this,t);var n=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r));return n.ready=n.create(0,0,"ready"),n.tap=n.create(0,50,"tap"),l.default.hcenter(n.tap,n),l.default.center(n,r),n}return a(t,e),s(t,[{key:"hide",value:function(){this.visible=!1}},{key:"show",value:function(){this.visible=!0}}]),t}(Phaser.Group);r.default=c},{"../util":15}],9:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(r,"__esModule",{value:!0});var s=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),u=e("../util"),l=(n(u),function(e){function t(e,r,n,a){o(this,t),r=r||"";var s=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,a,!1,!1));return s.type=r,s._score=0,s.parent=n,s.create(0,0,s.type+"0"),s}return a(t,e),s(t,[{key:"reset",value:function(){this.score=0}},{key:"show",value:function(){this.visible=!0}},{key:"hide",value:function(){this.visible=!1}},{key:"score",get:function(){return this._score},set:function(e){this._score=Math.round(e);var t=this._score.toString();this.removeAll();for(var r=0,n=(this.width,0);n<t.length;n++)r+=this.create(r,0,this.type+t[n]).width}}]),t}(Phaser.Group));r.default=l},{"../util":15}],10:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(r,"__esModule",{value:!0});var s=e("../util"),u=n(s),l=function(e){function t(e,r,n,a,s,l,c,f,p){o(this,t);var h=e.add.audio("swooshing"),d=function(){h.play();var t=e.add.tween(b).to({y:n+5},100,Phaser.Easing.Default.In,!0,0,0,!0);t.onComplete.add(a,s)},b=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r,n,"start",d,s,l,c,f,p));return b.x?0:u.default.hcenter(b,e.world),b}return a(t,e),t}(Phaser.Button);r.default=l},{"../util":15}],11:[function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),s=function(e){function t(){return n(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this))}return i(t,e),a(t,[{key:"init",value:function(){this.game.renderer.renderSession.roundPixels=!0}},{key:"create",value:function(){this.game.input.maxPointers=1,this.game.scale.pageAlignHorizontally=!0,this.game.scale.pageAlignVertically=!0,this.game.device.desktop?(this.game.scale.minWidth=this.game.scale.maxWidth=432,this.game.scale.minHeight=this.game.scale.maxHeight=768):(this.game.scale.scaleMode=Phaser.ScaleManager.SHOW_ALL,this.game.scale.minWidth=144,this.game.scale.minHeight=256,this.game.scale.maxWidth=432,this.game.scale.maxHeight=768,this.game.scale.forceOrientation(!0)),this.game.state.start("preloader")}}]),t}(Phaser.State);r.default=s},{}],12:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(r,"__esModule",{value:!0});var s=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),u=e("../prefabs/pipe"),l=n(u),c=e("../prefabs/ground"),f=n(c),p=e("../prefabs/bird"),h=n(p),d=e("../prefabs/score"),b=n(d),y=e("../prefabs/ready"),v=n(y),g=e("../prefabs/gameover"),m=n(g),w=e("../util"),_=n(w),O=function(e){function t(){o(this,t);var e=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e.background=null,e.ground=null,e.bird=null,e.pipes=null,e.score=null,e.ready=null,e.gameOver=null,e.timer=null,e.audio={},e}return a(t,e),s(t,[{key:"init",value:function(){this.game.renderer.renderSession.roundPixels=!0,this.game.physics.startSystem(Phaser.Physics.ARCADE),this.game.physics.arcade.gravity.y=800,this.game.add.tween(this.game.world).to({alpha:1},200,Phaser.Easing.Default.In,!0)}},{key:"create",value:function(){var e=this,t=this.game,r=this.game.world,n=this.game.add;this.background=n.sprite(0,0,"day"),["point","hit","die","swooshing"].forEach(function(t){return e.audio[t]=n.audio(t)}),this.pipes=n.physicsGroup(),this.ground=new f.default(t,r),n.existing(this.ground),this.bird=new h.default(t,30,0,"bird"),n.existing(this.bird),this.score=new b.default(t,"",r),this.score.y=20,_.default.hcenter(this.score,r),this.ready=new v.default(t,r),this.gameOver=new m.default(t,r,this.onRestart,this),this.input.onTap.add(this.onTap,this)}},{key:"update",value:function(){var e=this;this.pipes.forEachAlive(function(t){e.game.physics.arcade.overlap(e.bird,t,e.hitPipe,null,e)||e.passPipe(t)}),this.game.physics.arcade.collide(this.bird,this.ground,this.hitGround,null,this)}},{key:"onTap",value:function(){var e=this;this.ready.visible&&(this.ready.hide(),this.bird.start(),new l.default(this.game,this.pipes),this.timer=this.time.events.loop(1500,function(){return new l.default(e.game,e.pipes)})),this.bird.fly()}},{key:"onRestart",value:function(){var e=this,t=(this.game.add,this.game.add.tween(this.game.world).to({alpha:0},100,Phaser.Easing.Default.In,!0));t.onComplete.add(function(){e.bird.reset(),e.ground.reset(),e.ready.show(),e.gameOver.hide(),e.score.score=0,e.score.show(),e.pipes.removeAll(),e.game.add.tween(e.game.world).to({alpha:1},100,Phaser.Easing.Default.In,!0)})}},{key:"hitPipe",value:function(){var e=this;this.bird.alive!==!1&&(this.shock(),this.audio.hit.onStop.removeAll(),this.audio.hit.onStop.add(function(){return e.audio.die.play()}),this.audio.hit.play(),this.bird.die(this.onGameOver,this),this.game.time.events.remove(this.timer),this.pipes.forEachAlive(function(e){return e.stop()}),this.ground.stop())}},{key:"hitGround",value:function(){var e=this;this.bird.alive!==!1&&(this.shock(),this.audio.hit.onStop.removeAll(),this.audio.hit.play(),this.bird.alive=!1,this.game.time.events.remove(this.timer),this.pipes.forEachAlive(function(e){return e.stop()}),this.ground.stop(),this.time.events.repeat(500,0,function(){return e.onGameOver()}))}},{key:"shock",value:function(){this.game.camera.flash(),this.game.camera.shake(.02)}},{key:"onGameOver",value:function(){this.score.hide(),this.gameOver.setScore(this.score.score),this.gameOver.show()}},{key:"passPipe",value:function(e){e.pass||this.bird.x-e.topPipe.x>=e.width&&(e.pass=!0,this.score.score++,_.default.hcenter(this.score,this.game.world),this.audio.point.play())}}]),t}(Phaser.State);r.default=O},{"../prefabs/bird":2,"../prefabs/gameover":4,"../prefabs/ground":5,"../prefabs/pipe":7,"../prefabs/ready":8,"../prefabs/score":9,"../util":15}],13:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(r,"__esModule",{value:!0});var s=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),u=e("../util"),l=n(u),c=e("../prefabs/ground"),f=n(c),p=e("../prefabs/main-menu"),h=n(p),d=e("../prefabs/bird"),b=n(d),y=function(e){function t(){o(this,t);var e=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e.background=null,e.ground=null,e.mainMenu=null,e.title=null,e}return a(t,e),s(t,[{key:"init",value:function(){this.physics.startSystem(Phaser.Physics.ARCADE)}},{key:"create",value:function(){var e=this.game.add,t=this.game.world,r=this.game;this.background=e.sprite(0,0,"day"),this.ground=new f.default(r),e.existing(this.ground),this.mainMenu=new h.default(r,t),this.bird=new b.default(r,0,0,"bird"),e.existing(this.bird),l.default.hcenter(this.bird,t)}}]),t}(Phaser.State);r.default=y},{"../prefabs/bird":2,"../prefabs/ground":5,"../prefabs/main-menu":6,"../util":15}],14:[function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),s=function(e){function t(){n(this,t);var e=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e.asset=null,e.ready=!1,e}return i(t,e),a(t,[{key:"preload",value:function(){this.load.onLoadComplete.addOnce(this.onLoadComplete,this),this.loadResources()}},{key:"loadResources",value:function(){var e=this.load.image.bind(this.load),t=this.load.spritesheet.bind(this.load),r=this.load.audio.bind(this.load);e("day","assets/background/day.png"),e("pipe-top","assets/pipes/pipe_top.png"),e("pipe-bottom","assets/pipes/pipe_bottom.png"),e("ground","assets/background/ground.png"),e("board","assets/board.png"),["title","ready","tap","over"].forEach(function(t){return e(t,"assets/text/"+t+".png")});for(var n=0;n<10;n++)e(n,"assets/numbers/"+n+".png"),e("md"+n,"assets/numbers/md"+n+".png");e("start","assets/buttons/start.png"),t("bird","assets/birds/bird.png",19,14),["die","hit","point","swooshing","wing"].forEach(function(e){return r(e,"assets/audio/"+e+".wav")}),["bronze","gold","platinum","silver"].forEach(function(t){return e(t,"assets/medals/"+t+".png")})}},{key:"onLoadComplete",value:function(){this.game.state.start("menu")}}]),t}(Phaser.State);r.default=s},{}],15:[function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var o=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=function(){function e(){n(this,e)}return o(e,null,[{key:"center",value:function(e,t){this.hcenter(e,t),this.vcenter(e,t)}},{key:"hcenter",value:function(e,t){e.x=(t.width-e.width)/2}},{key:"vcenter",value:function(e,t){e.y=(t.height-e.height)/2}}]),e}();r.default=i},{}]},{},[1]);