/
bundle.min.js
1 lines (1 loc) · 5.35 KB
/
bundle.min.js
1
!function t(e,s,i){function o(a,r){if(!s[a]){if(!e[a]){var h="function"==typeof require&&require;if(!r&&h)return h(a,!0);if(n)return n(a,!0);var p=new Error("Cannot find module '"+a+"'");throw p.code="MODULE_NOT_FOUND",p}var d=s[a]={exports:{}};e[a][0].call(d.exports,function(t){var s=e[a][1][t];return o(s?s:t)},d,d.exports,t,e,s,i)}return s[a].exports}for(var n="function"==typeof require&&require,a=0;a<i.length;a++)o(i[a]);return o}({1:[function(t,e,s){function i(){}i.prototype.preload=function(){this.load.image("preloader","assets/preloader.gif")},i.prototype.create=function(){this.game.input.maxPointers=1,this.game.device.desktop?this.game.scale.pageAlignHorizontally=!0:(this.game.scale.scaleMode=Phaser.ScaleManager.SHOW_ALL,this.game.scale.minWidth=480,this.game.scale.minHeight=260,this.game.scale.maxWidth=640,this.game.scale.maxHeight=480,this.game.scale.forceOrientation(!0),this.game.scale.pageAlignHorizontally=!0,this.game.scale.setScreenSize(!0)),this.game.state.start("preloader")},e.exports=i},{}],2:[function(t,e,s){function i(){return this.objects=[],this.objects.push(new a(this)),this.objects.push(new r(this)),this.objects.push(new h(this)),this.objects.push(new p(this)),this.sensor=this.objects[0],this.paddle=this.objects[1],this.ping=this.objects[2],this.pong=this.objects[3],this}function o(t){const e=t.ping.y+t.ping.radius.current,s=t.paddle.paddle.y;e>=s&&(t.ping.kill(),t.pong.start(t.paddle.paddle.x,t.paddle.paddle.y))}function n(t){const e={x:275,y:65},s={x:t.pong.x,y:t.pong.y},i=t.physics.arcade.distanceBetween(e,s),o=t.pong.radius.current;o>=i&&(t.pong.kill(),t.ping.start())}const a=t("./sensor"),r=t("./paddle"),h=t("./ping"),p=t("./pong");i.prototype.preload=function(){this.objects.forEach(function(t){t.preload&&t.preload()})},i.prototype.create=function(){this.stage.backgroundColor="#3498db",this.objects.forEach(function(t){t.create&&t.create()}),this.ping.start()},i.prototype.update=function(){this.objects.forEach(function(t){t.update&&t.update()}),this.ping.dead===!1&&o(this),this.pong.dead===!1&&n(this)},e.exports=i},{"./paddle":5,"./ping":6,"./pong":7,"./sensor":9}],3:[function(t,e,s){const i=new Phaser.Game(640,480,Phaser.AUTO,"ultrasonic_sensor-game");i.state.add("boot",t("./boot")),i.state.add("preloader",t("./preloader")),i.state.add("menu",t("./menu")),i.state.add("game",t("./game")),i.state.start("boot")},{"./boot":1,"./game":2,"./menu":4,"./preloader":8}],4:[function(t,e,s){function i(){}i.prototype.create=function(){const t=this.add.text(.5*this.game.width,.5*this.game.height,"MENU",{font:"42px Arial",fill:"#ffffff",align:"center"});t.anchor.set(.5),this.input.onDown.add(this.onInputDown,this)},i.prototype.update=function(){},i.prototype.onInputDown=function(){this.game.state.start("game")},e.exports=i},{}],5:[function(t,e,s){function i(t){this.game=t}i.prototype.preload=function(){this.game.load.image("bricks","assets/bricksx64.png")},i.prototype.create=function(){this.paddle=this.game.add.sprite(365,this.game.world.centerY,"bricks"),this.game.physics.arcade.enable(this.paddle),this.paddle.anchor.setTo(.5,0),this.cursors=this.game.input.keyboard.createCursorKeys()},i.prototype.update=function(){const t=this.cursors,e=this.paddle;if(t.up.isDown)e.body.velocity.y=-150;else if(t.down.isDown)e.body.velocity.y=150;else{const s=e.body.velocity;Math.abs(s.y)<.5&&(s.y=0),s.y=.95*s.y}},e.exports=i},{}],6:[function(t,e,s){function i(t){return this.game=t,this}i.prototype.preload=function(){this.degToRad=this.game.math.degToRad,this.radius={current:30},this.x=365,this.y=75},i.prototype.create=function(){this.graphics=this.game.add.graphics(0,0)},i.prototype.update=function(){const t=this.graphics;t.clear(),this.dead||(t.lineStyle(10,16711680,.8),t.arc(this.x,this.y,this.radius.current,this.degToRad(45),this.degToRad(135),!1))},i.prototype.kill=function(){this.dead=!0,this.radius.current=30,this.tween.stop()},i.prototype.start=function(){this.dead=!1,this.radius.current=30,this.tween=this.game.add.tween(this.radius).to({current:360},4500,"Linear",!0)},e.exports=i},{}],7:[function(t,e,s){function i(t){return this.game=t,this}i.prototype.preload=function(){this.degToRad=this.game.math.degToRad,this.radius={current:30}},i.prototype.create=function(){this.graphics=this.game.add.graphics(0,0)},i.prototype.update=function(){const t=this.graphics;t.clear(),this.dead||(t.lineStyle(10,255,.8),t.arc(this.x,this.y,this.radius.current,this.degToRad(-45),this.degToRad(-135),!0))},i.prototype.kill=function(){this.dead=!0,this.radius.current=30,this.tween.stop()},i.prototype.start=function(t,e){this.x=t,this.y=e,this.dead=!1,this.radius.current=30,this.tween=this.game.add.tween(this.radius).to({current:360},4500,"Linear",!0)},e.exports=i},{}],8:[function(t,e,s){function i(){this.asset=null,this.ready=!1}i.prototype.preload=function(){this.asset=this.add.sprite(.5*this.game.width-110,.5*this.game.height-10,"preloader"),this.load.setPreloadSprite(this.asset),this.ready=!0},i.prototype.loadResources=function(){},i.prototype.create=function(){},i.prototype.update=function(){this.game.state.start("game")},i.prototype.onLoadComplete=function(){},e.exports=i},{}],9:[function(t,e,s){function i(t){return this.game=t,this}i.prototype.preload=function(){this.game.load.image("sensor","assets/ultrasonic_sensor_down.png")},i.prototype.create=function(){this.sensor=this.game.add.sprite(this.game.world.centerX,0,"sensor"),this.sensor.anchor.setTo(.5,0)},e.exports=i},{}]},{},[3]);