diff --git a/mantra-client/public/worlds.mantra.js b/mantra-client/public/worlds.mantra.js index ec9ff8b4..5458d77b 100644 --- a/mantra-client/public/worlds.mantra.js +++ b/mantra-client/public/worlds.mantra.js @@ -6130,31 +6130,6 @@ var Playground = exports["default"] = /*#__PURE__*/function () { this.id = Playground.id; } _createClass(Playground, [{ - key: "init", - value: function init(game) { - this.game = game; - game.config.defaultMouseMovement = false; - - // Movements with right click, switch default left-click-to-move behavior - game.config.mouseMovementButton = 'RIGHT'; - // Actions with left click - game.config.mouseActionButton = 'LEFT'; - // enables the default top-down mouse movements - game.config.defaultMouseMovement = true; - game.reset(); - game.data.camera.mode = 'none'; - - // Remark: Not ideal for mapping Mouse buttons, - // as they should be conditionals in Sutra tree like Keyboard events are - var mouse = game.systems.mouse; - mouse.setButtonMapping('LEFT', 1); - mouse.setButtonMapping('MIDDLE', 0); - // enables mouse wheel zoom - game.data.camera.mouseWheelZoomEnabled = true; - this.createWorld(); - this.setDefaultZoom(); - } - }, { key: "preload", value: function () { var _preload = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(game) { @@ -6185,6 +6160,31 @@ var Playground = exports["default"] = /*#__PURE__*/function () { } return preload; }() + }, { + key: "init", + value: function init(game) { + this.game = game; + game.config.defaultMouseMovement = false; + + // Movements with right click, switch default left-click-to-move behavior + game.config.mouseMovementButton = 'RIGHT'; + // Actions with left click + game.config.mouseActionButton = 'LEFT'; + // enables the default top-down mouse movements + game.config.defaultMouseMovement = true; + game.reset(); + game.data.camera.mode = 'none'; + + // Remark: Not ideal for mapping Mouse buttons, + // as they should be conditionals in Sutra tree like Keyboard events are + var mouse = game.systems.mouse; + mouse.setButtonMapping('LEFT', 1); + mouse.setButtonMapping('MIDDLE', 0); + // enables mouse wheel zoom + game.data.camera.mouseWheelZoomEnabled = true; + this.createWorld(); + this.setDefaultZoom(); + } }, { key: "createWorld", value: function createWorld() { @@ -6247,10 +6247,7 @@ var Playground = exports["default"] = /*#__PURE__*/function () { }).style({ cursor: 'pointer' }).position(-500, 150).size(128).createEntity(); - - // TODO: remove createContainer, upgrade to Container() plugin instead - - var container2 = game.make().Container({ + game.make().Container({ layout: 'grid', grid: { columns: 7, @@ -6603,10 +6600,6 @@ var Playground = exports["default"] = /*#__PURE__*/function () { return Playground; }(); //let entities = text2Entities(text); _defineProperty(Playground, "id", 'world-playground'); -// "world" type has special features in that it can be unloaded and reloaded. -// with special rules such as merge, replace, etc. -// this is currently used when switching between worlds in the GUI Editor -// the default behavior is to unload the world, then load the new world _defineProperty(Playground, "type", 'world'); function text2Entities(text) { var entities = []; diff --git a/mantra-client/public/worlds.mantra.min.js b/mantra-client/public/worlds.mantra.min.js index fe806ea5..0433f7ff 100644 --- a/mantra-client/public/worlds.mantra.min.js +++ b/mantra-client/public/worlds.mantra.min.js @@ -1 +1 @@ -!function(t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).WORLDS=t()}(function(){return function r(o,i,a){function u(e,t){if(!i[e]){if(!o[e]){var n="function"==typeof require&&require;if(!t&&n)return n(e,!0);if(c)return c(e,!0);throw(t=new Error("Cannot find module '"+e+"'")).code="MODULE_NOT_FOUND",t}n=i[e]={exports:{}},o[e][0].call(n.exports,function(t){return u(o[e][1][t]||t)},n,n.exports,r,o,i,a)}return i[e].exports}for(var c="function"==typeof require&&require,t=0;t=this.props.wattage)&&this.activate(t))}},{key:"break",value:function(t){this.props.isBroken=!0,this.emit("broken")}},{key:"handleCollision",value:function(t){this.props.isBroken||"Rover"===t.type&&(this.isOn=!1,this.props.isBroken=!0,this.props.color="grey",this.emit("broken"))}},{key:"update",value:function(){this.props.isBroken}}])&&r(e.prototype,t),n&&r(e,n),Object.defineProperty(e,"prototype",{writable:!1}),c}(t.Part);t=n,n="LEDLight",(c=u(c="type"))in t?Object.defineProperty(t,c,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[c]=n},{"../Part.js":2}],9:[function(t,e,n){"use strict";function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=a(t("../utils/EventEmitter.js")),i=a(t("../signals/ElectricalSignal.js"));function a(t){return t&&t.__esModule?t:{default:t}}function u(t,e){for(var n=0;n=o||(r.applyForce(t.id,{x:0,y:-2.3,z:0}),r.updateEntity({id:t.id,rotation:0,sprite:"playerRightJump"}))}),1);return t.on("RUN",function(t){i=1.6,o=35}),t.on("WALK",function(t){i=1,o=25}),t.on("DUCK",function(t){r.applyForce(t.id,{x:0,y:.5,z:0}),r.updateEntity({id:t.id,rotation:Math.PI})}),t.on("MOVE_LEFT",function(t,e,n){r.applyForce(t.id,{x:-i,y:0,z:0}),r.updateEntity({id:t.id,rotation:-Math.PI/2})}),t.on("MOVE_RIGHT",function(t){r.applyForce(t.id,{x:i,y:0,z:0}),r.updateEntity({id:t.id,rotation:Math.PI/2})}),t.on("FIRE_BULLET",function(t){r.systems.bullet.fireBullet(t.id)}),t.on("SWING_SWORD",function(t){r.systems.sword&&r.systems.sword.swingSword(t.id)}),t}},{}],27:[function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function a(t,e,n){return(e=function(t){t=function(t,e){if("object"!=r(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0===n)return("string"===e?String:Number)(t);n=n.call(t,e||"default");if("object"!=r(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"==r(t)?t:String(t)}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}Object.defineProperty(n,"__esModule",{value:!0}),n.default=function(n){var r=n.createSutra();function o(t){return(t.MOVE_UP||t.MOVE_DOWN)&&(t.MOVE_LEFT||t.MOVE_RIGHT)}r.addCondition("PLAYER_UP",{op:"or",conditions:["W","DPAD_UP"]}),r.addCondition("PLAYER_DOWN",{op:"or",conditions:["S","DPAD_DOWN"]}),r.addCondition("PLAYER_LEFT",{op:"or",conditions:["A","DPAD_LEFT"]}),r.addCondition("PLAYER_RIGHT",{op:"or",conditions:["D","DPAD_RIGHT"]}),r.addCondition("USE_ITEM_1",{op:"or",conditions:["SPACE","H","BUTTON_B"]}),r.addCondition("USE_ITEM_2",{op:"or",conditions:["J","BUTTON_X"]}),r.addCondition("USE_ITEM_3",{op:"or",conditions:["K","BUTTON_A"]}),r.addCondition("USE_ITEM_4",{op:"or",conditions:["L","BUTTON_Y"]}),r.addCondition("ZOOM_IN",{op:"or",conditions:["K","BUTTON_A"]}),r.addCondition("ZOOM_OUT",{op:"or",conditions:["L","BUTTON_Y"]}),r.if("PLAYER_UP").then("MOVE_UP").then("updateSprite",{sprite:"playerUp"}),r.if("PLAYER_LEFT").then("MOVE_LEFT").then("updateSprite",{sprite:"playerLeft"}),r.if("PLAYER_DOWN").then("MOVE_DOWN").then("updateSprite",{sprite:"playerDown"}),r.if("PLAYER_RIGHT").then("MOVE_RIGHT").then("updateSprite",{sprite:"playerRight"}),r.if("USE_ITEM_1").then("FIRE_BULLET").map("determineShootingSprite").then("updateSprite"),r.if("USE_ITEM_2").then("THROW_BOOMERANG"),r.if("ZOOM_IN").then("ZOOM_IN"),r.if("ZOOM_OUT").then("ZOOM_OUT"),r.addMap("determineShootingSprite",function(t,e){var n,r;return void 0!==t.texture&&(n=t.rotation%(2*Math.PI),r=a(a(a({0:"playerRodUp"},Math.PI/2,"playerRodRight"),Math.PI,"playerRodDown"),-Math.PI/2,"playerRodLeft"),t.texture.sprite=r[n]||t.currentSprite),t}),r.on("updateSprite",function(t,e){void 0!==t.texture&&(e=e.data.sprite||t.texture.sprite,n.updateEntity({id:t.id,texture:{frameIndex:0,sheet:t.texture.sheet,sprite:e,animationPlaying:!0}}))});var i=.7071;return r.on("MOVE_UP",function(t,e){e.state=e.state||{},e.state.MOVE_UP=!0;e={x:0,y:-2,z:0};o(r.state)&&(e.y*=i),n.applyForce(t.id,e),n.updateEntity({id:t.id,rotation:0})}),r.on("MOVE_DOWN",function(t,e){e.state=e.state||{},e.state.MOVE_DOWN=!0;e={x:0,y:2,z:0};o(r.state)&&(e.y*=i),n.applyForce(t.id,e),n.updateEntity({id:t.id,rotation:Math.PI})}),r.on("MOVE_LEFT",function(t,e){e.state=e.state||{},e.state.MOVE_LEFT=!0;e={x:-2,y:0,z:0};o(r.state)&&(e.x*=i),n.applyForce(t.id,e),n.updateEntity({id:t.id,rotation:-Math.PI/2})}),r.on("MOVE_RIGHT",function(t,e){e.state=e.state||{},e.state.MOVE_RIGHT=!0;e={x:2,y:0,z:0};o(r.state)&&(e.x*=i),n.applyForce(t.id,e),n.updateEntity({id:t.id,rotation:Math.PI/2})}),r.on("FIRE_BULLET",function(t){n.systems.bullet&&n.systems.bullet.fireBullet(t.id)}),r.on("SWING_SWORD",function(t){n.systems.sword&&n.systems.sword.swingSword(t.id)}),r.on("THROW_BOOMERANG",function(t){n.systems.boomerang&&n.systems.boomerang.throwBoomerang(t.id)}),r.on("CAMERA_SHAKE",function(t){n.shakeCamera(1e3)}),r.on("ZOOM_IN",function(t){var e=n.data.camera.currentZoom||1;n.setZoom(e+.05)}),r.on("ZOOM_OUT",function(t){var e=n.data.camera.currentZoom||1;n.setZoom(e-.05)}),r}},{}],28:[function(t,e,n){"use strict";function T(t){return(T="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function k(){k=function(){return a};var c,a={},t=Object.prototype,s=t.hasOwnProperty,l=Object.defineProperty||function(t,e,n){t[e]=n.value},e="function"==typeof Symbol?Symbol:{},r=e.iterator||"@@iterator",n=e.asyncIterator||"@@asyncIterator",o=e.toStringTag||"@@toStringTag";function i(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{i({},"")}catch(c){i=function(t,e,n){return t[e]=n}}function u(t,e,n,r){var o,i,a,u,e=e&&e.prototype instanceof v?e:v,e=Object.create(e.prototype),r=new x(r||[]);return l(e,"_invoke",{value:(o=t,i=n,a=r,u=p,function(t,e){if(u===d)throw new Error("Generator is already running");if(u===h){if("throw"===t)throw e;return{value:c,done:!0}}for(a.method=t,a.arg=e;;){var n=a.delegate;if(n){n=function t(e,n){var r=n.method,o=e.iterator[r];if(o===c)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=c,t(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),m;r=f(o,e.iterator,n.arg);if("throw"===r.type)return n.method="throw",n.arg=r.arg,n.delegate=null,m;o=r.arg;return o?o.done?(n[e.resultName]=o.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=c),n.delegate=null,m):o:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,m)}(n,a);if(n){if(n===m)continue;return n}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if(u===p)throw u=h,a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);u=d;n=f(o,i,a);if("normal"===n.type){if(u=a.done?h:y,n.arg===m)continue;return{value:n.arg,done:a.done}}"throw"===n.type&&(u=h,a.method="throw",a.arg=n.arg)}})}),e}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}a.wrap=u;var p="suspendedStart",y="suspendedYield",d="executing",h="completed",m={};function v(){}function b(){}function g(){}var e={},w=(i(e,r,function(){return this}),Object.getPrototypeOf),w=w&&w(w(_([]))),E=(w&&w!==t&&s.call(w,r)&&(e=w),g.prototype=v.prototype=Object.create(e));function P(t){["next","throw","return"].forEach(function(e){i(t,e,function(t){return this._invoke(e,t)})})}function O(a,u){var e;l(this,"_invoke",{value:function(n,r){function t(){return new u(function(t,e){!function e(t,n,r,o){var i,t=f(a[t],a,n);if("throw"!==t.type)return(n=(i=t.arg).value)&&"object"==T(n)&&s.call(n,"__await")?u.resolve(n.__await).then(function(t){e("next",t,r,o)},function(t){e("throw",t,r,o)}):u.resolve(n).then(function(t){i.value=t,r(i)},function(t){return e("throw",t,r,o)});o(t.arg)}(n,r,t,e)})}return e=e?e.then(t,t):t()}})}function S(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function x(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(S,this),this.reset(!0)}function _(e){if(e||""===e){var n,t=e[r];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return n=-1,(t=function t(){for(;++nMath.abs(e)?r=0",""),value:"https://yantra.gg/mantra/examples/demo.html?source="+t.url.replace(".html","")}})).unshift({label:n+"...",value:""}),(o=i.make().Select({options:o,title:n}).container(t)).afterUpdateEntity(function(t,e){var n;t&&void 0!==t.value&&a!==t.value&&(console.log("afterUpdateEntity",r,t.value,e),void 0!==r)&&void 0!==t.value&&""!==t.value&&null!==t.value&&(n=t.graphics["graphics-css"].querySelectorAll("select")[0],document.querySelectorAll("select").forEach(function(t){t!==n&&(t.value="")}),i.updateEntity(r.id,{meta:{src:t.value}}),e=t.value.replace("demo.html?source=","")+".js",console.log("sourceLink",e),i.updateEntity(l.id,{meta:{src:e}}),t=e.replace("https://yantra.gg/mantra","").replace(".js",""),e=e.replace(".js",""),i.updateEntity(u.id,{text:t,meta:{href:e}}),i.updateEntity(s.id,{style:{display:"none"}}),i.updateEntity(r.id,{style:{display:"block"}}))}),o.width(230).height(80).style({fontSize:"32px",backgroundColor:(null==(t=categories.find(function(t){return t.title===n}))?void 0:t.color)||"#e0e0e0"}).createEntity()});t=i.make().width(768).height(1e3),t.Iframe({src:"https://yantra.gg/mantra/examples"}),t.style({border:"none"}),t.x(0).y(1200),t.createEntity(),e=i.make().Text().text("Drag to move map"),e.x(200),e.y(220),e.width(600),e.color("white"),e.style({fontSize:"24px"}),e.createEntity(),t=i.make().Text().text("Wheel to Zoom"),t.x(0),t.y(220),t.width(600),t.color("white"),t.style({fontSize:"24px"}),t.createEntity(),e=i.make().Text().text("Click to interact");e.x(220),e.y(220),e.width(170),e.color("white"),e.style({fontSize:"24px",cursor:"pointer"}),e.pointerup(function(t,e){e.preventDefault(),n.game.shakeCamera({})}),e.createEntity()}},{key:"setDefaultZoom",value:function(){var t=this.game,e=window.innerWidth,n=window.innerHeight,r=.5/t.width,o=t.width,i=.5/t.height,a=t.height,e=Math.min(.5+(e-o)*r,.5+(n-a)*i),e=Math.max(.4,Math.min(e,1));t.setZoom(e)}}])&&i(e.prototype,n),r&&i(e,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();r(n,"id","world-playground"),r(n,"type","world")},{}],45:[function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){for(var n=0;nt.startingPosition.x+0}),t.addCondition("moveRight",function(t,e){return t.position.x<=+t.startingPosition.x}),t.addCondition("gameTickMod60",function(t,e){return e.tick%60==0}),t.if("gameTickMod60").if("isSpawner").then("spawnBlock",{x:0,y:100}),t.if("gameTickMod60").if("isSpawner","moveLeft").then("entity::updateEntity",{velocity:{x:-10,y:10}}),t.if("gameTickMod60").if("isSpawner","moveRight").then("entity::updateEntity",{velocity:{x:1,y:10}}),t.on("spawnBlock",function(t,e){a.createEntity({type:"BLOCK",position:{x:t.position.x,y:t.position.y},mass:100,friction:0,frictionAir:0,frictionStatic:0,velocity:{x:0,y:30},width:16,height:16})}),t.on("entity::updateEntity",function(t,e){a.updateEntity({id:t.id,velocity:t.velocity})}),t.addCondition("spawnUnitTouchedHomebase",function(t,e){if("COLLISION"===t.type)return"UnitSpawner"===t.bodyA.type&&"BORDER"===t.bodyB.type||"UnitSpawner"===t.bodyB.type&&"BORDER"===t.bodyA.type||void 0}),t.on("resetSpawnerUnit",function(t,e){var t=t.UnitSpawner,n={type:"UnitSpawner",health:100,position:t.startingPosition,width:64,height:64,color:65280,style:{backgroundColor:"#000000"}};n.startingPosition=t.startingPosition,a.createEntity(n)}),t.on("spawnEnemyUnits",function(t,e){console.log("data",t,e);try{for(var n=[],r=0;r<8;r++){var o=JSON.parse(JSON.stringify(u(u(u(u(u(u({type:"UnitSpawner",health:100,position:{x:0,y:0}},"health",100),"mass",100),"width",64),"height",64),"color",65280),"style",{backgroundColor:"#000000"}))),i=(console.log("spawner",o),.8*a.width);o.position.x=-i/2+i/8*r,o.position.y=-a.height/2+100,o.startingPosition={x:o.position.x,y:o.position.y},n.push(o)}n.forEach(function(t){a.createEntity(t)})}catch(t){console.log("err",t)}}),t.on("removeSpawnUnit",function(t,e,n){"BORDER"===t.bodyA.type&&a.removeEntity(t.bodyB.id),"BORDER"===t.bodyB.type&&a.removeEntity(t.bodyA.id)}),t}},{}],54:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=function(){var n=this.game,t=this.game.createSutra();return t.addCondition("PLAYER_UP",{op:"or",conditions:["W","DPAD_UP"]}),t.addCondition("PLAYER_DOWN",{op:"or",conditions:["S","DPAD_DOWN"]}),t.addCondition("PLAYER_LEFT",{op:"or",conditions:["A","DPAD_LEFT"]}),t.addCondition("PLAYER_RIGHT",{op:"or",conditions:["D","DPAD_RIGHT"]}),t.addCondition("USE_ITEM_1",{op:"or",conditions:["SPACE","H","BUTTON_B"]}),t.addCondition("USE_ITEM_2",{op:"or",conditions:["J","BUTTON_X"]}),t.addCondition("ZOOM_IN",{op:"or",conditions:["K","BUTTON_A"]}),t.addCondition("ZOOM_OUT",{op:"or",conditions:["L","BUTTON_Y"]}),t.if("PLAYER_UP").then("MOVE_UP"),t.if("PLAYER_LEFT").then("MOVE_LEFT"),t.if("PLAYER_DOWN").then("MOVE_DOWN"),t.if("PLAYER_RIGHT").then("MOVE_RIGHT"),t.if("USE_ITEM_1").then("FIRE_BULLET").map("determineShootingSprite").then("updateSprite"),t.on("FIRE_BULLET",function(t){n.systems.bullet.fireBullet(t.id)}),t.on("SWING_SWORD",function(t){n.systems.sword.swingSword(t.id)}),t.on("CAMERA_SHAKE",function(t){n.shakeCamera(1e3)}),t.on("ZOOM_IN",function(t){var e=n.data.camera.currentZoom||1;n.setZoom(e+.05)}),t.on("ZOOM_OUT",function(t){var e=n.data.camera.currentZoom||1;n.setZoom(e-.05)}),t.on("PLAYER_UP",function(t){n.applyForce(t.id,{x:0,y:.05*-r})}),t.on("PLAYER_LEFT",function(t){n.applyForce(t.id,{x:.05*-r,y:0})}),t.on("PLAYER_RIGHT",function(t){n.applyForce(t.id,{x:.05*r,y:0})}),t.on("PLAYER_DOWN",function(t){n.applyForce(t.id,{x:0,y:.05*r})}),console.log("creating input sutra",t),t};var r=5},{}],55:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=function(){var n=this.game,t=this.game.createSutra();return t.addCondition("isPlayer",function(t){return"PLAYER"===t.type}),t.addCondition("playerHealthBelow0",function(t,e){if("PLAYER"===t.type&&t.health<=0)return!0}),t.on("resetPlayerPosition",function(t,e){n.updateEntity({id:t.id,position:{x:0,y:0},velocity:{x:0,y:0},health:100,color:65280,score:0})}),t.on("damagePlayer",function(t,e){t.BLOCK;t=t.PLAYER;t.health-=10,n.updateEntity({id:t.id,health:t.health})}),t.on("healPlayer",function(t,e){t.BLOCK;t=t.PLAYER;t&&(t.health+=5,n.updateEntity({id:t.id,health:t.health}))}),t}},{}],56:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=function(){var t=this.game.createSutra();return t.addCondition("roundStarted",function(t,e){return console.log("roundStarted",e.roundStarted),!0===e.roundStarted}),t.addCondition("roundEnded",function(t,e){return!0===e.roundEnded}),t.addCondition("roundRunning",function(t,e){return!0===e.roundRunning}),t.addCondition("roundNotRunning",function(t,e){return!1===e.roundRunning}),t.addCondition("roundPaused",function(t,e){return!0===e.roundPaused}),t.addCondition("roundNotPaused",function(t,e){return!0!==e.roundPaused}),t.on("roundLost",function(t,e,n){console.log("roundLost!!!"),n.roundStarted=!1,n.roundRunning=!1,n.roundEnded=!0,n.roundPaused=!0}),t.on("startRound",function(t,e,n){console.log("startRound",e),n.roundRunning=!0,n.roundEnded=!1}),t}},{}],57:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=function(o,t){o.createEntity({type:"Walker",width:22,height:24,texture:{sheet:"jogurt",sprite:"walkLeft"},depth:64,position:{x:50,y:-150,z:32}});var i=o.createSutra();return i.route=t.route,i.routeIndex=0,i.target=i.route[i.routeIndex],i.tolerance=t.tolerance||5,i.addCondition("isWalker",function(t){return"Walker"===t.type}),i.addCondition("atTarget",function(t){var e=t.position.x-i.target[0],t=t.position.y-i.target[1];return Math.sqrt(e*e+t*t)=this.props.wattage)&&this.activate(t))}},{key:"break",value:function(t){this.props.isBroken=!0,this.emit("broken")}},{key:"handleCollision",value:function(t){this.props.isBroken||"Rover"===t.type&&(this.isOn=!1,this.props.isBroken=!0,this.props.color="grey",this.emit("broken"))}},{key:"update",value:function(){this.props.isBroken}}])&&r(e.prototype,t),n&&r(e,n),Object.defineProperty(e,"prototype",{writable:!1}),c}(t.Part);t=n,n="LEDLight",(c=u(c="type"))in t?Object.defineProperty(t,c,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[c]=n},{"../Part.js":2}],9:[function(t,e,n){"use strict";function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=a(t("../utils/EventEmitter.js")),i=a(t("../signals/ElectricalSignal.js"));function a(t){return t&&t.__esModule?t:{default:t}}function u(t,e){for(var n=0;n=o||(r.applyForce(t.id,{x:0,y:-2.3,z:0}),r.updateEntity({id:t.id,rotation:0,sprite:"playerRightJump"}))}),1);return t.on("RUN",function(t){i=1.6,o=35}),t.on("WALK",function(t){i=1,o=25}),t.on("DUCK",function(t){r.applyForce(t.id,{x:0,y:.5,z:0}),r.updateEntity({id:t.id,rotation:Math.PI})}),t.on("MOVE_LEFT",function(t,e,n){r.applyForce(t.id,{x:-i,y:0,z:0}),r.updateEntity({id:t.id,rotation:-Math.PI/2})}),t.on("MOVE_RIGHT",function(t){r.applyForce(t.id,{x:i,y:0,z:0}),r.updateEntity({id:t.id,rotation:Math.PI/2})}),t.on("FIRE_BULLET",function(t){r.systems.bullet.fireBullet(t.id)}),t.on("SWING_SWORD",function(t){r.systems.sword&&r.systems.sword.swingSword(t.id)}),t}},{}],27:[function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function a(t,e,n){return(e=function(t){t=function(t,e){if("object"!=r(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0===n)return("string"===e?String:Number)(t);n=n.call(t,e||"default");if("object"!=r(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"==r(t)?t:String(t)}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}Object.defineProperty(n,"__esModule",{value:!0}),n.default=function(n){var r=n.createSutra();function o(t){return(t.MOVE_UP||t.MOVE_DOWN)&&(t.MOVE_LEFT||t.MOVE_RIGHT)}r.addCondition("PLAYER_UP",{op:"or",conditions:["W","DPAD_UP"]}),r.addCondition("PLAYER_DOWN",{op:"or",conditions:["S","DPAD_DOWN"]}),r.addCondition("PLAYER_LEFT",{op:"or",conditions:["A","DPAD_LEFT"]}),r.addCondition("PLAYER_RIGHT",{op:"or",conditions:["D","DPAD_RIGHT"]}),r.addCondition("USE_ITEM_1",{op:"or",conditions:["SPACE","H","BUTTON_B"]}),r.addCondition("USE_ITEM_2",{op:"or",conditions:["J","BUTTON_X"]}),r.addCondition("USE_ITEM_3",{op:"or",conditions:["K","BUTTON_A"]}),r.addCondition("USE_ITEM_4",{op:"or",conditions:["L","BUTTON_Y"]}),r.addCondition("ZOOM_IN",{op:"or",conditions:["K","BUTTON_A"]}),r.addCondition("ZOOM_OUT",{op:"or",conditions:["L","BUTTON_Y"]}),r.if("PLAYER_UP").then("MOVE_UP").then("updateSprite",{sprite:"playerUp"}),r.if("PLAYER_LEFT").then("MOVE_LEFT").then("updateSprite",{sprite:"playerLeft"}),r.if("PLAYER_DOWN").then("MOVE_DOWN").then("updateSprite",{sprite:"playerDown"}),r.if("PLAYER_RIGHT").then("MOVE_RIGHT").then("updateSprite",{sprite:"playerRight"}),r.if("USE_ITEM_1").then("FIRE_BULLET").map("determineShootingSprite").then("updateSprite"),r.if("USE_ITEM_2").then("THROW_BOOMERANG"),r.if("ZOOM_IN").then("ZOOM_IN"),r.if("ZOOM_OUT").then("ZOOM_OUT"),r.addMap("determineShootingSprite",function(t,e){var n,r;return void 0!==t.texture&&(n=t.rotation%(2*Math.PI),r=a(a(a({0:"playerRodUp"},Math.PI/2,"playerRodRight"),Math.PI,"playerRodDown"),-Math.PI/2,"playerRodLeft"),t.texture.sprite=r[n]||t.currentSprite),t}),r.on("updateSprite",function(t,e){void 0!==t.texture&&(e=e.data.sprite||t.texture.sprite,n.updateEntity({id:t.id,texture:{frameIndex:0,sheet:t.texture.sheet,sprite:e,animationPlaying:!0}}))});var i=.7071;return r.on("MOVE_UP",function(t,e){e.state=e.state||{},e.state.MOVE_UP=!0;e={x:0,y:-2,z:0};o(r.state)&&(e.y*=i),n.applyForce(t.id,e),n.updateEntity({id:t.id,rotation:0})}),r.on("MOVE_DOWN",function(t,e){e.state=e.state||{},e.state.MOVE_DOWN=!0;e={x:0,y:2,z:0};o(r.state)&&(e.y*=i),n.applyForce(t.id,e),n.updateEntity({id:t.id,rotation:Math.PI})}),r.on("MOVE_LEFT",function(t,e){e.state=e.state||{},e.state.MOVE_LEFT=!0;e={x:-2,y:0,z:0};o(r.state)&&(e.x*=i),n.applyForce(t.id,e),n.updateEntity({id:t.id,rotation:-Math.PI/2})}),r.on("MOVE_RIGHT",function(t,e){e.state=e.state||{},e.state.MOVE_RIGHT=!0;e={x:2,y:0,z:0};o(r.state)&&(e.x*=i),n.applyForce(t.id,e),n.updateEntity({id:t.id,rotation:Math.PI/2})}),r.on("FIRE_BULLET",function(t){n.systems.bullet&&n.systems.bullet.fireBullet(t.id)}),r.on("SWING_SWORD",function(t){n.systems.sword&&n.systems.sword.swingSword(t.id)}),r.on("THROW_BOOMERANG",function(t){n.systems.boomerang&&n.systems.boomerang.throwBoomerang(t.id)}),r.on("CAMERA_SHAKE",function(t){n.shakeCamera(1e3)}),r.on("ZOOM_IN",function(t){var e=n.data.camera.currentZoom||1;n.setZoom(e+.05)}),r.on("ZOOM_OUT",function(t){var e=n.data.camera.currentZoom||1;n.setZoom(e-.05)}),r}},{}],28:[function(t,e,n){"use strict";function T(t){return(T="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function k(){k=function(){return a};var c,a={},t=Object.prototype,s=t.hasOwnProperty,l=Object.defineProperty||function(t,e,n){t[e]=n.value},e="function"==typeof Symbol?Symbol:{},r=e.iterator||"@@iterator",n=e.asyncIterator||"@@asyncIterator",o=e.toStringTag||"@@toStringTag";function i(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{i({},"")}catch(c){i=function(t,e,n){return t[e]=n}}function u(t,e,n,r){var o,i,a,u,e=e&&e.prototype instanceof v?e:v,e=Object.create(e.prototype),r=new x(r||[]);return l(e,"_invoke",{value:(o=t,i=n,a=r,u=p,function(t,e){if(u===d)throw new Error("Generator is already running");if(u===h){if("throw"===t)throw e;return{value:c,done:!0}}for(a.method=t,a.arg=e;;){var n=a.delegate;if(n){n=function t(e,n){var r=n.method,o=e.iterator[r];if(o===c)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=c,t(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),m;r=f(o,e.iterator,n.arg);if("throw"===r.type)return n.method="throw",n.arg=r.arg,n.delegate=null,m;o=r.arg;return o?o.done?(n[e.resultName]=o.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=c),n.delegate=null,m):o:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,m)}(n,a);if(n){if(n===m)continue;return n}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if(u===p)throw u=h,a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);u=d;n=f(o,i,a);if("normal"===n.type){if(u=a.done?h:y,n.arg===m)continue;return{value:n.arg,done:a.done}}"throw"===n.type&&(u=h,a.method="throw",a.arg=n.arg)}})}),e}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}a.wrap=u;var p="suspendedStart",y="suspendedYield",d="executing",h="completed",m={};function v(){}function b(){}function g(){}var e={},w=(i(e,r,function(){return this}),Object.getPrototypeOf),w=w&&w(w(_([]))),E=(w&&w!==t&&s.call(w,r)&&(e=w),g.prototype=v.prototype=Object.create(e));function P(t){["next","throw","return"].forEach(function(e){i(t,e,function(t){return this._invoke(e,t)})})}function O(a,u){var e;l(this,"_invoke",{value:function(n,r){function t(){return new u(function(t,e){!function e(t,n,r,o){var i,t=f(a[t],a,n);if("throw"!==t.type)return(n=(i=t.arg).value)&&"object"==T(n)&&s.call(n,"__await")?u.resolve(n.__await).then(function(t){e("next",t,r,o)},function(t){e("throw",t,r,o)}):u.resolve(n).then(function(t){i.value=t,r(i)},function(t){return e("throw",t,r,o)});o(t.arg)}(n,r,t,e)})}return e=e?e.then(t,t):t()}})}function S(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function x(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(S,this),this.reset(!0)}function _(e){if(e||""===e){var n,t=e[r];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return n=-1,(t=function t(){for(;++nMath.abs(e)?r=0",""),value:"https://yantra.gg/mantra/examples/demo.html?source="+t.url.replace(".html","")}})).unshift({label:n+"...",value:""}),(o=i.make().Select({options:o,title:n}).container(t)).afterUpdateEntity(function(t,e){var n;t&&void 0!==t.value&&a!==t.value&&(console.log("afterUpdateEntity",r,t.value,e),void 0!==r)&&void 0!==t.value&&""!==t.value&&null!==t.value&&(n=t.graphics["graphics-css"].querySelectorAll("select")[0],document.querySelectorAll("select").forEach(function(t){t!==n&&(t.value="")}),i.updateEntity(r.id,{meta:{src:t.value}}),e=t.value.replace("demo.html?source=","")+".js",console.log("sourceLink",e),i.updateEntity(l.id,{meta:{src:e}}),t=e.replace("https://yantra.gg/mantra","").replace(".js",""),e=e.replace(".js",""),i.updateEntity(u.id,{text:t,meta:{href:e}}),i.updateEntity(s.id,{style:{display:"none"}}),i.updateEntity(r.id,{style:{display:"block"}}))}),o.width(230).height(80).style({fontSize:"32px",backgroundColor:(null==(t=categories.find(function(t){return t.title===n}))?void 0:t.color)||"#e0e0e0"}).createEntity()});t=i.make().width(768).height(1e3),t.Iframe({src:"https://yantra.gg/mantra/examples"}),t.style({border:"none"}),t.x(0).y(1200),t.createEntity(),e=i.make().Text().text("Drag to move map"),e.x(200),e.y(220),e.width(600),e.color("white"),e.style({fontSize:"24px"}),e.createEntity(),t=i.make().Text().text("Wheel to Zoom"),t.x(0),t.y(220),t.width(600),t.color("white"),t.style({fontSize:"24px"}),t.createEntity(),e=i.make().Text().text("Click to interact");e.x(220),e.y(220),e.width(170),e.color("white"),e.style({fontSize:"24px",cursor:"pointer"}),e.pointerup(function(t,e){e.preventDefault(),n.game.shakeCamera({})}),e.createEntity()}},{key:"setDefaultZoom",value:function(){var t=this.game,e=window.innerWidth,n=window.innerHeight,r=.5/t.width,o=t.width,i=.5/t.height,a=t.height,e=Math.min(.5+(e-o)*r,.5+(n-a)*i),e=Math.max(.4,Math.min(e,1));t.setZoom(e)}}])&&i(e.prototype,n),r&&i(e,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();r(n,"id","world-playground"),r(n,"type","world")},{}],45:[function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){for(var n=0;nt.startingPosition.x+0}),t.addCondition("moveRight",function(t,e){return t.position.x<=+t.startingPosition.x}),t.addCondition("gameTickMod60",function(t,e){return e.tick%60==0}),t.if("gameTickMod60").if("isSpawner").then("spawnBlock",{x:0,y:100}),t.if("gameTickMod60").if("isSpawner","moveLeft").then("entity::updateEntity",{velocity:{x:-10,y:10}}),t.if("gameTickMod60").if("isSpawner","moveRight").then("entity::updateEntity",{velocity:{x:1,y:10}}),t.on("spawnBlock",function(t,e){a.createEntity({type:"BLOCK",position:{x:t.position.x,y:t.position.y},mass:100,friction:0,frictionAir:0,frictionStatic:0,velocity:{x:0,y:30},width:16,height:16})}),t.on("entity::updateEntity",function(t,e){a.updateEntity({id:t.id,velocity:t.velocity})}),t.addCondition("spawnUnitTouchedHomebase",function(t,e){if("COLLISION"===t.type)return"UnitSpawner"===t.bodyA.type&&"BORDER"===t.bodyB.type||"UnitSpawner"===t.bodyB.type&&"BORDER"===t.bodyA.type||void 0}),t.on("resetSpawnerUnit",function(t,e){var t=t.UnitSpawner,n={type:"UnitSpawner",health:100,position:t.startingPosition,width:64,height:64,color:65280,style:{backgroundColor:"#000000"}};n.startingPosition=t.startingPosition,a.createEntity(n)}),t.on("spawnEnemyUnits",function(t,e){console.log("data",t,e);try{for(var n=[],r=0;r<8;r++){var o=JSON.parse(JSON.stringify(u(u(u(u(u(u({type:"UnitSpawner",health:100,position:{x:0,y:0}},"health",100),"mass",100),"width",64),"height",64),"color",65280),"style",{backgroundColor:"#000000"}))),i=(console.log("spawner",o),.8*a.width);o.position.x=-i/2+i/8*r,o.position.y=-a.height/2+100,o.startingPosition={x:o.position.x,y:o.position.y},n.push(o)}n.forEach(function(t){a.createEntity(t)})}catch(t){console.log("err",t)}}),t.on("removeSpawnUnit",function(t,e,n){"BORDER"===t.bodyA.type&&a.removeEntity(t.bodyB.id),"BORDER"===t.bodyB.type&&a.removeEntity(t.bodyA.id)}),t}},{}],54:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=function(){var n=this.game,t=this.game.createSutra();return t.addCondition("PLAYER_UP",{op:"or",conditions:["W","DPAD_UP"]}),t.addCondition("PLAYER_DOWN",{op:"or",conditions:["S","DPAD_DOWN"]}),t.addCondition("PLAYER_LEFT",{op:"or",conditions:["A","DPAD_LEFT"]}),t.addCondition("PLAYER_RIGHT",{op:"or",conditions:["D","DPAD_RIGHT"]}),t.addCondition("USE_ITEM_1",{op:"or",conditions:["SPACE","H","BUTTON_B"]}),t.addCondition("USE_ITEM_2",{op:"or",conditions:["J","BUTTON_X"]}),t.addCondition("ZOOM_IN",{op:"or",conditions:["K","BUTTON_A"]}),t.addCondition("ZOOM_OUT",{op:"or",conditions:["L","BUTTON_Y"]}),t.if("PLAYER_UP").then("MOVE_UP"),t.if("PLAYER_LEFT").then("MOVE_LEFT"),t.if("PLAYER_DOWN").then("MOVE_DOWN"),t.if("PLAYER_RIGHT").then("MOVE_RIGHT"),t.if("USE_ITEM_1").then("FIRE_BULLET").map("determineShootingSprite").then("updateSprite"),t.on("FIRE_BULLET",function(t){n.systems.bullet.fireBullet(t.id)}),t.on("SWING_SWORD",function(t){n.systems.sword.swingSword(t.id)}),t.on("CAMERA_SHAKE",function(t){n.shakeCamera(1e3)}),t.on("ZOOM_IN",function(t){var e=n.data.camera.currentZoom||1;n.setZoom(e+.05)}),t.on("ZOOM_OUT",function(t){var e=n.data.camera.currentZoom||1;n.setZoom(e-.05)}),t.on("PLAYER_UP",function(t){n.applyForce(t.id,{x:0,y:.05*-r})}),t.on("PLAYER_LEFT",function(t){n.applyForce(t.id,{x:.05*-r,y:0})}),t.on("PLAYER_RIGHT",function(t){n.applyForce(t.id,{x:.05*r,y:0})}),t.on("PLAYER_DOWN",function(t){n.applyForce(t.id,{x:0,y:.05*r})}),console.log("creating input sutra",t),t};var r=5},{}],55:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=function(){var n=this.game,t=this.game.createSutra();return t.addCondition("isPlayer",function(t){return"PLAYER"===t.type}),t.addCondition("playerHealthBelow0",function(t,e){if("PLAYER"===t.type&&t.health<=0)return!0}),t.on("resetPlayerPosition",function(t,e){n.updateEntity({id:t.id,position:{x:0,y:0},velocity:{x:0,y:0},health:100,color:65280,score:0})}),t.on("damagePlayer",function(t,e){t.BLOCK;t=t.PLAYER;t.health-=10,n.updateEntity({id:t.id,health:t.health})}),t.on("healPlayer",function(t,e){t.BLOCK;t=t.PLAYER;t&&(t.health+=5,n.updateEntity({id:t.id,health:t.health}))}),t}},{}],56:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=function(){var t=this.game.createSutra();return t.addCondition("roundStarted",function(t,e){return console.log("roundStarted",e.roundStarted),!0===e.roundStarted}),t.addCondition("roundEnded",function(t,e){return!0===e.roundEnded}),t.addCondition("roundRunning",function(t,e){return!0===e.roundRunning}),t.addCondition("roundNotRunning",function(t,e){return!1===e.roundRunning}),t.addCondition("roundPaused",function(t,e){return!0===e.roundPaused}),t.addCondition("roundNotPaused",function(t,e){return!0!==e.roundPaused}),t.on("roundLost",function(t,e,n){console.log("roundLost!!!"),n.roundStarted=!1,n.roundRunning=!1,n.roundEnded=!0,n.roundPaused=!0}),t.on("startRound",function(t,e,n){console.log("startRound",e),n.roundRunning=!0,n.roundEnded=!1}),t}},{}],57:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=function(o,t){o.createEntity({type:"Walker",width:22,height:24,texture:{sheet:"jogurt",sprite:"walkLeft"},depth:64,position:{x:50,y:-150,z:32}});var i=o.createSutra();return i.route=t.route,i.routeIndex=0,i.target=i.route[i.routeIndex],i.tolerance=t.tolerance||5,i.addCondition("isWalker",function(t){return"Walker"===t.type}),i.addCondition("atTarget",function(t){var e=t.position.x-i.target[0],t=t.position.y-i.target[1];return Math.sqrt(e*e+t*t)=this.props.wattage)&&this.activate(t))}},{key:"break",value:function(t){this.props.isBroken=!0,this.emit("broken")}},{key:"handleCollision",value:function(t){this.props.isBroken||"Rover"===t.type&&(this.isOn=!1,this.props.isBroken=!0,this.props.color="grey",this.emit("broken"))}},{key:"update",value:function(){this.props.isBroken}}])&&r(e.prototype,t),n&&r(e,n),Object.defineProperty(e,"prototype",{writable:!1}),c}(t.Part);t=n,n="LEDLight",(c=u(c="type"))in t?Object.defineProperty(t,c,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[c]=n},{"../Part.js":2}],9:[function(t,e,n){"use strict";function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=a(t("../utils/EventEmitter.js")),i=a(t("../signals/ElectricalSignal.js"));function a(t){return t&&t.__esModule?t:{default:t}}function u(t,e){for(var n=0;n=o||(r.applyForce(t.id,{x:0,y:-2.3,z:0}),r.updateEntity({id:t.id,rotation:0,sprite:"playerRightJump"}))}),1);return t.on("RUN",function(t){i=1.6,o=35}),t.on("WALK",function(t){i=1,o=25}),t.on("DUCK",function(t){r.applyForce(t.id,{x:0,y:.5,z:0}),r.updateEntity({id:t.id,rotation:Math.PI})}),t.on("MOVE_LEFT",function(t,e,n){r.applyForce(t.id,{x:-i,y:0,z:0}),r.updateEntity({id:t.id,rotation:-Math.PI/2})}),t.on("MOVE_RIGHT",function(t){r.applyForce(t.id,{x:i,y:0,z:0}),r.updateEntity({id:t.id,rotation:Math.PI/2})}),t.on("FIRE_BULLET",function(t){r.systems.bullet.fireBullet(t.id)}),t.on("SWING_SWORD",function(t){r.systems.sword&&r.systems.sword.swingSword(t.id)}),t}},{}],27:[function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function a(t,e,n){return(e=function(t){t=function(t,e){if("object"!=r(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0===n)return("string"===e?String:Number)(t);n=n.call(t,e||"default");if("object"!=r(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"==r(t)?t:String(t)}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}Object.defineProperty(n,"__esModule",{value:!0}),n.default=function(n){var r=n.createSutra();function o(t){return(t.MOVE_UP||t.MOVE_DOWN)&&(t.MOVE_LEFT||t.MOVE_RIGHT)}r.addCondition("PLAYER_UP",{op:"or",conditions:["W","DPAD_UP"]}),r.addCondition("PLAYER_DOWN",{op:"or",conditions:["S","DPAD_DOWN"]}),r.addCondition("PLAYER_LEFT",{op:"or",conditions:["A","DPAD_LEFT"]}),r.addCondition("PLAYER_RIGHT",{op:"or",conditions:["D","DPAD_RIGHT"]}),r.addCondition("USE_ITEM_1",{op:"or",conditions:["SPACE","H","BUTTON_B"]}),r.addCondition("USE_ITEM_2",{op:"or",conditions:["J","BUTTON_X"]}),r.addCondition("USE_ITEM_3",{op:"or",conditions:["K","BUTTON_A"]}),r.addCondition("USE_ITEM_4",{op:"or",conditions:["L","BUTTON_Y"]}),r.addCondition("ZOOM_IN",{op:"or",conditions:["K","BUTTON_A"]}),r.addCondition("ZOOM_OUT",{op:"or",conditions:["L","BUTTON_Y"]}),r.if("PLAYER_UP").then("MOVE_UP").then("updateSprite",{sprite:"playerUp"}),r.if("PLAYER_LEFT").then("MOVE_LEFT").then("updateSprite",{sprite:"playerLeft"}),r.if("PLAYER_DOWN").then("MOVE_DOWN").then("updateSprite",{sprite:"playerDown"}),r.if("PLAYER_RIGHT").then("MOVE_RIGHT").then("updateSprite",{sprite:"playerRight"}),r.if("USE_ITEM_1").then("FIRE_BULLET").map("determineShootingSprite").then("updateSprite"),r.if("USE_ITEM_2").then("THROW_BOOMERANG"),r.if("ZOOM_IN").then("ZOOM_IN"),r.if("ZOOM_OUT").then("ZOOM_OUT"),r.addMap("determineShootingSprite",function(t,e){var n,r;return void 0!==t.texture&&(n=t.rotation%(2*Math.PI),r=a(a(a({0:"playerRodUp"},Math.PI/2,"playerRodRight"),Math.PI,"playerRodDown"),-Math.PI/2,"playerRodLeft"),t.texture.sprite=r[n]||t.currentSprite),t}),r.on("updateSprite",function(t,e){void 0!==t.texture&&(e=e.data.sprite||t.texture.sprite,n.updateEntity({id:t.id,texture:{frameIndex:0,sheet:t.texture.sheet,sprite:e,animationPlaying:!0}}))});var i=.7071;return r.on("MOVE_UP",function(t,e){e.state=e.state||{},e.state.MOVE_UP=!0;e={x:0,y:-2,z:0};o(r.state)&&(e.y*=i),n.applyForce(t.id,e),n.updateEntity({id:t.id,rotation:0})}),r.on("MOVE_DOWN",function(t,e){e.state=e.state||{},e.state.MOVE_DOWN=!0;e={x:0,y:2,z:0};o(r.state)&&(e.y*=i),n.applyForce(t.id,e),n.updateEntity({id:t.id,rotation:Math.PI})}),r.on("MOVE_LEFT",function(t,e){e.state=e.state||{},e.state.MOVE_LEFT=!0;e={x:-2,y:0,z:0};o(r.state)&&(e.x*=i),n.applyForce(t.id,e),n.updateEntity({id:t.id,rotation:-Math.PI/2})}),r.on("MOVE_RIGHT",function(t,e){e.state=e.state||{},e.state.MOVE_RIGHT=!0;e={x:2,y:0,z:0};o(r.state)&&(e.x*=i),n.applyForce(t.id,e),n.updateEntity({id:t.id,rotation:Math.PI/2})}),r.on("FIRE_BULLET",function(t){n.systems.bullet&&n.systems.bullet.fireBullet(t.id)}),r.on("SWING_SWORD",function(t){n.systems.sword&&n.systems.sword.swingSword(t.id)}),r.on("THROW_BOOMERANG",function(t){n.systems.boomerang&&n.systems.boomerang.throwBoomerang(t.id)}),r.on("CAMERA_SHAKE",function(t){n.shakeCamera(1e3)}),r.on("ZOOM_IN",function(t){var e=n.data.camera.currentZoom||1;n.setZoom(e+.05)}),r.on("ZOOM_OUT",function(t){var e=n.data.camera.currentZoom||1;n.setZoom(e-.05)}),r}},{}],28:[function(t,e,n){"use strict";function T(t){return(T="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function k(){k=function(){return a};var c,a={},t=Object.prototype,s=t.hasOwnProperty,l=Object.defineProperty||function(t,e,n){t[e]=n.value},e="function"==typeof Symbol?Symbol:{},r=e.iterator||"@@iterator",n=e.asyncIterator||"@@asyncIterator",o=e.toStringTag||"@@toStringTag";function i(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{i({},"")}catch(c){i=function(t,e,n){return t[e]=n}}function u(t,e,n,r){var o,i,a,u,e=e&&e.prototype instanceof v?e:v,e=Object.create(e.prototype),r=new x(r||[]);return l(e,"_invoke",{value:(o=t,i=n,a=r,u=p,function(t,e){if(u===d)throw new Error("Generator is already running");if(u===h){if("throw"===t)throw e;return{value:c,done:!0}}for(a.method=t,a.arg=e;;){var n=a.delegate;if(n){n=function t(e,n){var r=n.method,o=e.iterator[r];if(o===c)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=c,t(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),m;r=f(o,e.iterator,n.arg);if("throw"===r.type)return n.method="throw",n.arg=r.arg,n.delegate=null,m;o=r.arg;return o?o.done?(n[e.resultName]=o.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=c),n.delegate=null,m):o:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,m)}(n,a);if(n){if(n===m)continue;return n}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if(u===p)throw u=h,a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);u=d;n=f(o,i,a);if("normal"===n.type){if(u=a.done?h:y,n.arg===m)continue;return{value:n.arg,done:a.done}}"throw"===n.type&&(u=h,a.method="throw",a.arg=n.arg)}})}),e}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}a.wrap=u;var p="suspendedStart",y="suspendedYield",d="executing",h="completed",m={};function v(){}function b(){}function g(){}var e={},w=(i(e,r,function(){return this}),Object.getPrototypeOf),w=w&&w(w(_([]))),E=(w&&w!==t&&s.call(w,r)&&(e=w),g.prototype=v.prototype=Object.create(e));function P(t){["next","throw","return"].forEach(function(e){i(t,e,function(t){return this._invoke(e,t)})})}function O(a,u){var e;l(this,"_invoke",{value:function(n,r){function t(){return new u(function(t,e){!function e(t,n,r,o){var i,t=f(a[t],a,n);if("throw"!==t.type)return(n=(i=t.arg).value)&&"object"==T(n)&&s.call(n,"__await")?u.resolve(n.__await).then(function(t){e("next",t,r,o)},function(t){e("throw",t,r,o)}):u.resolve(n).then(function(t){i.value=t,r(i)},function(t){return e("throw",t,r,o)});o(t.arg)}(n,r,t,e)})}return e=e?e.then(t,t):t()}})}function S(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function x(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(S,this),this.reset(!0)}function _(e){if(e||""===e){var n,t=e[r];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return n=-1,(t=function t(){for(;++nMath.abs(e)?r=0",""),value:"https://yantra.gg/mantra/examples/demo.html?source="+t.url.replace(".html","")}})).unshift({label:n+"...",value:""}),(o=i.make().Select({options:o,title:n}).container(t)).afterUpdateEntity(function(t,e){var n;t&&void 0!==t.value&&a!==t.value&&(console.log("afterUpdateEntity",r,t.value,e),void 0!==r)&&void 0!==t.value&&""!==t.value&&null!==t.value&&(n=t.graphics["graphics-css"].querySelectorAll("select")[0],document.querySelectorAll("select").forEach(function(t){t!==n&&(t.value="")}),i.updateEntity(r.id,{meta:{src:t.value}}),e=t.value.replace("demo.html?source=","")+".js",console.log("sourceLink",e),i.updateEntity(l.id,{meta:{src:e}}),t=e.replace("https://yantra.gg/mantra","").replace(".js",""),e=e.replace(".js",""),i.updateEntity(u.id,{text:t,meta:{href:e}}),i.updateEntity(s.id,{style:{display:"none"}}),i.updateEntity(r.id,{style:{display:"block"}}))}),o.width(230).height(80).style({fontSize:"32px",backgroundColor:(null==(t=categories.find(function(t){return t.title===n}))?void 0:t.color)||"#e0e0e0"}).createEntity()});t=i.make().width(768).height(1e3),t.Iframe({src:"https://yantra.gg/mantra/examples"}),t.style({border:"none"}),t.x(0).y(1200),t.createEntity(),e=i.make().Text().text("Drag to move map"),e.x(200),e.y(220),e.width(600),e.color("white"),e.style({fontSize:"24px"}),e.createEntity(),t=i.make().Text().text("Wheel to Zoom"),t.x(0),t.y(220),t.width(600),t.color("white"),t.style({fontSize:"24px"}),t.createEntity(),e=i.make().Text().text("Click to interact");e.x(220),e.y(220),e.width(170),e.color("white"),e.style({fontSize:"24px",cursor:"pointer"}),e.pointerup(function(t,e){e.preventDefault(),n.game.shakeCamera({})}),e.createEntity()}},{key:"setDefaultZoom",value:function(){var t=this.game,e=window.innerWidth,n=window.innerHeight,r=.5/t.width,o=t.width,i=.5/t.height,a=t.height,e=Math.min(.5+(e-o)*r,.5+(n-a)*i),e=Math.max(.4,Math.min(e,1));t.setZoom(e)}}])&&i(e.prototype,n),r&&i(e,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();r(n,"id","world-playground"),r(n,"type","world")},{}],45:[function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){for(var n=0;nt.startingPosition.x+0}),t.addCondition("moveRight",function(t,e){return t.position.x<=+t.startingPosition.x}),t.addCondition("gameTickMod60",function(t,e){return e.tick%60==0}),t.if("gameTickMod60").if("isSpawner").then("spawnBlock",{x:0,y:100}),t.if("gameTickMod60").if("isSpawner","moveLeft").then("entity::updateEntity",{velocity:{x:-10,y:10}}),t.if("gameTickMod60").if("isSpawner","moveRight").then("entity::updateEntity",{velocity:{x:1,y:10}}),t.on("spawnBlock",function(t,e){a.createEntity({type:"BLOCK",position:{x:t.position.x,y:t.position.y},mass:100,friction:0,frictionAir:0,frictionStatic:0,velocity:{x:0,y:30},width:16,height:16})}),t.on("entity::updateEntity",function(t,e){a.updateEntity({id:t.id,velocity:t.velocity})}),t.addCondition("spawnUnitTouchedHomebase",function(t,e){if("COLLISION"===t.type)return"UnitSpawner"===t.bodyA.type&&"BORDER"===t.bodyB.type||"UnitSpawner"===t.bodyB.type&&"BORDER"===t.bodyA.type||void 0}),t.on("resetSpawnerUnit",function(t,e){var t=t.UnitSpawner,n={type:"UnitSpawner",health:100,position:t.startingPosition,width:64,height:64,color:65280,style:{backgroundColor:"#000000"}};n.startingPosition=t.startingPosition,a.createEntity(n)}),t.on("spawnEnemyUnits",function(t,e){console.log("data",t,e);try{for(var n=[],r=0;r<8;r++){var o=JSON.parse(JSON.stringify(u(u(u(u(u(u({type:"UnitSpawner",health:100,position:{x:0,y:0}},"health",100),"mass",100),"width",64),"height",64),"color",65280),"style",{backgroundColor:"#000000"}))),i=(console.log("spawner",o),.8*a.width);o.position.x=-i/2+i/8*r,o.position.y=-a.height/2+100,o.startingPosition={x:o.position.x,y:o.position.y},n.push(o)}n.forEach(function(t){a.createEntity(t)})}catch(t){console.log("err",t)}}),t.on("removeSpawnUnit",function(t,e,n){"BORDER"===t.bodyA.type&&a.removeEntity(t.bodyB.id),"BORDER"===t.bodyB.type&&a.removeEntity(t.bodyA.id)}),t}},{}],54:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=function(){var n=this.game,t=this.game.createSutra();return t.addCondition("PLAYER_UP",{op:"or",conditions:["W","DPAD_UP"]}),t.addCondition("PLAYER_DOWN",{op:"or",conditions:["S","DPAD_DOWN"]}),t.addCondition("PLAYER_LEFT",{op:"or",conditions:["A","DPAD_LEFT"]}),t.addCondition("PLAYER_RIGHT",{op:"or",conditions:["D","DPAD_RIGHT"]}),t.addCondition("USE_ITEM_1",{op:"or",conditions:["SPACE","H","BUTTON_B"]}),t.addCondition("USE_ITEM_2",{op:"or",conditions:["J","BUTTON_X"]}),t.addCondition("ZOOM_IN",{op:"or",conditions:["K","BUTTON_A"]}),t.addCondition("ZOOM_OUT",{op:"or",conditions:["L","BUTTON_Y"]}),t.if("PLAYER_UP").then("MOVE_UP"),t.if("PLAYER_LEFT").then("MOVE_LEFT"),t.if("PLAYER_DOWN").then("MOVE_DOWN"),t.if("PLAYER_RIGHT").then("MOVE_RIGHT"),t.if("USE_ITEM_1").then("FIRE_BULLET").map("determineShootingSprite").then("updateSprite"),t.on("FIRE_BULLET",function(t){n.systems.bullet.fireBullet(t.id)}),t.on("SWING_SWORD",function(t){n.systems.sword.swingSword(t.id)}),t.on("CAMERA_SHAKE",function(t){n.shakeCamera(1e3)}),t.on("ZOOM_IN",function(t){var e=n.data.camera.currentZoom||1;n.setZoom(e+.05)}),t.on("ZOOM_OUT",function(t){var e=n.data.camera.currentZoom||1;n.setZoom(e-.05)}),t.on("PLAYER_UP",function(t){n.applyForce(t.id,{x:0,y:.05*-r})}),t.on("PLAYER_LEFT",function(t){n.applyForce(t.id,{x:.05*-r,y:0})}),t.on("PLAYER_RIGHT",function(t){n.applyForce(t.id,{x:.05*r,y:0})}),t.on("PLAYER_DOWN",function(t){n.applyForce(t.id,{x:0,y:.05*r})}),console.log("creating input sutra",t),t};var r=5},{}],55:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=function(){var n=this.game,t=this.game.createSutra();return t.addCondition("isPlayer",function(t){return"PLAYER"===t.type}),t.addCondition("playerHealthBelow0",function(t,e){if("PLAYER"===t.type&&t.health<=0)return!0}),t.on("resetPlayerPosition",function(t,e){n.updateEntity({id:t.id,position:{x:0,y:0},velocity:{x:0,y:0},health:100,color:65280,score:0})}),t.on("damagePlayer",function(t,e){t.BLOCK;t=t.PLAYER;t.health-=10,n.updateEntity({id:t.id,health:t.health})}),t.on("healPlayer",function(t,e){t.BLOCK;t=t.PLAYER;t&&(t.health+=5,n.updateEntity({id:t.id,health:t.health}))}),t}},{}],56:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=function(){var t=this.game.createSutra();return t.addCondition("roundStarted",function(t,e){return console.log("roundStarted",e.roundStarted),!0===e.roundStarted}),t.addCondition("roundEnded",function(t,e){return!0===e.roundEnded}),t.addCondition("roundRunning",function(t,e){return!0===e.roundRunning}),t.addCondition("roundNotRunning",function(t,e){return!1===e.roundRunning}),t.addCondition("roundPaused",function(t,e){return!0===e.roundPaused}),t.addCondition("roundNotPaused",function(t,e){return!0!==e.roundPaused}),t.on("roundLost",function(t,e,n){console.log("roundLost!!!"),n.roundStarted=!1,n.roundRunning=!1,n.roundEnded=!0,n.roundPaused=!0}),t.on("startRound",function(t,e,n){console.log("startRound",e),n.roundRunning=!0,n.roundEnded=!1}),t}},{}],57:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=function(o,t){o.createEntity({type:"Walker",width:22,height:24,texture:{sheet:"jogurt",sprite:"walkLeft"},depth:64,position:{x:50,y:-150,z:32}});var i=o.createSutra();return i.route=t.route,i.routeIndex=0,i.target=i.route[i.routeIndex],i.tolerance=t.tolerance||5,i.addCondition("isWalker",function(t){return"Walker"===t.type}),i.addCondition("atTarget",function(t){var e=t.position.x-i.target[0],t=t.position.y-i.target[1];return Math.sqrt(e*e+t*t)=this.props.wattage)&&this.activate(t))}},{key:"break",value:function(t){this.props.isBroken=!0,this.emit("broken")}},{key:"handleCollision",value:function(t){this.props.isBroken||"Rover"===t.type&&(this.isOn=!1,this.props.isBroken=!0,this.props.color="grey",this.emit("broken"))}},{key:"update",value:function(){this.props.isBroken}}])&&r(e.prototype,t),n&&r(e,n),Object.defineProperty(e,"prototype",{writable:!1}),c}(t.Part);t=n,n="LEDLight",(c=u(c="type"))in t?Object.defineProperty(t,c,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[c]=n},{"../Part.js":2}],9:[function(t,e,n){"use strict";function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=a(t("../utils/EventEmitter.js")),i=a(t("../signals/ElectricalSignal.js"));function a(t){return t&&t.__esModule?t:{default:t}}function u(t,e){for(var n=0;n=o||(r.applyForce(t.id,{x:0,y:-2.3,z:0}),r.updateEntity({id:t.id,rotation:0,sprite:"playerRightJump"}))}),1);return t.on("RUN",function(t){i=1.6,o=35}),t.on("WALK",function(t){i=1,o=25}),t.on("DUCK",function(t){r.applyForce(t.id,{x:0,y:.5,z:0}),r.updateEntity({id:t.id,rotation:Math.PI})}),t.on("MOVE_LEFT",function(t,e,n){r.applyForce(t.id,{x:-i,y:0,z:0}),r.updateEntity({id:t.id,rotation:-Math.PI/2})}),t.on("MOVE_RIGHT",function(t){r.applyForce(t.id,{x:i,y:0,z:0}),r.updateEntity({id:t.id,rotation:Math.PI/2})}),t.on("FIRE_BULLET",function(t){r.systems.bullet.fireBullet(t.id)}),t.on("SWING_SWORD",function(t){r.systems.sword&&r.systems.sword.swingSword(t.id)}),t}},{}],27:[function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function a(t,e,n){return(e=function(t){t=function(t,e){if("object"!=r(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0===n)return("string"===e?String:Number)(t);n=n.call(t,e||"default");if("object"!=r(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"==r(t)?t:String(t)}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}Object.defineProperty(n,"__esModule",{value:!0}),n.default=function(n){var r=n.createSutra();function o(t){return(t.MOVE_UP||t.MOVE_DOWN)&&(t.MOVE_LEFT||t.MOVE_RIGHT)}r.addCondition("PLAYER_UP",{op:"or",conditions:["W","DPAD_UP"]}),r.addCondition("PLAYER_DOWN",{op:"or",conditions:["S","DPAD_DOWN"]}),r.addCondition("PLAYER_LEFT",{op:"or",conditions:["A","DPAD_LEFT"]}),r.addCondition("PLAYER_RIGHT",{op:"or",conditions:["D","DPAD_RIGHT"]}),r.addCondition("USE_ITEM_1",{op:"or",conditions:["SPACE","H","BUTTON_B"]}),r.addCondition("USE_ITEM_2",{op:"or",conditions:["J","BUTTON_X"]}),r.addCondition("USE_ITEM_3",{op:"or",conditions:["K","BUTTON_A"]}),r.addCondition("USE_ITEM_4",{op:"or",conditions:["L","BUTTON_Y"]}),r.addCondition("ZOOM_IN",{op:"or",conditions:["K","BUTTON_A"]}),r.addCondition("ZOOM_OUT",{op:"or",conditions:["L","BUTTON_Y"]}),r.if("PLAYER_UP").then("MOVE_UP").then("updateSprite",{sprite:"playerUp"}),r.if("PLAYER_LEFT").then("MOVE_LEFT").then("updateSprite",{sprite:"playerLeft"}),r.if("PLAYER_DOWN").then("MOVE_DOWN").then("updateSprite",{sprite:"playerDown"}),r.if("PLAYER_RIGHT").then("MOVE_RIGHT").then("updateSprite",{sprite:"playerRight"}),r.if("USE_ITEM_1").then("FIRE_BULLET").map("determineShootingSprite").then("updateSprite"),r.if("USE_ITEM_2").then("THROW_BOOMERANG"),r.if("ZOOM_IN").then("ZOOM_IN"),r.if("ZOOM_OUT").then("ZOOM_OUT"),r.addMap("determineShootingSprite",function(t,e){var n,r;return void 0!==t.texture&&(n=t.rotation%(2*Math.PI),r=a(a(a({0:"playerRodUp"},Math.PI/2,"playerRodRight"),Math.PI,"playerRodDown"),-Math.PI/2,"playerRodLeft"),t.texture.sprite=r[n]||t.currentSprite),t}),r.on("updateSprite",function(t,e){void 0!==t.texture&&(e=e.data.sprite||t.texture.sprite,n.updateEntity({id:t.id,texture:{frameIndex:0,sheet:t.texture.sheet,sprite:e,animationPlaying:!0}}))});var i=.7071;return r.on("MOVE_UP",function(t,e){e.state=e.state||{},e.state.MOVE_UP=!0;e={x:0,y:-2,z:0};o(r.state)&&(e.y*=i),n.applyForce(t.id,e),n.updateEntity({id:t.id,rotation:0})}),r.on("MOVE_DOWN",function(t,e){e.state=e.state||{},e.state.MOVE_DOWN=!0;e={x:0,y:2,z:0};o(r.state)&&(e.y*=i),n.applyForce(t.id,e),n.updateEntity({id:t.id,rotation:Math.PI})}),r.on("MOVE_LEFT",function(t,e){e.state=e.state||{},e.state.MOVE_LEFT=!0;e={x:-2,y:0,z:0};o(r.state)&&(e.x*=i),n.applyForce(t.id,e),n.updateEntity({id:t.id,rotation:-Math.PI/2})}),r.on("MOVE_RIGHT",function(t,e){e.state=e.state||{},e.state.MOVE_RIGHT=!0;e={x:2,y:0,z:0};o(r.state)&&(e.x*=i),n.applyForce(t.id,e),n.updateEntity({id:t.id,rotation:Math.PI/2})}),r.on("FIRE_BULLET",function(t){n.systems.bullet&&n.systems.bullet.fireBullet(t.id)}),r.on("SWING_SWORD",function(t){n.systems.sword&&n.systems.sword.swingSword(t.id)}),r.on("THROW_BOOMERANG",function(t){n.systems.boomerang&&n.systems.boomerang.throwBoomerang(t.id)}),r.on("CAMERA_SHAKE",function(t){n.shakeCamera(1e3)}),r.on("ZOOM_IN",function(t){var e=n.data.camera.currentZoom||1;n.setZoom(e+.05)}),r.on("ZOOM_OUT",function(t){var e=n.data.camera.currentZoom||1;n.setZoom(e-.05)}),r}},{}],28:[function(t,e,n){"use strict";function T(t){return(T="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function k(){k=function(){return a};var c,a={},t=Object.prototype,s=t.hasOwnProperty,l=Object.defineProperty||function(t,e,n){t[e]=n.value},e="function"==typeof Symbol?Symbol:{},r=e.iterator||"@@iterator",n=e.asyncIterator||"@@asyncIterator",o=e.toStringTag||"@@toStringTag";function i(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{i({},"")}catch(c){i=function(t,e,n){return t[e]=n}}function u(t,e,n,r){var o,i,a,u,e=e&&e.prototype instanceof v?e:v,e=Object.create(e.prototype),r=new x(r||[]);return l(e,"_invoke",{value:(o=t,i=n,a=r,u=p,function(t,e){if(u===d)throw new Error("Generator is already running");if(u===h){if("throw"===t)throw e;return{value:c,done:!0}}for(a.method=t,a.arg=e;;){var n=a.delegate;if(n){n=function t(e,n){var r=n.method,o=e.iterator[r];if(o===c)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=c,t(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),m;r=f(o,e.iterator,n.arg);if("throw"===r.type)return n.method="throw",n.arg=r.arg,n.delegate=null,m;o=r.arg;return o?o.done?(n[e.resultName]=o.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=c),n.delegate=null,m):o:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,m)}(n,a);if(n){if(n===m)continue;return n}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if(u===p)throw u=h,a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);u=d;n=f(o,i,a);if("normal"===n.type){if(u=a.done?h:y,n.arg===m)continue;return{value:n.arg,done:a.done}}"throw"===n.type&&(u=h,a.method="throw",a.arg=n.arg)}})}),e}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}a.wrap=u;var p="suspendedStart",y="suspendedYield",d="executing",h="completed",m={};function v(){}function b(){}function g(){}var e={},w=(i(e,r,function(){return this}),Object.getPrototypeOf),w=w&&w(w(_([]))),E=(w&&w!==t&&s.call(w,r)&&(e=w),g.prototype=v.prototype=Object.create(e));function P(t){["next","throw","return"].forEach(function(e){i(t,e,function(t){return this._invoke(e,t)})})}function O(a,u){var e;l(this,"_invoke",{value:function(n,r){function t(){return new u(function(t,e){!function e(t,n,r,o){var i,t=f(a[t],a,n);if("throw"!==t.type)return(n=(i=t.arg).value)&&"object"==T(n)&&s.call(n,"__await")?u.resolve(n.__await).then(function(t){e("next",t,r,o)},function(t){e("throw",t,r,o)}):u.resolve(n).then(function(t){i.value=t,r(i)},function(t){return e("throw",t,r,o)});o(t.arg)}(n,r,t,e)})}return e=e?e.then(t,t):t()}})}function S(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function x(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(S,this),this.reset(!0)}function _(e){if(e||""===e){var n,t=e[r];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return n=-1,(t=function t(){for(;++nMath.abs(e)?r=0",""),value:"https://yantra.gg/mantra/examples/demo.html?source="+t.url.replace(".html","")}})).unshift({label:n+"...",value:""}),(o=i.make().Select({options:o,title:n}).container(t)).afterUpdateEntity(function(t,e){var n;t&&void 0!==t.value&&a!==t.value&&(console.log("afterUpdateEntity",r,t.value,e),void 0!==r)&&void 0!==t.value&&""!==t.value&&null!==t.value&&(n=t.graphics["graphics-css"].querySelectorAll("select")[0],document.querySelectorAll("select").forEach(function(t){t!==n&&(t.value="")}),i.updateEntity(r.id,{meta:{src:t.value}}),e=t.value.replace("demo.html?source=","")+".js",console.log("sourceLink",e),i.updateEntity(l.id,{meta:{src:e}}),t=e.replace("https://yantra.gg/mantra","").replace(".js",""),e=e.replace(".js",""),i.updateEntity(u.id,{text:t,meta:{href:e}}),i.updateEntity(s.id,{style:{display:"none"}}),i.updateEntity(r.id,{style:{display:"block"}}))}),o.width(230).height(80).style({fontSize:"32px",backgroundColor:(null==(t=categories.find(function(t){return t.title===n}))?void 0:t.color)||"#e0e0e0"}).createEntity()});t=i.make().width(768).height(1e3),t.Iframe({src:"https://yantra.gg/mantra/examples"}),t.style({border:"none"}),t.x(0).y(1200),t.createEntity(),e=i.make().Text().text("Drag to move map"),e.x(200),e.y(220),e.width(600),e.color("white"),e.style({fontSize:"24px"}),e.createEntity(),t=i.make().Text().text("Wheel to Zoom"),t.x(0),t.y(220),t.width(600),t.color("white"),t.style({fontSize:"24px"}),t.createEntity(),e=i.make().Text().text("Click to interact");e.x(220),e.y(220),e.width(170),e.color("white"),e.style({fontSize:"24px",cursor:"pointer"}),e.pointerup(function(t,e){e.preventDefault(),n.game.shakeCamera({})}),e.createEntity()}},{key:"setDefaultZoom",value:function(){var t=this.game,e=window.innerWidth,n=window.innerHeight,r=.5/t.width,o=t.width,i=.5/t.height,a=t.height,e=Math.min(.5+(e-o)*r,.5+(n-a)*i),e=Math.max(.4,Math.min(e,1));t.setZoom(e)}}])&&i(e.prototype,n),r&&i(e,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();r(n,"id","world-playground"),r(n,"type","world")},{}],45:[function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){for(var n=0;nt.startingPosition.x+0}),t.addCondition("moveRight",function(t,e){return t.position.x<=+t.startingPosition.x}),t.addCondition("gameTickMod60",function(t,e){return e.tick%60==0}),t.if("gameTickMod60").if("isSpawner").then("spawnBlock",{x:0,y:100}),t.if("gameTickMod60").if("isSpawner","moveLeft").then("entity::updateEntity",{velocity:{x:-10,y:10}}),t.if("gameTickMod60").if("isSpawner","moveRight").then("entity::updateEntity",{velocity:{x:1,y:10}}),t.on("spawnBlock",function(t,e){a.createEntity({type:"BLOCK",position:{x:t.position.x,y:t.position.y},mass:100,friction:0,frictionAir:0,frictionStatic:0,velocity:{x:0,y:30},width:16,height:16})}),t.on("entity::updateEntity",function(t,e){a.updateEntity({id:t.id,velocity:t.velocity})}),t.addCondition("spawnUnitTouchedHomebase",function(t,e){if("COLLISION"===t.type)return"UnitSpawner"===t.bodyA.type&&"BORDER"===t.bodyB.type||"UnitSpawner"===t.bodyB.type&&"BORDER"===t.bodyA.type||void 0}),t.on("resetSpawnerUnit",function(t,e){var t=t.UnitSpawner,n={type:"UnitSpawner",health:100,position:t.startingPosition,width:64,height:64,color:65280,style:{backgroundColor:"#000000"}};n.startingPosition=t.startingPosition,a.createEntity(n)}),t.on("spawnEnemyUnits",function(t,e){console.log("data",t,e);try{for(var n=[],r=0;r<8;r++){var o=JSON.parse(JSON.stringify(u(u(u(u(u(u({type:"UnitSpawner",health:100,position:{x:0,y:0}},"health",100),"mass",100),"width",64),"height",64),"color",65280),"style",{backgroundColor:"#000000"}))),i=(console.log("spawner",o),.8*a.width);o.position.x=-i/2+i/8*r,o.position.y=-a.height/2+100,o.startingPosition={x:o.position.x,y:o.position.y},n.push(o)}n.forEach(function(t){a.createEntity(t)})}catch(t){console.log("err",t)}}),t.on("removeSpawnUnit",function(t,e,n){"BORDER"===t.bodyA.type&&a.removeEntity(t.bodyB.id),"BORDER"===t.bodyB.type&&a.removeEntity(t.bodyA.id)}),t}},{}],54:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=function(){var n=this.game,t=this.game.createSutra();return t.addCondition("PLAYER_UP",{op:"or",conditions:["W","DPAD_UP"]}),t.addCondition("PLAYER_DOWN",{op:"or",conditions:["S","DPAD_DOWN"]}),t.addCondition("PLAYER_LEFT",{op:"or",conditions:["A","DPAD_LEFT"]}),t.addCondition("PLAYER_RIGHT",{op:"or",conditions:["D","DPAD_RIGHT"]}),t.addCondition("USE_ITEM_1",{op:"or",conditions:["SPACE","H","BUTTON_B"]}),t.addCondition("USE_ITEM_2",{op:"or",conditions:["J","BUTTON_X"]}),t.addCondition("ZOOM_IN",{op:"or",conditions:["K","BUTTON_A"]}),t.addCondition("ZOOM_OUT",{op:"or",conditions:["L","BUTTON_Y"]}),t.if("PLAYER_UP").then("MOVE_UP"),t.if("PLAYER_LEFT").then("MOVE_LEFT"),t.if("PLAYER_DOWN").then("MOVE_DOWN"),t.if("PLAYER_RIGHT").then("MOVE_RIGHT"),t.if("USE_ITEM_1").then("FIRE_BULLET").map("determineShootingSprite").then("updateSprite"),t.on("FIRE_BULLET",function(t){n.systems.bullet.fireBullet(t.id)}),t.on("SWING_SWORD",function(t){n.systems.sword.swingSword(t.id)}),t.on("CAMERA_SHAKE",function(t){n.shakeCamera(1e3)}),t.on("ZOOM_IN",function(t){var e=n.data.camera.currentZoom||1;n.setZoom(e+.05)}),t.on("ZOOM_OUT",function(t){var e=n.data.camera.currentZoom||1;n.setZoom(e-.05)}),t.on("PLAYER_UP",function(t){n.applyForce(t.id,{x:0,y:.05*-r})}),t.on("PLAYER_LEFT",function(t){n.applyForce(t.id,{x:.05*-r,y:0})}),t.on("PLAYER_RIGHT",function(t){n.applyForce(t.id,{x:.05*r,y:0})}),t.on("PLAYER_DOWN",function(t){n.applyForce(t.id,{x:0,y:.05*r})}),console.log("creating input sutra",t),t};var r=5},{}],55:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=function(){var n=this.game,t=this.game.createSutra();return t.addCondition("isPlayer",function(t){return"PLAYER"===t.type}),t.addCondition("playerHealthBelow0",function(t,e){if("PLAYER"===t.type&&t.health<=0)return!0}),t.on("resetPlayerPosition",function(t,e){n.updateEntity({id:t.id,position:{x:0,y:0},velocity:{x:0,y:0},health:100,color:65280,score:0})}),t.on("damagePlayer",function(t,e){t.BLOCK;t=t.PLAYER;t.health-=10,n.updateEntity({id:t.id,health:t.health})}),t.on("healPlayer",function(t,e){t.BLOCK;t=t.PLAYER;t&&(t.health+=5,n.updateEntity({id:t.id,health:t.health}))}),t}},{}],56:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=function(){var t=this.game.createSutra();return t.addCondition("roundStarted",function(t,e){return console.log("roundStarted",e.roundStarted),!0===e.roundStarted}),t.addCondition("roundEnded",function(t,e){return!0===e.roundEnded}),t.addCondition("roundRunning",function(t,e){return!0===e.roundRunning}),t.addCondition("roundNotRunning",function(t,e){return!1===e.roundRunning}),t.addCondition("roundPaused",function(t,e){return!0===e.roundPaused}),t.addCondition("roundNotPaused",function(t,e){return!0!==e.roundPaused}),t.on("roundLost",function(t,e,n){console.log("roundLost!!!"),n.roundStarted=!1,n.roundRunning=!1,n.roundEnded=!0,n.roundPaused=!0}),t.on("startRound",function(t,e,n){console.log("startRound",e),n.roundRunning=!0,n.roundEnded=!1}),t}},{}],57:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=function(o,t){o.createEntity({type:"Walker",width:22,height:24,texture:{sheet:"jogurt",sprite:"walkLeft"},depth:64,position:{x:50,y:-150,z:32}});var i=o.createSutra();return i.route=t.route,i.routeIndex=0,i.target=i.route[i.routeIndex],i.tolerance=t.tolerance||5,i.addCondition("isWalker",function(t){return"Walker"===t.type}),i.addCondition("atTarget",function(t){var e=t.position.x-i.target[0],t=t.position.y-i.target[1];return Math.sqrt(e*e+t*t)