!function(t){var e={};function n(i){if(e[i])return e[i].exports;var o=e[i]={i:i,l:!1,exports:{}};return t[i].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(i,o,function(e){return t[e]}.bind(null,o));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=13)}([function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;nn.x?this.x-=this.getMin(o,i):this.x+=this.getMin(o,i),this._preturn=!0):e=this.getMin(o,i)}if(this._isH(t)){var s=Math.abs(this.y-n.y);this.preturn?this._isCentered("y")?this._preturn=!1:(this.y>n.y?this.y-=this.getMin(s,i):this.y+=this.getMin(s,i),this._preturn=!0):e=this.getMin(s,i)}}e||(this.dir=t,this._setNextAnimation())}e||(this._canGo(this.dir)?e=i:(this._isV(this.dir)&&(e=this.getMin(Math.abs(this.y-n.y),i)),this._isH(this.dir)&&(e=this.getMin(Math.abs(this.x-n.x),i)))),e&&("u"===this.dir&&(this.y-=e),"r"===this.dir&&(this.x+=e),"d"===this.dir&&(this.y+=e),"l"===this.dir&&(this.x-=e)),this.x<0&&(this.x=this.map.width*this.map.tileWidth),this.x>this.map.width*this.map.tileWidth&&(this.x=0),this.y<0&&(this.y=this.map.height*this.map.tileHeight),this.y>this.map.height*this.map.tileHeight&&(this.y=0),(n=this.getTile())!==this._lastTile&&(this._lastTile=n,this.emit("item:tile",n)),this.update()}}},{key:"getStep",value:function(){return this.step*(this._speed/100)}},{key:"_setNextAnimation",value:function(){this._nextAnimation=this.animations[u[this.dir]]}},{key:"_getOpDirection",value:function(t){return l[t||this.dir]}},{key:"_canGo",value:function(t){var e=this.getTile().get(t);return e&&!e.isHouse()&&!e.isWall()}},{key:"_isV",value:function(t){return"u"===t||"d"===t}},{key:"_isH",value:function(t){return"l"===t||"r"===t}},{key:"_isCentered",value:function(t){var e=this.getTile(),n=e.x===this.x,i=e.y===this.y;return"x"===t?n:("y"===t||n)&&i}},{key:"getMin",value:function(){for(var t=null,e=0,n=arguments.length;eh)&&(t=u,e=h)}}return t}},{key:"_getTarget",value:function(){}},{key:"setAnimation",value:function(){o.default.prototype._setNextAnimation.call(this.ghost)}},{key:"canGo",value:function(t,e){e||(e=this.ghost.getTile());var n=e.get(t);return!!n&&(!n.isWall()&&!n.isHouse())}},{key:"exit",value:function(){return this.ghost.mode!=this.ghost.globalMode}},{key:"onExit",value:function(){this.ghost.getTile().isHouse()||(this.ghost._turnBack=!0),this.ghost.setMode()}}]),t}();e.default=u},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(){return(new Date).getTime()/1e3}},function(t,e,n){"use strict";e.__esModule=!0;var i=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}return t.prototype.on=function(t,e){if("function"!=typeof e)throw TypeError("Listener must be a function");this.listeners||(this.listeners={}),this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push(e)},t.prototype.once=function(t,e){if("function"==typeof e){var n=this,i=e;e=function(){i.apply(void 0,arguments),n.off(t,e)}}this.on(t,e)},t.prototype.off=function(t,e){if(t)if(e){var n=this.listeners[t];if(n)n.slice().forEach((function(t,i){t===e&&n.splice(i,1)})),n.length||delete this.listeners[t]}else delete this.listeners[t];else this.listeners={}},t.prototype.emit=function(t){for(var e=arguments.length,n=Array(e>1?e-1:0),i=1;i0&&void 0!==arguments[0]?arguments[0]:{};r(this,e);var n=a(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return t.map&&(n.map=t.map),n.offsetX=parseInt(n.width/2),n.offsetY=parseInt(n.height/2),n.render(),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),o(e,[{key:"getTile",value:function(){return this.map.getTile(this.x,this.y,!0)}},{key:"destroy",value:function(){(function t(e,n,i){null===e&&(e=Function.prototype);var o=Object.getOwnPropertyDescriptor(e,n);if(void 0===o){var s=Object.getPrototypeOf(e);return null===s?void 0:t(s,n,i)}if("value"in o)return o.value;var r=o.get;return void 0!==r?r.call(i):void 0})(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"destroy",this).call(this,{remove:!0})}},{key:"hide",value:function(){this.el.style.display="none"}},{key:"show",value:function(){this.el.style.display=""}}]),e}(((i=s)&&i.__esModule?i:{default:i}).default);e.default=u},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t,e){var n=t.x,i=e.x,o=t.y,s=e.y;return Math.sqrt(Math.pow(n-i,2)+Math.pow(o-s,2))}},function(t,e,n){t.exports=n.p+"./img/maze.png"},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.EVENT_KEY_DOWN=e.EVENT_KEY_UP=e.KEY_LEFT=e.KEY_DOWN=e.KEY_RIGHT=e.KEY_UP=void 0;var i=function(){function t(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};s(this,e);var n=r(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,{...t,el:t.el||document&&document.body}));return Object.keys(c).forEach((function(e){e in t&&(n[e]=t[e])})),n.onTouchStart=n.onTouchStart.bind(n),n.onTouchEnd=n.onTouchEnd.bind(n),n.el.addEventListener("touchstart",n.onTouchStart,!1),n.el.addEventListener("touchend",n.onTouchEnd,!1),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),i(e,[{key:"onDestroy",value:function(){this.el.removeEventListener("touchstart",this.onTouchStart),this.el.removeEventListener("touchend",this.onTouchEnd)}},{key:"onTouchStart",value:function(t){var e=t.changedTouches[0];this.startX=e.pageX,this.startY=e.pageY,this.startTime=new Date}},{key:"onTouchEnd",value:function(t){var e=null,n=t.changedTouches[0],i=n.pageX-this.startX,o=n.pageY-this.startY;new Date-this.startTime<=this.allowedTime&&(Math.abs(i)>=this.threshold&&Math.abs(o)<=this.restraint?e=i<0?f:l:Math.abs(o)>=this.threshold&&Math.abs(i)<=this.restraint&&(e=o<0?u:h),this.emit(a,e,t))}}]),e}(o.View);Object.assign(d.prototype,c),e.default=d},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=r(n(0)),o=n(62),s=r(o);function r(t){return t&&t.__esModule?t:{default:t}}e.default=function(t,e){return new s.default({animations:{...o.animations,default:new i.default({...o.animationBase,offsetX:60*t})},...e})}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n2){var t={d:"l",l:"u",u:"r",r:"d"};this.dir=t[this.dir],this._setNextAnimation(),this.update(),this._eatenTurnsFrames=5}else this._eatenTurnsFrames=25;this._eatenTurns--,0===this._eatenTurns&&this.emit("item:life")}else r.default.prototype.move.apply(this,arguments)}}]),e}(r.default);Object.assign(h.prototype,l),e.default=h},function(t,e,n){t.exports=n(14)},function(t,e,n){"use strict";n(15),n(8),n(16),n(17),n(18),n(19),n(20),n(21),n(22),n(23),n(24),n(25),n(26),n(27);var i,o=n(36),s=(i=o)&&i.__esModule?i:{default:i};window.addEventListener("load",(function(t){document.querySelector(".js-pacman-container");var e=Math.max(document.documentElement.clientWidth||0,window.innerWidth||0),n=Math.max(document.documentElement.clientHeight||0,window.innerHeight||0);new(function(t){function e(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var n=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return n.el.style.left="50%",n.el.style.marginLeft="-"+n.el.offsetWidth/2+"px",n.el.style.top="50%",n.el.style.marginTop="-"+n.el.offsetHeight/2+"px",n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e}(s.default))({el:document.querySelector(".js-pacman-playground"),width:.9*e,height:.9*n})}))},function(t,e,n){t.exports=n.p+"./img/characters.png"},function(t,e,n){t.exports=n.p+"./img/misc.png"},function(t,e,n){t.exports=n.p+"./img/pills.png"},function(t,e,n){t.exports=n.p+"./audio/back.mp3"},function(t,e,n){t.exports=n.p+"./audio/bonus.mp3"},function(t,e,n){t.exports=n.p+"./audio/dead.mp3"},function(t,e,n){t.exports=n.p+"./audio/dot.mp3"},function(t,e,n){t.exports=n.p+"./audio/eat.mp3"},function(t,e,n){t.exports=n.p+"./audio/eaten.mp3"},function(t,e,n){t.exports=n.p+"./audio/frightened.mp3"},function(t,e,n){t.exports=n.p+"./audio/intro.mp3"},function(t,e,n){t.exports=n.p+"./audio/life.mp3"},function(t,e,n){var i=n(28);"string"==typeof i&&(i=[[t.i,i,""]]);var o={hmr:!0,transform:void 0,insertInto:void 0};n(34)(i,o);i.locals&&(t.exports=i.locals)},function(t,e,n){var i=n(29);(t.exports=n(30)(!1)).push([t.i,"/* press-start-2p-regular - latin */\n@font-face {\n font-family: 'Press Start 2P';\n font-style: normal;\n font-weight: 400;\n src: local(''),\n url("+i(n(31))+") format('woff2'), \n url("+i(n(32))+") format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */\n}\n\nbody {\n background-color: #222;\n margin: 0;\n padding: 0;\n overflow: hidden;\n}\n\n.js-pacman-playground {\n position: absolute;\n color: #EFEFEF;\n font-family: 'Press Start 2P', cursive;\n font-size: 2em;\n background-color: #000;\n background-image: url("+i(n(8))+");\n background-size: 400% 200%;\n display: none;\n cursor: default;\n user-select: none;\n touch-action: none;\n}\n\n.js-pacman-playground.with-border {\n border-radius: 0.5em;\n border: 1em solid #000;\n}\n\n.js-pacman-playground.with-border.with-light {\n box-shadow: 0 0 1em 0.1em #EEE;\n}\n\n.js-pacman-playground.maze-1 {\n background-position: 0 0;\n}\n\n.js-pacman-playground.maze-2 {\n background-position: -100% 0;\n}\n\n.js-pacman-playground.maze-3 {\n background-position: -200% 0;\n}\n\n.js-pacman-playground.maze-4 {\n background-position: -300% 0;\n}\n\n.js-pacman-playground.maze-1.blink {\n background-position: 0 -100%;\n}\n\n.js-pacman-playground.maze-2.blink {\n background-position: -100% -100%;\n}\n\n.js-pacman-playground.maze-3.blink {\n background-position: -200% -100%;\n}\n\n.js-pacman-playground.maze-4.blink {\n background-position: -300% -100%;\n}\n\n.js-pacman-playground .splash {\n background-image: url("+i(n(33))+");\n background-size: 100% 100%;\n background-color: #000;\n text-align: center;\n position: absolute;\n top: 0;\n bottom: 0;\n right: 0;\n left: 0;\n z-index: 1;\n}\n\n.js-pacman-playground .splash a {\n color: #DDDDDD;\n cursor: pointer;\n font-weight: bold;\n}\n\n.js-pacman-playground .splash a:hover {\n color: #FFF;\n}\n\n.js-pacman-playground .splash a.start {\n position: relative;\n top: 65%;\n text-transform: uppercase;\n font-size: 1.6em;\n}\n\n.js-pacman-playground .splash .title {\n position: absolute;\n top: 22.04%;\n left: 0;\n right: 0;\n text-align: center;\n color: #FCB644;\n}\n\n.js-pacman-playground .splash p.nerd {\n position: absolute;\n top: 33.15%;\n left: 35.26%;\n text-align: center;\n color: #FFF;\n}\n\n.js-pacman-playground .splash p span {\n color : #FFFF00;\n}\n\n.js-pacman-playground .splash .keys {\n position: absolute;\n top: 85%;\n left: 0;\n right: 0;\n text-align: center;\n color: #FFF;\n}\n\n.js-pacman-playground .splash .credits {\n font-family: 'Press Start 2P', cursive;\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n color: #FFF;\n padding: 0.1em;\n font-size: 0.6em;\n}\n\n.js-pacman-playground .splash .credits span {\n color: #FF3333;\n}\n\n.js-pacman-playground .splash .credits a {\n color: #FFFF00;\n}\n\n.js-pacman-playground .splash .credits a:hover {\n color: #FFFF4D;\n}\n\n.js-pacman-playground .loadbar {\n position: absolute;\n top: 65%;\n left: 22.32%;\n right: 22.32%;\n background: #FF0;\n height: 3.472%;\n overflow: visible;\n border: 2px solid #FFF;\n}\n\n.js-pacman-playground .loadbar .inner {\n position: relative;\n background: #FF0000;\n height: 100%;\n width: 0;\n}\n\n.js-pacman-playground .score {\n position: absolute;\n top: 0;\n right: 0.4464%;\n left: 0.4464%;\n text-align: center;\n z-index: 2\n}\n\n.js-pacman-playground .score .p1-score {\n position: absolute;\n width: 22%;\n top: 0;\n left: 0;\n}\n\n.js-pacman-playground .score .high-score {\n width: 40%;\n margin-left: auto;\n margin-right: auto;\n}\n\n.js-pacman-playground .score .p2-score {\n position: absolute;\n width: 22%;\n top: 0;\n right: 0;\n}\n\n.js-pacman-playground .score span {\n text-align: right;\n display: block;\n}\n\n.js-pacman-playground .score .high-score span {\n text-align: center;\n}\n\n.js-pacman-playground .start-p1 {\n position: absolute;\n top: 38.71%;\n left: 0;\n right: 0;\n text-align: center;\n color: #5EE;\n}\n\n.js-pacman-playground .game-over,\n.js-pacman-playground .start-ready,\n.js-pacman-playground .sound-status,\n.js-pacman-playground .paused {\n position: absolute;\n top: 55.55%;\n left: 0;\n right: 0;\n text-align: center;\n color: #F00;\n}\n\n.js-pacman-playground .sound-status.on span.on,\n.js-pacman-playground .sound-status span.off {\n display : inline;\n}\n\n.js-pacman-playground .sound-status.on span.off,\n.js-pacman-playground .sound-status span.on {\n display : none;\n}\n\n.js-pacman-playground .sound-status .wrap,\n.js-pacman-playground .paused .wrap {\n background: #000;\n padding: 0.1em;\n}\n\n@media screen and (orientation: portrait) {\n /* body {\n background-color: #000;\n }\n\n .js-pacman-playground.with-border {\n border-radius: 0;\n box-shadow: none;\n border: none;\n } */\n}\n",""])},function(t,e){t.exports=function(t){return"string"!=typeof t?t:(/^['"].*['"]$/.test(t)&&(t=t.slice(1,-1)),/["'() \t\n]/.test(t)?'"'+t.replace(/"/g,'\\"').replace(/\n/g,"\\n")+'"':t)}},function(t,e){t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n=function(t,e){var n=t[1]||"",i=t[3];if(!i)return n;if(e&&"function"==typeof btoa){var o=(r=i,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(r))))+" */"),s=i.sources.map((function(t){return"/*# sourceURL="+i.sourceRoot+t+" */"}));return[n].concat(s).concat([o]).join("\n")}var r;return[n].join("\n")}(e,t);return e[2]?"@media "+e[2]+"{"+n+"}":n})).join("")},e.i=function(t,n){"string"==typeof t&&(t=[[null,t,""]]);for(var i={},o=0;o=0&&f.splice(e,1)}function g(t){var e=document.createElement("style");return void 0===t.attrs.type&&(t.attrs.type="text/css"),v(e,t.attrs),m(t,e),e}function v(t,e){Object.keys(e).forEach((function(n){t.setAttribute(n,e[n])}))}function b(t,e){var n,i,o,s;if(e.transform&&t.css){if(!(s=e.transform(t.css)))return function(){};t.css=s}if(e.singleton){var r=h++;n=l||(l=g(e)),i=O.bind(null,n,r,!1),o=O.bind(null,n,r,!0)}else t.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=function(t){var e=document.createElement("link");return void 0===t.attrs.type&&(t.attrs.type="text/css"),t.attrs.rel="stylesheet",v(e,t.attrs),m(t,e),e}(e),i=E.bind(null,n,e),o=function(){y(n),n.href&&URL.revokeObjectURL(n.href)}):(n=g(e),i=k.bind(null,n),o=function(){y(n)});return i(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;i(t=e)}else o()}}t.exports=function(t,e){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(e=e||{}).attrs="object"==typeof e.attrs?e.attrs:{},e.singleton||"boolean"==typeof e.singleton||(e.singleton=r()),e.insertInto||(e.insertInto="head"),e.insertAt||(e.insertAt="bottom");var n=p(t,e);return d(n,e),function(t){for(var i=[],o=0;o0&&void 0!==arguments[0]?arguments[0]:{};b(this,e);var n=_(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return Object.keys(k).forEach((function(e){e in t&&(n[e]=t[e])})),n.model=new u.default({lives:n.defaultLives}),n.model.fetch(),n.render(),n.elements={splash:n.$(".splash"),start:n.$(".start"),startP1:n.$(".start-p1"),startReady:n.$(".start-ready"),highScore:n.$(".high-score span"),score:n.$(".p1-score span"),gameOver:n.$(".game-over"),soundStatus:n.$(".sound-status"),paused:n.$(".paused"),load:n.$(".loadbar")},n.keyboard.on(y.EVENT_KEY_DOWN,n._onKeyDown.bind(n)),n.touch.on(g.EVENT_SWIPE,n._onSwipe.bind(n)),n.sound=new r.default({soundEnabled:n.soundEnabled,addSound:n.addSound.bind(n)}),n.lives=new p.default({lives:n.defaultLives+1,x:40,y:1124,model:n.model,factor:n.scaling.getFactor(),addSprite:n.addSprite.bind(n)}),n.bonuses=new m.default({level:n.model.level,x:860,y:1124,model:n.model,factor:n.scaling.getFactor(),addSprite:n.addSprite.bind(n)}),n._onGhostEaten=n._onGhostEaten.bind(n),n._onGhostEat=n._onGhostEat.bind(n),n.model.on("change:score",n._onChangeScore.bind(n)),n.model.on("change:highScore",n._onChangeHighScore.bind(n)),n.model.on("change:lives",n._onChangeLives.bind(n)),n.model.on("change:extraLives",n._onChangeExtraLives.bind(n)),n.model.on("change:mode",n._onChangeMode.bind(n)),n.makeLevel(),n.start((function(){O(n.elements.load),w(n.elements.start)})),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),i(e,[{key:"startLevel",value:function(){return this._win?(this.model.level++,this.reset(),void(this._win=!1)):this._gameOver?(this.model.level=1,this.reset(),this._gameOver=!1,O(this.elements.splash),void this.sound.play("intro")):(O(this.elements.splash),this.sound.play("intro"),void this.addCallback(this.mainLoop.bind(this)))}},{key:"reset",value:function(){this.model.mode=null,this.pinky.destroy(),this.blinky.destroy(),this.inky.destroy(),this.sue.destroy(),this.pacman.destroy(),this.map.destroyItems(),this.off("game:ghost:eaten",this._onGhostEaten),this.off("game:ghost:eat",this._onGhostEat),this._win||(this.model.lives=this.defaultLives+1,this.model.score=0),this.keyboard.clear(),this._inputDirection=null,this._lastSwipe=null,this.makeLevel()}},{key:"makeLevel",value:function(){var t=this;Object.assign(this,this.model.getSettings("game")),this.map=new a.default(this.map),this.el.classList.remove("maze-1"),this.el.classList.remove("maze-2"),this.el.classList.remove("maze-3"),this.el.classList.remove("maze-4"),this.el.classList.add(this.maze);var e="white";"maze-2"===this.maze&&(e="yellow"),"maze-3"===this.maze&&(e="red"),this._pauseFrames=80,this._destroyBonus=0,this._showBonus=500;for(var n=this.map.tiles.length,i=0;n--;){var o=this.map.tiles[n];if("."===o.code){var s=(0,h.default)({defaultAnimation:e,map:this.map,factor:this.scaling.getFactor(),normalizeRefrashRate:this.normalizeRefrashRate.bind(this),x:o.x,y:o.y});o.item=s,this.addSprite(s),i++}if("*"===o.code){var r=(0,f.default)({defaultAnimation:e,map:this.map,factor:this.scaling.getFactor(),normalizeRefrashRate:this.normalizeRefrashRate.bind(this),x:o.x,y:o.y});o.item=r,this.addSprite(r),i++}}this.totalItems=i,this.pacman=new d.default({preturn:!0,x:452,y:848,...this.model.getSettings("pacman"),map:this.map,factor:this.scaling.getFactor(),normalizeRefrashRate:this.normalizeRefrashRate.bind(this),addGameGhostEatEventListener:function(e){return t.on("game:ghost:eat",e)},addGameGhostModeFrightenedEnter:function(e){return t.on("game:ghost:modefrightened:enter",e)},addGameGhostModeFrightenedExit:function(e){return t.on("game:ghost:modefrightened:exit",e)}}),this.pacman.on("item:eatpill",(function(e){t._pauseFrames=2,t.model.addScore(t.pillScore),t.totalItems--,0===t.totalItems?t.win():t.sound.play("frightened")})),this.on("game:ghost:eaten",this._onGhostEaten),this.on("game:ghost:eat",this._onGhostEat),this.pacman.on("item:die",(function(e){t.sound.play("eaten")})),this.pacman.on("item:life",(function(){t.keyboard.clear(),t._inputDirection=null,t._lastSwipe=null,t.model.mode=null,t.pacman.reset(),t.pinky.reset(),t.blinky.reset(),t.inky.reset(),t.sue.reset(),t.bonus&&(t._destroyBonus=0,t._showBonus=250,t.bonus.reset(),t.bonus.hide()),t.showGhosts(),t.model.lives--,t._pacmanEaten=!1,t.model.lives?(w(t.elements.startReady),t._start=1,t._pauseFrames=40):t._pauseFrames=120})),this.pacman.on("item:eatdot",(function(e){t.model.addScore(t.dotScore),t.sound.play("dot"),t.totalItems--,0===t.totalItems&&t.win()})),this.addSprite(this.pacman),this.bonus&&this.bonus.destroy();var u=this.map.tunnels[this.map.tunnels.length-1];this.bonus=(0,c.default)(this.bonusIndex,{map:this.map,dir:"l",score:this.bonusScore,x:u.x,y:u.y,factor:this.scaling.getFactor(),normalizeRefrashRate:this.normalizeRefrashRate.bind(this),addPacmanPositionEventListener:function(e){return t.pacman.on("item:position",e)}}),this.bonus.on("item:destroy",(function(e){t.bonus.destroy(),t.bonus=null})),this.bonus.on("item:eaten",(function(e){t._showBonus||(t._pauseFrames=5,t._destroyBonus=25,t.model.addScore(parseInt(e.score)),t.sound.play("bonus"))})),this.addSprite(this.bonus);var p={...this.model.getSettings("ghost"),map:this.map,normalizeRefrashRate:this.normalizeRefrashRate.bind(this),factor:this.scaling.getFactor(),addGameGlobalModeEventListener:function(e){return t.on("game:globalmode",e)},addGameGhostEatenEventListener:function(e){return t.on("game:ghost:eaten",e)},addPacmanPositionEventListener:function(e){return t.pacman.on("item:position",e)},addPacmanEatPillEventListener:function(e){return t.pacman.on("item:eatpill",e)}},m=this.map.houseCenter.getR();this.pinky=(0,l.default)("pinky",{...p,x:m.x-this.map.tileWidth/2,y:m.y}),this.addEventListenersToGhost(this.pinky),this.addSprite(this.pinky);var y=this.map.house.getU().getR();this.blinky=(0,l.default)("blinky",{...p,x:y.x-this.map.tileWidth/2,y:y.y}),this.addEventListenersToGhost(this.blinky),this.addSprite(this.blinky);var g=this.map.houseCenter.getL();this.inky=(0,l.default)("inky",{...p,blinky:this.blinky,x:g.x-16,y:g.y}),this.addEventListenersToGhost(this.inky),this.addSprite(this.inky);var v=this.map.houseCenter.getR().getR();this.sue=(0,l.default)("sue",{...p,x:v.x+16,y:v.y}),this.addEventListenersToGhost(this.sue),this.addSprite(this.sue),w(this.elements.startReady),this._win?(this.bonus.hide(),this._start=1):(w(this.elements.startP1),this.hideGhosts(),this.pacman.hide(),this._start=2)}},{key:"addEventListenersToGhost",value:function(t){var e=this;t.on("item:eat",(function(){return e.emit("game:ghost:eat",t)})),t.on("item:eaten",(function(){return e.emit("game:ghost:eaten",t)})),t.on("item:modefrightened:enter",(function(){return e.emit("game:ghost:modefrightened:enter")})),t.on("item:modefrightened:exit",(function(){return e.emit("game:ghost:modefrightened:exit")}))}},{key:"mainLoop",value:function(){if(this.model.updateMode(),this._inputDirection=this._getInputDirection(),this._pauseFrames)this._pauseFrames--;else{if(2===this._start)return O(this.elements.startP1),this.showGhosts(),this.pacman.show(),this.model.lives=this.defaultLives,this._pauseFrames=60,void this._start--;if(1===this._start)return O(this.elements.startReady),void this._start--;if(this._win)return void this.startLevel();if(this._gameOver)return O(this.elements.gameOver),void w(this.elements.splash);this._showPacman&&(this.pacman.show(),this._showPacman=!1),this.pacman.move(this._inputDirection),this._pacmanEaten?this.hideGhosts():(this._soundBackPauseFrames?this._soundBackPauseFrames--:(this._isGhostDead()?this.sound.play("dead"):this._isGhostFrightened()||this.sound.play("back"),this._soundBackPauseFrames=5),this.pinky.move(),this.blinky.move(),this.inky.move(),this.sue.move(),this._destroyBonus?(1===this._destroyBonus&&(this.bonus.destroy(),delete this.bonus),this._destroyBonus--):this.bonus&&(this._showBonus?(1===this._showBonus&&this.bonus.show(),this._showBonus--):this.bonus.move()))}}},{key:"pause",value:function(){o(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"pause",this).call(this),this.pinky.pause(),this.blinky.pause(),this.inky.pause(),this.sue.pause(),this.muteSound(!0),this.model.pause(),this.elements.paused.style.display=""}},{key:"resume",value:function(){o(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"resume",this).call(this),this.pinky.resume(),this.blinky.resume(),this.inky.resume(),this.sue.resume(),this.muteSound(!!this._muted),this.model.resume(),O(this.elements.paused)}},{key:"win",value:function(){var t=this;this._pauseFrames=120,this._win=!0;var e=14;this.addCallback((function(){return e?(e--,t.el.classList.toggle("blink"),!1):(t.el.classList.remove("blink"),!0)}),8*this.refreshRate),this.hideGhosts(),this.map.hideItems(),this.pacman.pauseAnimation()}},{key:"hideGhosts",value:function(){this.pinky.hide(),this.blinky.hide(),this.inky.hide(),this.sue.hide(),this.bonus&&this.bonus.hide()}},{key:"showGhosts",value:function(){this.pinky.show(),this.blinky.show(),this.inky.show(),this.sue.show(),this.bonus&&!this._showBonus&&this.bonus.show()}},{key:"_isGhostFrightened",value:function(){return this.blinky.isFrightened()||this.inky.isFrightened()||this.pinky.isFrightened()||this.sue.isFrightened()}},{key:"_isGhostDead",value:function(){return this.blinky.isDead()||this.inky.isDead()||this.pinky.isDead()||this.sue.isDead()}},{key:"_getInputDirection",value:function(){var t=this.keyboard.keys,e=null;return t[y.KEY_UP]?e="u":t[y.KEY_RIGHT]?e="r":t[y.KEY_DOWN]?e="d":t[y.KEY_LEFT]&&(e="l"),e?this._lastSwipe=null:this._lastSwipe===g.EVENT_SWIPE_UP?e="u":this._lastSwipe===g.EVENT_SWIPE_RIGHT?e="r":this._lastSwipe===g.EVENT_SWIPE_DOWN?e="d":this._lastSwipe===g.EVENT_SWIPE_LEFT&&(e="l"),e}},{key:"onLoadProgress",value:function(t){this.elements.load.querySelector(".inner").style.width=t+"%"}},{key:"_onSwipe",value:function(t,e){this._lastSwipe=t}},{key:"_onKeyDown",value:function(t){if(83===t.keyCode){if(!this.soundEnabled)return;this._muted=!this._muted,this.muteSound(this._muted);var e=this.elements.soundStatus;this._muted?e.classList.remove("on"):e.classList.add("on"),w(e),this._hideSoundStatusTimeout&&clearTimeout(this._hideSoundStatusTimeout),this._hideSoundStatusTimeout=setTimeout((function(){O(e)}),2e3)}else 80===t.keyCode&&(this._paused=!this._paused,this._paused?this.pause():this.resume())}},{key:"_onChangeScore",value:function(t,e){this.elements.score.innerText=e||"00"}},{key:"_onChangeHighScore",value:function(t,e){this.elements.highScore.innerText=e||"00"}},{key:"_onChangeLives",value:function(t,e){0===e&&(this._gameOver=!0,w(this.elements.gameOver),this.hideGhosts(),this.pacman.hide(),this.model.save())}},{key:"_onChangeExtraLives",value:function(t,e){this.sound.play("life")}},{key:"_onChangeMode",value:function(t,e){this.emit("game:globalmode",e)}},{key:"_onGhostEaten",value:function(t){this.pacman.hide(),this._pauseFrames=15,this._showPacman=!0,this.model.addScore(parseInt(t.score)),this.sound.play("eat")}},{key:"_onGhostEat",value:function(){this._pauseFrames=40,this._pacmanEaten=!0}},{key:"template",value:function(t){return'\n
\n
1UP
00
\n
HIGH SCORE
'+(t.highScore||"00")+'
\n
2UP
00
\n
\n \n \n \n \n \n
\n "JS PAC-MAN"\n

HTML - CSS

JAVASCRIPT

\n \n
\n

←↑↓→:MOVE S:SOUND P:PAUSE

\n
© 2014-2020 8TENTACULOS SOURCE+INFO
\n
\n '}}]),e}(s.default);Object.assign(E.prototype,k),e.default=E},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.STATE_PAUSED=e.STATE_RUNNING=e.STATE_NEW=void 0;var i=function(){function t(t,e){for(var n=0;n=this.loadedSpritesIndex;t--)this.sprites[t].load();for(var e=this.sounds.length-1;e>=this.loadedSoundsIndex;e--)this.sounds[e].load();this.waitForResources()}},{key:"waitForResources",value:function(){for(var t=0,e=this.loadedSpritesIndex;e1&&void 0!==arguments[1]?arguments[1]:this.refreshRate;this.callbacks.push({fn:t,refreshRate:this.normalizeRefrashRate(e),idleCounter:0})}},{key:"refresh",value:function(){if(this.state===h){this.sprites.forEach((function(t){t.refresh()}));for(var t=[],e=this.callbacks.length-1;e>=0;e--){if(this.callbacks[e].idleCounter===this.callbacks[e].refreshRate-1){var n=this.callbacks[e].fn();"boolean"==typeof n?n&&t.push(e):"number"==typeof n&&(this.callbacks[e].refreshRate=this.normalizeRefrashRate(n),this.callbacks[e].idleCounter=0)}this.callbacks[e].idleCounter=(this.callbacks[e].idleCounter+1)%this.callbacks[e].refreshRate}for(e=t.length-1;e>=0;e--)this.callbacks.splice(t[e],1)}}},{key:"clear",value:function(t){this.destroyChildren(),this.loadedSpritesIndex=0,this.sounds=[],this.loadedSoundsIndex=0,t&&(this.callbacks=[]),this.scenegraph.innerHTML=""}},{key:"muteSound",value:function(t){for(var e=this.sounds.length-1;e>=0;e--)this.sounds[e].mute(t)}},{key:"start",value:function(t){"function"==typeof t&&(this._onReadyCallback=t),this.preload()}},{key:"pause",value:function(){this.state=f,this.scenegraph.style.visibility="hidden"}},{key:"resume",value:function(t){this.state===f&&("function"==typeof t&&(this._onReadyCallback=t),this.preload())}},{key:"normalizeRefrashRate",value:function(t){return Math.round(t/this.refreshRate)||1}}]),e}(o.View);Object.assign(d.prototype,c),e.default=d},function(t,e,n){"use strict";e.__esModule=!0;var i,o=n(5);function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}var a=function(t){function e(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};s(this,e);var i=r(this,t.call(this));return i.attributes=Object.assign({},i.defaults||{},n),i.previous={},Object.keys(i.attributes).forEach(i.defineAttribute.bind(i)),i}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.defineAttribute=function(t){var e=this;Object.defineProperty(this,t,{get:function(){return e.get(t)},set:function(n){return e.set(t,n)}})},e.prototype.get=function(t){return this.attributes[t]},e.prototype.set=function(t,e){var n,i=this,o="object"==typeof t?t:((n={})[t]=e,n);return Object.keys(o).forEach((function(t){var e=t in i.attributes&&o[t]!==i.attributes[t];i.previous[t]=i.attributes[t],i.attributes[t]=o[t],e&&(i.emit("change",i,t,o[t]),i.emit("change:"+t,i,o[t]))})),this},e.prototype.toJSON=function(){return this.attributes},e}(((i=o)&&i.__esModule?i:{default:i}).default);e.default=a},function(t,e,n){"use strict";e.__esModule=!0;var i,o=n(5),s=(i=o)&&i.__esModule?i:{default:i};function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}var u={el:!0,tag:!0,attributes:!0,events:!0,model:!0,template:!0,onDestroy:!0},l=function(t){function e(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};r(this,e);var i=a(this,t.call(this));return i.uid="uid"+ ++e.uid,i.delegatedEventListeners=[],i.children=[],Object.keys(n).forEach((function(t){u[t]&&(i[t]=n[t])})),i.ensureElement(),i}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.$=function(t){return this.el.querySelector(t)},e.prototype.$$=function(t){return this.el.querySelectorAll(t)},e.prototype.destroy=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.remove;this.destroyChildren(),this.undelegateEvents(),this.off(),e&&this.removeElement(),this.onDestroy()},e.prototype.onDestroy=function(){},e.prototype.addChild=function(t){return this.children.push(t),t},e.prototype.destroyChildren=function(){for(;this.children.length;)this.children.shift().destroy()},e.prototype.ensureElement=function(){this.el||(this.el=this.createElement(this.tag,this.attributes)),this.delegateEvents()},e.prototype.createElement=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"div",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=document.createElement(t);return Object.keys(e).forEach((function(t){return n.setAttribute(t,e[t])})),n},e.prototype.removeElement=function(){this.el.parentNode.removeChild(this.el)},e.prototype.delegateEvents=function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.events;if(e){var n={};Object.keys(e).forEach((function(i){var o=i.split(" "),s=o[0],r=o[1],a=e[i];"string"==typeof a&&(a=t[a].bind(t)),n[s]||(n[s]=[]),n[s].push({selector:r,listener:a})}));var i=Array.prototype.indexOf;Object.keys(n).forEach((function(e){var o=t,s=function(t){n[e].forEach((function(e){var n=e.selector,s=e.listener;(!n&&o.el===t.target||i.call(o.el.querySelectorAll(n),t.target)>-1)&&s(t,o)}))};t.delegatedEventListeners.push({type:e,listener:s}),t.el.addEventListener(e,s)}))}},e.prototype.undelegateEvents=function(){var t=this;this.delegatedEventListeners.forEach((function(e){var n=e.type,i=e.listener;t.el.removeEventListener(n,i)})),this.delegatedEventListeners=[]},e.prototype.render=function(){return this.destroyChildren(),this.template&&(this.el.innerHTML=this.template(this.model)),this},e}(s.default);e.default=l,l.uid=0},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;nthis.widthToHeight?(this.width=e*this.widthToHeight,this.height=e):(this.height=t/this.widthToHeight,this.width=t)}},{key:"getFactor",value:function(){return this.width/this.originalWidth}}]),t}();e.default=o},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i,o=function(){function t(t,e){for(var n=0;nthis.width-1&&(t=0),t<0&&(t=this.width-1),e>this.height-1&&(e=0),e<0&&(e=this.height-1);var i=e*this.width+t;return this.tiles[i]||null}},{key:"destroyItems",value:function(){for(var t=this.tiles.length;t--;){var e=this.tiles[t];e.item&&e.item.destroy()}}},{key:"hideItems",value:function(){for(var t=this.tiles.length;t--;){var e=this.tiles[t];e.item&&e.item.hide()}}}]),t}();e.default=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;ne||i===t.length-1){this.mode=t[i].mode;break}i++}}},{key:"pause",value:function(){this.pauseTime=(0,s.default)()}},{key:"resume",value:function(){this.modeTime=(0,s.default)()-this.pauseTime}},{key:"getSettings",value:function(t){for(var e={},n=this.level>c.length?c.length:this.level,i=d.length;i--;){var o=d[i].split(".");o[0]===t&&(e[o[1]]=c[n-1][i])}return e}},{key:"onChangeScore",value:function(){this.extraLives&&this.score>=this.extraLifeScore&&(this.extraLives--,this.lives++),this.highScore16*t.w?t:this.scatterTarget},animations:{...o.animations,right:new i.default({...o.animationBase,offsetY:188,offsetX:-2}),down:new i.default({...o.animationBase,offsetY:188,offsetX:126}),up:new i.default({...o.animationBase,offsetY:188,offsetX:254}),left:new i.default({...o.animationBase,offsetY:188,offsetX:382})}},e)),new s.default(e)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.animations=e.animationBase=void 0;var i=function(){function t(t,e){for(var n=0;n1)){var t=0,e=0;this.animation.type&s.ANIMATION_VERTICAL?(t=-this.animation.offsetX,e=-this.animation.offsetY-this.animation.delta*this.currentFrame):this.animation.type&s.ANIMATION_HORIZONTAL&&(t=-this.animation.offsetX-this.animation.delta*this.currentFrame,e=-this.animation.offsetY),this.el.style.backgroundPosition=t+"px "+e+"px"}this.idleCounter=(this.idleCounter+1)%this.normalizeRefrashRate(this.animation.refreshRate)}}},{key:"pauseAnimation",value:function(){this.playing=!1}},{key:"resumeAnimation",value:function(){this.playing=!0}},{key:"setAnimation",value:function(t,e,n){this.animation=t,this.currentFrame=0,this.frameIncrement=1,this.el.style.backgroundImage="url('"+t.imageURL+"')",t.type&s.ANIMATION_VERTICAL?this.el.style.backgroundRepeat="repeat-x":t.type&s.ANIMATION_HORIZONTAL?this.el.style.backgroundRepeat="repeat-y":this.el.style.backgroundRepeat="no-repeat";this.el.style.backgroundPosition=-0-t.offsetX+"px "+(-0-t.offsetY)+"px","function"==typeof n&&(this.callback=n)}},{key:"transform",value:function(){this.el.style.transform="translate("+(this.x*this.factor-this.offsetX)+"px, "+(this.y*this.factor-this.offsetY)+"px) rotate("+this.angle+"deg) scale("+this.factor*this.factorH+", "+this.factor*this.factorV+")"}},{key:"rotate",value:function(t,e){!0===e&&(t+=this.angle,t%=360),this.angle=parseFloat(t),this.transform()}},{key:"scale",value:function(t,e){!0===e&&(t*=this.factor),this.factor=parseFloat(t),this.transform()}},{key:"flipH",value:function(t){if(void 0===t)return void 0!==this.factorH&&-1===this.factorH;this.factorH=t?-1:1,this.transform()}},{key:"flipV",value:function(t){if(void 0===t)return void 0!==this.factorV&&-1===this.factorV;this.factorV=t?-1:1,this.transform()}},{key:"setXYZ",value:function(t,e){var n=this,i=!1;Object.keys(t).forEach((function(o){switch(o){case"x":e&&(t.x+=n.x),n.x=t.x,i=!0;break;case"y":e&&(t.y+=n.y),n.y=t.y,i=!0;break;case"z":e&&(t.z+=n.z),n.z=t.z,n.el.style.zIndex=n.z}})),i&&this.transform()}},{key:"setWH",value:function(t,e){var n=this;Object.keys(t).forEach((function(i){switch(i){case"w":e&&(t.w+=n.width),n.width=t.w,n.el.style.width=n.width+"px";break;case"h":e&&(t.h+=n.height),n.height=t.h,n.el.style.height=n.height+"px"}}))}}]),e}(o.View);Object.assign(a.prototype,r),e.default=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i,o=function(){function t(t,e){for(var n=0;nt?this.ghost.dir="l":this.ghost.y(0,s.default)()-this._startTime?this.ghost._nextAnimation=this.ghost.animations.frightened:this.ghost._nextAnimation=this.ghost.animations.frightenedBlink}},{key:"exit",value:function(){return!(this.ghost.frightenedTime>(0,s.default)()-this._startTime)}},{key:"onExit",value:function(){this.ghost.frightened||this.ghost.setMode(),this.ghost.emit("item:modefrightened:exit")}}]),e}(o.default);e.default=h},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){return Math.floor(Math.random()*t)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;nthis.ghost.waitTime&&!t.isWall()&&(this._prepareExit=!0,this.ghost.y=t.y),this.exit()?this.onExit():this._prepareExit?(this.ghost.xthis._exitTileX?this.ghost.dir="l":this.ghost.dir="u","u"===this.ghost.dir&&(this.ghost.y-=this.ghost.getMin(this.ghost.getStep(),this.ghost.y-this._exitTile.getU().y)),"r"===this.ghost.dir&&(this.ghost.x+=this.ghost.getMin(this.ghost.getStep(),this._exitTileX-this.ghost.x)),"l"===this.ghost.dir&&(this.ghost.x-=this.ghost.getMin(this.ghost.getStep(),this.ghost.x-this._exitTileX)),this.setAnimation(),this.ghost.update()):(this.ghost.y<=this._houseTop&&"u"===this.ghost.dir&&(this.ghost.dir="d"),this.ghost.y>=this._houseBottom&&"d"===this.ghost.dir&&(this.ghost.dir="u"),"u"===this.ghost.dir&&(this.ghost.y-=this.ghost.getMin(this.ghost.getStep(),this.ghost.y-this._houseTop)),"d"===this.ghost.dir&&(this.ghost.y+=this.ghost.getMin(this.ghost.getStep(),this._houseBottom-this.ghost.y)),this.setAnimation(),this.ghost.update())}},{key:"setAnimation",value:function(){this.ghost.frightened?this.ghost.frightened.setAnimation():o.default.prototype._setNextAnimation.call(this.ghost)}},{key:"exit",value:function(){return this.ghost.frightened&&this.ghost.frightened.exit()&&(this.ghost.frightened=null),this.ghost.getTile()===this._exitTile.getU()}},{key:"onExit",value:function(){this._startTime=null;var t=this.ghost.getTile();this.ghost._dir="l",this.ghost._nextDir="l",this.ghost._lastTile=t.getD(),this.ghost._speed=this.ghost.speed,this.ghost.setMode()}}]),e}(s.default);e.default=u},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i,o=function(){function t(t,e){for(var n=0;nh)&&(t=u,e=h)}}return t}},{key:"canGo",value:function(t,e){e||(e=this.getTile());var n=e.get(t);return!!n&&(!n.isWall()&&!n.isHouse())}},{key:"_getTarget",value:function(){return this.map.tunnels[0]}},{key:"_setNextAnimation",value:function(){}}]),e}(s.default);Object.assign(h.prototype,l),e.default=h},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i,o=function(){function t(t,e){for(var n=0;nthis.model.lives-2&&this.pacmans[n].hide()}this.model.on("change:lives",this.render.bind(this))}return o(t,[{key:"render",value:function(){for(var t=0;t<5;t++)t>this.model.lives-2?this.pacmans[t].hide():this.pacmans[t].show()}}]),t}();e.default=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i,o=function(){function t(t,e){for(var n=0;n=this.model.level&&this.bonuses[n].hide()}this.model.on("change:level",this.render.bind(this))}return o(t,[{key:"render",value:function(){for(var t=0;t<8;t++)t>=this.model.level?this.bonuses[t].hide():this.bonuses[t].show()}}]),t}();e.default=a}]);